【问题标题】:Opencv cannot find chess board cornersOpencv找不到棋盘角
【发布时间】:2023-04-01 17:23:01
【问题描述】:

我有以下从 LMS 鱼眼数据集拍摄的图像:

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

但是,在打开的 cv 中找到所有可能的图案尺寸的角点,如下所示:

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 到 2222、2222 的每个模式大小,我得到 False None。如何解决这个问题?

【问题讨论】:

    标签: opencv computer-vision camera-calibration


    【解决方案1】:

    很巧,这周的实践课,我的导师让我们玩和你问的类似的编码。我是 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,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

    【讨论】:

    • 它根据需要检测每个边缘的多个点,而不是单个点。
    • 我认为您可以过滤所有具有接近 x 和 y 的点,并为每条边保留一个。
    猜你喜欢
    • 1970-01-01
    • 2020-11-23
    • 2017-02-22
    • 2023-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-03
    相关资源
    最近更新 更多