解释相机校准结果?
Interpreting camera calibration results?
我在一些棋盘图像(40~)上使用了 OpenCV 的 findChessboardCorners,大约 27 个似乎准确地找到了角落。如何从这里开始?我是否只计算正确识别的图像的重投影误差?这正常吗?
部分正确识别的图片-
部分图片识别错误-
我如何校准图像 -
import cv2 as cv
def calibrate():
criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)
objp = np.zeros((6*9,3),np.float32)
objp[:,:2] = np.mgrid[0:9, 0:6].T.reshape(-1,2)
objpoints = []
imgpoints = []
images = glob.glob('*.png')
for fname in images:
img = cv.imread(fname)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
ret, corners = cv.findChessboardCorners(gray, (9,6), None)
if ret == True:
print('Hello')
objpoints.append(objp)
corners2 = cv.cornerSubPix(gray, corners, (11,11), (-1,-1), criteria)
# cv.drawChessboardCorners(img, (9,6), corners, ret)
imgpoints.append(corners2)
cv.imshow('img',img)
cv.waitKey(500)
cv.destroyAllWindows()
ret, mtx, dist, rvecs, tvecs = cv.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None)
return objpoints, imgpoints, ret, mtx, dist, rvecs, tvecs
如果有人想试一试,我已经添加了原始图像。
https://imgur.com/a/rsl0SHr
Is this normal to expect?
不是,你错误识别的图像很奇怪。我认为您的校准过程可能有问题。你能展示一些代码吗(例如 findChessboardCorner()
和 calibrateCamera()
调用)?
Do I calculate the reprojection error over just the correctly identified images?
您应该计算所有点的重投影误差,但首先您需要修复校准过程。
我在一些棋盘图像(40~)上使用了 OpenCV 的 findChessboardCorners,大约 27 个似乎准确地找到了角落。如何从这里开始?我是否只计算正确识别的图像的重投影误差?这正常吗?
部分正确识别的图片-
部分图片识别错误-
我如何校准图像 -
import cv2 as cv
def calibrate():
criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)
objp = np.zeros((6*9,3),np.float32)
objp[:,:2] = np.mgrid[0:9, 0:6].T.reshape(-1,2)
objpoints = []
imgpoints = []
images = glob.glob('*.png')
for fname in images:
img = cv.imread(fname)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
ret, corners = cv.findChessboardCorners(gray, (9,6), None)
if ret == True:
print('Hello')
objpoints.append(objp)
corners2 = cv.cornerSubPix(gray, corners, (11,11), (-1,-1), criteria)
# cv.drawChessboardCorners(img, (9,6), corners, ret)
imgpoints.append(corners2)
cv.imshow('img',img)
cv.waitKey(500)
cv.destroyAllWindows()
ret, mtx, dist, rvecs, tvecs = cv.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None)
return objpoints, imgpoints, ret, mtx, dist, rvecs, tvecs
如果有人想试一试,我已经添加了原始图像。 https://imgur.com/a/rsl0SHr
Is this normal to expect?
不是,你错误识别的图像很奇怪。我认为您的校准过程可能有问题。你能展示一些代码吗(例如 findChessboardCorner()
和 calibrateCamera()
调用)?
Do I calculate the reprojection error over just the correctly identified images?
您应该计算所有点的重投影误差,但首先您需要修复校准过程。