C# aforge 颜色检测

标签 c# image-processing colors bitmap

我正在尝试学习 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;

这是我的源图像

经过我的过滤后是这样的

那么我该怎么做才能在这张图片中只选择紫色数字而不选择其他东西或只选择紫色东西呢?

最佳答案

我建议您使用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 个 Blob

关于C# aforge 颜色检测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16502384/

相关文章:

Python/PyGame : Find pixel by colorcode

javascript - 计算具有 2 种颜色和百分比/位置的颜色 HEX

java - 打印 ANSI 颜色消息后设置用户输入文本的颜色?

c# - PDF 证书过期后的数字签名验证

c# - 根据年份在 View 中呈现不同的表格

c# - GDAX/Coinbase API Level3 订单簿 - 跳过消息

c# - 用文本框中的数字填充字典并将文本框作为键

python - 如何使用 python 从图像中去除边界边缘噪声?

python - 使用 Opencv 从 python 中的图片中删除小边缘

java - 如何在 java 中旋转缩放图像(使用 opencv)?