2010/1/31 Igor Tuphanov <ituphanov@gmail.com>

This "forward" method is rarely used for the reason that it is too hard to get a smooth result with predictable noise response, aliasing, etc, etc. It works OK when the local stretching required by the transformation mapping is small, but badly otherwise. The "reverse" method can be made to work stably and well in all cases, by choosing the right interpolation function. In fact, if you try to optimize the "forward" interpolation in general you will find you are forced to build it out of "reverse" interpolations.

To get more speed, one can use a mesh-based form of the reverse interpolation: instead of mapping every pixel, map every 4th or 6th one in each direction; then use a simple bilinear or bicubic interpolation to calculate the target points for the pixels not mapped. Because those pixels form a regular grid the needed coefficients can be precomputed and read from a table. This method is implemented in libpano under the name "fast transform" and is now the default mode for image warping.

Cheers, Tom

As I can see from the sources (resample.c, I guess), in libpano there implemented following way to build the resulting image:

take a pixel of the resulting image, apply back transformation to see, where it falls in the original image (say, it would be a point with float coords (u,v)). After that we take some pixels of original image near (u,v), take its colour, colours of some of its neighbours and do some interpolation to make all the stuff smooth.

Do I understand it correct?

Correct.

What do you think of the following algorithm?

Consider pixel as a unit square, apply transformation to it's four points. After that look, what pixels of the resulting image are covered by this transformed quadrangle. Consider a pixel of the resulting image as a unit square. We take it's colour as a weighted average of colours of transformed quadrangles, covering it. Weights are common areas of our unit rectangle and the current quadrangle.

I've implemented this method for my needs, and it works quite nice, but maybe too slow. The speed depends mainly on how you calculate a common area for a square and quadrangle.

This "forward" method is rarely used for the reason that it is too hard to get a smooth result with predictable noise response, aliasing, etc, etc. It works OK when the local stretching required by the transformation mapping is small, but badly otherwise. The "reverse" method can be made to work stably and well in all cases, by choosing the right interpolation function. In fact, if you try to optimize the "forward" interpolation in general you will find you are forced to build it out of "reverse" interpolations.

To get more speed, one can use a mesh-based form of the reverse interpolation: instead of mapping every pixel, map every 4th or 6th one in each direction; then use a simple bilinear or bicubic interpolation to calculate the target points for the pixels not mapped. Because those pixels form a regular grid the needed coefficients can be precomputed and read from a table. This method is implemented in libpano under the name "fast transform" and is now the default mode for image warping.

Cheers, Tom

Is someone interested in implementation of the method?

------------------------------------------------------------------------------

The Planet: dedicated and managed hosting, cloud storage, colocation

Stay online with enterprise data centers and the best network in the business

Choose flexible plans and management services without long-term contracts

Personal 24x7 support from experience hosting pros just a phone call away.

http://p.sf.net/sfu/theplanet-com

_______________________________________________

PanoTools-devel mailing list

PanoTools-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/panotools-devel