I need to group the region in green and get its coordinates, like this output image. How to do this in python?
Please see the attached images for better clarity
I need to group the region in green and get its coordinates, like this output image. How to do this in python?
Please see the attached images for better clarity
At first, split
the green channel of the image, put a threshold
on that and have a binary image. This binary image contains the objects of the green area. Start dilating
the image with the suitable kernel, this would make adjacent objects stick to each other and become to one big object. Then use findcontour
to take the sizes of all objects, then hold the biggest object and remove the others, this image would be your mask. Now you can reconstruct
the original image (green channel only) with this mask and fit a box to the remained objects.
You can easily find the code each part.