views:

1617

answers:

5
+1  A: 
Frank Krueger
The problem is, how do you convert the 4 points into a 3D rotation?
Neil N
+2  A: 

The keyword here is homography. Manolis Lourakis has written a GPL'ed homography implementation in C that is available here; however, this will not be able to be ported very easily because it relies on some external libraries such as LAPACK.

Adam Rosenfield
+2  A: 

Disclaimer: I work at Atalasoft

If you are willing to go commercial, DotImage Photo can do this with the QuadrilateralWarpCommand. Sample C# Code

// Load an image.
AtalaImage image = new AtalaImage("test-image.jpg");

// Prepare the warp positions.
Point bottomLeft = new Point(100, image.Height - 80);
Point topLeft = new Point(130, 45);
Point topRight = new Point(image.Width - 60, 140);
Point bottomRight = new Point(image.Width - 20, image.Height);

// Warp the image.
QuadrilateralWarpCommand cmd = new QuadrilateralWarpCommand(bottomLeft,
   topLeft, topRight, bottomRight, InterpolationMode.BiLinear, Color.White);
AtalaImage result = cmd.Apply(image).Image;

http://www.atalasoft.com/products/dotimage

Lou Franco
Is this an affine warp or a perspective warp?
Mr Fooz
I don't believe you can get this with an Affine warp (at least not 2d) We support several common affine transformations, and you can make your own 2D matrix. We don't support 3D transformations (which is what I think you would need to do this kind of transformation using a matrix).
Lou Franco
+4  A: 

Check out the Perspective warping examples from ImageMagick. It is available for most mainstream platforms.

unwind
A: 

can you explain in matlab?