OpenCV - a suitable implementation for thin plate scintigraphy

I have a face shape along with a face reconstruction, and I want to simulate the corresponding image of the original shape.

Basically, I want to move the points from the original shape to the position indicated by face reconstruction. I tried to do this using subtle deformation of spline splines, this implementation: http://ipwithopencv.blogspot.ro/2010/01/thin-plate-spline-example.html .

However, it does not work as I would like. I want the corners of the image to be fixed and just move the corresponding points that define the face. I can illustrate this with two pictures. In the first shot I have the shape of the original face with the reconstructed shape. enter image description here

Here I have the image that I want to change and the image shown using the code from the link above. Green dots mark the starting points of the face, and blue dots mark their new position and where I want to move them and stretch my face.

enter image description here

All I want to do is just move the green dots to the blue dots so that they look warped. Do you know any method for this that you tested?

+5
source share
1 answer

Getting fixed angles is pretty simple. Just add four additional matches for the four corners of the image. From the point of view 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, the width is the image width and the height is the image height

+1
source

All Articles