我是Aforge.net的新手。
我已使用Aforge.Net过滤并使用YCbCr过滤器进行图像
YCbCrFilter.Y = new Range(0, 1);
YCbCrFilter.Cb = new Range(-0.1862745098039216f, 0.0294117647058824f);
YCbCrFilter.Cr = new Range(0.0137254901960784f, 0.2254901960784314f);
// apply the filter
var YCbCrFilteredImage = YCbCrFilter.Apply(bitmap);
我需要将生成的图像(即YCbCrFilteredImage
)转换为Grayscale
图像,然后将其转换为黑白图像。
那么我怎样才能转换成灰度呢?
答案 0 :(得分:0)
Salam Ruba,使用此灰度值Grayscale(0.2125,0.7154,0.0721)并且对于阈值处理BradleyLocalThresholding是此库中最好的。也许你想使用HSL Filtering而不是YCbCrFilter,这里是你的代码
YCbCrFiltering YCbCrFilter = new YCbCrFiltering();
YCbCrFilter.Y = new Range(0, 1);
YCbCrFilter.Cb = new Range(-0.1862745098039216f, 0.0294117647058824f);
YCbCrFilter.Cr = new Range(0.0137254901960784f, 0.2254901960784314f);
// apply the filter
var YCbCrFilteredImage = YCbCrFilter.Apply(bitmap);
Grayscale gfilter = new Grayscale(0.2125, 0.7154, 0.0721);
YCbCrFilteredImage = gfilter.Apply(YCbCrFilteredImage);
BradleyLocalThresholding thfilter = new BradleyLocalThresholding();
thfilter.ApplyInPlace(YCbCrFilteredImage);
你现在可以搜索blob;)