c# 图片内容 识别 无干扰

zhangbaiwan 2015-10-15 09:29:35


图片如上

取出数字 即可

之前没有做过这块 高手给个思路 最好给个demo 3q
...全文
662 31 打赏 收藏 转发到动态 举报
写回复
用AI写文章
31 条回复
切换为时间正序
请发表友善的回复…
发表回复
为轮子而生 2015-11-16
  • 打赏
  • 举报
回复
为什么不自己做点阵库? 这样的识别很简单,关键是算法速度优化
czh1012 2015-10-19
  • 打赏
  • 举报
回复
像这种图片,自己来识别会好很多。
qq_32097415 2015-10-17
  • 打赏
  • 举报
回复
召蒹zhi_在家可做,8¤-3¤¤―天,公資 曰,结    手機-電-腦都可以喔。適合學生,寶媽,上班族,無聊在家de 扣2473259249
qq_32085669 2015-10-17
  • 打赏
  • 举报
回复
表示完全看不懂啊
zhangbaiwan 2015-10-16
  • 打赏
  • 举报
回复
这个问题 太难了吗?咋都没有高手呢
zhangbaiwan 2015-10-16
  • 打赏
  • 举报
回复
自己再顶顶看吧
泡泡龙 2015-10-16
  • 打赏
  • 举报
回复
引用 9 楼 zhangbaiwan 的回复:
OCR字库 要怎么做 百度上 没有找到
http://club.excelhome.net/thread-897117-1-1.html
zhouxingyu896 2015-10-16
  • 打赏
  • 举报
回复
http://www.oschina.net/code/snippet_54100_2136
zhouxingyu896 2015-10-16
  • 打赏
  • 举报
回复
http://www.codeproject.com/KB/graphics/BarcodeImaging3.aspx
BitCoffee 2015-10-16
  • 打赏
  • 举报
回复
http://www.cnblogs.com/yuanbao/archive/2007/09/25/905322.html 看看这个.
zhangbaiwan 2015-10-16
  • 打赏
  • 举报
回复
OCR字库 要怎么做 百度上 没有找到
zhangbaiwan 2015-10-16
  • 打赏
  • 举报
回复
感觉这样的图片 取数字 应该不难吧,没有什么干扰 字体也很规整 是不是 OCR字库 做的不对? 大神给支个招
BitCoffee 2015-10-16
  • 打赏
  • 举报
回复
放大看了下你的图片,有些字之间是连着的,你需要将与最红的那个颜色值相差很远的当成白色.
BitCoffee 2015-10-16
  • 打赏
  • 举报
回复
识别的话就是比较字符串了, 0011000100011100... 1000011000011000000... 用异或运算(^),取最相似的即可,最好不要用相等去取. 另外,如果两个长度不相等,可以在少的结尾用补齐.
jiaoshiyao 2015-10-16
  • 打赏
  • 举报
回复
百度 搜索 OCR 把这个图片转成 文字 然后在过滤
BitCoffee 2015-10-16
  • 打赏
  • 举报
回复

private string GetImageChars(Bitmap bmpCutImage)
{
	StringBuilder chars = new StringBuilder();
	for(int w = 0;w < bmpCutImage.Width;w++)
	{
		for(int h = 0;h < bmpCutImage.Height;h++)
		{
			Color color = bmpCutImage.GetPixel(w,h);
			if(color.R == 255 && color.G == 255 && color.B = 255)
			{
				chars.Append("0");
			}
			else
			{
				chars.Append("1");
			}
		}
	}
	return chars.ToString();
}
得到切割图片的字符库.
BitCoffee 2015-10-16
  • 打赏
  • 举报
回复

private Bitmap GetCutImage(Bitmap bmpSource,int x,int y)
{
	int width = y - x;
	int height = bmpSource.Height;
	Bitmap bitmap = new Bitmap(width,height);
	Rectangle rectangle = new Rectangle(x,0,width,height);
	Graphics g = Graphics.FromImage(bitmap);
	g.DrawImage(bmpSource,0,0,rectangle,GraphicsUnit.Pixel);
	g.Dispose();
	return bitmap;
}
得到切割图: bmpSource:原图 x:每个字符的left y:每个字符的right(开始那个方法得到的.)
这货很帅 2015-10-16
  • 打赏
  • 举报
回复
用谷歌现成的tesseractOCR
zhangbaiwan 2015-10-16
  • 打赏
  • 举报
回复
@BitCoffee 3q 我先试试看
BitCoffee 2015-10-16
  • 打赏
  • 举报
回复

Bitmap bitmap = new Bitmap("图片路径");
bool flag =true;
string result = "";
for(int w = 0;w < bitmap.Width;w++)
{
	int index = -1;
	for(int h = 0;h<bitmap.Height;h++)
	{
		Color color = bitmap.GetPixel(w,h);
		if(flag)
		{
			if(color.R != 255 || color.G != 255 || color.B != 255)
			{
				index = w;
				flag = false;
				break;
			}
		}
		else
		{
			if(color.R == 255 && color.G == 255 && color.B == 255)
			{
				if(h == bitmap.Height - 1)
				{
					index = w;
					flag = true;
					break;
				}
			}
			else
			{
				break;
			}
		}
	}
	if(index > -1)
	{
		result += index.ToString() + ";"
	}
}
result中每两个就能切出一个字符.
加载更多回复(11)

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧