Ask Your Question

Revision history [back]

One idea:

Add a fourth point in the middle of the polygon (how you define the "middle or a polygon" is up to you :) and connect the new point with all others. Your polygon now consists of four triangles. (Do the same for your source image) Now your task is to only map each triangle in your source image to the correcponding triangle in the polygon. This can be done via cv::getAffine and cv::warpAffine. Tutorial is here: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.html

One idea:

Add a fourth point in the middle of the polygon (how you define the "middle or of a polygon" is up to you :) and connect the new point with all others. Your polygon now consists of four triangles. (Do the same for your source image) Now your task is to only map each triangle in your source image to the correcponding corresponding triangle in the polygon. This can be done via cv::getAffine and cv::warpAffine. Tutorial is here: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.html