I have the shape of a face with together with the reconstruction of that face and I want to model the corresponding image of the initial shape.
Basically, I want to move the points from the original shape to the position indicated by the reconstruction of the face. I have tried to do this by using thin plate spline warping, this implementation of it : http://ipwithopencv.blogspot.ro/2010/01/thin-plate-spline-example.html.
However, it's not working as I would want. I want to have the corners of the image fixed and just to move the corresponding points which define the face. I can illustrate this with 2 pictures. In the first picture I have the shape of the original face with the reconstructed shape.
In here I have the picture which I want to modify and the resulted picture by using the code from the link mentioned above. The green points mark the original face points and the blue points mark their new position and where I want to reposition them and stretch my face.
All I want is just to move the green points to the blue points so that it looks deformed. Do you know of any method to do this which you have tested?
Getting the corners fixed is quite easy. Just add four additional correspondencies for the four image corners. In terms of your example:
iP.push_back(cv::Point(0, 0));
iiP.push_back(cv::Point(0, 0));
iP.push_back(cv::Point(0, height-1));
iiP.push_back(cv::Point(0, height-1));
iP.push_back(cv::Point(width-1, 0));
iiP.push_back(cv::Point(width-1, 0));
iP.push_back(cv::Point(width-1, height-1));
iiP.push_back(cv::Point(width-1, height-1));
Where, of course, width is the image width and height is the image height
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With