C#A大颜色检测
我正在努力学习一门外语。我写了o代码,它工作得很好,但ı只想检测我图像上的紫色,但ı无法发现它是如何工作的。有人能帮我吗? 这是我的密码C#A大颜色检测,c#,image-processing,colors,bitmap,C#,Image Processing,Colors,Bitmap,我正在努力学习一门外语。我写了o代码,它工作得很好,但ı只想检测我图像上的紫色,但ı无法发现它是如何工作的。有人能帮我吗? 这是我的密码 Bitmap resim = new Bitmap(pictureBox1.Image); EuclideanColorFiltering filter = new EuclideanColorFiltering(); // set center color and radius filter.CenterColor = new RGB(80,90,120)
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;
这是我的原始图像
在我的过滤器之后是这个
那么,在这张图片中,你能做些什么来选择紫色的数字而不选择其他东西,或者只选择紫色的东西呢?我建议你使用HSLFilter,以获得更好的颜色过滤效果
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
在颜色过滤步骤之后,您可以继续执行blob过滤步骤
过滤以下每个blob:
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
最后,您应该只有数字或至少只有1-2个斑点