简体   繁体   English

OpenCV:如何从黑白图像的特定部分删除文本

[英]OpenCV: How to remove text from specific part of a black and white image

Good morning.早上好。

I am developing an application in Python to detect the frames of a manga page, and that detects the speech bubbles to erase the text.我正在用Python开发一个应用程序来检测漫画页面的框架,并检测语音气泡以擦除文本。 Example: 1 : 1st Image:示例: 1 :第一个图像:

在此处输入图片说明

在此处输入图片说明

Ideal result 1:理想结果 1:

在此处输入图片说明

However, OCV has difficulties to detect the text formed in Japanese or Korean, so I thought that perhaps it was easier to find an algorithm that recognized the shape of the speech bubbles and filled their interior with white, eliminating the text.然而, OCV很难检测到日文或韩文形成的文本,所以我想也许更容易找到一种算法来识别语音气泡的形状并用白色填充其内部,从而消除文本。

I would also like to divide the manga pages by their frames, although this is much simpler, because they are usually square and have a frame that makes them easily detectable.我还想按框架划分漫画页面,虽然这要简单得多,因为它们通常是方形的,并且有一个框架,可以很容易地检测到它们。

The problem is that I dont have much idea about OCV or Tesseract , and I wouldnt even know where and how to start.问题是我对OCV or Tesseract不太了解,我什至不知道从哪里开始以及如何开始。

This user repository is what I am using but doesnt work too well for what I want...这个用户存储库是我正在使用的,但对于我想要的效果不太好......

https://github.com/DivyaKrishnani/Working-with-Text-on-Images https://github.com/DivyaKrishnani/Working-with-Text-on-Images

I can think of the following methods:我可以想到以下方法:

  1. You can run an OCR to detect Korean texts and their corresponding box.您可以运行 OCR 来检测韩文文本及其相应的框。 Then you can paint the whole bounding box with white colour to remove these Korean words.然后你可以用白色绘制整个边界框以删除这些韩语单词。 There are free OCR python libraries available like Pytesseract, Keras-OCR, easy OCR, EAST text detection.有免费的 OCR python 库,如 Pytesseract、Keras-OCR、easy OCR、EAST 文本检测。 Paid ones by Microsoft Azure, Amazon and Google.微软 Azure、亚马逊和谷歌付费的。

  2. You can treat each character as an object and train an object detection module (EfficientDet or YOLO) to detect the same.您可以将每个字符视为一个对象,并训练一个对象检测模块(EfficientDet 或 YOLO)来检测它们。 You will get the bounding box and do the same steps as mentioned in previous point.您将获得边界框并执行与前一点所述相同的步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM