PDA

View Full Version : Tutorial: Masking for Noise Reduction (Big!)


Scottes
23rd of November 2004 (Tue), 20:36
This is a little tutorial on building a mask to protect edges from noise reduction software.

NOTE: This tutorial seems to require noise reduction software that can be run as a Photoshop Plugin. But at the end I list steps to put this tutorial to use when you use a stand-alone noise reducer. You can still get back your detail!

And this whole masking process has a lot of uses, so you might wish to read on anyway.



Noise is most apparent in open areas that don't show much detail. Details in an image will generally hide noise, or at least noise isn't so apparent. So it's a good idea to protect the detail because NR software will remove detail along with the the little noise speckles. This loss of detail can soften the edges, so we're going to protect them with a mask. The NR software will run on the rest of the image, leaving the detail - the edges - untouched or barely touched.

First we'll start with a noisy image. This is a 100% crop of a finch who stumbled near my bird feeder that I have conveniently placed within range of a window. Alas, this day was overcast, so I had to bump the ISO to 1600 to get a decent shot.

http://www.itsanadventure.com/postimages/nrtut-org.jpg

Kinda ugly. But you'll notice that the noise is most apparent in the open section, the background, as well as the plain colored beak. The edges of the feathers don't show much noise because the details of the feathers help hide the noise. But yet the open areas of individual feathers show noise.


To build our mask we first want to flip to the Channels tab and click on each of the channels, Red, Green and Blue. We're looking for the most contrasty channel - the one with more apparent details. In my case it was the green channel. So I'll right click on the Green channel and duplicate it.

http://www.itsanadventure.com/postimages/nrtut-channels.gif

A pop-up box will, amazingly enough, pop up and ask you for a name. I stretched a bit and chose "Mask" which I thought was a good choice. The Mask channel will be selected now, and you'll see a grayscale version of the bird.

In order to make the mask to protect the edges we first will find the edges. Choose Filter... Stylize... Find Edges.

I now have this:

http://www.itsanadventure.com/postimages/nrtut-findedges.jpg

Yep, it found all the edges, and also found all the edges of the noise, too. Not to worry, as we'll fix that later.

Also, all the edges are kinda dark grey, which isn't ideal. In Photoshop a mask is a grayscale image, with Black designating the areas to be completely masked (protected) and White designating areas not to be masked at all. Shades of gray in between designate the amount of masking to be done.

This is a very important concept here. Black areas will be completely masked and any noise reduction you do to the image will not be done AT ALL to these areas. White areas will get noise reduction at full power.

So of course we want the edges to be very black while everything else is very white. So we want to increase contrast in this mask to drive everything to black and white. We'll do that with Curves.

Bring up Curves (Image... Adjustments... Curves, or Ctrl-M). Click on the little dot in the lower left corner, the Black Point, and drag it towards the middle but keep it at the bottom. Now click on the upper right corner and drag the White Point to the middle at the top. Your "curve" should now be a straight light going up and down.

If you check out the image you'll see that it's now pure black and pure white, but the lines are very thin. They're not wide enough to cover the detail completely - they'll only cover the center of the detail. We want the lines to be wide enough to completely protect the edges. So grab that white point and drag it back towards the right. The lines will get a little wider...

I chose this:

http://www.itsanadventure.com/postimages/nrtut-curve1.gif

Which got me this:

http://www.itsanadventure.com/postimages/nrtut-curve1result.gif

Note that most of the speckles in the background are gone. We're still going to fix this later.


Each image will be different though. An image of a bird has a lot of small details so I want a lot of thin lines - the mask is just as detailed as the image. If you had a picture of a car, with less but larger details, you'd want less but wider details in the mask. So play with the Curve depending on your image.


Right now my bird looks good.

Except for two things: the speckles in the background, and the fact that this mask would make for very hard edges. We don't want hard edges, - it looks better if you smooth the change from complete NR (white) to no NR (black). We're going to make the transitions smoother by blending from white to black - yep, were' going to add some shades of gray.

Then we're going to get rid of those ugly speckles. No worries.

To add the shades of gray we're going to blur this mask using Gaussian Blur. Choose Filter... Blur... Gaussian Blur. I chose a Radius of 1, which is about the limit for this image because more would start to blur the lines together. We don't want this, so 1 works for this image. (Again, with a car you might want 2 or 3 or...)

I got this:

http://www.itsanadventure.com/postimages/nrtut-blur.gif


Now to get rid of the speckles. Click on Filter... Noise... Despeckle. No options, and it got rid of some of the noise, but not much really. I could have run this early - before the blur - but I feel that it can destroy too much detail in the mask. It's up to you and your image.

But the noise is unacceptable here, so I'm just going to grab the Pencil tool and "erase" the speckles with white. I use the pencil here because it uses a hard edge, rather than the soft anti-aliased edge of the Brush. Just my preference.

Erasing the speckles this way is easy because I have such a large, clean background. Your image may be different, and erasing may be a pain. So try undoing a couple steps and try running Despeckle before the Blur. It all depends on the image.


So far, I now have a blurred despeckled mask, but it's too gray. I want Black to completely protect the edges. So back to Curves to increase contrast. But this time I'm just going to drag the black point over towards the middle and leave the white point alone. If you drag it too much you'll drive all the grays to black and detroy the smooth transitions, so don't go overboard.

I choose this Curve:

http://www.itsanadventure.com/postimages/nrtut-curve2.gif

Which gave me this:

http://www.itsanadventure.com/postimages/nrtut-curve2result.gif


Looks good. Even better, we're almost done.

Click back on the Layer tab, and click on the Background layer, and you'll be back to the original image.

? ? ?

No worries. The channel is saved, we never deleted it. Now we just want to load the Mask channel as a selection. Simply click on Select.. Load Selection.. and chose the Mask channel. Suddenly the image is covered with those annoying marching ants.

http://www.itsanadventure.com/postimages/nrtut-selected.jpg

Since they're annoying - and hide too much because they're in the way - hide the ants by pressing Ctrl-H. You're back to the original image, but the selection is hidden, so now you're ready to run the noise reduction software.

I use Neat Image, and I run it a little stronger than normal because I know that the important parts are protected by the mask. By the time the NR is done, I get a nice looking image.

Here's a before and after:

http://www.itsanadventure.com/postimages/nrtut-ba.jpg

(Note that it hasn't been sharpened yet.)

As a comparison, here's the original next to a copy where I ran NR without a mask. The image on the right is what I used to get, and the NR is about 20% less than used above!

http://www.itsanadventure.com/postimages/nrtut-ba-nomask.jpg


So this was an mask used to protect the edges during noise reduction. Think about sharpening for a second... You generally want to sharpen only the edges and not the open areas, right? This same process can do it, but after you run Find Edges simply Invert the image using Image... Adjust... Invert. You'll end up with a mask that will protect the open areas from sharpening, and the sharpening will just run on the edges! Cool!


Now what if you run a noise reduction program that's standalone, one that can't run as a PS plugin? Well, this tutorial can *still* work for you with a couple extra steps.

You'll need 2 copies of the image - the original, and one where you ran noise reduction outside of Photoshop.

1 ) Open them both in Photoshop.
2 ) Run this tutorial on the NR'd version to get the edge mask.
3 ) On the original, click on the Background, hold the mouse button down and drag the background to the NR version.
4 ) The NR version will now have 2 layers with the original on top.
5 ) Click on Select... Load Selection... Mask.
6 ) Ctrl-H to hide the selection.
7 ) Hit the Delete key.
8 ) On the top layer (the Original image) click on the Eye icon in the Layer palette. This will turn the layer off. Click again, and turn the layer on. You'll see the nice noise reduced image, but with the top layer on some of the detail will come back. If it's difficult to see the difference re-run the tutorial and make the mask stronger (blacker).


Now all that seems like a lot of work. It's not so bad once you run it a few times. But Since you read through this whole tutorial I'll give you a bonus - my Action for this.

http://www.itsanadventure.com/postimages/NRMask.atn

Right click and save this to your Actions directory, which for me is C:\Program Files\Adobe\Photoshop CS\Presets\Photoshop Actions. Go back into PS, click on the Action tab, then the little triangle to the right of the Actions tab. Click on Load Actions, and choose NRMask.atn. That's it, you now have my action for the above tutorial. Use it freely, modify it freely, give it to your friends.

Some of the steps in the action, like despeckle, are automatic and just run. Others, like all the Curves, wait for your input which is explained above. If you don't like my choice for Gaussian Blur, expand the action and click on the empty square next to the checkmark. Now theaction will pause and wait for you to change the radius.

But please, if you cheated and just came to get the action you'll be cheating yourself. Read the tutorial to understand what is going on. Then you can run the action with an idea of what you need to change.

Have Fun!


NOTE: As always, Photoshop gives you many ways to do things. There *are* easier ways than this, but this is what I developed as I was stumbling through it. Hopefully other, more experienced Photoshop users will add more tips to make this a better, easier process.

dsze
23rd of November 2004 (Tue), 21:37
Awesome Tutorial..... Thanks for the hard work it took to share this with us all!

Moppie
23rd of November 2004 (Tue), 21:39
Absolutly Awsome Tute Scottes, very well written, and very very easy to follow.

dtrayers
23rd of November 2004 (Tue), 21:47
Thanks, Scott!

This technique works with the Noise Ninja plugin as well. However, I just did some testing and to me NN works pretty well without the mask. I couldn't see much of a difference between with and without a mask.

I think that it might keep away from edges all by itself.

Might I suggest another way to get rid of the 'speckles'? After finding the edges and adjusting the darkness of the mask (I use Levels instead of Curves) try the Threshold adjustment. You adjust the slider to get rid of the speckles. Just don't do it too much or your nice edge lines run together.

tommykjensen
23rd of November 2004 (Tue), 22:46
Excellent work, I'll have to read this later though.

CyberDyneSystems
24th of November 2004 (Wed), 00:18
Thank you!

I just went through it step by step.. and it's not Cabalist Mysticism after all! It really works! :)

Jesper
24th of November 2004 (Wed), 01:59
I haven't read it all or tried it out yet but... thanks! :)

Scottes
24th of November 2004 (Wed), 06:39
However, I just did some testing and to me NN works pretty well without the mask. I couldn't see much of a difference between with and without a mask.

It may very well be that it doesn't show much difference. But with the mask you should find that you can increase the noise removal. The more noise removed the more sharpening you can do because sharpening magnifies the noise. And the more detail you keep will result in a better look when sharpened, too.

As you can see from the final examples there's not a huge difference. But the non-masked case had 20% less noise removal, and you can still see that the masked version kept a little more detail, and definitely removed more noise.

This is a way to tweak another 10% out of the photo. It may not be for everyone, and it may not be worthwhile for every image.


Might I suggest another way to get rid of the 'speckles'? After finding the edges and adjusting the darkness of the mask (I use Levels instead of Curves) try the Threshold adjustment. You adjust the slider to get rid of the speckles. Just don't do it too much or your nice edge lines run together.

Excellent suggestion, no doubt.

TonyKInTexas
24th of November 2004 (Wed), 06:59
I am not able to download the action because of permissions.

The tutorial is good though and I looked forward to using the action.

Thanks,

Scottes
24th of November 2004 (Wed), 07:07
I am not able to download the action because of permissions.

Fixed. Thanks for pointing that out.

TonyKInTexas
24th of November 2004 (Wed), 07:27
Got it. Thanks.

I am not able to download the action because of permissions.

Fixed. Thanks for pointing that out.

PacAce
24th of November 2004 (Wed), 09:40
Cool, Scott. I've used edge masks to sharpen parts [within the mask but I've never thought of using an inverted edge mask to "blur" out details or noises.

Thanks for the useful tip. :)

Tiger1
24th of November 2004 (Wed), 18:59
:D Scott,

As usual, thanks again for the help :!:
BTW, how do you know to create another tutorial on exactly the problem I can't solve :?: HeHeHe

Gene

kennyclark
25th of November 2004 (Thu), 02:26
Great tutorial, thanks for all your hard work.

Aylwin
25th of November 2004 (Thu), 20:13
Once again, an amazing tutorial, Scott! Thanks! :D

RinkRat
27th of November 2004 (Sat), 16:04
Scott,

Thank you so much.

Excellent tutorial.

I'm now re-touching all of my photos with this.

Thanks again.

Aylwin
30th of November 2004 (Tue), 04:57
I've had a chance now to try this out and also try the action.

A few questions/clarifications:

When doing this manually, one step is to hide the selection using Ctrl-H. After running the noise reduction, the selection is still there and one might proceed with other actions. It would be a good idea to remember to unselect right after. Or, simply leave the marching ants visible so you can easily remember to unselect.

Regarding the automated action. Does it always use the green channel? Is there any way to select which channel to use?

Scottes
30th of November 2004 (Tue), 07:10
As to Hiding the marching ants - they bug the crap out of me and I don't think they allow for a good representation of the final image because they obscure the edges. So I *always* Hide selection, but that's me and I'm used to it. But your comment about remembering to unselect is exactly why I didn't make it part of the action. :wink:


Regarding the automated action. Does it always use the green channel? Is there any way to select which channel to use?

Yes, it always using the green channel. More often than not the green channel is the more contrasty channel - at least I've been told this, and it proved true on the 5 or 6 images I looked at when I first developed this. I think this is because there are twice as many green sensors compared to blue or red.


To change the channel you'll have to make a copy of the action using another channel. There's no way to choose it when it runs.

To duplicate & change...

Highlight the action "NR Edge Mask" and click on the triangle to the right of the Action tab. From the flyout menu choose Duplicate. You'll now have "NR Edge Mask copy" so double-click on that phrase and you'll be able to rename it, like "NR Edge Mask Red"

Expand the "NR Edge Mask Red" action and click on the "Select Green Channel" step. Hit the little circle at the bottom of the palette (between the square and the triangle) to start recording and then click on another channel, like red. Now hit the square to stop recording. This will add another step, "Select Red Channel." Click on the "select green channel" again, then click on the Trash Can icon.

Now click on the action set "NRMask.atn" and then on the triangle to the right of the "Actions" tab at the top of the palette. From the fly-out menu choose "Save Actions"

PhotosGuy
2nd of December 2004 (Thu), 11:32
Very nice Scott. Keep it up! :wink:

vjack
4th of February 2006 (Sat), 09:40
Outstanding tutorial, even if the link for the action doesn't work. I've been using the tutorial to modify some of TLR's surface and edge mask actions.

Scottes
4th of February 2006 (Sat), 13:17
Outstanding tutorial, even if the link for the action doesn't work. Thanks vjack. The link looks correct and works for me. Did you right-click and save-as? Did you get an error?

However, I think its a waste to download given Mitch's actions. They are far superior to my simple action. (Mitch's masking toolkit can be found here (http://www.thelightsright.com/TLREdge&SurfaceMasks.htm) if anyone's looking for them.)

I've been using the tutorial to modify some of TLR's surface and edge mask actions. That's actually how I recommend this tutorial once Mitch made his actions available. This gives a good understanding of the process, and Mitch's actions make it easy. Understanding both is good when you want to fine-tune the mask to a particularly worthy image, too.

schmoelzel
4th of February 2006 (Sat), 14:17
Excellent Scottes! I have not used much NR software but with the 1D, sometimes NR would really help since the higher ISO's tend to have a lot of noise! Great tutorial!

Airedale1
25th of February 2006 (Sat), 10:13
Thank you so much.

Fangman
25th of February 2006 (Sat), 17:00
An excellent tutorial - saved it to Acrobat for future late night trials. Shame the link to your action did not work.

Hoping to visit your part of the world - wedding in Mystic so look forward to sampling the New England light in September.

Scottes
25th of February 2006 (Sat), 18:30
Thanks folks. The appreciation makes it all worthwhile.

As to the link to the action, it works for me. Right-click and Save As. Do you get an error or something?

NoLight
25th of February 2006 (Sat), 19:45
Wow thanx for the excellent write-up

MrV
11th of May 2009 (Mon), 15:07
tag for later

weezerfan84
17th of July 2009 (Fri), 14:15
subbed

Scottes
17th of July 2009 (Fri), 15:17
If you wish to subscribe to a thread, please use Thread Tools... Subscribe. There's no need to post a reply.

freebird
18th of July 2009 (Sat), 11:13
Great stuff, thanks for sharing!!

budo7
18th of July 2009 (Sat), 11:18
Thank you ! Great Tut. Easy to follow along

Grimlock
18th of July 2009 (Sat), 11:45
Thanks for this Scottes.

Very well written.

Scottes
18th of July 2009 (Sat), 18:57
You're all very welcome. I'm glad you all found it useful.


Heh heh. Funny how a tutorial written 5 years ago is still relevant, and still useful.

Again, just in case someone didn't read everything, don't forget to visit GMitchel's site, The Light's Right, for a heckuva lotta very useful tutorials and actions. Including one that does the above, with a lot of options. http://www.thelightsright.com/TLREdge&SurfaceMasks.htm

pigtailpat
19th of July 2009 (Sun), 06:45
Scott -

I use noiseware plugin instead of NN, is there a way to alter the action to link it to the noiseware plugin, or, should I just record the whole thing as an action for each channel?

Also, I am correct in understanding that the whole point to this method is to be able to use stronger noise reduction via the plug in than one normally would, because the edges are protected by the mask? That's the whole point to this method right?

Thanks. I am going to try this soon.

CyberDyneSystems
7th of June 2010 (Mon), 19:49
Yeah, it's been a year but,. :rolleyes:

...Once your familiar with the action and the steps involved,. you can either re-record a new one, or edit the existing action by re-recording that single step.

cuonghuutran
8th of June 2010 (Tue), 08:52
This tutorial is very useful. How come I did not think about it? BTW, the link http://www.thelightsright.com/TLREdge&SurfaceMasks.htm does not work!

You're all very welcome. I'm glad you all found it useful.


Heh heh. Funny how a tutorial written 5 years ago is still relevant, and still useful.

Again, just in case someone didn't read everything, don't forget to visit GMitchel's site, The Light's Right, for a heckuva lotta very useful tutorials and actions. Including one that does the above, with a lot of options. http://www.thelightsright.com/TLREdge&SurfaceMasks.htm

imranali
15th of February 2012 (Wed), 22:06
Thank you for the advice!!

Lookin forward to trying this!