Hi Igor

2010/1/31 Igor Tuphanov
I've thought of using libpano for rectification of sea images.

We have a perspective image of some area and want to rectify it to easily put on maps and so on. The way to determine angles of a shot, is to take it directly from a camera, or use ground control point, witch can be seen on the picture. If we know GPS coordinates of such ground control points, we can make an equations and after that make optimization like libpano does.

But, using libpano for this look not easy, cause in libpano we should have a pairs of control points and mark it as weather vertical or horizontal.

What do you think, would it be difficult to use libpano for such mention of control points? Do I understand libpano's control points correct?

I don't think there is any need here for control point pairs of the kind used in stitching panoramas.  Their purpose is to determine the unknown transformations relating multiple images.  Once those transformations are determined, the control points have no part in the actual image warping.  You have a single image and already know (or can calculate) the transformation you need.  So it is only a question of whether you can use PanoTools to apply that transformation.

It sounds as if the transformation you need is just a  perspective remapping to change the apparent angle of view to vertical.  PanoTools can do that easily, given rotation angles around the X and Y axes.  There is a tool among the PT Photoshop plugins whose job is exactly that, I think its name is Perspective.  Of course if you own Photoshop you could just as well use its own perspective tool, so I'm assuming you  don't.

In that case you have to learn how to write a script for PTMender (the image warping engine) that will make it do what you need. The script format is primitive, but intelligible once you know the meanings of the symbols.  I am not expert in such scripting, but I think you need to specify the rectilinear projection (code 0) for both source and destination images, and give the rotations around X and Y as the pitch ( 'p' ) and yaw ('y' ) parameters.  Of course you put image sizes, file names, etc. in the script too.

If you need to correct radial distortion in the lens, PT has a mechanism for that, in the form of a 4th order polynomial (a little different from the ones common in photogrammetry but usable).  Its coefficients are the 'a', 'b', and 'c' parameters.  For manual use it is recommended to leave 'a' and 'c' at zero,and use 'b' to correct the 'barrel' or 'pincushion' distortion.  If you can measure it.

You should find some guidance to PT scripts at the Panotools.org wiki, though there is no complete manual.  It is quite convenient to run the command line PanoTools from Perl or Python scripts, in case you want to combine calculating the transformation with executing it.  There is a nice collection of Bruno Postle's Perl scripts at http://search.cpan.org/~bpostle/Panotools-Script-0.24/.

If you have any luck, let us see some results.

Regards, Tom

------------------------------------------------------------------------------
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