# How to precisely calculate circularity of objects

Hello together,

I'm currently working with Knime to analyse images. I want to calculate the circularityof objects. I therefore started with self-drawn circles (see attached photos).

First I let KNIME find the circles in the photos and then it should calculate the circularity of these detected circles. Somehow, the circularity of perfect circles is always at 0.9. I came to the conclusion, that the calculated circularity is not the circularity of the circles but of the rectangles (in this case squares). Is there some other way to get the true circularity of the circles?

Best regards,

Björn

Hi Björn,

can you use the `Connected Component Analysis` after the bitmask and then calculate the circularity on the detect connected component (=ROI)? Image Segment Features node should help in this case.

I also want to point you on https://www.knime.org/nodeguide (Community Folder) where you can find tons of example workflows. Furthermore, on knime.imagej.net you find a lot of material to get started with KNIME Image Processing (e.g. a tutorial paper and more).

Let me know if you have any further questions,

Christian

Hey Christian,

thanks for your reply. Unfortunately this didn't work for me, because during the working routine the image is transformed into a labelling and these cannot be used as an input for the Image Segment Features node.

However, I came upon another way to (maybe?) solve the problem: Using the Feature Calculator (Beta) node, I found the feature set (Geometric Features 2D). Here I can select different features to calculate like size, circularity etc. The value for the circularity is however still wrong. Knime is somehow not able to create a "round" bitmask. After applying the Connected Component Analysis node I still had squares as bitmask (see attached image) and therefore the circularity was wrong. In the Feature Calculator (Beta) node I selected roundness as feature and here Knime seems to calculate correct values, because with 0.99 these are close to the expected (true) value of 1.00 for perfect circles.

Could someone explain me, what the difference between roundness and circularity is and if this is actually a solution the my question? :-)

Best regards,

Björn

Hi Björn,

there are many things to consider here:

1. your input image is a jpeg image, therefore you might see some compression artefacts.

2. If you heavily zoom into a image with a circle you will always see "rectangles". If you zoom in deep enough, you will see the pixels, which look like little rectangles (however, see http://www.cs.princeton.edu/courses/archive/spr05/cos426/papers/smith95b.pdf ;-)). This means, you can only approximate the real circle in the case of pixel images.

3. Use the `Segment Feature` node instead of the `Image Segment Feature Node`. check out the tutorials in the links I provided. a lot of very general concepts are explained there in all detail.

I hope this helps,

Christian