# The function which returns the angle of curvature of the object Opencv C++

Hello, i'm searching a function in Opencv which returns the angle of a specific object on image from its contour points or points of its related envelope. Exemple: !

Does the image change shape or size? The first step is to use one of the object detectors. If you are generating the shape and it's BW you could use an average of the X and Y of all the black pixels to find it's center and then take the average of x and y for all the black pixels that are in the 4 quadrants from the center to get the rotation.

The object or the image has the same size and for the detection, i used findcontours() and ApproxpolyDP to find the contours points and i got the gravity center

ok... then to get the rotation you can create a weighted filter. or for a crude value you could find the points that are farthest from the center.