Home | History | Annotate | Download | only in tests
      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.image
     16 import its.device
     17 import its.objects
     18 import pylab
     19 import os.path
     20 import matplotlib
     21 import matplotlib.pyplot
     22 
     23 def main():
     24     """Test that the android.sensor.exposureTime parameter is applied properly
     25     within a burst. Inspects the output metadata.
     26     """
     27     NAME = os.path.basename(__file__).split(".")[0]
     28 
     29     exp_times = range(1*1000*1000, 100*1000*1000, 9*1000*1000)
     30     reqs = [its.objects.manual_capture_request(100,e) for e in exp_times]
     31 
     32     with its.device.ItsSession() as cam:
     33         caps = cam.do_capture(reqs)
     34         for i,cap in enumerate(caps):
     35             e_req = exp_times[i]*1000*1000
     36             e_res = cap["metadata"]["android.sensor.exposureTime"]
     37             print e_req, e_res
     38 
     39 if __name__ == '__main__':
     40     main()
     41 
     42