Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th May 2020, 18:56   #1  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Masking text from an image?

I have a scanned image, and after applying a descreen filter in photoshop, the screen was removed but the text on the image were also blurred. So I'm looking for a way to mask the text from the descreen filter. I couldn't find anything useful about masking text in photoshop so I think maybe vapoursynth and python can help?

Here what I have observed so far: the screen only applies to areas that were printed with color. Since most of the text were black, they didn't have any screen.

Testing image here:
https://imgur.com/bpVcWMV
lansing is offline   Reply With Quote
Old 15th May 2020, 19:20   #2  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Use the magic wand tool to select the background. Then Right click and invert selection. You have selected all your text. Now you can copy it, create a mask etc.
But you probably want to just apply the descreen filter while the background is selected.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 15th May 2020, 21:15   #3  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by ChaosKing View Post
Use the magic wand tool to select the background. Then Right click and invert selection. You have selected all your text. Now you can copy it, create a mask etc.
But you probably want to just apply the descreen filter while the background is selected.
I tried it, I stacked the masked one on top of the descreened, it works okay, but it doesn't have option to expand the mask like in vapoursynth. The masked one couldn't cover the whole text and its surrounding.
lansing is offline   Reply With Quote
Old 15th May 2020, 21:35   #4  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
You can expand your selection, just google it. There are tons of videos showing how to properly select stuff in PS.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 15th May 2020, 21:52   #5  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Basically selecting stuff = masking stuff when you apply filters https://imgur.com/a/QPd1jwZ
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 16th May 2020, 03:19   #6  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Thanks ChaosKing, you're right the mask selection of photoshop is the most advance in the world. After more tests, I finally figured out a workflow to do this effectively.

I used the "select and mask" option to further refine the mask after using magic wand. After that I saved the selection as a mask and made a new copy of the original for the descreen layer. Applied the text mask to the new copy and deleted the text, and then run the descreen. So what we got is a descreened image with no text.

Finally I put the descreened layer on top of the original and done.


This workflow produces better result than extracting the text first and put it on top of the descreened layer.

I put up the comparison images here.

With this image the text was printed on top of a screened background.
lansing is offline   Reply With Quote
Old 16th May 2020, 07:58   #7  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Select by color range could be a better selection in this case to avoid manually selections of fonts like A O Q P B
https://helpx.adobe.com/photoshop/us...nge-image.html
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 16th May 2020, 10:20   #8  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by ChaosKing View Post
Select by color range could be a better selection in this case to avoid manually selections of fonts like A O Q P B
https://helpx.adobe.com/photoshop/us...nge-image.html
Wow this is a great tips, I was manually going over every character that has a hole in the middle to add them to the selection and I was like "this can't be the right way."

Do you have anymore tips to select only the text with this color range selection? Right now when I eyedropped the text color, some images on the page were also selected, right now I'm manually erasing them in the "select and mask" window, is there other way to do this?
lansing is offline   Reply With Quote
Old 16th May 2020, 10:39   #9  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Hmm maybe look also at "Posterize". It could help with selecting text in your case. Just reduce it to like 2-4 color tones.
And remember, you can always make a selection on layer A und work with layer B!

EDIT And of course "tone correction". https://imgur.com/a/yAgglYD

EDIT I would google how to batch process in PS if you have many images.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 16th May 2020 at 10:54.
ChaosKing is offline   Reply With Quote
Old 16th May 2020, 15:04   #10  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by ChaosKing View Post
Hmm maybe look also at "Posterize". It could help with selecting text in your case. Just reduce it to like 2-4 color tones.
And remember, you can always make a selection on layer A und work with layer B!

EDIT And of course "tone correction". https://imgur.com/a/yAgglYD

EDIT I would google how to batch process in PS if you have many images.
I tried both methods, they didn't really help much. They did reduced the selection of wrong areas but I would still have to go through the same process cleaning them, so I guess that's the limit of text masking.

UPDATE: These methods are actually good at eliminating small dot noise that may be selected.

Last edited by lansing; 16th May 2020 at 15:30. Reason: update
lansing is offline   Reply With Quote
Reply

Tags
descreening, text masking

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:41.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.