2013-05-11 181 views
1

我想學習Aforge.net。我寫o代碼,它工作正常,但我想檢測我的形象只是紫色,但我無法找到它是如何。所以任何人都可以幫助我呢? 這裏是我的代碼C#aforge顏色檢測

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; 

,並有我的源圖像

我的過濾器後,它是這個

所以我能做些什麼來隨便挑紫色的數字沒有其他的東西或只是紫色的東西在這張照片?

回答

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 

顏色過濾步驟中,您可以在斑點過濾步驟進行之後。

過濾器,每個斑點:

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只斑點更