Home | History | Annotate | Download | only in scene1
      1 # 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 
     15 import its.caps
     16 import its.device
     17 
     18 import numpy as np
     19 
     20 
     21 def 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()
     29         its.caps.skip_unless(its.caps.read_3a(props))
     30         mono_camera = its.caps.mono_camera(props)
     31 
     32         sens, exp, gains, xform, focus = cam.do_3a(get_results=True,
     33                                                    mono_camera=mono_camera)
     34         print 'AE: sensitivity %d, exposure %dms' % (sens, exp/1000000)
     35         print 'AWB: gains', gains, 'transform', xform
     36         print 'AF: distance', focus
     37         assert sens > 0
     38         assert exp > 0
     39         assert len(gains) == 4
     40         for g in gains:
     41             assert not np.isnan(g)
     42         assert len(xform) == 9
     43         for x in xform:
     44             assert not np.isnan(x)
     45         assert focus >= 0
     46 
     47 if __name__ == '__main__':
     48     main()
     49 
     50