• Welcome to Operation Photo Rescue's Online Community.
 

Removing White Dots

Started by rockthumper, September 14, 2007, 08:39:40 AM

Previous topic - Next topic

rockthumper

After working on my first restoration photo, which was covered in white dots, I was sure there was a better way to deal with or at least reduce the problem to automatically bring the photo to a reasonable state for manual finishing. I recorded some actions as a 'script' in Paint Shop Pro X which is the photo manipulation software I use and was pleasantly surprised by the results. The success of my early efforts was very dependent on the brightness of the background and completely ignored non-white blemishes - black dots, for example. Recent changes I've made to the way the script detects the dots means that it now works on light or dark dots, and also reduces small scratches and blotches. Here is an example of the kind of damage I was dealing with:



The script is currently in it's third version and is called WD3. This can be applied to the whole photograph or, I think with better results, to a selection. The script can run completely automatically. For best results it can also be run manually and the parameters fine tuned to get the best fit to the image. You can run it several times over the same area of the image with some improvement.
Here is the result of running WD3 through two iterations - firstly in auto on the larger selection and then manually on the smaller one. The square selections I made are indicated by the taped corners:



All that was required was to make a selection and run the script. Personally I think it looks pretty good. It works on either colour or b&w images.
I haven't done photo restoration before so I don't know all the tools that are available. I'm sure there are better ones out there but I thought the results were worth a post here. If any member of OPR  would like to use my script as a tool to help them with their restorations I'll send you a copy. For the Photoshop people I can just tell you what the script does and you can write your own action(?) - there's actually nothing very complicated going on.
RT.

Hannie

Wow, you really made those white spots disappear completely, very good job!
The only reservation I have is that there are now some fuzzy edges that weren't there before.
(I know, I'm being a real crab-apple now!  :P)

Hannie
Hannie Scheltema
Distribution Coordinator
[email protected]

glennab

#2
Hi RT

I love the functionality of your script.  What a time-saver!  Since I'm using Photoshop, I'd appreciate an explanation of what your script does, so I can try to replicate it.  Anything that eliminates the kind of grunt work involved in cleaning up the type of debris you have in your restoration will allow us to be much more productive on the worst areas.

My compliments on your tenacity and savvy!

Glenna

P.S.  Ms. Crab Apple -- picky, picky, picky!  I don't know about you, but I'd rather deal with smoothing some fuzzy edges than eliminating five gazillion small dots one by one.  Been there; done that; have a t-shirt!
What we do for ourselves dies with us. What we do for others and the world remains and is immortal. ~Albert Pine

(Photoshop CS5 /Mac Pro)

phischer

Hmm looks pretty good. What's your secret for us Photoshop users?

sanbie

Oooh thank you for the offer RT..I would love to have it please..anything that helps with those ghastly white dots has to be a bonus!!

Sanbie
paintshop pro X1

Hannie

#5
You are absolutely right Glenna!  Who worries about fuzzy arms, certainly not when restoring a portrait of an orangutan!
Just kidding, I think RT did an amazing job writing that script.  It will be very helpful to many of us!

P.P.P. Crabapple
Hannie Scheltema
Distribution Coordinator
[email protected]

Ratz

great job RT! what a time saver,very close to the "poofer" tool we used to joke about :up:

Tess (Tassie D)

Great job RT. :up: Puts hand up for script.
Tess Cameron
Distribution Coordinator
[email protected]

klassylady25

Won't be much help if ya don't know what he's talking about!  lol

rockthumper

No worries, I'll be happy to answer what I can.  :)

Sanbie and Tassie D - I'm going to upload the script in text file format to an online file host. But there may be a delay while I work that out. Alternatively if you're happy to send me your email address I'll email it to you.

Hannie - You are quite right, the script does introduce imperfections - it blurs edges and it introduces a white 'fog' visible on dark areas, particularly when the white dots get very dense. That's partly why I think it works better on selections rather than on the whole image - you can avoid boundaries for one thing to avoid the edge problem. You may decide it causes more damage than it's worth but I've got to say, on the few examples I've tried it, the results look good to me!

The basic idea is replace a white dot with a slightly larger dot of similar colour to it's surroundings. Here are the details of what the script should do:

Make a selection in the original damaged image.
Copy the selection and 'paste as a new image' three times.
The copies will be named "image#1","image#2" etc but I will refer to them by usage. Leave the original to one side but do not close the selection.

Copy 1 - "Tones"
Apply the Salt & Pepper filter
  Set Speck size=15 sensitivity=7
  Include lower speck sizes, aggressive action.
Copy this image.

Copy 2- "Mask"
Sharpen More
Paste as a new layer ( this pastes in a copy of Tones).
Set blend mode to difference.
Add a Levels Adjustment layer to maximise contrast between the background and the dots.
Merge Visible then use Dilate (Effects > Edge Effects > Dilate). 

Copy 3 - "Fix"
Copy and paste Tones as a new layer.
Add a new layer mask 'from image' and select the number of the image used for Mask.
Merge visible.
Copy this image and close all the images except the original.

Original Image
Make a new Raster layer, call it "Repair" for example.
Paste into selection.
Select none and save.

The original selection should now have the white dots replaced by areas of colour which closely match their surroundings. The new Repair layer can be edited to improve the match or if unsatisfactory can be discarded leaving the original untouched.


If anyone has a suggestion for a better way of making the Tones copy (or anything else) please let me know.
RT

klassylady25

Thanks.  Now will need to translate it into Photoshop, but I can work on that.  There are some similarity of terms.

:hug: Candy

rockthumper

#11
Candy - good luck, let me know how it goes.

For the PaintShop Pro people - a text version of the script can be downloaded from here:
WD3Auto.txt

- save the file as a PspScript in the 'My Documants\My PSP Files\Scripts-Trusted' folder. It needs to run as a trusted script because it deletes copies of images as it runs.
For those not familiar with using scripts turn on the Script Toolbar in PSP by clicking View > Toolbars > Script. You should now have a toolbar where you can select WD3Auto from a pulldown menu, open (a copy of) your restoration original, make a selection and then press the Play button in the toolbar to run the scipt. :D

Cheers,
RT.

Edit: The PspScript version is now here: http://www.keepmyfile.com/download/ba04111883239 so you don't have to cut and paste the text file.

Tess (Tassie D)

:up: Thanks RT, got it. Will try it out after lunch.
Tess Cameron
Distribution Coordinator
[email protected]

schen

I asked for one that I thought would be easy:



After the high-res download, I see the picture is covered with white dots all over.  Since they are not evenly distributed, FFT filter did not yield much.



These white dots seem to be the artifact of copy lighting on the textured paper.  The problem appeared to be common in this copy run.

I would like to do some research on white dot reduction techniques during the copy process.  Could someone send me a picture of the copy stand and lighting arrangement for me to duplicate the process?
Shujen Chen
Windows 10, Photoshop CS6

sanbie

Quote from: rockthumper on September 14, 2007, 10:18:58 PM
Candy - good luck, let me know how it goes.

For the PaintShop Pro people - a text version of the script can be downloaded from here:
WD3Auto.txt

- save the file as a PspScript in the 'My Documants\My PSP Files\Scripts-Trusted' folder. It needs to run as a trusted script because it deletes copies of images as it runs.
For those not familiar with using scripts turn on the Script Toolbar in PSP by clicking View > Toolbars > Script. You should now have a toolbar where you can select WD3Auto from a pulldown menu, open (a copy of) your restoration original, make a selection and then press the Play button in the toolbar to run the scipt. :D

Cheers,
RT.

That will teach me not to read all the way down first wont it..Lol..Just ignore my email RT I have now downloaded it! Thank you so much for sharing this...

Sanbie
paintshop pro X1