2

So I've been using gnu-gsl and CImg to implement some of the fundamental projective space techniques for affine and metric rectification.

I've completed computing an affine rectification but, I'm having a hard time figuring out how to apply the affine rectification matrix to the original (input) image.

My current thought process is to iterate across the input image for each pixel coordinate. Then multiply the original pixel coordinate (converted to a homogeneous coordinate) by the affine rectification matrix to get the output pixel coordinate.

Then access the output image using the output pixel coordinate and conduct a blend (addition) operation on the output image's pixel location with the pixel color from the original image.

Does that sound right? I'm getting a lot of really weird values after multiplying the original pixel coordinate by the affine rectification matrix.

ct_
  • 1,189
  • 4
  • 20
  • 34

1 Answers1

1

No, your values should not be weird. Why don't you make a simple example, a small scale with a small translation; e.g.

x' = 1.01*x + 0.0*y + 5;
y' = 0.0*x + 0.98*y + 10;

Now the pixel at (10,10) should map to (15.1,19.8), right ?

If you want to make a nice output image, you should find the forward projection and then back project to the input image and interpolate there rather than try to blend into the output image. Otherwise you will end up with gaps in the output.

You need to be careful with your terminology here; it sounds to me like you are doing projections, sometimes called warping in the computer graphics community. Rectification is something else, but it depends on what you are doing.

koan
  • 3,596
  • 2
  • 25
  • 35
  • I figured out a major part of my problem was related to coordinate normalization. *sigh* somewhat obvious. Having said that, I've noticed most of the image coordinates I've been getting back from the system are negative values. They actually look like pixel coordinates, just negative. A little strange...I guess I could compare what gnu-gsl is doing against Matlab. As for applying the transformation, I found some reference code that conducts a matrix-vector multiplication (element-wise). That seems to be doing the trick. – ct_ Mar 11 '11 at 16:14
  • It sounds to me like you should make a small ground truth example, with known test data, known parameters and known result. Then problems with co-ordinate normalization, location of the origin, etc etc can be waived while you fix your system. – koan Mar 11 '11 at 16:55