findCirclesGrid()用于不规则模式

时间:2019-01-28 15:09:24

标签: opencv camera-calibration corner-detection

我期待使用DLT,RANSAC和Zhang的方法实现相机校准。SE link适用于不规则网格,并且效果很好。我有一个尺寸为5472x3648的图像,该图像显然不在平面上。

我的image脚本失败。

import cv2
import numpy as np
from matplotlib import pyplot as plt


params = cv2.SimpleBlobDetector_Params()
params.maxArea = 100000
detector = cv2.SimpleBlobDetector_create(params)
ret, corners = cv2.findCirclesGrid(self.gray, (horsq, versq), None,
                flags=cv2.CALIB_CB_ASYMMETRIC_GRID, blobDetector=detector)


filename = 'data/IMG_5455.jpg'
img = cv2.imread(filename)
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

plt.imshow(gray, cmap="gray")
plt.axis("off")

plt.show()


#ret, corners = cv2.findCirclesGrid(gray, (5, 5), None,flags=cv2.CALIB_CB_ASYMMETRIC_GRID+cv2.CALIB_CB_CLUSTERING)

ret, corners = cv2.findCirclesGrid(gray, (5, 5), None,flags=cv2.CALIB_CB_ASYMMETRIC_GRID+cv2.CALIB_CB_CLUSTERING,blobDetector=detector)

corners=corners.reshape(-1,2)
print (corners.shape)
print (corners[0])

我收到错误

  

AttributeError:'NoneType'对象没有属性'reshape'

0 个答案:

没有答案