MATLAB: How to remove complex background on a grayscale Image and do Object Detection.

duplicate postimage analysisimage processingImage Processing Toolboximage segmentationleaf

As you can see the Image has a complex background, which I need to remove to find only the leaves of all plants. What procedure would lead me to complete removal of background except plants.
The images are from IR camera which have to be further used to find temperatures on leaves. So it has to be made sure we dont loose leaves while subtracting background.
I have tried to remove background with imopen and then thresholding it after using imadapthisteq but its still not clear. Kindly guide me if you know how to solve this issue.
Thank you

Best Answer

You should attach the image. All I can say now is to use a better background if possible, and use a color camera or a monochrome camera with a filter that can improve the contrast between the subject (green plants) and the background.
Related Question