- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在 opencv 上校准我的相机。我已经尝试过这段工作正常的代码并识别了 CHessboard 上的点,但是在尝试校准相机时出现错误。我正在使用 python 3.6
我收到这个错误:
error: C:\projects\opencv-
python\opencv\modules\calib3d\src\calibration.cpp:3334: error: (-215)
nimages > 0 in function cv::calibrateCamera
这是我的代码:
import numpy as np
import cv2
numero = 25
nx = 9
ny = 6
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
objp = np.zeros((nx*ny,3), np.float32)
objp[:,:2] = np.mgrid[0:ny,0:nx].T.reshape(-1,2)
# 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.
#image adress
img = cv2.imread('captureL'+ str(numero)+'.png')
#color to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#find and draw ChessboardsCorners
ret, corners = cv2.findChessboardCorners(gray,(nx,ny),None )
if ret == True:
cv2.cornerSubPix(gray, corners, (11, 11), (-1, -1), criteria)
draw_chess = cv2.drawChessboardCorners(img, (nx,ny), corners, ret)
cv2.imshow('video testR',draw_chess)
#camera calibration
ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1], None, None)
cv2.waitKey()
cv2.destroyAllWindows()
你有什么想法吗?因为它,我不再有头发了。谢谢。
最佳答案
我添加了 objpoints.append(objp) 和 imgpoints.append(corners) 来为它们赋值。现在该函数正确返回相机矩阵和所有其他信息。我的错误消息消失了。
关于python - opencv cv2.calibrateCamera错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50202410/
我想知道使用cvCalibrateCamera2来查找两个相机之间的旋转和平移的可能性有多大。 以您刚刚完成棋盘校准的场景为例,其中棋盘对于两个图像平面都是可见的。如果我然后将一个相机中的这些点作为
我正在校准我的相机,以消除图像失真。为了实现这个目标,我正在使用 OpenCV 库的校准相机功能。所以我用棋盘在真实引用系统中取点来提取点数。然后我用mm将这些点转换成真实的引用系。所以最后我得到两个
几天来,我一直在用棋盘示例进行相机校准。一切都很好(找到并显示角,然后馈送到数组)直到我调用最终函数 calibrateCamera。比我得到断言错误: OpenCV 错误:calibrateCame
我正在使用圆网格校准相机。相机位于 table 上方的固定位置,因此我使用单张图像进行校准。 (我将使用的所有对象都是平的,并且与我的校准图像在同一张 table 上。)我将圆心的真实位置放入 obj
我正在使用 calibrateCamera 执行相机校准。部分输出是一组 Rodrigues 旋转矢量和 3-D 平移矢量。 我对相机的世界位置感兴趣。如果我直接绘制翻译点,结果看起来不正确。我觉得我
我正在尝试为三角测量过程获取一个3x4 相机矩阵,但是calibrateCamera()仅返回 3x3 和 4x1 矩阵。 如何从这些矩阵中得到 3x4? 提前致谢! 最佳答案 calibrateCa
一段时间以来,我一直在尝试使用 Opencv calibrateCamera() 函数来校准我的相机。我遵循了 opencv 示例程序中描述的相同过程。我试图首先加载 10 9 x 6 棋盘图像。然后
我正在尝试让calibrateCamera在我的Node.js后端上工作。该库运行正常,但是如果输入错误,我会遇到OpenCV函数无法给出任何错误消息的麻烦。我有点在黑暗中飞翔。 但这不是重点。我已经
我想将 findChessboardCorners 与 calibrateCamera 一起使用,但在使用 calibrateCamera 时遇到错误。输出不是很有帮助。 OpenCV Error:
我正在使用 OpenCV 的 calibrateCamera 并试图了解它如何计算重投影误差以及该误差代表什么。它似乎是投影点和测量图像点之间的(欧几里得)距离的 RMS——对吗?然而,最终的重投影误
当我尝试使用 cv2.calibrateCamera 校准相机时出现以下错误: rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrate
我试图从函数 cv::calibrateCamera() 中获取 cameraMatrix,实际上我不确定我做的是否正确,我最初的想法是: 获取来自同一相机的两张输入图像。 提取image_1和ima
我有一个 python 脚本,它使用 calibratecamera2 方法从棋盘的几个 View 校准相机。成功校准后,我追踪所有原始点并绘制一些图并再次计算重新投影误差。令我惊讶的是,opencv
我正在尝试使用 cv::calibrateCamera 来校准相机+投影仪系统。虽然它有时似乎有效,但在许多情况下,估计的解决方案似乎与正确的解决方案相去甚远。 这是一个显示问题的代码示例(包括所有数
我正在使用 VisualStudio 2010 和 OpenCV 3.0。我想校准相机,我遇到的问题与 this 中描述的基本相同去年发的帖子,一直没回复。我正在调用 calibrateCamera,
我有一个立体相机装置。我已经捕获了一个 chessboardPattern 序列(相同的序列,每次曝光两张照片)。我使用 cv2.calibrateCamera 对各个相机执行了单个相机校准。 我的问
背景: 我目前正在使用 OpenCV 进行立体视觉项目。我正在尝试从一组两个校正图像创建视差图,但我没有得到我期望的结果。查看校正后的图像时,图像之间存在明显的垂直偏移,校正后不应存在。我目前正在寻找
我正在尝试使用OpenCV calibrateCamera函数来校准我的MSFT LifeCam 3000 HD网络摄像头。为此,我了解需要知道fx和fy(x和y轴的焦距)。但是,我很难找到这些信息。
大家好,我一直在使用 Python 和 OpenCV 深入研究计算机视觉,并尝试校准我购买的两台相机,以便进行一些 3D 立体重建,但我遇到了一些问题。 我主要关注的是这个tutorial为了分别校准
calibrateCamera 的定义是:CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,InputArray
我是一名优秀的程序员,十分优秀!