2
$\begingroup$

I want to, as part of a C++ school project (no OpenCV), work with an RGB image taken from a camera filming smarties (round colored pellets) from above and extract the number of candies in each color.

Is converting the (reasonably lit and clear) image to HSV sufficient to perform edge detection (with Sobel on the V channel) and color identification (with H and S), following noise removal and possibly histogram (or other kinds of) equalization? Or should I stick with RGB color space and do more thorough filtering in order to properly isolate the same color of differently lit smarties.

Hope this makes sense, thank you for your time

$\endgroup$
  • 1
    $\begingroup$ For a traditional vision app like this, check out the textbook Machine Vision by Davies. Yes, try to solve the problem yourself, but then see how Davies approaches it. The book covers applications rather than just theory and algorithms. $\endgroup$ – Rethunk Feb 23 at 14:18
  • 1
    $\begingroup$ thats exactly what I need, thank you for this $\endgroup$ – AudyCed Feb 23 at 19:07
1
$\begingroup$

The approach seems reasonable.
Indeed doing edge detection in weighted RGB channel is the classic approach (Though you could also employ more advance methods, See Edge Detection on a Color Image).

I think you could achieve great results if you also look specifically for oval shapes then you reduce the chances for false positives.

Color identification in the H and S channels will give most information (Well, up to differences in luminosity of the color).

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you Royi for your answer! My intention is to, after finding the edges, run a circle shape of precalibrated size (based on the logic size of the candy on the screen) on every pixel, and produce a "heatmap" of correlation between the shape and the edges(and so an oval would score reasonably well). The local maxes I find will be my smarties, if all goes well, and maybe I can use another cutoff value to identify anomalies, such as broken bits or smarties half out of the picture. $\endgroup$ – AudyCed Feb 20 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.