[英]Python OpenCV Camera Calibration cv::imshow error
I am trying to calibrate an SJ4000 camera using OpenCV 2.4.11 in Python 2.7 in Anaconda. 我正在尝试在Anaconda的Python 2.7中使用OpenCV 2.4.11校准SJ4000摄像机。
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 但是,我无法在此处运行以下脚本: http : //opencv-python-tutroals.readthedocs.io/zh-CN/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
. 我什至在用
samples/cpp/
可用的samples/cpp/
图像( 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. 编辑1:在进一步调试后,我发现
img = cv2.drawChessboardCorners(img, (7,6), corners2,ret)
导致None对象。
How do I solve this? 我该如何解决?
Thanks for any help! 谢谢你的帮助!
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! 一切正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.