Circularity metric

one of my students asked for this small example to compute how circular a shape is, ie a numerical ranking to help identify circles:

thought folks might find it useful. it’s based on:

example is here:

1 Like

It’s interesting that a “perfect” circle only gets a score of 0.9. I wonder if some pre-processing could make it cleaner.
I remember having a class of mathematical morphology that showed how to isolate circles in a b/w image using opening/closing and a circular structuring element. But I guess it all depends on what your use case scenario is :slight_smile:

I think it’s going to be based either on some oddities of the opencv routines “cvContourArea” and “cvArcLength” or on the fact that there is some aliasing happening on the pixel grid. I tried a much larger circle, it just got closer to 0.9…