From a0bfdb9bf1e63b898546334e4d13edc81b314087 Mon Sep 17 00:00:00 2001 From: Matt Venn Date: Fri, 7 Feb 2014 20:53:57 +0000 Subject: [PATCH 1/4] fixed examples for opencv 2.4.8 --- .../py_calib3d/py_calibration/py_calibration.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst index abf0411775..e24d478c16 100644 --- a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst +++ b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst @@ -93,9 +93,8 @@ Once we find the corners, we can increase their accuracy using **cv2.cornerSubPi objp = np.zeros((6*7,3), np.float32) objp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2) - # Arrays to store object points and image points from all the images. + # Arrays to store object points objpoints = [] # 3d point in real world space - imgpoints = [] # 2d points in image plane. images = glob.glob('*.jpg') @@ -110,16 +109,16 @@ Once we find the corners, we can increase their accuracy using **cv2.cornerSubPi if ret == True: objpoints.append(objp) - corners2 = cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria) - imgpoints.append(corners2) + cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria) # Draw and display the corners - img = cv2.drawChessboardCorners(img, (7,6), corners2,ret) + cv2.drawChessboardCorners(img, (7,6), corners,ret) cv2.imshow('img',img) cv2.waitKey(500) cv2.destroyAllWindows() + One image with pattern drawn on it is shown below: .. image:: images/calib_pattern.jpg From 3170414ca8561264fc45ce766f0b6ffc847a199c Mon Sep 17 00:00:00 2001 From: Matt Venn Date: Fri, 7 Feb 2014 22:18:59 +0000 Subject: [PATCH 2/4] fixed whitespace --- doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst index e24d478c16..9a6a7dfe81 100644 --- a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst +++ b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst @@ -79,7 +79,6 @@ So to find pattern in chess board, we use the function, **cv2.findChessboardCorn .. seealso:: Instead of chess board, we can use some circular grid, but then use the function **cv2.findCirclesGrid()** to find the pattern. It is said that less number of images are enough when using circular grid. Once we find the corners, we can increase their accuracy using **cv2.cornerSubPix()**. We can also draw the pattern using **cv2.drawChessboardCorners()**. All these steps are included in below code: - :: import numpy as np From 2d33063a590edccf7926bc027cc9a58fc9baa83c Mon Sep 17 00:00:00 2001 From: Matt Venn Date: Mon, 10 Feb 2014 14:51:29 +0000 Subject: [PATCH 3/4] removed whitespace at end of line 96 --- doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst index 9a6a7dfe81..c3622fa210 100644 --- a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst +++ b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst @@ -92,7 +92,7 @@ Once we find the corners, we can increase their accuracy using **cv2.cornerSubPi objp = np.zeros((6*7,3), np.float32) objp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2) - # Arrays to store object points + # Arrays to store object points objpoints = [] # 3d point in real world space images = glob.glob('*.jpg') From 7acd28fbea28d370ae879bf75a0a12ecb47d7ff5 Mon Sep 17 00:00:00 2001 From: Matt Venn Date: Thu, 13 Feb 2014 07:44:29 +0000 Subject: [PATCH 4/4] added imgpoints back --- .../py_calib3d/py_calibration/py_calibration.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst index c3622fa210..4f0e7cc067 100644 --- a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst +++ b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.rst @@ -79,6 +79,7 @@ So to find pattern in chess board, we use the function, **cv2.findChessboardCorn .. seealso:: Instead of chess board, we can use some circular grid, but then use the function **cv2.findCirclesGrid()** to find the pattern. It is said that less number of images are enough when using circular grid. Once we find the corners, we can increase their accuracy using **cv2.cornerSubPix()**. We can also draw the pattern using **cv2.drawChessboardCorners()**. All these steps are included in below code: + :: import numpy as np @@ -92,8 +93,9 @@ Once we find the corners, we can increase their accuracy using **cv2.cornerSubPi objp = np.zeros((6*7,3), np.float32) objp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2) - # Arrays to store object points + # Arrays to store object points and image points from all the images. objpoints = [] # 3d point in real world space + imgpoints = [] # 2d points in image plane. images = glob.glob('*.jpg') @@ -109,15 +111,15 @@ Once we find the corners, we can increase their accuracy using **cv2.cornerSubPi objpoints.append(objp) cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria) + imgpoints.append(corners) # Draw and display the corners - cv2.drawChessboardCorners(img, (7,6), corners,ret) + cv2.drawChessboardCorners(img, (7,6), corners2,ret) cv2.imshow('img',img) cv2.waitKey(500) cv2.destroyAllWindows() - One image with pattern drawn on it is shown below: .. image:: images/calib_pattern.jpg