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!
imgit can beNonesize.width>0 && size.height>0. i.e. your image is probably 0x0 in size, or doesn't exist.Nonebut why?imgbefore that? In fact, is it notNoneright afterimg = cv2.imread(fname)?imgbeforedrawChessboardCornersmaybe problem is somewhere before this line. I found that CV doesn't raise error when there is some problem but it returnsNone- ie. it returnsNonewhen it can't get image from camera.