图像处理 - 旋转扫描的文档以对齐文本 [英] Image processing - rotate scanned document to align text

查看:300
本文介绍了图像处理 - 旋转扫描的文档以对齐文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个OCR C#项目,我在其中获得一个带有文本的扫描文档,我需要在文档中返回文本。

I have an OCR C# project where I get a scanned document with text in it, and I need to return the text in the document.

我已经有了解析文本的解决方案,但我们卡在扫描文档旋转的部分(向右或向左)。

I already have the solution for parsing the text, however we are stuck in the part where the scanned document is rotated (to the right or to the left).

假设没有噪音图像(所有像素都是白色或黑色),任何人都可以帮助我们使用算法在运行时旋转图像(没有人眼)?

Suppose there is no noise in the image (All pixels are white or black), can anyone help us with an algorithm to rotate the image in runtime (Without a human eye)?

谢谢

推荐答案

使用霍夫变换检测应该是水平文本方向的最强线方向。 Hough变换的基本前提是将xy坐标转换为r-theta坐标系,其中r是距离原点的距离,theta是方向。

Use Hough Transform to detect the strongest line orientation which should be the horizontal text orientation. The basic premise of the Hough Transform is to convert x-y coordinate to a r-theta coordinate system where r is the distance from origin and theta is the orientation.

图像一次变换,bin相同,以找到最强的方向。

Once the image is transformed, bin same thetas to find the strongest orientation.

因为此方法在离散r和thetas中使用投票。 theta的分辨率仅与使用的箱数一样好。因此,您可能希望将其限制为更精确的角度或速度,而不是在一度增量中使用-180到+180度。

Because this method uses voting within discrete r and thetas. The resolution of the theta is only as good as number of bins used. So instead of using -180 to +180 degree in one degree increment, you might want to bound it for either more accurate angle or speed.

这篇关于图像处理 - 旋转扫描的文档以对齐文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆