【问题标题】:C# aforge color detectionC# aforge 颜色检测
【发布时间】:2013-05-06 07:49:26
【问题描述】:

我正在努力学习 Aforge.net。我写了代码,它工作正常,但我想在我的图像上检测到紫色,但我不知道它是怎么回事。所以任何人都可以帮助我吗? 这是我的代码

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;

还有我的源图片

经过我的过滤后就是这个

那么在这张图片中,我可以做些什么来选择没有其他东西的紫色数字或只选择紫色的东西?

【问题讨论】:

    标签: c# image-processing colors bitmap


    【解决方案1】:

    我建议你使用 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:

     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 个斑点

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-01
      • 2012-05-21
      • 1970-01-01
      • 2021-08-17
      • 1970-01-01
      • 1970-01-01
      • 2012-08-31
      • 2011-11-22
      相关资源
      最近更新 更多