Advertisement
ozakisama

C# IMAPRO GetHistogram Values

Dec 11th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. public long[] GetHistogram(Bitmap picture)
  2.         {
  3.             long[] myHistogram = new long[256];
  4.  
  5.             for (int i = 0; i < picture.Size.Width; i++)
  6.             {
  7.                 for (int j = 0; j < picture.Size.Height; j++)
  8.                 {
  9.                     Color c = picture.GetPixel(i, j);
  10.  
  11.                     long Temp = 0;
  12.                     Temp += c.R;
  13.                     Temp += c.G;
  14.                     Temp += c.B;
  15.  
  16.                     Temp = (int)Temp / 3;
  17.                     myHistogram[Temp]++;
  18.                 }
  19.             }
  20.             return myHistogram;
  21.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement