I know that you can easily compute the center of mass, and area of a contour using the moment of the contours. Is there a quick way to compute the curvature of a contour with opencv in python?
Thanks
In OpenCV,
a contour is a Numpy array of (x,y) coordinates of boundary points of the object.
A method for computing the curvature is described for example in:
They have a contour composed by 400 points (they call them boundary points) and:
At each boundary point, we calculate the boundary curvature by fitting a circle to that boundary point and the two points that are 10 boundary points away from it. The magnitude of the boundary curvature is then defined as the reciprocal of the radius of that circle.
See also this video from the above paper.
I am not familiar with Python and so I cannot suggest you a function for circle interpolation; anyway in order to fit a circle to three points you can follow the formulae from (25) to (34) from Weisstein, Eric W. "Circle." From MathWorld--A Wolfram Web Resource.
Taken from https://math.stackexchange.com/a/1215914/10799
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With