поиск шахматной доски на изображении
Я пытаюсь найти шахматную доску с помощью cv2. Код ниже не находит ее даже на "идеальном" изображении. Я также пробовал другие комбинации флагов в функции findChessboardCorners.
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
using namespace cv;
using namespace std;
int main()
{
Size patternsize(5, 5); //number of centers
Mat cal = imread("1.jpg");
vector<Point2f> centers; //this will be filled by the detected centers
bool found = findChessboardCorners(cal, patternsize, centers, CALIB_CB_FAST_CHECK);
cout << found << "\n";
if (found)
drawChessboardCorners(cal, patternsize, centers, found);
return 0;
}
