Pascal_Kelm

Answer Pablo 2nd

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