aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTimothy Knight <tknight@google.com>2014-10-11 02:20:35 -0700
committerTimothy Knight <tknight@google.com>2014-10-11 02:20:35 -0700
commit1d249d8b1ca8eb6458971a8e81a718c8cbbe1543 (patch)
tree41338d3a61ba2acd1b9f0c1d4287077a68f5876f /apps
parent3a7882e8950b2de5f7693807794ad10c11b499da (diff)
downloadpdk-1d249d8b1ca8eb6458971a8e81a718c8cbbe1543.tar.gz
CameraITS: Added its.caps module
Change-Id: Iea737c2f8284f47da85b0ed25f0edbd2163e1d31
Diffstat (limited to 'apps')
-rw-r--r--apps/CameraITS/build/envsetup.sh2
-rw-r--r--apps/CameraITS/pymodules/its/caps.py109
-rw-r--r--apps/CameraITS/tests/scene0/test_metadata.py13
3 files changed, 122 insertions, 2 deletions
diff --git a/apps/CameraITS/build/envsetup.sh b/apps/CameraITS/build/envsetup.sh
index 7e2a86b..a95c445 100644
--- a/apps/CameraITS/build/envsetup.sh
+++ b/apps/CameraITS/build/envsetup.sh
@@ -37,7 +37,7 @@ done
export PYTHONPATH="$PWD/pymodules:$PYTHONPATH"
-for M in device objects image
+for M in device objects image caps dng target error
do
python "pymodules/its/$M.py" 2>&1 | grep -q "OK" || \
echo ">> Unit test for $M failed" >&2
diff --git a/apps/CameraITS/pymodules/its/caps.py b/apps/CameraITS/pymodules/its/caps.py
new file mode 100644
index 0000000..e70853f
--- /dev/null
+++ b/apps/CameraITS/pymodules/its/caps.py
@@ -0,0 +1,109 @@
+# 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 unittest
+
+def full(props):
+ """Returns whether a device is a FULL capability camera2 device.
+
+ Args:
+ props: Camera properties object.
+
+ Returns:
+ Boolean.
+ """
+ return props.has_key("android.info.supportedHardwareLevel") and \
+ props["android.info.supportedHardwareLevel"] == 1
+
+def limited(props):
+ """Returns whether a device is a LIMITED capability camera2 device.
+
+ Args:
+ props: Camera properties object.
+
+ Returns:
+ Boolean.
+ """
+ return props.has_key("android.info.supportedHardwareLevel") and \
+ props["android.info.supportedHardwareLevel"] == 0
+
+def legacy(props):
+ """Returns whether a device is a LEGACY capability camera2 device.
+
+ Args:
+ props: Camera properties object.
+
+ Returns:
+ Boolean.
+ """
+ return props.has_key("android.info.supportedHardwareLevel") and \
+ props["android.info.supportedHardwareLevel"] == 2
+
+def manual_sensor(props):
+ """Returns whether a device supports MANUAL_SENSOR capabilities.
+
+ Args:
+ props: Camera properties object.
+
+ Returns:
+ Boolean.
+ """
+ return props.has_key("android.request.availableCapabilities") and \
+ 1 in props["android.request.availableCapabilities"]
+
+def manual_post_proc(props):
+ """Returns whether a device supports MANUAL_POST_PROCESSING capabilities.
+
+ Args:
+ props: Camera properties object.
+
+ Returns:
+ Boolean.
+ """
+ return props.has_key("android.request.availableCapabilities") and \
+ 2 in props["android.request.availableCapabilities"]
+
+def raw(props):
+ """Returns whether a device supports RAW capabilities.
+
+ Args:
+ props: Camera properties object.
+
+ Returns:
+ Boolean.
+ """
+ return props.has_key("android.request.availableCapabilities") and \
+ 3 in props["android.request.availableCapabilities"]
+
+def sensor_fusion(props):
+ """Returns whether the camera and motion sensor timestamps for the device
+ are in the same time domain and can be compared direcctly.
+
+ Args:
+ props: Camera properties object.
+
+ Returns:
+ Boolean.
+ """
+ return props.has_key("android.sensor.info.timestampSource") and \
+ props["android.sensor.info.timestampSource"] == 1
+
+class __UnitTest(unittest.TestCase):
+ """Run a suite of unit tests on this module.
+ """
+ # TODO: Add more unit tests.
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/apps/CameraITS/tests/scene0/test_metadata.py b/apps/CameraITS/tests/scene0/test_metadata.py
index 861c071..57d0aac 100644
--- a/apps/CameraITS/tests/scene0/test_metadata.py
+++ b/apps/CameraITS/tests/scene0/test_metadata.py
@@ -16,6 +16,7 @@ import its.image
import its.device
import its.objects
import its.target
+import its.caps
import os.path
import pprint
@@ -36,10 +37,20 @@ def main():
cap = cam.do_capture(req, cam.CAP_YUV)
md = cap["metadata"]
+ print "Hardware level"
+ print " Legacy:", its.caps.legacy(props)
+ print " Limited:", its.caps.limited(props)
+ print " Full:", its.caps.full(props)
+ print "Capabilities"
+ print " Manual sensor:", its.caps.manual_sensor(props)
+ print " Manual post-proc:", its.caps.manual_post_proc(props)
+ print " Raw:", its.caps.raw(props)
+ print " Sensor fusion:", its.caps.sensor_fusion(props)
+
# Test: hardware level should be a valid value.
check('props.has_key("android.info.supportedHardwareLevel")')
check('props["android.info.supportedHardwareLevel"] is not None')
- check('props["android.info.supportedHardwareLevel"] in [0,1]')
+ check('props["android.info.supportedHardwareLevel"] in [0,1,2]')
full = getval('props["android.info.supportedHardwareLevel"]') == 1
# Test: rollingShutterSkew, frameDuration, and