我想讓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