ITS: skip scaling factors that are out of range

Scaling is dead reckoned. In outlier cases it might generate a scaled
image that is smaller than the template cv2 is trying to match. Skip
those.

bug: 112039843

Change-Id: Ibea8523543e893547fe39956d16d05b90c924644
diff --git a/apps/CameraITS/pymodules/its/cv2image.py b/apps/CameraITS/pymodules/its/cv2image.py
index 8cd7ca9..21804e9 100644
--- a/apps/CameraITS/pymodules/its/cv2image.py
+++ b/apps/CameraITS/pymodules/its/cv2image.py
@@ -158,6 +158,9 @@
         print 'Finding chart in scene...'
         for scale in numpy.arange(scale_start, scale_stop, scale_step):
             scene_scaled = scale_img(scene_gray, scale)
+            if (scene_scaled.shape[0] < chart.shape[0] or
+                scene_scaled.shape[1] < chart.shape[1]):
+                continue
             result = cv2.matchTemplate(scene_scaled, chart, cv2.TM_CCOEFF)
             _, opt_val, _, top_left_scaled = cv2.minMaxLoc(result)
             # print out scale and match