Operation Photo Rescue's Online Community

OPR Workshop Information Exchange => General Techniques => Topic started by: rockthumper on September 14, 2007, 08:39:40 AM

Title: Removing White Dots
Post by: rockthumper on September 14, 2007, 08:39:40 AM
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:

(http://i26.photobucket.com/albums/c137/Rimmer8/OPR/Armsampleoriginal.jpg)

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:

(http://i26.photobucket.com/albums/c137/Rimmer8/OPR/WD3Test2iterations.jpg)

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.
Title: Re: Removing White Dots
Post by: Hannie on September 14, 2007, 09:04:01 AM
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
Title: Re: Removing White Dots
Post by: glennab on September 14, 2007, 09:50:22 AM
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!
Title: Re: Removing White Dots
Post by: phischer on September 14, 2007, 10:05:37 AM
Hmm looks pretty good. What's your secret for us Photoshop users?
Title: Re: Removing White Dots
Post by: sanbie on September 14, 2007, 10:13:24 AM
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
Title: Re: Removing White Dots
Post by: Hannie on September 14, 2007, 02:14:07 PM
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
Title: Re: Removing White Dots
Post by: Ratz on September 14, 2007, 03:44:17 PM
great job RT! what a time saver,very close to the "poofer" tool we used to joke about :up:
Title: Re: Removing White Dots
Post by: Tess (Tassie D) on September 14, 2007, 07:26:49 PM
Great job RT. :up: Puts hand up for script. (http://209.85.48.9/867/137/emo/sway.gif)
Title: Re: Removing White Dots
Post by: klassylady25 on September 14, 2007, 09:20:18 PM
Won't be much help if ya don't know what he's talking about!  lol
Title: Re: Removing White Dots
Post by: rockthumper on September 14, 2007, 09:24:42 PM
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
Title: Re: Removing White Dots
Post by: klassylady25 on September 14, 2007, 09:33:03 PM
Thanks.  Now will need to translate it into Photoshop, but I can work on that.  There are some similarity of terms.

:hug: Candy
Title: Re: Removing White Dots
Post by: 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 (http://www.keepmyfile.com/download/ba04111877396)

- 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.
Title: Re: Removing White Dots
Post by: Tess (Tassie D) on September 14, 2007, 10:58:06 PM
:up: Thanks RT, got it. Will try it out after lunch.
Title: Re: Removing White Dots
Post by: schen on September 15, 2007, 05:31:37 PM
I asked for one that I thought would be easy:
(http://i195.photobucket.com/albums/z298/schen_album/BoudreauxE_20_02_see_no_white_dots.jpg)


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.

(http://i195.photobucket.com/albums/z298/schen_album/BoudreauxE_20_02_white_dots.jpg)

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?
Title: Re: Removing White Dots
Post by: sanbie on September 15, 2007, 08:29:46 PM
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 (http://www.keepmyfile.com/download/ba04111877396)

- 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
Title: Re: Removing White Dots
Post by: Tess (Tassie D) on September 15, 2007, 09:03:49 PM
That one is a mess schen. I ran the crop through the median noise filter with the aperture set at 5 with fairly good results. I masked out the eyes, nose & mouth first.

(http://i24.photobucket.com/albums/c5/tassie_devil/OPR/median.jpg)
Title: Re: Removing White Dots
Post by: rockthumper on September 15, 2007, 11:47:50 PM
This took me 5 minutes with WD3. I made individual passes for the face (masking out eyes and mouth), hair and background and ran it manually on the veil. I was left with a few dots to be removed by cloning and some edges to fade in.
(http://i26.photobucket.com/albums/c137/Rimmer8/OPR/BoudreauxETest.jpg)
Title: Re: Removing White Dots
Post by: Ausimax on September 19, 2007, 03:57:43 AM
From this:

(http://img168.imageshack.us/img168/8559/bxoriginalnj8.jpg)


To this in 2 clicks:

(http://img72.imageshack.us/img72/2055/spotshf1.jpg)


1. Dust & Scratches filter - Radius 6    Threshold 25

2. Curves - click on dress collar with white point sampler.

Done.

I have just reworked this image in half an hour and its better than the other with over 20 hours work.

Max

Title: Re: Removing White Dots
Post by: Tess (Tassie D) on September 19, 2007, 04:04:54 AM
Great tip Max. Couldn't you just scream though, 20 hours v 2 hours.  :knuppel:
Title: Re: Removing White Dots
Post by: Hannie on September 19, 2007, 05:34:10 AM
Thanks for the tips Max!

Hannie
Title: Re: Removing White Dots
Post by: Ratz on September 19, 2007, 09:45:34 AM
That's fantastic, Max. Sure cuts down on the time and gives a great result.
Thanks :up:
Title: Re: Removing White Dots
Post by: klassylady25 on September 19, 2007, 11:29:40 AM
It's a great remedy for some pictures that's for sure.  The pano that I'm working on (military) needs to keep all the detail that it can.  I tried your remedy for it and was tempted, but for this project ATD is required.  I've stored your lesson and it will definately help on some of the others that I'm working!  Thank you Max

I just love the military!!!   :loveit:
Title: Re: Removing White Dots
Post by: sanbie on September 19, 2007, 08:32:47 PM
I have been driven insane with my new one...I just can't seem to get rid of the white dots enough to be able to do the face properly...I have started it 4 times doing soooo many different ways and each time the face especially in the right hand side doesn't turn out right...am posting the original in the hope that someone will come up with an idea of what would be best to do...

(http://i59.photobucket.com/albums/g320/Sanbie2/th_BoudreauxE_20_14.org1.jpg) (http://i59.photobucket.com/albums/g320/Sanbie2/BoudreauxE_20_14.org1.jpg)

Hope someone can help...

Sanbie

Title: Re: Removing White Dots
Post by: sanbie on September 19, 2007, 09:12:27 PM
PLEASE.... :hug: Otherwise I will have to give it back as I can't see a way around it!!

Sanbie
Title: Re: Removing White Dots
Post by: kstruve on September 19, 2007, 09:43:20 PM
The first thing I would do would be to run a FFT (Fast Fourier Transform) filter on it to get rid of the paper texture.  As far as I know, you can only use FFT on a PC installation of Photoshop, not Mac.  But I may be wrong.  You can find a tutorial as well as a download for the filter here:

http://retouchpro.com/tutorials/?m=show&id=185

After you run the FFT, I'd create a new layer above the original on "Overlay" blending mode, and use a paint brush to "dodge" and "burn" the reflections from the photo.  Use a dark gray or black color to burn, and use a light gray or white brush to dodge.  Somebody posted a tutorial about this technique a while back, so you might want to search for it.

I hope this helps,
Kurt
Title: Re: Removing White Dots
Post by: Ausimax on September 19, 2007, 09:52:19 PM
 Hi Sanbie,

I had a go at it using the de-interlace filter and that did no good, I tried the dust and scratches filter and that removed a lot of the white and streaks, it reduces the sharpness a bit but you should be able to repair the face and then copy that back into another sharper image.

It still has the paper texture, I tried to remove that with the FTT filter action, but for some strange reason it wouldn't work and crashed PS. Hopefully somebody will come up with a more elegant solution for you.


(http://www.divshare.com/img/thumb/2037658-582.jpg) (http://www.divshare.com/download/2037658-582)

I see Kurt has posted as I type, maybe he could run the FTT on it for you, as I know you use PSP and I'm not sure if it works on that.

Max
Title: Re: Removing White Dots
Post by: sanbie on September 19, 2007, 10:06:41 PM
I have looked for FTT on psp and I can't find it...I think then this just may need photoshop and might be wise for me to send back so someone who has it can fix it up...

Sanbie
Title: Re: Removing White Dots
Post by: Ausimax on September 19, 2007, 10:12:02 PM
sanbie,

I have just had another play with it and I managed to get rid of the photo texture with the Dust & Scratches set to Radius 6 Threshold 1

If you can't do this in PSP let me know and I will upload a copy of the image you could use.

Max
Title: Re: Removing White Dots
Post by: Tess (Tassie D) on September 19, 2007, 10:49:05 PM
Hi Sanbie. I ran RT's wd3 on the face twice with the eyes and mouth deselected and it smoothed the features out fairly well. You can see the difference round the mouth how much it reduced the white dots.
I thought you had photoshop too? You can always copy/paste into PSP. The FFT filter will work in PSP.
I gotta go buy a new mouse, have worn out the right click lol so hope this helps a bit.

(http://i24.photobucket.com/albums/c5/tassie_devil/OPR/th_BoudreauxE_20_14.org1.jpg) (http://i24.photobucket.com/albums/c5/tassie_devil/OPR/BoudreauxE_20_14.org1.jpg)
Title: Re: Removing White Dots
Post by: sanbie on September 19, 2007, 11:01:20 PM
Ok back to the drawing board then!! Thanks everyone...

Sanbie
Title: Re: Removing White Dots
Post by: Ausimax on September 19, 2007, 11:15:01 PM
Here is the other file sanbie, with all this help you should have enough spare parts to build several.


(http://www.divshare.com/img/thumb/2038527-646.jpg) (http://www.divshare.com/download/2038527-646)

Max
Title: Re: Removing White Dots
Post by: sanbie on September 20, 2007, 04:06:45 AM
I have tried and tried and no matter what I do I cannot seem to do this photo justice so I am going to return it for someone else to have a go with it...

Thanks for all your help though

Sanbie
Title: Re: Removing White Dots
Post by: Hannie on September 20, 2007, 06:45:30 AM
That was a hard one Sanbie, I've tried for hours and nothing looked good enough, picture always came out looking too painted.
Can't blame you for sending this one back!

Hannie
Title: Re: Removing White Dots
Post by: sanbie on September 20, 2007, 08:39:24 AM
Yeah I got it to the point of the dots not been that bad..but then when I used the healing tool..it just went worse...I couldn't seem to judge this one at all...

Sanbie
Title: Re: Removing White Dots
Post by: Hannie on September 20, 2007, 10:50:27 AM
Problem with those white dots arise when they cover the areas of the face!  Any other area looks acceptable after cleanup but never the face!  Aaargh!   :mad:
Title: Re: Removing White Dots
Post by: schen on September 21, 2007, 06:37:48 PM
I manually healed the white spots on the face, veil and the surrounding area; duplicated the layer and use Max's method to clear the rest of the white spots.  That slightly blurred the whole picture.  Then I masked out the face and veil of the duplicated/blurred layer.  The result is a compromise of sharpness and time.  I tried to manually clear the flower arrangement in the background but found that I actually prefer the blurred background.

Any comments?

(http://i195.photobucket.com/albums/z298/schen_album/OPR9__before.jpg)

(http://i195.photobucket.com/albums/z298/schen_album/OPR9_after.jpg)
Title: Re: Removing White Dots
Post by: Hannie on September 21, 2007, 07:00:54 PM
Hi Chen!

The slight blurring in the background makes the beautifully restored bride stand out even better!  Amazing job,  really well done!  :up2:
Now Chen, if you really are in desperate need of a single little comment, here goes: the area in the background on the right of the bride's head could be just a tiny bit darker (burn tool?).  (It really isn't even worth mentioning...)

Hannie
Title: Re: Removing White Dots
Post by: Ratz on September 21, 2007, 07:11:20 PM
Beautiful job Chen!
Title: Re: Removing White Dots
Post by: schen on September 21, 2007, 07:34:54 PM
Thanks Hannie.  It was definitely worth mentioning.  That area had the worst white spots besides the bottom.  The scratch removal blended in a little bit of white.  I will burn the area.

The bottom was worse but I manually reconstructed.  It is a little reddish.  I think the red tint is from the reflection of the red carpet.  I am debating whether I should remove the tint.
Title: Re: Removing White Dots
Post by: sanbie on September 21, 2007, 07:43:30 PM
 :wnw: What a beautiful restore Schen..they will be rapt to get this one back!!

Sanbie
Title: Re: Removing White Dots
Post by: Tess (Tassie D) on September 21, 2007, 08:25:46 PM
:up: Beautiful job schen.
Title: Re: Removing White Dots
Post by: glennab on September 21, 2007, 09:43:16 PM
Hi Chen

One word: awesome!

Glenna
Title: Re: Removing White Dots
Post by: Mhayes on September 22, 2007, 01:22:43 AM
Chen,

Really beautiful job!

Margie

Title: Re: Removing White Dots
Post by: Hannie on September 22, 2007, 03:43:11 AM
Chen, I just also noticed how you rebuild the bottom of the gown: a dressmaker worthy!

Hannie
Title: Re: Removing White Dots
Post by: schen on September 22, 2007, 06:29:41 AM
Thanks Hannie,

It was the photos from Max with the complete bottom of the same wedding gown that helped me to reconstruct it.

I did darken the area behind the face to the right.  Thank you for pointing that out.  I know  if you can see it, somebody else will.

(http://i195.photobucket.com/albums/z298/schen_album/th_OPR9a_after.jpg) (http://i195.photobucket.com/albums/z298/schen_album/OPR9a_after.jpg)
clickable thumbnail
Title: Re: Removing White Dots
Post by: Hannie on September 22, 2007, 07:11:52 AM
Wow, looking great, send her home!  :up:

Hannie