Question

I took some photos that I am attempting to map/transform onto satellite images on Google Maps. Normally, I would need only 4 pairs of points to apply a perspective transform effectively. However, this is not useful in my case because of two reasons:

  1. Mainly, the poor resolution of Google's satellite images (poor for my application, at least) make it harder to pinpoint the exact points that correspond with those on my photos.
  2. I think Google's satellite images are stitched together slightly imperfectly meaning that even with perfectly chosen pairs of points, I might be a little off because the points on the Google images are slightly off themselves.

As a result, I would like to conduct a least-squares estimation of the perspective transform using more than 4 points, so that I can get a better fit. However, I have no idea how to do so.

I am using Python with PIL and/or OpenCV for this, so a solution using those libraries would be helpful.

Was it helpful?

Solution

Homography is slightly more powerful than affine (it doesn’t preserve parallel lines). It requires 4 points or more (findHomography uses RANSAC and selects its best set of inliers using a linear solution; this is followed by non-linear optimization of distance residual in a least squares sense). You have to provide as many matches as you can (>=4) but try to avoid too many inaccurate matches.

The original statistical model for least squares is ML (maximum likelihood) that finds an optimal solution in the presence of noise. RANSAC compensates for the presence of outliers. There is nothing in the algorithm though that compensates for systematic biases. If they cannot be modeled as noise or outliers a solution is not well defined. If the number of inliers (after rejecting outliers) is less than 4 the solution won’t be found.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top