【发布时间】:2014-05-14 09:22:57
【问题描述】:
使用此代码,我可以制作黑白图片。但是我怎样才能把图片中的数字变成标签呢?
Bitmap BMP = new Bitmap("H:\\pelak.jpg");
Color col;
//int r, g, b, rgb;
byte blue, green, red;
for (int i = 0; i < Int32.Parse(BMP.Width.ToString()); i++)
{
for (int j = 0; j < Int32.Parse(BMP.Height.ToString()); j++)
{
col = BMP.GetPixel(i, j);
blue = col.B;
green = col.G;
red = col.R;
if (red < 128)
{
BMP.SetPixel(i, j, Color.FromArgb(0, 0, 0));
}
if (red >= 128)
{
BMP.SetPixel(i, j, Color.FromArgb(255, 255, 255));
}
}
}
pictureBox2.Image = BMP;
【问题讨论】:
-
图片中的数字?还是处理的图片总数?
-
你想从图片中获得哪些数字???
-
为什么是
int.Parse(int.ToString())? -
您在寻找 OCR 库吗?更精确地定义数字,如果它在图片内,请添加示例图片。此外,避免在宽度和高度上使用 .ToString/Parse。如果它不是正确的类型,您可以一步转换它。
-
我想要车牌...