我下载了Asprise制作的OCR样本。我喜欢它,因为它速度非常快。示例中只有一点问题:导入图片时,无法选择要转换为TXT的照片部分。如何查看pictureBox中的图像并选择(我认为使用两个点)要扫描的部分?使用Asprise OCR扫描部分
1
A
回答
0
你将不得不做的是创建一个类似裁剪的工具。假设你的图片是在一个图片框控件,它会是这样的:
private bool _isSelecting;
private Rectangle _selectionRectangle;
private void Form1_Load(object sender, EventArgs e)
{
_isSelecting = false;
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
_selectionRectangle = new Rectangle(e.X, e.Y, 0, 0);
pictureBox1.Invalidate();
_isSelecting = true;
}
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
_selectionRectangle = new Rectangle(_selectionRectangle.Left, _selectionRectangle.Top,
e.X - _selectionRectangle.Left, e.Y - _selectionRectangle.Top);
pictureBox1.Invalidate();
}
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
if (!_isSelecting)
return;
using (var pen = new Pen(Color.Red, 2))
{
e.Graphics.DrawRectangle(pen, _selectionRectangle);
}
}
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
using (var bmp = new Bitmap(pictureBox1.Image))
{
if (_selectionRectangle.Width + _selectionRectangle.X > pictureBox1.Image.Width)
_selectionRectangle.Width = pictureBox1.Image.Width - _selectionRectangle.X;
if (_selectionRectangle.Height + _selectionRectangle.Y > pictureBox1.Image.Height)
_selectionRectangle.Height = pictureBox1.Image.Height - _selectionRectangle.Y;
var selectedBmp = bmp.Clone(_selectionRectangle, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
pictureBox1.Image = selectedBmp;
}
_isSelecting = false;
pictureBox1.Invalidate();
}
此代码将允许您拖动您要选择的区域中,那么它会用更换旧形象旧图像的选定区域。然后,您只需将新图像传送到您的OCR软件即可。
0
您不需要为了性能而制作新的图像。 Asprise OCR允许您将想要将OCR作为参数的区域通过。例如:
string s = ocr.Recognize("img.jpg", -1, 0, 0, 400, 200,
AspriseOCR.RECOGNIZE_TYPE_ALL, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
上面的代码指示OCR引擎在宽度为400像素和高度为200像素的图像的左上部分执行OCR。
欲了解更多详情,请访问C# VB.NET OCR Developer's Guide: Perform OCR On Part Of The Image
相关问题
- 1. 问题asprise成像扫描
- 2. OCR使用Asprise与Java
- 3. 配置OCR JAVA Asprise
- 4. OCR扫描不显示扫描输出
- 5. 使用特定字体的OCR扫描
- 6. OCR + QR码一次扫描
- 7. 如何实现Asprise OCR库
- 8. cygwin安装和OCR /扫描
- 9. Android OCR号码扫描
- 10. OCR文档扫描.NET SDK
- 11. 提高扫描文档的OCR精度
- 12. 复杂文档的OCR扫描
- 13. Windows Phone 7.5中的扫描文本(OCR)
- 14. 使用asprise从图像中提取文本ocr
- 15. OCR验证使用Rails构建一个名片扫描仪
- 16. 使用扫描
- 17. 使用扫描仪扫描txt文件
- 18. 使用扫描仪扫描Java输入
- 19. 使用异步扫描进行扫描
- 20. 扫描NSMutableArray的一部分字符串
- 21. 如何做HBase部分扫描?
- 22. 想扫描最后一部分编号
- 23. Zxing扫描分类
- 24. 使用扫描器
- 25. 使用StructureMap扫描
- 26. 使用扫描仪
- 27. 扫描错误:局部变量扫描的值不用于
- 28. Anyline OCR SDK集成,用于扫描图像中的url
- 29. Asprise scanner.js函数myCallBackFunc错误
- 30. 使用FilterExpression进行Dynamodb扫描()使用FilterExpression进行Dynamodb扫描()