Ask Your Question

Non-rigid stitching functions

asked 2012-07-20 08:16:38 -0500

sammy gravatar image

updated 2012-07-20 08:17:02 -0500

Starting from a reference in this answer about elastic (non-rigid) transforms between images, I am wondering whether OpenCV supports such transforms.

So, given an image, some landmarks in it, and a new set of landmarks, it is a way to transform the image so that the old landmarks move to the new set? By elastic transform, I mean it should not be a simple homography, but a more flexible (locally adaptive) algorithm. The idea would be to create a map between the original and the destination, in such a way that the old image looks "stretched" or "squizzed"

I know algorithms that do it, and how it works, I am just curious whether such functions are available in OpenCV.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-07-20 10:16:37 -0500

Kirill Kornyakov gravatar image

cv::remap function can apply such transformation, but the most interesting question is now the generate the map. Here is a very gentle intro to the subject:

So, I don't even know if OpenCV can help you with map generation, you probably should do it manually. In fact it is custom for every application: rectification, warping for stitching. You should probably study sources of such algorithms...

edit flag offensive delete link more


I know about remap - I was interested in the process of generating such maps. But I hope the answer will be helpful for others

sammy gravatar imagesammy ( 2012-07-20 11:45:39 -0500 )edit

answered 2012-08-30 01:17:55 -0500

mrgloom gravatar image

updated 2012-08-30 02:04:40 -0500

I think you are talking about something like this? Moving Least Squares or Thin Plate Splines

also here some code for opencv

I think you can generate some map and then use remap.

by the way what is other algorithms to do this?what if we have no landmarks but just pixel data?

edit flag offensive delete link more


That is the algorithm I knew about. If you have only pixel data, that means you have the maps for remap, so all you have to do is to apply it.

sammy gravatar imagesammy ( 2012-08-30 01:31:41 -0500 )edit

no, I'm talking about some algorithms that don't use landmarks but just pixel data. Maybe it's called dense optical flow I'm not sure or something correlation based.

mrgloom gravatar imagemrgloom ( 2012-08-30 01:39:23 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2012-07-20 08:16:38 -0500

Seen: 2,270 times

Last updated: Aug 30 '12