赞
踩
最近实验课要做一个图片文字识别
,需求是Winform中有一个图片,进行框选后,识别框选中的内容,老师提示说去找OCR的开源库,所以我就找到了IronOCR
IronOCR:The C# OCR Library : Iron OCR
IronOcr makes it easy to read text from images in your .net apps & websites.
1.Read text and barcodes from scanned images & PDFs
2.Supports multiple international languages
3.Output as plain text or structured data
进行识别前,必须框选出识别区域,所以就要先去实现框选,思路就是通过MouseUp
、MouseMove
、MouseDown
三个事件去绘制一个矩形,类似于拖选
private bool _mouseIsDown = false;
private Rectangle _selectArea = Rectangle.Empty;
private void pictureBox_MouseUp(object sender, MouseEventArgs e)
{
// 修正Width和Height可能为负数的问题
if (_selectArea.Width < 0)
{
_selectArea.Width = -_selectArea.Width;
_selectArea.X -= _selectArea.Width;
}
if (_
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。