Closed Sterben1579 closed 5 days ago
It is expected to fail on onomatopoeia, these are hard cases for detection model. As for the pic you provided, you could tune the dilate slider in the rectangle tool which will dilate the inpainting mask. Note it will also affect the RUN process.
@dmMaze I didn't fully understand what I need to do. Could you please send me a screenshot of the program settings you recommend?
I made a change that would add a "third method" to the inpaint, allowing me to use the mask already created by the detector, and to remove all these imperfections manually but very easily. I've tried it and it's pretty useful, I'll just like you and you can add it to the project BallonsTranslator.
For example, I run the project, with opencv-tela (very fast) and the dilate slider at zero(0-5) so that it does not affect the dialogue balloons, and already manually correct the onomatopoeia that require a dilation of 10-30, but when having the shape in the mask(detection), it is very easy to remove them with the LAME inpaint.
ui\drawingpanel.py
changed line 203
self.methodComboBox.addItems([self.tr('method 1'), self.tr('method 2'), self.tr('method 3 Mask')])
changed line 775
if mode == 0:
im = np.copy(img[y1: y2, x1: x2])
if self.rectPanel.methodComboBox.currentIndex() < 2:
maskseg_method = self.rectPanel.get_maskseg_method()
inpaint_mask_array, ballon_mask, bub_dict = maskseg_method(im)
else:
inpaint_mask_array=self.canvas.imgtrans_proj.mask_array[y1: y2, x1: x2]
ballon_mask=inpaint_mask_array
bub_dict = {"bgr": [0, 0, 0],"bground_bgr": [255, 255, 255],"need_inpaint": True}
mask = self.rectPanel.post_process_mask(inpaint_mask_array)
I made a change that would add a "third method" to the inpaint, allowing me to use the mask already created by the detector, and to remove all these imperfections manually but very easily. I've tried it and it's pretty useful, I'll just like you and you can add it to the project BallonsTranslator.
For example, I run the project, with opencv-tela (very fast) and the dilate slider at zero(0-5) so that it does not affect the dialogue balloons, and already manually correct the onomatopoeia that require a dilation of 10-30, but when having the shape in the mask(detection), it is very easy to remove them with the LAME inpaint.
ui\drawingpanel.py
changed line 203
self.methodComboBox.addItems([self.tr('method 1'), self.tr('method 2'), self.tr('method 3 Mask')])
changed line 775
if mode == 0: im = np.copy(img[y1: y2, x1: x2]) if self.rectPanel.methodComboBox.currentIndex() < 2: maskseg_method = self.rectPanel.get_maskseg_method() inpaint_mask_array, ballon_mask, bub_dict = maskseg_method(im) else: inpaint_mask_array=self.canvas.imgtrans_proj.mask_array[y1: y2, x1: x2] ballon_mask=inpaint_mask_array bub_dict = {"bgr": [0, 0, 0],"bground_bgr": [255, 255, 255],"need_inpaint": True} mask = self.rectPanel.post_process_mask(inpaint_mask_array)
Just added this option 8aa8a00adff4b10051dfd47e2550fa2191a46551. Thanks for the idea.
Thank you very much, but there's a bug, when you're selected the "Use Existing Mask" method and you realize the inpainting from the menu of a textblock
Traceback (most recent call last):
File "\BallonsTranslator-dev\ui\module_manager.py", line 485, in run
self.job()
File "\BallonsTranslator-dev\ui\module_manager.py", line 309, in
Thank you very much, but there's a bug, when you're selected the "Use Existing Mask" method and you realize the inpainting from the menu of a textblock
Traceback (most recent call last): File "\BallonsTranslator-dev\ui\module_manager.py", line 485, in run self.job() File "\BallonsTranslator-dev\ui\module_manager.py", line 309, in self.job = lambda : self._blktrans_pipeline(blk_list, tgt_img, mode, blk_ids) File "\BallonsTranslator-dev\ui\module_manager.py", line 334, in _blktrans_pipeline inpaint_mask_array, ballon_mask, bub_dict = maskseg_method(im) TypeError: existing_mask() missing 1 required positional argument: 'mask'
fixed https://github.com/dmMaze/BallonsTranslator/commit/e56e9cc3d1864c3df7116567cbb0f488d693ee1b
dilate slider in the rectangle tool which will dilate the inpainting mask.
А... Intuitive. I thought it had no effect. Wouldn't it be easier to duplicate this function in the settings to make it clear that it is GLOBAL)
I think I didn't configure the settings properly because it's not cleaning the webtoon or manga as neatly as in the image. I have to check all the pages and manually clean these parts.
But that's not all. Could you please tell me the exact settings I need to apply for the program to work perfectly with webtoons and manga, or could you share a screenshot of your settings?
Note: Im using GPT-4o for translations..