blob: 2c5dcfe907764054d2f5af2fa51ebfe3d747708d [file] [log] [blame]
Ruben Brunk370e2432014-10-14 18:33:23 -07001# Copyright 2013 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Ruben Brunk370e2432014-10-14 18:33:23 -070015import its.caps
Clemenz Portmann8f3b0762017-12-19 09:18:50 -080016import its.device
17
18import numpy as np
19
Ruben Brunk370e2432014-10-14 18:33:23 -070020
21def main():
22 """Basic test for bring-up of 3A.
23
24 To pass, 3A must converge. Check that the returned 3A values are legal.
25 """
26
27 with its.device.ItsSession() as cam:
28 props = cam.get_camera_properties()
Chien-Yu Chenbad96ca2014-10-20 17:30:56 -070029 its.caps.skip_unless(its.caps.read_3a(props))
Ruben Brunk370e2432014-10-14 18:33:23 -070030
31 sens, exp, gains, xform, focus = cam.do_3a(get_results=True)
Clemenz Portmann8f3b0762017-12-19 09:18:50 -080032 print 'AE: sensitivity %d, exposure %dms' % (sens, exp/1000000)
33 print 'AWB: gains', gains, 'transform', xform
34 print 'AF: distance', focus
35 assert sens > 0
36 assert exp > 0
37 assert len(gains) == 4
38 for g in gains:
39 assert not np.isnan(g)
40 assert len(xform) == 9
41 for x in xform:
42 assert not np.isnan(x)
43 assert focus >= 0
Ruben Brunk370e2432014-10-14 18:33:23 -070044
45if __name__ == '__main__':
46 main()
47