aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTimothy Knight <tknight@google.com>2014-10-12 12:54:05 -0700
committerTimothy Knight <tknight@google.com>2014-10-12 12:54:05 -0700
commitb81d86158a88e1da5d5c35f85bdc16cdee7112d0 (patch)
tree243545439db0390f71b830fc7983878982753ce6 /apps
parent37c39203b4d48ef976a86d4c34d31b3d41a03c6a (diff)
downloadpdk-b81d86158a88e1da5d5c35f85bdc16cdee7112d0.tar.gz
CameraITS: Made the burst-sameness tests less strict
Change-Id: Iccce0f725a3c88d3bef6f5b17f076855d70797df
Diffstat (limited to 'apps')
-rw-r--r--apps/CameraITS/tests/inprog/test_burst_sameness_fullres_auto.py (renamed from apps/CameraITS/tests/scene1/test_burst_sameness_fullres_auto.py)0
-rw-r--r--apps/CameraITS/tests/scene1/test_burst_sameness_auto.py42
-rw-r--r--apps/CameraITS/tests/scene1/test_burst_sameness_manual.py36
3 files changed, 41 insertions, 37 deletions
diff --git a/apps/CameraITS/tests/scene1/test_burst_sameness_fullres_auto.py b/apps/CameraITS/tests/inprog/test_burst_sameness_fullres_auto.py
index a8d1d45..a8d1d45 100644
--- a/apps/CameraITS/tests/scene1/test_burst_sameness_fullres_auto.py
+++ b/apps/CameraITS/tests/inprog/test_burst_sameness_fullres_auto.py
diff --git a/apps/CameraITS/tests/scene1/test_burst_sameness_auto.py b/apps/CameraITS/tests/scene1/test_burst_sameness_auto.py
index e4b37be..aa6cced 100644
--- a/apps/CameraITS/tests/scene1/test_burst_sameness_auto.py
+++ b/apps/CameraITS/tests/scene1/test_burst_sameness_auto.py
@@ -32,30 +32,44 @@ def main():
NAME = os.path.basename(__file__).split(".")[0]
BURST_LEN = 50
- BURSTS = 10
+ BURSTS = 5
FRAMES = BURST_LEN * BURSTS
- DELTA_THRESH = 0.1
+ SPREAD_THRESH = 0.03
with its.device.ItsSession() as cam:
# Capture at the smallest resolution.
props = cam.get_camera_properties()
_, fmt = its.objects.get_fastest_manual_capture_settings(props)
- req = its.objects.auto_capture_request()
w,h = fmt["width"], fmt["height"]
# Converge 3A prior to capture.
- cam.do_3a()
+ cam.do_3a(lock_ae=True, lock_awb=True)
+
+ # After 3A has converged, lock AE+AWB for the duration of the test.
+ req = its.objects.auto_capture_request()
+ req["android.blackLevel.lock"] = True
+ req["android.control.awbLock"] = True
+ req["android.control.aeLock"] = True
# Capture bursts of YUV shots.
- # Build a 4D array, which is an array of all RGB images.
+ # Get the mean values of a center patch for each.
+ # Also build a 4D array, which is an array of all RGB images.
+ r_means = []
+ g_means = []
+ b_means = []
imgs = numpy.empty([FRAMES,h,w,3])
for j in range(BURSTS):
caps = cam.do_capture([req]*BURST_LEN, [fmt])
for i,cap in enumerate(caps):
n = j*BURST_LEN + i
imgs[n] = its.image.convert_capture_to_rgb_image(cap)
+ tile = its.image.get_image_patch(imgs[n], 0.45, 0.45, 0.1, 0.1)
+ means = its.image.compute_image_means(tile)
+ r_means.append(means[0])
+ g_means.append(means[1])
+ b_means.append(means[2])
# Dump all images.
print "Dumping images"
@@ -66,19 +80,11 @@ def main():
img_mean = imgs.mean(0)
its.image.write_image(img_mean, "%s_mean.jpg"%(NAME))
- # Compute the deltas of each image from the mean image; this test
- # passes if none of the deltas are large.
- print "Computing frame differences"
- delta_maxes = []
- for i in range(FRAMES):
- deltas = (imgs[i] - img_mean).reshape(h*w*3)
- delta_max_pos = numpy.max(deltas)
- delta_max_neg = numpy.min(deltas)
- delta_maxes.append(max(abs(delta_max_pos), abs(delta_max_neg)))
- max_delta_max = max(delta_maxes)
- print "Frame %d has largest diff %f" % (
- delta_maxes.index(max_delta_max), max_delta_max)
- assert(max_delta_max < DELTA_THRESH)
+ # Pass/fail based on center patch similarity.
+ for means in [r_means, g_means, b_means]:
+ spread = max(means) - min(means)
+ print spread
+ assert(spread < SPREAD_THRESH)
if __name__ == '__main__':
main()
diff --git a/apps/CameraITS/tests/scene1/test_burst_sameness_manual.py b/apps/CameraITS/tests/scene1/test_burst_sameness_manual.py
index 0404e98..e500860 100644
--- a/apps/CameraITS/tests/scene1/test_burst_sameness_manual.py
+++ b/apps/CameraITS/tests/scene1/test_burst_sameness_manual.py
@@ -32,10 +32,10 @@ def main():
NAME = os.path.basename(__file__).split(".")[0]
BURST_LEN = 50
- BURSTS = 10
+ BURSTS = 5
FRAMES = BURST_LEN * BURSTS
- DELTA_THRESH = 0.1
+ SPREAD_THRESH = 0.03
with its.device.ItsSession() as cam:
@@ -46,17 +46,23 @@ def main():
req = its.objects.manual_capture_request(s, e)
w,h = fmt["width"], fmt["height"]
- # Converge 3A prior to capture.
- cam.do_3a()
-
# Capture bursts of YUV shots.
- # Build a 4D array, which is an array of all RGB images.
+ # Get the mean values of a center patch for each.
+ # Also build a 4D array, which is an array of all RGB images.
+ r_means = []
+ g_means = []
+ b_means = []
imgs = numpy.empty([FRAMES,h,w,3])
for j in range(BURSTS):
caps = cam.do_capture([req]*BURST_LEN, [fmt])
for i,cap in enumerate(caps):
n = j*BURST_LEN + i
imgs[n] = its.image.convert_capture_to_rgb_image(cap)
+ tile = its.image.get_image_patch(imgs[n], 0.45, 0.45, 0.1, 0.1)
+ means = its.image.compute_image_means(tile)
+ r_means.append(means[0])
+ g_means.append(means[1])
+ b_means.append(means[2])
# Dump all images.
print "Dumping images"
@@ -67,19 +73,11 @@ def main():
img_mean = imgs.mean(0)
its.image.write_image(img_mean, "%s_mean.jpg"%(NAME))
- # Compute the deltas of each image from the mean image; this test
- # passes if none of the deltas are large.
- print "Computing frame differences"
- delta_maxes = []
- for i in range(FRAMES):
- deltas = (imgs[i] - img_mean).reshape(h*w*3)
- delta_max_pos = numpy.max(deltas)
- delta_max_neg = numpy.min(deltas)
- delta_maxes.append(max(abs(delta_max_pos), abs(delta_max_neg)))
- max_delta_max = max(delta_maxes)
- print "Frame %d has largest diff %f" % (
- delta_maxes.index(max_delta_max), max_delta_max)
- assert(max_delta_max < DELTA_THRESH)
+ # Pass/fail based on center patch similarity.
+ for means in [r_means, g_means, b_means]:
+ spread = max(means) - min(means)
+ print spread
+ assert(spread < SPREAD_THRESH)
if __name__ == '__main__':
main()