quad16
quad16

Reputation: 204

Defining a 3D scene from a photo of a circle

Given a photo containing a circle, for example this photo of a fountain: photo of a fountain

is it possible to define the 3D position and rotation of the fountain in relation to the camera?

I realise we have to define the scale, so lets say the fountain is 2m wide (the diameter of the circle consisting of the inner rim of the fountain is 2m).

So assuming the circle is a perfect circle, and defining the diameter to 2m, is it possible to determine how the circle and the camera relate spatially? I dont know any camera matrix or anything, the only information i have is the picture.

I specifically want to determine the 3D coordinates of a given pixel on the rim of the fountain.

What would be the math and/or OpenCV code to do this?

Upvotes: 4

Views: 314

Answers (1)

Humam Helfawi
Humam Helfawi

Reputation: 20294

Circle with perspective is an ellipse. So you basicly you need an ellipse detector. This algorithm should work:

  1. Detect all ellipses in the given image.
  2. Filter ellipses that you think they are not a circles in origin. (This is not possible using just 1 Camera so you have to depend on previous knowledge. Something like that you knows that you are taking a photo for a circle).
  3. mmm I stopped typing here and bring a paper&pen and started figuring how to estimate the Homography and it is not that easy! you should deal with the circle a special case of an ellipse and then try to construct a linear system of equations. However, I made quick googling :

https://www.researchgate.net/publication/265212988_Homography_estimation_using_one_ellipse_correspondence_and_minimal_additional_information

http://www.macs.hw.ac.uk/bmvc2006/papers/306.pdf

Seems very interesting topic, I am going to spare sometimes on it later!

Upvotes: 3

Related Questions