annotate python/tests/cvutils.txt @ 807:52aa03260f03 opencv3

reversed all code to OpenCV 2.4.13
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 10 Jun 2016 15:26:19 -0400
parents
children be28a3538dc9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
807
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
1 >>> import cv2, cvutils
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
2 >>> from numpy import array, round
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
3 >>> img = cv2.imread("../samples/val-dor-117-111.png")
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
4 >>> width = img.shape[1]
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
5 >>> height = img.shape[0]
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
6 >>> intrinsicCameraMatrix = array([[ 377.42, 0. , 639.12], [ 0. , 378.43, 490.2 ], [ 0. , 0. , 1. ]])
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
7 >>> [map1, map2] = cvutils.computeUndistortMaps(width, height, 1.31, intrinsicCameraMatrix, [-0.11759321, 0.0148536, 0.00030756, -0.00020578, -0.00091816])
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
8 >>> undistorted = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR)
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
9 >>> (undistorted.shape == array([int(round(height*1.31)), int(round(width*1.31)), 3])).all()
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
10 True