C # Determine if an object is present in the image

Background:

We plan to use cameras on a conveyor system to count objects. In this particular case, we cannot use sensors. All my objects are pretty consistent, and it will be easy to detect if they are present in the picture. I looked at Athens and some other libraries, and it seems simple enough. This is what I want to do.

Having said that, I have some problems. In the filtering process, you need to specify the color you are looking for. My goal is solid color, but we all know that there can be more than 100 different rgb values ​​for a particular point that he is looking at.

Is there a way to search a range of colors or to see if a color is “like” a particular color?

This is my first approach to image processing of any type. I haven’t tried anything yet, I’m about to start, and that was a problem before I even started.

Any help would be greatly appreciated.

+5
source share
1 answer

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

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

Here's how to do it using C # (thanks to how to change the 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();
+2
source

All Articles