High Speed Candy Sorting Machine

Hello everyone,

I’m starting a project for the 2016 Hackaday prize. It’s a candy sorting machine for which I plan to use OpenMV to detect the color of candy at high speed.

More info here: High Speed Candy Sorting Machine | Hackaday.io

Give it a like, that would help :slight_smile:

I’ll try to keep you updated.

Great idea,

So, make sure to use a DIFFUSED lighting source to illuminate the candy. Then, the camera shouldn’t have a problem seeing anything.

Also, make sure candies are very different colors.Red and Orange for example are too similar for a camera to easily distinguish.

If you’re working on the camera side right now… note that we don’t have AWB and AGC controls yet (coming soon). So, when you need to fix the cameras color gain levels let me know and I’ll give you the register settings that you have to use to turn those off and on.

As for the color tracking itself. The threshold() and find_blobs() functions can be used to do what you want. However, I’ve yet to get to them and review the code on those. Right now, threshold() thresholds via a color center pointer and then you give it a numerical distance to allows colors to deviate from. This method… doesn’t work that great for color since colored objects have very skewed color distributions. The binary() function on the other hand takes a list of upper and lower thresholds right now. With binary you can easily segment the image. Additionally, I put a feature into the GUI which makes find the color thresholds easy. Simple click and drag on an area of color in the IDE and click “copy color” and the IDE will compute good threshold starting points for you. (This feature didn’t make it into the recent release, need to work from the repo to get this).

After the image has been binaried you can use the centroid function to get the location of the color blob in the image. For multiple color tracking find_blobs() needs to be used. So, you’ll have to wait for that feature which will be in the final firmware release for the KickStarter.

Thanks for the advice!