diff options
Diffstat (limited to 'apps/CameraITS/tests/scene1/test_tonemap_sequence.py')
-rw-r--r-- | apps/CameraITS/tests/scene1/test_tonemap_sequence.py | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/apps/CameraITS/tests/scene1/test_tonemap_sequence.py b/apps/CameraITS/tests/scene1/test_tonemap_sequence.py deleted file mode 100644 index 7af51c5..0000000 --- a/apps/CameraITS/tests/scene1/test_tonemap_sequence.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2014 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import its.image -import its.caps -import its.device -import its.objects -import os.path -import numpy - -def main(): - """Test a sequence of shots with different tonemap curves. - """ - NAME = os.path.basename(__file__).split(".")[0] - - # There should be 3 identical frames followed by a different set of - # 3 identical frames. - MAX_SAME_DELTA = 0.01 - MIN_DIFF_DELTA = 0.10 - - with its.device.ItsSession() as cam: - props = cam.get_camera_properties() - if (not its.caps.manual_sensor(props) or - not its.caps.manual_post_proc(props)): - print "Test skipped" - return - - sens, exp_time, _,_,_ = cam.do_3a(do_af=False,get_results=True) - - means = [] - - # Capture 3 manual shots with a linear tonemap. - req = its.objects.manual_capture_request(sens, exp_time, True) - for i in [0,1,2]: - cap = cam.do_capture(req) - img = its.image.convert_capture_to_rgb_image(cap) - its.image.write_image(img, "%s_i=%d.jpg" % (NAME, i)) - tile = its.image.get_image_patch(img, 0.45, 0.45, 0.1, 0.1) - means.append(tile.mean(0).mean(0)) - - # Capture 3 manual shots with the default tonemap. - req = its.objects.manual_capture_request(sens, exp_time, False) - for i in [3,4,5]: - cap = cam.do_capture(req) - img = its.image.convert_capture_to_rgb_image(cap) - its.image.write_image(img, "%s_i=%d.jpg" % (NAME, i)) - tile = its.image.get_image_patch(img, 0.45, 0.45, 0.1, 0.1) - means.append(tile.mean(0).mean(0)) - - # Compute the delta between each consecutive frame pair. - deltas = [numpy.max(numpy.fabs(means[i+1]-means[i])) \ - for i in range(len(means)-1)] - print "Deltas between consecutive frames:", deltas - - assert(all([abs(deltas[i]) < MAX_SAME_DELTA for i in [0,1,3,4]])) - assert(abs(deltas[2]) > MIN_DIFF_DELTA) - -if __name__ == '__main__': - main() - |