Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment of the image in realtime #34

Closed
robosina opened this issue Oct 14, 2019 · 0 comments
Closed

Alignment of the image in realtime #34

robosina opened this issue Oct 14, 2019 · 0 comments

Comments

@robosina
Copy link

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

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant