从图像中删除(裁剪)文本
我正在尝试实现一个图像识别程序,我需要删除(或“裁剪”)图像上存在的所有文本,例如:
到:
我已经尝试过 Keras OCR 方法,但首先我不需要背景模糊,我只需要删除文本,其次它需要大量的时间和 CPU 能力。有没有更简单的方法来检测这些文本区域并简单地将它们从图片中裁剪出来?
I am trying to implement an image recognition program and I need to remove (or "crop") all text, present on the image, so for example from that:
to that:
I already tried the Keras OCR method, but firstly I don't need the background blur I simply need to delete the text, and secondly it takes a lot of time and CPU power. Is there an easier way to detect those text regions and simply crop them out of the picture?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是使用 findContours 检测文本 - 面积 < 的文本。阈值是字母,然后在这些区域上绘制,或者/并且首先找到它们的边界矩形并绘制一个大的矩形。
检测具有轮廓的文本区域后从图像中提取文本
还有 pytesseract 来检测字母及其区域,但我猜它会比轮廓重。
这是我使用 pytesseract 的一个示例项目: 如何从 pytesseract 获得最佳结果?
One way is to detect the text with findContours - the ones with an area < threshold are letters, then paint over these areas, or/and first find their bounding rectangle and paint a big one.
Text Extraction from image after detecting text region with contours
There is also pytesseract to detect letters and their region, but I guess it will be heavier than the contours.
Here is an example project where I worked with pytesseract: How to obtain the best result from pytesseract?