BINKLE
BINKLE

Reputation: 1

Computing the homography matrix

I have a poster in the world image. I have to replace the poster with my own image. Let the poster in world image have points A, B , C , D. My own image coordinates are a , b , c , d. The idea is to compute a homography matrix such that a = HA, b = HB, c = HC, d = HD. After that I apply H^-1 to my image and transform them to the poster in in world image. I saw a couple of books , lectures like this.

Why is not that I can compute a homography H' such that A = H'a , B = H'b and so on. Why find H and then its inverse and not directly H'. Is there some problem with it?

Upvotes: 0

Views: 780

Answers (1)

alexisrozhkov
alexisrozhkov

Reputation: 1632

Actually there isn't any difference between finding H and inverting it, or directly finding H^-1. Usually it is better to avoid inversion to speed up the algorithm and reduce accumulation of numerical errors.

I can't think of any 'real' reasons to use the inversion the way you described. Maybe authors did it for sake of clarity, or some notation conventions.

Also, usually when you warp an image using a homography - it is inverted under the hood. So instead of calculating the 'new' coordinates for points in the original image and writing source colors there - you iterate over pixels in the destination image and see where should you take the color values from in the source image. This way you can avoid writing to same pixel several times (if you are downscaling an image) or producing a sparse image (when upscaling).

If you post the exact sources where you have seen this unnecessary conversion - we can give you more helpful comments.

Upvotes: 2

Related Questions