|
|
|
@ -1,7 +1,10 @@ |
|
|
|
|
#include <iostream> |
|
|
|
|
#include <opencv2/opencv_modules.hpp> |
|
|
|
|
#ifdef HAVE_OPENCV_ARUCO |
|
|
|
|
#include <opencv2/opencv.hpp> |
|
|
|
|
#include <opencv2/core.hpp> |
|
|
|
|
#include <opencv2/imgproc.hpp> |
|
|
|
|
#include <opencv2/calib3d.hpp> |
|
|
|
|
#include <opencv2/highgui.hpp> |
|
|
|
|
#include <opencv2/aruco.hpp> |
|
|
|
|
|
|
|
|
|
using namespace std; |
|
|
|
@ -17,32 +20,6 @@ Scalar randomColor( RNG& rng ) |
|
|
|
|
return Scalar( icolor & 255, (icolor >> 8) & 255, (icolor >> 16) & 255 ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void calcChessboardCorners(Size boardSize, float squareSize, vector<Point3f>& corners, Pattern patternType = CHESSBOARD) |
|
|
|
|
{ |
|
|
|
|
corners.resize(0); |
|
|
|
|
|
|
|
|
|
switch (patternType) |
|
|
|
|
{ |
|
|
|
|
case CHESSBOARD: |
|
|
|
|
case CIRCLES_GRID: |
|
|
|
|
for( int i = 0; i < boardSize.height; i++ ) |
|
|
|
|
for( int j = 0; j < boardSize.width; j++ ) |
|
|
|
|
corners.push_back(Point3f(float(j*squareSize), |
|
|
|
|
float(i*squareSize), 0)); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case ASYMMETRIC_CIRCLES_GRID: |
|
|
|
|
for( int i = 0; i < boardSize.height; i++ ) |
|
|
|
|
for( int j = 0; j < boardSize.width; j++ ) |
|
|
|
|
corners.push_back(Point3f(float((2*j + i % 2)*squareSize), |
|
|
|
|
float(i*squareSize), 0)); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
CV_Error(Error::StsBadArg, "Unknown pattern type\n"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void perspectiveCorrection(const string &img1Path, const string &img2Path, const Size &patternSize, RNG &rng) |
|
|
|
|
{ |
|
|
|
|
Mat img1 = imread(img1Path); |
|
|
|
|