Ask Your Question
1

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

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

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 ?

Thanks.

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
2

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

There are the different (Hu-)moments:

http://docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=moments#structural-analysis-and-shape-descriptors

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

edit flag offensive delete link more

Question Tools

Stats

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

Seen: 11,561 times

Last updated: Nov 30 '14