i have a list of integer in which i m storing RGB values of an image but after storing the sum of the values in integer then it become negative while all the values in array is positive nd this is the code!
Bitmap bi = new Bitmap(@"E:\Store Signature Data\01\01_1.bmp");
bi = ResizeImage(bi, 20, 20);
Color[,] imgary = new Color[bi.Width, bi.Height];
for (int x = 0; x < bi.Width; x++)
{
for (int y = 0; y < bi.Height; y++)
{
imgary[x, y] = bi.GetPixel(x, y);
}
}
List<int> RGB = new List<int>();
int c = 0;
//RGB value= Red + (Green*256) + (Blue*256*256)
for (int i = 0; i <20; i++)
{
for (int a = 0; a < 20; a++)
{
c++;
Console.WriteLine(imgary[i,a]+" "+c);
Color Pixels = imgary[i, a];
int Red = Pixels.R;
int Blue = Pixels.B;
int Green = Pixels.G;
RGB.Add(Red + (Green * 256) + (Blue * 256 * 256));
}
}
int total = 0;
for (int i = 0; i < RGB.Count; i++)
{
total += Math.Abs(RGB[i]);
}
Math.Abs(total);
Console.WriteLine(total);