# How to determine the axis of a prolonged object?

The angle of the line is of primary interest. I know an algorithm for ellipse (will post it here as answer later), but would like to find out what is popular for an arbitrary shape. Fast methods are preferable for work with video input.

https://docs.opencv.org/master/d1/dee...

also: https://docs.opencv.org/master/db/dd6...

Yes, this is classics. It is based on the method of least squares. Only I guess it will be not very fast? By the way, do you know how modern math processors work? In the past, floating point arithmetic was substantially slower than integer numbers. Now I tested and the speed is the same.

I'm sorry... are you looking for the line and the angle, or just the angle?