differentiating between cotton and plant

I need to differentiate between the colour of the cotton in the plant and sun light on leaf that also observed by cam as white colour. Please help me to differentiate between the actual cotton white and light reflected by the plant’s leaves.

Thanks in advance

Hi, please got to our FIle → Examples → Color Tracking. Click on the single color tracking RGB565 script. And then open the threshold editor under Tools → Machine Vision → Threshold Editor.


Thank you.
I have done that and taken threshold values from frame buffer. The cam shows both the cotton and leaf as detected white blob. Will the polarizing filter helps us in order to make the leaf appear green by filtering the solar light??
Kindly reply asap.
Thanks again


Kindly see the images in which both cotton and leaves are detected as same in sunlight.

Ah, I see. Okay, go to the sensor examples and lower your exposure drastically. This will increase the color saturation. Finally, call img.compress(quality=90) at the end of your main loop to improve video streaming to the IDE.

i had tried by reducing the exposure,but of no use. If i reduce the exposure, the screen of ide gets darker,since the plant is not green in ide.what may be the problem?

which lens is best suited for my application??

Hmm, um, how many different exposure values did you try? Note that the scene at which you’re pointing the camera isn’t particularly suited for vision to have an easy job doing color tracking on. For example, you have way too much going on in the image and you’re pointing the camera into the sky.

In this situation there are too many variables and things aren’t going to work well. Can you constrain the problem in any way?

Also, note that it’s impossible to really ever select one colored object given thresholds. You will get noise, so, given that you’re going to want to do filtering on the objects to reduce the noise to make them easier to track. Like, for example, in one of your pictures you’ve clearly selected the cotton blobs. Given you’d done that the thing to do now would be to toss all blobs with less than a certain number of pixels and area.

Thanks for the reply.
As i tried by changing the exposure value of different values such as 1000,2000 upto 10000 in another area(on roof of a building). check the images. And i made the test in evening when sun is not much brighter. So, i could find the white coloured blobs(cotton). And the green coloured objects such as trees and leafs are not detected as white blob. If there is any option to find the object by automatically changing the exposure using the program to detect the cotton every time? what about the machine learning in the example?

And after that we have used a polariser lens of camera. As it too filters the light. The sky made into somewhat dark with polariser lens. Will this help everytime?

Hi, if you’re outside you’re going to need to constantly change the exposure in regards to the lighting. I’d focus on making a freedback loop that keeps the colors of the image within the bounds you want given whatever is seen. You can do this buy calling get_stats() and then adjusting the exposure based on that what returns.

For exposure control,is only the L-max and L-min enough??
Thank you

See this: http://docs.openmv.io/library/omv.sensor.html?highlight=exposure#sensor.sensor.set_auto_exposure

Also, there are example scripts with the IDE under sensor control.