Reputation: 219
I am trying to calibrate an SJ4000 camera using OpenCV 2.4.11 in Python 2.7 in Anaconda.
However, I am unable to run the script available here: http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html#setup
I am even testing it with the sample images available in samples/cpp/
, images left01.jpg to left14.jpg
. It is able to detect the chessboard in the images, but once it hits this line:
cv2.imshow('img',img)
It throws an error:
error: ..\..\..\modules\highgui\src\window.cpp:261: error: (-215) size.width>0 && size.height>0 in function cv::imshow
EDIT 1: After further debugging, I have found that img = cv2.drawChessboardCorners(img, (7,6), corners2,ret)
results in a None object.
How do I solve this?
Thanks for any help!
Upvotes: 0
Views: 504
Reputation: 219
Hooray! All solved after some further debugging. I suspect this is a version issue.
I changed
corners2 = cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria)
imgpoints.append(corners2)
# Draw and display the corners
img1 = cv2.drawChessboardCorners(img, (7,6), corners2,ret)
To
cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria)
# Draw and display the corners
cv2.drawChessboardCorners(img, (7,6), corners,ret)
And everything works perfectly!
Upvotes: 2