Hello,

I am working in an automatical fungi spores measurements program. I detect the spores contours with instance segmentation and calculate length and width with opencv functions. But some spores are curved and I have no idea of what to do with them. An idea please ?

Thank you !

Best regards

Example of curved spore : https://www.facebook.com/photo?fbid=1553958058292162&set=pcb.5092998937382944

I couldnâ€™t see the photo. Can you paste it here?

If you have contours, you can classify them through moments and Hu invariants.

https://docs.opencv.org/master/d0/d49/tutorial_moments.html

yes but with the moments I canâ€™t measure the length and width of the spore, the length is the maximum length along the middle of the spore and the width is the minimum length of the spore

you can use moments to estimate the angle of the major axis, then calculate the length along that axis (either project onto axis, or rotate)

You can classify contours with their moments.

You can also get the contour center, orientation and eccentricity.

About width, length and middle of the spore, I donâ€™t think there is a function to measure that, but you can measure them over a contour providing you can come with a geometric definition of those elements.

Letâ€™s say you can define and calculate the so called middle point of a spore: you can traverse all contour points and get the closest and farthest ones, those with min or max distance to that point.

thank you but I suck at mathematics and donâ€™t understand concepts of moments, orientation and eccentricity.

OK, donâ€™t worry about them.

You can try using **thinning** on each spore, so it produce a curved line representing the length of a curved spore.

The following post is about thinning:

Ok thank you, question resolved