test_param_edge_mode.py revision 12339cdd90b2c98eb4f7adf794ddca8de53992b8
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 15import its.image 16import its.device 17import its.objects 18import pylab 19import os.path 20import matplotlib 21import matplotlib.pyplot 22 23def main(): 24 """Test that the android.edge.mode parameter is applied. 25 """ 26 NAME = os.path.basename(__file__).split(".")[0] 27 28 req = its.objects.capture_request( { 29 "android.control.aeMode": 0, 30 "android.sensor.frameDuration": 0, 31 "android.sensor.exposureTime": 100*1000*1000, 32 "android.sensor.sensitivity": 100 33 }) 34 35 with its.device.ItsSession() as cam: 36 for e in [0,1,2]: 37 req["captureRequest"]["android.edge.mode"] = e 38 fname, w, h, cap_md = cam.do_capture(req) 39 img = its.image.load_yuv420_to_rgb_image(fname, w, h) 40 its.image.write_image(img, "%s_mode=%d.jpg" % (NAME, e)) 41 42if __name__ == '__main__': 43 main() 44 45