0

I want to estimate homography between 2 images:

import numpy as np
import skimage as ski
import matplotlib.pyplot as plt

my_image = np.zeros(shape=(400, 400))
rr, cc = ski.draw.ellipse_perimeter(150, 150, r_radius=45, c_radius=30, shape=my_image.shape)
my_image[rr, cc] = 1

rr, cc = ski.draw.line(50, 220, 300, 220)
my_image[rr, cc] = 1

rr, cc = ski.draw.line(60, 100, 60, 300)
my_image[rr, cc] = 1

plt.imshow(my_image, 'gray')
plt.show()

H = np.array([[1, -0.5, 100],
                   [0.15, 0.6, 50],
                   [0.0005, 0.0007, 1]])

proj = ski.transform.ProjectiveTransform(matrix=H)
proj_image = ski.transform.warp(my_image, proj.inverse, output_shape=my_image.shape)

plt.imshow(proj_image, 'gray')
plt.show()

enter image description here

enter image description here

Instead of pair of points I have the parameterization of the ellipse on the 2 images and the parameterization of the 2 lines on both images.

How can I estimate the homography from the data?

I couldn't find any model for abstract objects like lines and ellipses to estimate homography.
No function on opencv or scikit-image.

3
  • nobody seriously wants to deal with that situation. you've gotta have points on corners, not "points on a line". if you don't, the formulation of the equation has to take into account that your data only has one dimension pinned down (lines), not both (corners). if you guess random points on your lines, it might still be solvable iteratively but that strikes me as a hack. Commented Oct 20, 2023 at 19:15
  • @ChristophRackwitz, I could get the intersection. Though I think it can be solvable by the parameters of the ellipse. Commented Oct 21, 2023 at 6:05
  • if you assume that the ellipse-looking object in the projection is a proper circle in space, then you could calculate its projected center (not the center of the ellipse). that's extra work. I think most people would instead take the time to figure out the equation that allows points to slip, at least linearly. it's a more general solution than just dealing with ellipses. yes, it requires that you ditch existing "match points to points" APIs and reimplement that magic using linear algebra primitives (possibly a least squares solver). Commented Oct 21, 2023 at 10:04

0

Your Answer

By clicking โ€œPost Your Answerโ€, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.