Курсовая работа: Распознавание графических символов
{
Color cl = ((Bitmap)inImg).GetPixel(i,j);
int gray = (cl.R + cl.G + cl.B) / 3;
if (gray > sredn)
outImg.SetPixel(i, j, Color.FromArgb(255, 255, 255));
else
outImg.SetPixel(i, j, Color.FromArgb(0, 0, 0));
}
}
return outImg;
}
/// <summary>
/// Инверсия цвета битмапа
/// </summary>
/// <param name="b"></param>
/// <returns></returns>
public static Bitmap InverseBitmap(Bitmap b)
{
Bitmap outImg = new Bitmap(b.Width, b.Height);
for (int i = 0; i < b.Width; i++)
{
for (int j = 0; j < b.Height; j++)
{
Color c = b.GetPixel(i,j);
outImg.SetPixel(i, j, Color.FromArgb(255 - c.R, 255 - c.G, 255 - c.B));
}
}
return outImg;
}