I have a problem to align faces using opencv. I detect the face then I use flandmarks and calculate the angle of rotation. I use this function to rotate the image :
cv::Mat rotate(cv::Mat src, double angle)
{
cv::Mat dst;
cv::Point2f pt(src.cols/2., src.rows/2.);
cv::Mat r = getRotationMatrix2D(pt, angle, 1.0);
cv::warpAffine(src, dst, r, cv::Size(src.cols, src.rows));
return dst;
}
I want to find the new position of eyes after rotation to crop the face based on the eyes center.