aboutsummaryrefslogtreecommitdiff
path: root/apps/CameraITS/tests/scene1/test_param_noise_reduction.py
diff options
context:
space:
mode:
authorTimothy Knight <tknight@google.com>2014-07-30 16:24:58 -0700
committerTimothy Knight <tknight@google.com>2014-07-30 18:06:36 -0700
commitcdf6fb51a1dfd6b5dbada0a3d575ffec7d316a43 (patch)
tree8a770e65f33a70af88ae5a707cde86543f9f5939 /apps/CameraITS/tests/scene1/test_param_noise_reduction.py
parent02d20525be468b666278b86486650475d9955b41 (diff)
downloadpdk-cdf6fb51a1dfd6b5dbada0a3d575ffec7d316a43.tar.gz
CameraITS: Removed hard-coded values from test_param_noise_reduction.
Change-Id: Ib67f8b5966f5fd2926c9be0135c43c37c48fc405
Diffstat (limited to 'apps/CameraITS/tests/scene1/test_param_noise_reduction.py')
-rw-r--r--apps/CameraITS/tests/scene1/test_param_noise_reduction.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/apps/CameraITS/tests/scene1/test_param_noise_reduction.py b/apps/CameraITS/tests/scene1/test_param_noise_reduction.py
index 81a49e4..cd77559 100644
--- a/apps/CameraITS/tests/scene1/test_param_noise_reduction.py
+++ b/apps/CameraITS/tests/scene1/test_param_noise_reduction.py
@@ -15,6 +15,7 @@
import its.image
import its.device
import its.objects
+import its.target
import pylab
import os.path
import matplotlib
@@ -23,8 +24,8 @@ import matplotlib.pyplot
def main():
"""Test that the android.noiseReduction.mode param is applied when set.
- Capture images with the camera dimly lit. Uses a long exposure
- and a high analog gain to ensure the captured image is noisy.
+ Capture images with the camera dimly lit. Uses a high analog gain to
+ ensure the captured image is noisy.
Captures three images, for NR off, "fast", and "high quality".
Also captures an image with low gain and NR off, and uses the variance
@@ -34,14 +35,6 @@ def main():
THRESHOLD_MIN_VARIANCE_RATIO = 0.7
- req = {
- "android.control.mode": 0,
- "android.control.aeMode": 0,
- "android.control.awbMode": 0,
- "android.control.afMode": 0,
- "android.sensor.frameDuration": 0
- }
-
# List of variances for Y,U,V.
variances = [[],[],[]]
@@ -51,11 +44,11 @@ def main():
nr_modes_reported = []
with its.device.ItsSession() as cam:
+ props = cam.get_camera_properties()
# NR mode 0 with low gain
+ e, s = its.target.get_target_exposure_combos(cam)["minSensitivity"]
+ req = its.objects.manual_capture_request(s, e)
req["android.noiseReduction.mode"] = 0
- # TODO: Stop using hard-coded exposure values.
- req["android.sensor.sensitivity"] = 100
- req["android.sensor.exposureTime"] = 20*1000*1000
cap = cam.do_capture(req)
its.image.write_image(
its.image.convert_capture_to_rgb_image(cap),
@@ -65,12 +58,13 @@ def main():
img = planes[j]
tile = its.image.get_image_patch(img, 0.45, 0.45, 0.1, 0.1)
ref_variance.append(its.image.compute_image_variances(tile)[0])
+ print "Ref variances:", ref_variance
for i in range(3):
# NR modes 0, 1, 2 with high gain
+ e, s = its.target.get_target_exposure_combos(cam)["maxSensitivity"]
+ req = its.objects.manual_capture_request(s, e)
req["android.noiseReduction.mode"] = i
- req["android.sensor.sensitivity"] = 100*16
- req["android.sensor.exposureTime"] = (20*1000*1000/16)
cap = cam.do_capture(req)
nr_modes_reported.append(
cap["metadata"]["android.noiseReduction.mode"])
@@ -83,6 +77,7 @@ def main():
tile = its.image.get_image_patch(img, 0.45, 0.45, 0.1, 0.1)
variance = its.image.compute_image_variances(tile)[0]
variances[j].append(variance / ref_variance[j])
+ print "Variances with NR mode [0,1,2]:", variances
# Draw a plot.
for j in range(3):