Reputation: 45
I am trying to learn Aforge.net. I write o code and it works fine but ı wanna detect just purple color on my image but ı could not find out how it is. so any one can help me about it? here is my code
Bitmap resim = new Bitmap(pictureBox1.Image);
EuclideanColorFiltering filter = new EuclideanColorFiltering();
// set center color and radius
filter.CenterColor = new RGB(80,90,120);
filter.Radius = 40;
// apply the filter
filter.ApplyInPlace(resim);
pictureBox1.Image = resim;
and there is my source image
After my filter it is this
So what can ı do to pick just purple numbers without other thing oor just purple things in this picture?
Upvotes: 2
Views: 5837
Reputation: 933
I suggest you to use a HSLFilter, for a better color filtering
HSLFiltering filter = new HSLFiltering();
filter.Saturation = new Range(0.05f, 1f);
filter.Luminance = new Range(0.05f, 0.70f);
filter.Hue = new IntRange(280, 340); //these settings should works, if not
Bitmap red = filter.Apply(image); //search "HSL color picker online" to tune it
After the color filtering step you may proceed at the blob filtering step.
Filter each blob that:
1. Have a Width more than 20%(example) of the Image.Width (for the height too)
2. Have a too much/too poor fullness (blob.fullness)
3. Have a not good ratio Width/Height
Finally you should have only the numbers or at least only 1-2 blobs more
Upvotes: 2