Ask Your Question

Has OpenCV built-in functions to calculate circularity, compactness etc for contours/blobs?

asked 2014-11-30 00:05:17 -0500

huehuehue gravatar image

Compactness can be defined for example as the perimeter squared, divided by 4piarea, so that a circle has a compactness of 1.

Before writing my own function, Is there a similar function in the OpenCV Library ?


Ps : SimpleBlobDetector does not help me as I want to calculate circularity for existing prior extracted contours.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-11-30 13:52:42 -0500

There are the different (Hu-)moments:

You could easily compute your compactness via cv::arcLength (perimeter) and cv::contourArea

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-11-30 00:05:17 -0500

Seen: 7,080 times

Last updated: Nov 30 '14