5

Background:

We are planning to use cameras on a conveyor system to count objects. In this specific case, we can't use sensors. All of my objects are pretty consistent, and will be easy to detect if they are present in the picture. I have been looking at Aforge and some other libraries, and it seems easy enough. This is what I want to do.

That being said, I do have some concerns. The filtering process, you have to specify a color you are searching for. My object is a solid color, but we all know there could be 100+ different rgb values on the specific point im looking at.

Is there some way to search a range of colors, or to see if a color is "like" a specific color?

This is my first go at any sort of image processing. I haven't tried anything yet, just about to get started and this was a concern before I even got started.

Any help would be greatly appreciated.

CSharpDev
  • 869
  • 1
  • 13
  • 22
  • 3
    In the first code example in the link that's what the `radius` is. Imagine the RGB colour space as a cube. The link is filtering colours that fall within a sphere in that cube defined by the centre and radius. – George Duckett Aug 30 '12 at 13:45
  • Are the objects indoors in a constant even environment? Nice link by the way. – Jodrell Aug 30 '12 at 13:46
  • @GeorgeDuckett yes I'm doing more reading now and starting to understand it more. So to me, it looks like I can accomplish what I want with this. – CSharpDev Aug 30 '12 at 13:51
  • @Jodrell yes, indoors constant environment. Stuff sitting on shafts running down a conveyor – CSharpDev Aug 30 '12 at 13:52
  • Regarding your answer to @Jodrell's comment, in that case you might be able to compare the differences between an image with no object and the one you're testing. Just be careful of other shadows / brightness changes etc. – George Duckett Aug 30 '12 at 13:58
  • @GeorgeDuckett Yes, I will probably do that. I was really just looking for a starting point. I have no clue what I'm doing right now so hopefully it won't be a steep learning curve. I just gotta get the library out and start playing with it – CSharpDev Aug 30 '12 at 14:00

1 Answers1

2

Instead of using the RGB color model, you can use the HSL one (Hue Saturation Light) where you can ignore the saturation and light and only check the hue parameter:

http://en.wikipedia.org/wiki/HSL_and_HSV

Here is a way to do it using c# (thanks to how to change rgb color to hsv) :

System.Drawing.Color color = System.Drawing.Color.FromArgb(red, green, blue);
float hue = color.GetHue();
float saturation = color.GetSaturation();
float lightness = color.GetBrightness();
Community
  • 1
  • 1
YohannP
  • 309
  • 1
  • 3