Now that we have defined all the components of our pipeline, let us put everything together into one single piece of code that performs the face alignment from end-to-end:
#include <iostream> #include <cmath> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace std; using namespace cv; #define PI 3.14159265 float getAngleInRad(Point A, Point B) { float A_x = A.x; float A_y = A.y; float B_x = B.x; float B_y = B.y; float slope = ((B_y - A_y) / (B_x - A_x)); return (-1 * atan(slope)); } float getEuclideanDistance(Point A, Point B) { return sqrt( (A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y) ); } Mat getAffineTransformationMatrix(float rotation_angle, Point...