Finding Homography Matrix Using Lines I have some Points and Lines from original image and the corresponding points and lines from top view image.

-> I tried to find homography using points


Used OpenCV function findHomography(objectPointsPlanar, imagePoints) :


It takes 4 points from original image and 4 points from top view image(required image) and it returns homography matrix of 3x3.

Used mathematical formula to find homography matrix (Didn't use any library) :


Please look at the attached images for the formula to find homography matrix using 4 points by your own.

I have tested the formula by writing it in c++. It gives the homography matrix same as given by opencv function findHomography().



PS : I used the determined homography matrix to warp the image, but I am not happy with the output. It doesn't come to be accurate.
So I am thinking to use lines to find homography matrix.

-> Homography determination using Lines :


I tried to look for any library which can find homography matrix using lines, but I didn't get.
I also looked at research papers to get the mathematical formula to find the homography matrix, but was not able to understand the formula.
I am sharing the link of a research paper  : A new normalized method on line-based homography estimation


So could someone please help me to find the homography matrix using lines.

Thanks in advance,
Regards.
I think you can't do Homography on lines.

I don't remember the equations but I don't think lines in one image are kept as lines in the other image.

What you can do is treat a line as set of points and have Homography estimation using many point samples.