I want to create a tool for affine transformation on selected part of image(4 corners polygon, see image link). http://s14.postimg.org/fn9btus8h/explanation.png
I tried to use opencv but without success.
Thanks for help. Regards
I want to create a tool for affine transformation on selected part of image(4 corners polygon, see image link). http://s14.postimg.org/fn9btus8h/explanation.png
I tried to use opencv but without success.
Thanks for help. Regards
You should show us what you have tried, and how you got no success. You may be using wrong points for creating the transformation matrix. The correct procedure is described below.
You should use getAffineTransform
to create an affine transformation matrix. This maps an input triangle to an output triangle, as mentioned in the documentation. But you should make sure that you pass three corresponding points of your two planes.
If you are not sure how to choose three corresponding points of your two planes, just use getPerspectiveTransform
and pass in four points of two planes, in their respective order. It still works, as affine transform is just a special case of perspective transform.
After getting the transformation matrix, you should use warpAffine
or warpPerspective
to map
the input image.
Thanks everyone for help. I found solution.
I used Qt functionality. Here is my code: