Years ago I learned a Photoshop technique commonly used in astronomy photography (based on the median filter) to remove noise from high ISO images and the results I got back then were outstanding. A few days ago, I decided to set up a small product shoot to test how this technique is holding up, compared with the new noise reduction technology in Adobe Lightroom.
The Median Filter
Wikipedia defines the median filter as “… a non-linear digital filtering technique, often used to remove noise from an image or signal.” (Wikipedia)
The idea behind this mathematical concept is quite intuitive: given a list of numbers sorted in ascending order, we define median as “the value in the middle”. Let’s see some (simple) examples:
median(8, 1, 0) = median(0, 1, 8) = 1
median(100, 12837, 123) = median(100, 123, 12837) = 123
and so on. As we add more numbers, calculating the median value requires a stricter math definition and, if you want to learn more, I suggest to start with the following two articles:
Median Filter, Wikipedia, for an overview
Image Filtering, University of Auckland, for a deep dive on the math behind median and image filtering
Why Does It Matter for Photography?
Imagine you have to shoot a scene at a very high ISO, say, 25600 and above. In such a scenario, you have the following three options:
You give up because the picture would be too noisy to be unusable
You take the shot anyway, and you will apply some noise reduction in post-production
You take several shots of the same scene and then you apply the median filter in post
If you opted for the last option, here's an overview of how the median filter will come to rescue your image and save the day! But for this filter to perform at its best, you have to satisfy the following three conditions:
The camera is on a tripod, so that frame does not change over time
The camera is in manual mode so that exposure does not change over time
You take at least 5 shots of the same scene, at the same exposure
With all the 5 images stacked and aligned one on top of another, and for each given pixel location, there will be 5 different pixel values, because noise introduces pixel’s value fluctuation.
In our example, we will have 5 values for the Red channel, 5 for the Green and 5 for the Blue, as follow:
Red (139, 145, 150, 151, 191)
Green(166, 176, 200, 207, 215)
Blue (49, 65, 87, 91, 100)
By applying the median filter to the 5 values for each one of the RGB channels, we will end up with one single layer, with the following median pixel values:
RGB (150, 200, 87)
Now, since neither the scene nor the exposure changed in all 5 images, the only thing affecting the value of a pixel id noise, and that is the key: by getting rid of that value fluctuation, we do get rid of noise itself.
How to Apply Median Filter in Photoshop
Assuming you have imported all your images in Adobe Lightroom:
Click on the first image of the series and, holding down SHIFT, click on the last one: this will select all the images of the stack
Right-click on one of the selected photos and then “Edit In” -> “Open as Layers in Photoshop…”
Even when I shoot on a tripod, I always let Photoshop align the layers for me to get rid of any micro-movement that might have happened during the shooting. To do so, once the import process is done:
Select the top layer and, holding down SHIFT, click on the bottom layer
Menu: “Edit” -> "Auto-Align Layers…“
In the Auto-Align Layers pop-up, make sure to have “Projection” set to Auto and click “OK”
Photoshop will go through all your layers to align them so that they can be perfectly stacked, on top of each other.
After aligning the layers, you may end up with some transparent background showing up at the edges of the images (see screenshot below): that is caused by the alignment process which involves moving and rotating images. If that's the case, just crop the image to get rid of that transparent part.
Now you are ready for the last two steps:
Repeat the process of selecting all the layers in the Photoshop document (Select the top layer and, holding down SHIFT, click on the bottom layer)
Right-click next to one of the layer's name; not on the layer name, just next to it!
Select “Convert to Smart Object”
Photoshop will create a new smart object for you: at the end of the process you will end up with only 1 layer in your document, the new smart object. But do not panic! Your layers did not disappear: they are stacked inside that smart object. To see them, just double click on the smart object's icon and a new tab will open showing all your layers.
Close the new tab and go back to the original document containing the smart object to finally apply the median filter to get rid of all the noise in your image!
Click once on the smart object just created
Menu: “Layer” -> “Smart Objects“ -> "Stack Mode“ -> "Median“
Let Photoshop apply the filter and, when done, all the noise in your photos will be gone!
In the screenshot below, you can see a comparison of results achieved by applying different techniques, specifically:
Original photo, with no noise reduction nor median filter appied
Median filter applied to 3 stacked photos
Median filter applied to 5 stacked photos
Median filter applied to 8 stacked photos
Median filter applied to 12 stacked photos
Original photo with Lightroom noise reduction applied (50% of noise reduction)
As I wrote at the beginning of the article, the point of this test was for me to compare a technique learned years ago with today's software noise reduction algorithm, and here's my take on it.
Despite the advancement of technology with software becoming better and better, I still find that the median filter is by far superior to the Adobe Lightroom noise removal filter.
The 12 stacked images with the median filter applied, preserve a lot of details with almost no noise, and I worked with images shot at 25600 ISO.
On the other side, the single picture treated with Lightroom it does show a lot of noise and I had to stop the noise reduction slider at 50% because beyond that, I was starting to lose important details in the image making the picture look plasticky.
How many images should you stack together to get the best result? I did run a few tests with stacks of 3, 5, 8 and 12 images and, as you can see in the graph below, I have noticed that the amount of noise decreases with the number of images stacked together, following a non linear curve: you will notice great improvements from a single shot to 3 stacked images but, as you add more pictures to the stack, the improvements tend to be less noticeable.
For me, 5 stacked images are the sweet spot: not too many images for Photoshop to process, but enough to get rid of the majority of the noise and still retain lots of details.
Did you know this technique? What do you think about it? Leave a comment down below to let me know your thoughts and don't forget to subscribe to my YouTube channel.