我正在尝试获取棋盘图案的角点,并认为我可以将 openCV 与cv2.findChessboardCorners
.
但是,我找不到传递给该函数的良好参数,以便它成功检测棋盘。我认为该图像适合此功能。如果不是,我不知道我应该做什么预处理。
这是我的代码:
import numpy as np
import cv2
import glob
import sys
import os
nline = 4
ncol = 4
img = cv2.imread(glob.glob('*.jpg')[0])
## termination criteria
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
## processing
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Find the chessboard corners
ret, corners = cv2.findChessboardCorners(gray, (nline, ncol), None)
corners2 = cv2.cornerSubPix(gray, corners, (11, 11), (-1, -1), criteria)
and this is the image :
我尝试过各种尺寸的图案给他,因为我认为4*4的图案会更容易找到,但事实并非如此。
EDIT : Actually using the appropriated number of lines and columns its works :
However, it doesn't for these ones which are not so different from the first one ... 11 lines, for 8 or 9 columns, tried both.
Or this one : which is 13*9.
如何处理此类图像?