Skip to content
Advertisement

I’m not able to get the correct homography points

I’m trying to create homography matrix from this field: enter image description here

(source image with ids:) enter image description here

To the destination image: enter image description here

The points for the source points are:

JavaScript

And the points for destination points (new image):

JavaScript

I tried to create homography matrix with the following code:

JavaScript

And I got the following homography matrix:

JavaScript

I tried to check if the homography matrix is correct, so I used the first coordinate from the source image (761, 704), and check if I get the correct coordinate in destination image, which should be (147, 330). I tried to use the equation new_x, new_y, new_z = h*(x,y,z):

JavaScript

And I got:

JavaScript

Which is very far (and for some reason the z is 4.1).

And I also tried the second point (910, 292), and I should get (35 , 20), but I got [86.33414416, 71.5606917 , 2.47246832].

Any idea why I’m not able to get the correct coordinates?

Advertisement

Answer

The solution was mentioned in the comments thanks to @fana – dividing the x and y coordinates by z (x/z, y/z).

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement