[英]Converting Ycbcr Image to grayscale with Aforge.net
我是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
圖像,以便稍后將其轉換為黑白圖像。
那么如何進行灰度轉換呢?
Salam Ruba使用此灰度值Grayscale(0.2125,0.7154,0.0721)進行閾值設置,BradleyLocalThresholding是該庫中最好的。 也可能要使用HSL過濾 ,而不是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了;)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.