我想让OpenCV 2.4.5从我的摄像头识别棋盘图案。我不能得到那个工作,所以我决定尝试只使用一个“完美”的形象得到它的工作:findChessboardCorners校准失败
,但它仍然是行不通的 - 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);
}
}
棋盘必须是不对称的。我再说一遍,棋盘必须是不对称的。告诉我你如何可能校准,否则。 – CTZStef
@laurenelizabeth你的回答让我更近了一步,但我似乎仍然有同样的问题。关于7x7而不是8x8的提示对我来说非常重要。但是,我仍然无法检测到拍摄棋盘的角落,甚至没有发现接近完美的照片。 –
我们正在尝试使用不对称9x7棋盘,我们要求8x6(内部正方形)。它工作得非常快。没有问题检测。而且我们使用的是双摄像头,我们只考虑两台摄像头同时检测到的东西。 谢谢! – helios