我正在开发一个项目,对标签上的文本进行 OCR 操作。我的工作是对图像进行倾斜校正,使其可以用超正方体读取。
I have been using this approach https://www.pyimagesearch.com/2017/02/20/text-skew-correction-opencv-python/, that greyscales and thresholds the picture, gets the coordinates of the black pixels, draws a minAreaRect around it and then corrects the skew by the skew angle of this rectangle. This works on , but not on images with background, like the presented image. There, it calculates a skew angle of 0.0 and does not rotate the image. (Expected result: 17°)
我怀疑发生这种情况是因为背景中有黑色像素。由于它们,minAreaRect 围绕整个图片,从而导致倾斜角度为 0。
我尝试进行背景去除,但找不到一种效果足够好的方法,以便只留下带有文本的标签
我尝试的另一种方法是通过 k 均值聚类对像素进行聚类。但即使手动选择一个好的 k,带有文本的簇仍然包含部分背景。
更不用说我仍然需要另一种方法来遍历所有集群并使用某种启发式来确定哪个集群是文本,哪个集群是背景,这将花费大量的运行时间。
对有背景的图像进行倾斜校正的最佳方法是什么?
您可以尝试基于深度学习natural scene text detection
方法。通过这些方法,您可以获得每个文本的旋转边界框。基于这些得到覆盖所有框的旋转边界矩形。然后使用该矩形的 4 个角来校正图像。
RRPN_plusplus
基于样本图像RRPN_plusplus https://github.com/mjq11302010044/RRPN_plusplus似乎在极端角度上表现得很好。
EAST
Pyimagesearch 有一个教程EAST
场景文本检测器。尽管不确定东方是否能在极端角度下表现良好。
https://www.pyimagesearch.com/2018/08/20/opencv-text-detection-east-text- detector/ https://www.pyimagesearch.com/2018/08/20/opencv-text-detection-east-text-detector/
图片来自,https://github.com/argman/EAST https://github.com/argman/EAST.
这些应该可以帮助您找到最近更好的存储库和方法,
- https://github.com/topics/scene-text-detection https://github.com/topics/scene-text-detection
- https://paperswithcode.com/task/scene-text-detection https://paperswithcode.com/task/scene-text-detection
- https://paperswithcode.com/task/curved-text-detection https://paperswithcode.com/task/curved-text-detection
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)