Vernier Library
detectingMegarenaPattern.cpp
#include "Vernier.hpp"
using namespace vernier;
using namespace cv;
using namespace std;
int main() {
// Loading the image
string filename = "megarenaPatternImage_12bits_9um.jpg";
Mat image = cv::imread(filename);
// Detecting the pattern and estimating its pose
double physicalPeriod = 9; // µm
int codeSize = 12; // bits
MegarenaPatternDetector detector(physicalPeriod, codeSize);
detector.compute(image);
// Displaying the pose if a pattern has been found
cout << "Detector: " << detector.toString() << endl;
if (detector.patternFound()) {
cout << "Estimated pose: " << detector.get2DPose().toString() << endl;
detector.draw(image);
} else {
cout <<"Pattern not found..." << endl;
}
// Showing image and its spectrum
detector.showControlImages();
imshow(filename, image);
waitKey(3000);
}