0

For a project, I need to store circles detected on some photos. The problem is that some of these photos are taken from an angle, meaning the circles are ellipses. Is it possible to somehow turn the ellipses into circles?

I thought of rectifying the ellipse, then transforming the rectangle to a square. Indeterminate problem comes to my mind, meaning there are too many possible variations for my approach, and the results are different for each approach.

Stepan Filonov
  • 324
  • 1
  • 11
  • 2
    Show us the pictures, otherwise any answer can be meaningless. And "storing circles" has little meaning. Is it just keeping center/radius ?? –  Dec 27 '18 at 13:27
  • perspective projected circle is not an ellipse !!! rather ellipse-like shape ... after un-projection you will obtain circle again but for that you need to know the perspective matrix (so FOVx,FOVy and focal length of camera used) and the distance of the points ... however you can estimate the plane the circle is on and that is enough to fit circle that fits your shape after projection .... see [Transformation of 3D objects related to vanishing points and horizon line](https://stackoverflow.com/a/53303948/2521214) for some additional ideas – Spektre Dec 30 '18 at 08:34

1 Answers1

0

To find perspective transform, you need to have 4 pairs of corresponding coordinates: points at distorted picture and their ideal positions after correction of perspective.

In this case you can calculate matrix of perspective transform with getPerspectiveTransform function and apply it to correct all the picture. Example

MBo
  • 77,366
  • 5
  • 53
  • 86
  • to find the 4 points in this case, fitEllipse or minAreaRect can be used, but the center of the transformed circle probably isnt the center of the ellipse, so the warped image might not look exactly like the original real circle... – Micka Dec 27 '18 at 09:42