简体   繁体   English

Python OpenCV相机校准cv :: imshow错误

[英]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.

相关问题 相机校准opencv python imshow错误:(-215)size.width> 0 && size.height> 0 - Camera Calibration opencv python imshow error: (-215) size.width>0 && size.height>0 使用Python进行OpenCV摄像机校准而不使用cv2.findChessboardCorners - OpenCV camera calibration in Python without using cv2.findChessboardCorners 如何在python中找到open-cv摄像机校准常数,OpenCV错误:cv :: calibrateCamera中的断言失败(nimages> 0) - How can I find open-cv camera calibration constant in python , OpenCV Error: Assertion failed (nimages > 0) in cv::calibrateCamera 相机校准的opencv教程中的错误 - error in opencv tutorial for camera calibration Python Opencv imshow错误 - Python Opencv imshow error Python Opencv imshow 错误 - Python Opencv imshow error 相机流 - OpenCV 错误:(-215:断言失败)size.width>0 && size.height>0 in function 'cv::imshow' - Camera Streaming - OpenCV error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow' 使用openCV进行摄像机校准-cv2.getOptimalNewCameraMatrix的投资回报率为零 - Camera Calibration with openCV - cv2.getOptimalNewCameraMatrix results in zero roi openCV Python相机校准-作物和投资回报率 - openCV Python camera calibration - crop and ROI OpenCV Python相机校准:Objp矩阵 - Opencv python camera calibration : objp matrix
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM