Help locate trunk of a tree

Hi,

i got assigned a project to determine the health of some trees.
The idea is to cut out the exact same square in every picture to evaluate which one is better growing.
The problem is, we need the x-coordinates of the trees (they don’t have to be very precise) and i simply don’t get a solution.

I’m very new to Python and OpenCV, so I would be very happy if someone of you has got an idea to solve this problem.

Thank you.

that’s best done with AI.

have a network for semantic segmentation. it’ll paint the trunks for you. then you can decide what to do with such a mask.

you could try one of those “segment anything” models that are super powerful.

if that’s too computationally expensive, but it works, then you can use it to generate training data, then train a cheaper network.

manually annotating such data seems simple enough. just have a bunch of pictures, best if they’re varied (lighting, time of day, time of year, different plant types, different level of weed growth…), then get someone to look at the pictures and paint on the tree trunks with an annotation tool. it’s just one broad brush stroke per trunk, more or less.

I painted these trunks in a photo editor. took me a minute. anyone with practice (and a tablet) could do that a lot faster.

mask:

composite/illustration: