| |
/* Hello Word!
strona ta
poświęcona jest: -
segmentacji zdjęć na obszary -
programowaniu
*/ |
| |
int[] ArrayRGB =
new int[256];
public void
DoHistogram()
{
DoArrayRGB();
// get the biggest value
int max = ArrayRGB[0];
for (int x
= 0; x < 256; x ++)
{
if (ArrayRGB[x] > max)
max = ArrayRGB[x];
}
//int maxRGB = 0;
for (int i
= 0; i < 255; i++)
{
// do scale of colors
bitmap.SetPixel(i, BitmapHeight - 7, Color.FromArgb(i, i, i));
bitmap.SetPixel(i, BitmapHeight - 6, Color.FromArgb(i, i, i));
bitmap.SetPixel(i, BitmapHeight - 5, Color.FromArgb(i, i, i));
bitmap.SetPixel(i, BitmapHeight - 4, Color.FromArgb(i, i, i));
bitmap.SetPixel(i, BitmapHeight - 3, Color.FromArgb(i, i, i));
bitmap.SetPixel(i, BitmapHeight - 2, Color.FromArgb(i, i, i));
bitmap.SetPixel(i, BitmapHeight - 1, Color.FromArgb(i, i, i));
//if (maxR == ArrayRGB[i].Red)
//{
// maxRGB = i;
//}
// percent calculate
int procent = ArrayRGB[i] * 100 / max;
for (int j
= 0; j <= procent; j++)
{
bitmap.SetPixel(i, 100 - j, Color.Black);
}
}
} |
| |
| |
|
|
|