Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UnmanagedImage img = UnmanagedImage.FromManagedImage(AForge.Imaging.Image.FromFile(@"C:\Users\admin\Pictures\img008.jpg"));
- ImageStatistics stat = new ImageStatistics(img);
- AForge.Math.Histogram hist = stat.Gray; //or .GrayWithoutBlack, .Blue, .Green, .Red
- int[] histBins = hist.Values;
- int pixelCount = 0;
- for (int i = 5; i < 128; i++)
- pixelCount += histBins[i];
- Console.WriteLine("numbers of pixels in the gray range: " + pixelCount);
Advertisement
Add Comment
Please, Sign In to add comment