Opencv无法找到棋盘角落

问题描述

我从LMS鱼眼数据集中获取了以下图像:

https://www.lms.tf.fau.eu/research/downloads/fisheye-data-set/

enter image description here

但是,在具有所有可能的图案尺寸的开放式简历中找到拐角时,如下所示:

for i in range(3,22*22):
    ret,corners = cv2.findChessboardCorners(gray,(i,i),cv2.CALIB_CB_ADAPTIVE_THRESH)
    print(i,ret,corners)

对于从3,3到22 22,22 22的每个图案大小,我得到False None。该如何解决

解决方法

如此巧合的是,在本周的实践课上,我的老师让我们玩了与您要求的编码类似的编码。我是python的新手,而且对openCV的了解不多。希望编码能给您一个想法。

filename = 'Test.png'
img = cv2.imread(filename)
img = cv2.resize(img,None,fx=0.5,fy=0.5)
cv2.imshow('picOriChessboard',img)

# Corner detection using Harris corner detector
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
gray = np.float32(gray)
dst = cv2.cornerHarris(gray,2,3,0.04)
dst = cv2.dilate(dst,None) #result is dilated for marking the corners,not important
img[dst>0.01*dst.max()]=[0,255] # Threshold for an optimal value,it may vary depending on the image.
cv2.imshow('picCornerHarris',img)

cv2.waitKey(0)
cv2.destroyAllWindows()

测试:https://i.stack.imgur.com/6NzxW.png