Projective transformation

Posted by mcwehner on Stack Overflow See other posts from Stack Overflow or by mcwehner
Published on 2008-10-04T07:14:14Z Indexed on 2010/03/31 9:33 UTC
Read the original article Hit count: 281

Filed under:
|

Given two image buffers (assume it's an array of ints of size width * height, with each element a color value), how can I map an area defined by a quadrilateral from one image buffer into the other (always square) image buffer? I'm led to understand this is called "projective transformation".

I'm also looking for a general (not language- or library-specific) way of doing this, such that it could be reasonably applied in any language without relying on "magic function X that does all the work for me".

An example: I've written a short program in Java using the Processing library (processing.org) that captures video from a camera. During an initial "calibrating" step, the captured video is output directly into a window. The user then clicks on four points to define an area of the video that will be transformed, then mapped into the square window during subsequent operation of the program. If the user were to click on the four points defining the corners of a door visible at an angle in the camera's output, then this transformation would cause the subsequent video to map the transformed image of the door to the entire area of the window, albeit somewhat distorted.

© Stack Overflow or respective owner

Related posts about graphics

Related posts about image-processing