Identify and count vegetables

OpenMV related project discussion.
leo9872
Posts: 3
Joined: Thu Sep 27, 2018 3:45 pm

Identify and count vegetables

Postby leo9872 » Thu Sep 27, 2018 3:50 pm

Is it possible to use the OpenMV cam to identify and count the number of vegetables in my hydroponic garden? Maybe even determine if a tomato is ripe or not? I'm new to this (machine vision, not micro-controllers and programming), so if it is possible, and you can point me in a direction to get started, it is greatly appreciated.
User avatar
kwagyeman
Posts: 2286
Joined: Sun May 24, 2015 2:10 pm

Re: Identify and count vegetables

Postby kwagyeman » Fri Sep 28, 2018 1:16 pm

Hi, you need to specify exactly how you plan to do he counting. If it's via color we can do that as long as there's contrast between the foregorund object and the background object.
Nyamekye,
leo9872
Posts: 3
Joined: Thu Sep 27, 2018 3:45 pm

Re: Identify and count vegetables

Postby leo9872 » Fri Sep 28, 2018 3:28 pm

I'm thinking by color, for tomatoes cucumbers and peppers. I am assuming that it can differentiate the objects, based on shape, and I would have to provide it with images of each group (tomatoes, peppers, and cucumbers), and then in those groups, divided groups by ripeness( so for tomatoes I would have two more separate groups of green tomatoes (unripe) and red tomatoes (ripe)). I just need an idea on how to get started coding that.
User avatar
kwagyeman
Posts: 2286
Joined: Sun May 24, 2015 2:10 pm

Re: Identify and count vegetables

Postby kwagyeman » Sat Sep 29, 2018 5:08 pm

Okay, start with the color tracking examples built into OpenMV IDE under File->Examples. You should also loo into the sensor control examples which let you control the sensor exposure and whatnot. These help greatly. Anyway, to do color tracking well you can do do this...

Assuming you 100% control the lighting of your garden (if it's indoors). Then you can do everything via color tracking. First, you just need to determine the color of the soil. You can use the Threshold Editor in OpenMV IDE to do this (see tools -> machine vision). Once you have the color of the soil you can find_blobs() with the invert flag set to True to find all colors that aren't the color of the soil. This will give you blobs that represent each plant. You can then pass options to find_blobs() to merge blobs and whatnot. Anyway, after doing this you can then proceed to look at the color within each blob using get_stats(). This will then return the color distribution for each blob. Note that you want to use a loop over the objects returned by find_blobs() and call get_stats() with the roi argument on each blob returned by find_blobs().

Anyway, for color tracking getting the lighting stable will be your enemy. Focus on that carefully.
Nyamekye,
leo9872
Posts: 3
Joined: Thu Sep 27, 2018 3:45 pm

Re: Identify and count vegetables

Postby leo9872 » Sat Sep 29, 2018 7:55 pm

I've been doing a little research, and I am finding that the pi-Cam is more suited for this task, because of its higher resolution, and an existing library that I can use, based around object recognition. However, I do have a hexapod project that I can see the OpenMv Cam being very applicable in. Thanks for the help.
User avatar
kwagyeman
Posts: 2286
Joined: Sun May 24, 2015 2:10 pm

Re: Identify and count vegetables

Postby kwagyeman » Sat Sep 29, 2018 9:56 pm

Cool. Good luck.
Nyamekye,

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest