Vernier Library
analysingImage.cpp

Computes the phase planes of a given patternAll the memory allocation and possible pre-calculations are done at the construction of the detector, then the images can be computed without any delays (but all the computed images must have the same size).

#include "Vernier.hpp"
using namespace vernier;
using namespace cv;
using namespace std;
int main() {
// Loading the image
Mat image = imread("megarenaPatternImage_12bits_9um.jpg");
// Analysing the spectrum of the image
PatternPhase patternPhase;
patternPhase.compute(image);
// Displaying the phase planes if two peaks have been found
if (patternPhase.peaksFound()) {
cout << "Phase plane 1: " << patternPhase.getPlane1().toString() <<endl;
cout << "Phase plane 2: " << patternPhase.getPlane2().toString() <<endl;
} else {
cout << "Peaks not found..." << endl;
}
// Showing image spectrum and fringes
patternPhase.showControlImages();
waitKey(3000);
}