aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Knight <tknight@google.com>2013-09-22 15:15:51 -0700
committerTimothy Knight <tknight@google.com>2013-09-24 01:51:15 -0700
commit2f0c08fee536ac8d40fa419a67001a02b2cfd1f9 (patch)
treec60a9d38683dec166bda9b5c87de5086a4016a16
parentea6832b4dd23f5abaa6265f52803c1ef9628030b (diff)
downloadpdk-2f0c08fee536ac8d40fa419a67001a02b2cfd1f9.tar.gz
CameraITS: More updates to Python test scripts.
* Added some more pass/fail checks. * Added a 3A pass (AE+AWB only) to capture result test. * Reordered its.device.do_3a args for consistency. Change-Id: I664f272ef4a15b539363a50b4bd3f906146853f0
-rw-r--r--apps/CameraITS/pymodules/its/device.py4
-rwxr-xr-xapps/CameraITS/tests/regress.sh1
-rw-r--r--apps/CameraITS/tests/test_capture_result.py13
-rw-r--r--apps/CameraITS/tests/test_param_flash_mode.py25
-rw-r--r--apps/CameraITS/tests/test_param_noise_reduction.py10
5 files changed, 40 insertions, 13 deletions
diff --git a/apps/CameraITS/pymodules/its/device.py b/apps/CameraITS/pymodules/its/device.py
index 2165301..f773451 100644
--- a/apps/CameraITS/pymodules/its/device.py
+++ b/apps/CameraITS/pymodules/its/device.py
@@ -348,7 +348,7 @@ class ItsSession(object):
local_fname = os.path.basename(remote_fname)
return self.__parse_captured_json([local_fname])[0]['cameraProperties']
- def do_3a(self, region_ae, region_af, region_awb,
+ def do_3a(self, region_ae, region_awb, region_af,
do_ae=True, do_awb=True, do_af=True):
"""Perform a 3A operation on the device.
@@ -359,8 +359,8 @@ class ItsSession(object):
Args:
region_ae: Normalized rect. (x,y,w,h) specifying the AE region.
- region_af: Normalized rect. (x,y,w,h) specifying the AF region.
region_awb: Normalized rect. (x,y,w,h) specifying the AWB region.
+ region_af: Normalized rect. (x,y,w,h) specifying the AF region.
Returns:
Five values:
diff --git a/apps/CameraITS/tests/regress.sh b/apps/CameraITS/tests/regress.sh
index 0cd7ca4..68a903e 100755
--- a/apps/CameraITS/tests/regress.sh
+++ b/apps/CameraITS/tests/regress.sh
@@ -42,6 +42,7 @@ for T in \
test_latching.py \
test_linearity.py \
test_param_edge_mode.py \
+ test_param_flash_mode.py \
do
let testcount=testcount+1
diff --git a/apps/CameraITS/tests/test_capture_result.py b/apps/CameraITS/tests/test_capture_result.py
index d8de498..d0ff74e 100644
--- a/apps/CameraITS/tests/test_capture_result.py
+++ b/apps/CameraITS/tests/test_capture_result.py
@@ -84,13 +84,20 @@ def main():
matplotlib.pyplot.savefig("%s_plot_lsc_%s.png" % (NAME, name))
def test_auto(cam, w_map, h_map):
+ # Get 3A lock first, so the auto values in the capture result are
+ # populated properly.
+ rect = [0,0,1,1]
+ cam.do_3a(rect, rect, rect, True, True, False)
+
fname, w, h, md_obj = cam.do_capture(auto_req)
cap_res = md_obj["captureResult"]
gains = cap_res["android.colorCorrection.gains"]
transform = cap_res["android.colorCorrection.transform"]
exp_time = cap_res['android.sensor.exposureTime']
lsc_map = cap_res["android.statistics.lensShadingMap"]
+ ctrl_mode = cap_res["android.control.mode"]
+ print "Control mode:", ctrl_mode
print "Gains:", gains
print "Transform:", [r2f(t) for t in transform]
print "AE region:", cap_res['android.control.aeRegions']
@@ -98,6 +105,8 @@ def main():
print "AWB region:", cap_res['android.control.awbRegions']
print "LSC map:", w_map, h_map, lsc_map[:8]
+ assert(ctrl_mode == 1)
+
# Color correction gain and transform must be valid.
assert(len(gains) == 4)
assert(len(transform) == 9)
@@ -138,7 +147,9 @@ def main():
lsc_map = cap_res["android.statistics.lensShadingMap"]
pred_gains = cap_res["android.statistics.predictedColorGains"]
pred_transform = cap_res["android.statistics.predictedColorTransform"]
+ ctrl_mode = cap_res["android.control.mode"]
+ print "Control mode:", ctrl_mode
print "Gains:", gains
print "Transform:", [r2f(t) for t in transform]
print "Predicted gains:", pred_gains
@@ -149,6 +160,8 @@ def main():
print "AWB region:", cap_res['android.control.awbRegions']
print "LSC map:", w_map, h_map, lsc_map[:8]
+ assert(ctrl_mode == 0)
+
# Color correction gain and transform must be valid.
# Color correction gains and transform should be the same size and
# values as the manually set values.
diff --git a/apps/CameraITS/tests/test_param_flash_mode.py b/apps/CameraITS/tests/test_param_flash_mode.py
index cfc1a0d..091a896 100644
--- a/apps/CameraITS/tests/test_param_flash_mode.py
+++ b/apps/CameraITS/tests/test_param_flash_mode.py
@@ -25,23 +25,30 @@ def main():
"""
NAME = os.path.basename(__file__).split(".")[0]
- req = its.objects.capture_request( {
- "android.control.mode": 0,
- "android.control.aeMode": 0,
- "android.control.awbMode": 0,
- "android.control.afMode": 0,
- "android.sensor.frameDuration": 0,
- "android.sensor.exposureTime": 100*1000*1000,
- "android.sensor.sensitivity": 100
- })
+ req = its.objects.auto_capture_request()
+
+ flash_modes_reported = []
+ flash_states_reported = []
with its.device.ItsSession() as cam:
for f in [0,1,2]:
req["captureRequest"]["android.flash.mode"] = f
fname, w, h, cap_md = cam.do_capture(req)
+ flash_modes_reported.append(
+ cap_md["captureResult"]["android.flash.mode"])
+ flash_states_reported.append(
+ cap_md["captureResult"]["android.flash.state"])
img = its.image.load_yuv420_to_rgb_image(fname, w, h)
its.image.write_image(img, "%s_mode=%d.jpg" % (NAME, f))
+ assert(flash_modes_reported == [0,1,2])
+
+ # TODO: Add check on flash_states_reported values.
+
+ # TODO: Add an image check on the brightness of the captured shots, as well
+ # as the exposure values in the capture result, to test that flash was
+ # fired as expected (i.e.) on the shots it was expected to be fired for.
+
if __name__ == '__main__':
main()
diff --git a/apps/CameraITS/tests/test_param_noise_reduction.py b/apps/CameraITS/tests/test_param_noise_reduction.py
index d43d4ed..63d663a 100644
--- a/apps/CameraITS/tests/test_param_noise_reduction.py
+++ b/apps/CameraITS/tests/test_param_noise_reduction.py
@@ -32,7 +32,7 @@ def main():
"""
NAME = os.path.basename(__file__).split(".")[0]
- THRESHOLD_MIN_VARIANCE_RATIO = 0.5
+ THRESHOLD_MIN_VARIANCE_RATIO = 0.7
req = its.objects.capture_request( {
"android.control.mode": 0,
@@ -48,6 +48,8 @@ def main():
# Reference (baseline) variance for each of Y,U,V.
ref_variance = []
+ nr_modes_reported = []
+
with its.device.ItsSession() as cam:
# NR mode 0 with low gain
req["captureRequest"]["android.noiseReduction.mode"] = 0
@@ -66,10 +68,12 @@ def main():
for i in range(3):
# NR modes 0, 1, 2 with high gain
req["captureRequest"]["android.noiseReduction.mode"] = i
- req["captureRequest"]["android.sensor.sensitivity"] = 1600
+ req["captureRequest"]["android.sensor.sensitivity"] = 100*16
req["captureRequest"]["android.sensor.exposureTime"] = (
20*1000*1000/16)
fname, w, h, md_obj = cam.do_capture(req)
+ nr_modes_reported.append(
+ md_obj["captureResult"]["android.noiseReduction.mode"])
its.image.write_image(
its.image.load_yuv420_to_rgb_image(fname, w, h),
"%s_high_gain_nr=%d.jpg" % (NAME, i))
@@ -85,6 +89,8 @@ def main():
pylab.plot(range(3), variances[j], "rgb"[j])
matplotlib.pyplot.savefig("%s_plot_variances.png" % (NAME))
+ assert(nr_modes_reported == [0,1,2])
+
# Check that the variance of the NR=0 image is much higher than for the
# NR=1 and NR=2 images.
for j in range(3):