factory: Add the camera performance test backend library

The CL adds the supporting library which will be used in the
factory camera performance test. It works with the SFR Plus test
charts and can automatically identify several image quality matrix
without the human intervention. The test charts files will be added
later in another CL after the design details are fixed.

The library currently supports two major functionalities - the
slanted-edge MTF computation and the lens shading detection.
Besides these, it can also check whether the test pattern is
correctly present in the test image. This can prevent the autotest
being fooled by other targets.

The MTF computation is implemented according to the guideline from
the Imatest. For more information, pease visit the Imatest website.

BUG=chrome-os-partner:6617
TEST=Supply the functions with synthetic test cases -> works.

Change-Id: Icef634576a9a3e73e2cb5df48cdf7230758b1c02
Reviewed-on: https://gerrit.chromium.org/gerrit/17296
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Tai-Hsu Lin <sheckylin@chromium.org>
Tested-by: Tai-Hsu Lin <sheckylin@chromium.org>
diff --git a/client/cros/camera/camera_utils.py b/client/cros/camera/camera_utils.py
new file mode 100644
index 0000000..ba45f03
--- /dev/null
+++ b/client/cros/camera/camera_utils.py
@@ -0,0 +1,26 @@
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import numpy as np
+
+# Dimension padding/unpadding function for converting points matrices to
+# the OpenCV format (channel-based).
+def Pad(x):
+    return np.expand_dims(x, axis=0)
+
+
+def Unpad(x):
+    return np.squeeze(x)
+
+
+class Pod(object):
+    '''A POD (plain-old-data) object containing arbitrary fields.'''
+    def __init__(self, **args):
+        self.__dict__.update(args)
+
+    def __repr__(self):
+        '''Returns a representation of the object, including its properties.'''
+        return (self.__class__.__name__ + '(' +
+        ', '.join('%s=%s' % (k, v) for k, v in sorted(self.__dict__.items())
+                  if not k.startswith('_')) + ')')