0
$\begingroup$

I'm studying image warping and I'm unsure how to warp a starting rectangular image into another image where the box corner points have been changed as I want:

enter image description here

(image from http://www.inf.ethz.ch/personal/pomarc/courses/CompPhoto/cpv03.pdf)

As far as I've understood, I need to:

1) Decide the four points (e.g. by using direct mapping on the border cases of the transformation)

2) Create a lattice of integer points on it (how?)

3) Do reverse mapping on those integer points to get the values in the original image

4) ??

I can't say I understood a lot of that, can somebody help me out please?

$\endgroup$
0
$\begingroup$
  1. 4 corresponding points defines a Homography matrix, which maps your coordinates in the first image to the second image (or from second to first, inversely). This is sort of a perspective transform for homogeneous coordinates. Read more about it here: http://en.wikipedia.org/wiki/Homography. (Since you have exact correspondences it is very easy to solve for Homography matrix.)

  2. Convert your image points to homogeneous representation: http://en.wikipedia.org/wiki/Homogeneous_coordinates

  3. Apply a bilinear interpolation (backward mapping) using your matrix. That is to say, a homogeneous point $x_i$ is mapped to the corresponding point in the second image $x'_i$ as $x'_i=Hx_i$. Yet you have to de-homogenize the final coordinate as $x_i=\frac{x_i}{x^z_i}$, where $x^z_i$ is the $3^{rd}$ component of $x_i$. You can basically now, create your indices for the entire grid. Yet, as I said, you should interpolate by reverse lookup, so that you don't end up with black dots allover.

$\endgroup$
0
$\begingroup$

ImageMagick does that sort of thing, and it's open source. Look at the source code in magick/distort.c of the current ImageMagick distribution, which you can get from imagemagick.org. This assumes you have already selected the four control points and passed them in as an option.

The particular distortion method you described is called "binlinear forward" distortion in ImageMagick. See http://www.imagemagick.org/Usage/distorts/#bilinear_forward

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.