map image contour defined by non-symetric trapeze to a square destination iamge

asked 2014-04-23 16:01:58 -0600

lpb gravatar image

Hi, I was wondering if there was a function in OpenCV that would allow me to deform an image in this way: take 4 points that defines the trapeze boundary of a region in an image and apply them as texture coordinate of a plane so that it is interpolated correctly on a square plane (wrap this region's inside of this new square region). I can do this in OpenGL by defining UV coordinates of a texture to be applied on a plane but I was wondering it the equivalent existed in OpenCV.

Remap() seems to take as arguments a table of correlated points in both images for each axis. In my case, both images might not be of the same size and the src image points are not on a symmetrical boundary. Also, the source plane is not necessarily the destination one transformed in 2D, so no geometrical manipulation.

Thank you

edit retag flag offensive close merge delete

Comments

May be warpPerspective, also showing some image will be helpful for the viewers.

Haris gravatar imageHaris ( 2014-04-23 22:47:12 -0600 )edit

well the src image I want to deform to a square shape is not a 2D or 3D transformed plane, warping the iamge according to a geometrical transformation is not what I am looking for. I want to apply the content of an image between 4 control points so that it is interpolated to a plane, just like applying a texture on a plane in OpenGL/DirectX by proviing UV custom texture coordinate of an image.

lpb gravatar imagelpb ( 2014-04-24 11:37:54 -0600 )edit