findChessboardCorners无法获得校准图像

lau*_*eth 12 c++ opencv computer-vision camera-calibration

我试图让OpenCV 2.4.5从我的网络摄像头识别棋盘图案.我无法做到这一点,所以我决定尝试使用"完美"的图像让它工作:

棋盘与白色边框

但它仍然不起作用 - patternFound每次都返回false.有谁知道我做错了什么?

#include <stdio.h>

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;
using namespace std;

int main(){
    Size patternsize(8,8); //number of centers
    Mat frame = imread("perfect.png"); //source image
    vector<Point2f> centers; //this will be filled by the detected centers

    bool patternfound = findChessboardCorners(frame,patternsize,centers);

    cout<<patternfound<<endl;
    drawChessboardCorners(frame, patternsize, Mat(centers), patternfound);

    cvNamedWindow("window");
    while(1){
        imshow("window",frame);
        cvWaitKey(33);
    }
}
Run Code Online (Sandbox Code Playgroud)

lau*_*eth 19

通过反复试验,我意识到patternize应该是7x7,因为它计算内角.这个参数必须准确 - 8x8不起作用,但也不会小于7x7.

  • 棋盘需要不对称.我再说一遍,棋盘需要不对称.告诉我你怎么可能校准. (5认同)

小智 11

而不是使用

Size patternsize(8,8); 
Run Code Online (Sandbox Code Playgroud)

使用

Size patternsize(7,7);  
Run Code Online (Sandbox Code Playgroud)