Alignment of the image in realtime
robosina opened this issue · comments
I want to test caffemodel on the the real world problem, so I use mtcnn landmarks and align image like the below:
`
Mat transform(Mat image, //cropped face image
vector<Point2f> dst) //dst are the landmark of the face
{
float image_height=96.0/image.cols;
float image_width=112.0/image.rows;
for (int i = 0; i < dst.size(); ++i)
{
dst[i].y*=image_height; //in this line I will scale the points to the new size of image(96,112)
dst[i].x*=image_width;
}
cv::resize(image,image,Size(96,112));
vector<Point2f> src;
src.push_back(Point2f(30.2946,51.6963));
src.push_back(Point2f(65.5318,51.5014));
src.push_back(Point2f(48.0252,71.7366));
src.push_back(Point2f(33.5493,92.3655));
src.push_back(Point2f(62.7299,92.2041));
cv::Mat R = cv::estimateRigidTransform(dst,src,false);
Mat out;
cv::warpAffine(image,out,R,Size(96,112));
return out;
}
`
what I got is something like the below image
As you can see there is a black area in the top and rights side of the image, So I'm confused that is this normal?