ITS: snap to Sony's final test_aspect_ratio_and_crop CL
bug: 199121485
Change-Id: I0c86d0aa80b88a46d527cb272ff69a6166299db6
diff --git a/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py b/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
index 107877d..1a43788 100644
--- a/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
+++ b/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
@@ -219,9 +219,12 @@
k_new = cv2.getOptimalNewCameraMatrix(
k, opencv_dist, (img_raw.shape[1], img_raw.shape[0]), 0)[0]
scale = max(k_new[0][0] / k[0][0], k_new[1][1] / k[1][1])
- k_new[0][0] = k[0][0] * scale
- k_new[1][1] = k[1][1] * scale
- img_raw = cv2.undistort(img_raw, k, opencv_dist, None, k_new)
+ if scale > 1:
+ k_new[0][0] = k[0][0] * scale
+ k_new[1][1] = k[1][1] * scale
+ img_raw = cv2.undistort(img_raw, k, opencv_dist, None, k_new)
+ else:
+ img_raw = cv2.undistort(img_raw, k, opencv_dist)
# Get image size.
size_raw = img_raw.shape