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 os.path
     19 
     20 def main():
     21     """Just capture a YUV shot, using auto mode, and save as a JPEG.
     22     """
     23     NAME = os.path.basename(__file__).split(".")[0]
     24 
     25     with its.device.ItsSession() as cam:
     26         req = its.objects.auto_capture_request()
     27         rect = [0,0,1,1]
     28         sens, exp, gains, xform, focus = cam.do_3a(rect, rect, rect)
     29         cap = cam.do_capture(req)
     30         img = its.image.convert_capture_to_rgb_image(cap)
     31         its.image.write_image(img, "%s.jpg" % (NAME))
     32 
     33 if __name__ == '__main__':
     34     main()
     35 
     36