Close

Computer vision is not easy

A project log for High Speed Candy Sorting Machine

Sorting candy by color, as fast as possible

fabien-chouteauFabien-Chouteau 06/26/2016 at 20:442 Comments

It's been a little while since my last update. My attention was drawn by a project at work but now that it's launched I can focus on the High Speed Candy Sorting Machine.

First things first, the High Speed Candy Sorting Machine was selected for the Hackaday Prize 2016 final round!!! This is amazing! Thanks for the support, this will give me the extra motivation to finish this project on time.

Computer vision

I've started to work on computer vision using the OpenMV board. Of course, my firmware will be in Ada. You can have a look at the sources here and here.

To implement color detection, I compare all the pixels from the camera snapshot with a set of reference colors. Each of the reference colors matches the color of a candy. For each pixel I need to compute a distance between the reference color and the color of that pixel. The classic RGB format is very bad for computing distance between two colors, so I translate the RGB values to the LAB color space. It is then trivial to get the distance between two LAB values. Using this distance value, I can tell to which reference color the current pixel is the closest.

To speed up the process, I pre-calculate every RGB565 to LAB inside conversion table during initialization. With this table, converting from RGB to LAB is blazing fast.

For the moment I use the QQVGA2 resolution (128, 160). It's not a lot of pixels,but it's maybe already too much. I don't need a fine resolution to detect colors of candies that will be very close to the lens and having less pixels means faster image processing.

Laser cut frame

Last week-end, I ordered laser cut acrylic parts from a German website, formulor.de.

I didn't know this website, but it looks like it's the only online laser cutting service in Europe.

You can find the designs (3D and SVG) in the project repository: here

Discussions

Laurent GUERBY wrote 07/17/2016 at 21:20 point

For laser cutting may be http://damengo.com/ (in Toulouse, France)

  Are you sure? yes | no

Fabien-Chouteau wrote 07/18/2016 at 08:31 point

Thanks, I will have a look!

  Are you sure? yes | no