From f125027ca7ab83660bfd31d9ba2bc31e3f237e19 Mon Sep 17 00:00:00 2001 From: Timothy Knight Date: Thu, 31 Jul 2014 10:42:18 -0700 Subject: CameraITS: Fixed some TODOs Change-Id: Ib55a48f657761934cc55c4fbc85156fb4827215e --- apps/CameraITS/pymodules/its/device.py | 2 +- apps/CameraITS/pymodules/its/image.py | 4 ++-- .../tests/scene1/test_tonemap_sequence.py | 22 ++++++++++++++++++++-- apps/CameraITS/tools/compute_dng_noise_model.py | 3 +-- 4 files changed, 24 insertions(+), 7 deletions(-) (limited to 'apps') diff --git a/apps/CameraITS/pymodules/its/device.py b/apps/CameraITS/pymodules/its/device.py index a601b6c..269c0c0 100644 --- a/apps/CameraITS/pymodules/its/device.py +++ b/apps/CameraITS/pymodules/its/device.py @@ -80,7 +80,7 @@ class ItsSession(object): for s in sys.argv[1:]: if s[:7] == "camera=" and len(s) > 7: camera_id = int(s[7:]) - # TODO: Figure out why "--user 0" is needed, and fix the problem + # TODO: Figure out why "--user 0" is needed, and fix the problem. _run('%s logcat -c' % (self.ADB)) _run('%s shell am force-stop --user 0 %s' % (self.ADB, self.PACKAGE)) _run(('%s shell am startservice --user 0 -t text/plain ' diff --git a/apps/CameraITS/pymodules/its/image.py b/apps/CameraITS/pymodules/its/image.py index 14bd248..aa9307c 100644 --- a/apps/CameraITS/pymodules/its/image.py +++ b/apps/CameraITS/pymodules/its/image.py @@ -138,7 +138,8 @@ def get_canonical_cfa_order(props): left Bayer grid of R,Gr,Gb,B, where the 2x2 grid is labeled as 0,1,2,3 in row major order. """ - # TODO: Take sensor crop region into account in the CFA logic. + # Note that raw streams aren't croppable, so the cropRegion doesn't need + # to be considered when determining the top-left pixel color. cfa_pat = props['android.sensor.info.colorFilterArrangement'] if cfa_pat == 0: # RGGB @@ -165,7 +166,6 @@ def get_gains_in_canonical_order(props, gains): Returns: List of gains values, in R,Gr,Gb,B order. """ - # TODO: Take sensor crop region into account in the CFA logic. cfa_pat = props['android.sensor.info.colorFilterArrangement'] if cfa_pat in [0,1]: # RGGB or GRBG, so G_even is Gr diff --git a/apps/CameraITS/tests/scene1/test_tonemap_sequence.py b/apps/CameraITS/tests/scene1/test_tonemap_sequence.py index c72e69a..750c2cd 100644 --- a/apps/CameraITS/tests/scene1/test_tonemap_sequence.py +++ b/apps/CameraITS/tests/scene1/test_tonemap_sequence.py @@ -16,21 +16,31 @@ import its.image import its.device import its.objects import os.path +import numpy def main(): - """Test a sequence of shots with different tonrmap curves. + """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.20 + with its.device.ItsSession() as cam: sens, exp_time, _,_,_ = cam.do_3a(do_af=False) + 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) @@ -38,8 +48,16 @@ def main(): 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 - # TODO: Add pass/fail check. + 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() diff --git a/apps/CameraITS/tools/compute_dng_noise_model.py b/apps/CameraITS/tools/compute_dng_noise_model.py index e528332..39c890a 100644 --- a/apps/CameraITS/tools/compute_dng_noise_model.py +++ b/apps/CameraITS/tools/compute_dng_noise_model.py @@ -26,8 +26,7 @@ import math def main(): """Compute the DNG noise model from a color checker chart. - TODO: Make this more robust; some manual futzing may be needed to get - this to work on a new device. + TODO: Make this more robust; some manual futzing may be needed. """ NAME = os.path.basename(__file__).split(".")[0] -- cgit v1.2.3