Experiments in noise reduction

Hi folks, it’s been a while I didn’t publish anything. I’ve been in holidays, went to some trips and slept a lot (I need that)! However, I do photography a lot. And do some experiment in my camera…

I want to explain what I found about “Noise” and “Noise Reduction” in my Digital SLR. How much do you know about digital photography? Do you know how the sensor work? Have you ever noticed to red or green noisy pixels in long exposure photographs?

You all know that ,in digital photography, we have a digital sensor instead of film negative. The CMOS sensor, now it is available in most DSLRs, convert the light into signals of electricity. Every pixel has three channels of Red, Green, and Blue; so it signal the luminance of light in each channel by electric voltages. And the processor of camera translate the voltages into colors. The range of color in 8-bit pictures vary from 0 to 255 for each channel. And it means we have 256*256*256 ~ 16 millions color from pure dark [0 0 0] to pure white [255 255 255]. So you can guess how color range is in 16-bit RAW captures…

The CMOS sensor is not perfect; It always has noises, of course electric devices have electric noises. This noise is escalated in some condition. Long exposure, high ambient temperature of CMOS, and high ISO can boost the noises. I guess long exposure increase the probability for noise occurrence; High temperature potentially create electrical noises; And in high ISO the camera amplify noises as well as signals.

However, most cameras have a feature to reduce the noises: Noise Reduction. The mechanism is simple. If you enable this feature, the camera capture a “Dark Frame” or closed-shutter frame after taking each photo. For example, if you take a photo with ISO 400 and 1/4s, the camera take a dark frame with the same configuration right after the original frame. Then it subtracts the luminance of pixels of dark frame from original frame. For example if the first pixel in original frame has [20 30 50] (RGB) coler, and the corresponding pixel in dark frame has [10 0 20]… The output of Noise Reduction process for the pixel will be [10 30 30]… becoming more green. So the dark frame is not exactly pure dark… the noisy pixels in dark frame are deviated from pure dark [0 0 0].

As I made many long exposure photos till now, I want to know the performance of Noise Reduction in my camera. I have a D3200 Nikon. So I designed three experiments:

  1. How does the exposure affect the noises?
  2. How does the ISO affect the noise?
  3. Does the Noise Reduction really reduce the noises?

As I don’t have lab, make the work so simple. I took several dark frames; Using body cap and eyepiece cap, I prevent any ray of light to enter the camera, in fact, I captured manual dark frames. To find the relationship between exposure time and noises I took 14 frames vary from 1 to 3600 seconds in ISO 100. Similarly, took 8 frames from ISO 100 to 12800, exposing for 30s. And finally, I took 10 continues frames with the same configuration: ISO 100, 30s. All the frames has been taken in same condition, in RAW format, in room temperature and almost the same battery charge.

Luminosity Histogram for Frame 5193, ISO 100 30s

Luminosity Histogram for Frame 5193, ISO 100 30s

Then I imported the samples into CS6 Photoshop to gather the data of luminance histogram. You probably now that the histogram shows the statistic of picture’s luminance. From the left to right, it shows the quantity of pixels in the same luminance, varying from 0 to 255. So in pure dark frame we must have a single line on 0 point. Other levels in dark frame histogram are noise! Fortunately the histogram in Photoshop calculates the Mean, Standard Deviation, Median, and custom pixel count. So I got those data for each frame and fill my spreadsheet… You should know that I love spreadsheets!! Let me explain the indexes and numbers:

  • Mean: The average luminance of all pixels in the frame. For example, Mean=0.19 is a very dark photo, but it is not pure dark. So we have 0.19 out of 255 intensity of noises. I made this index in percentage to use in diagrams.
  • Standard Deviation: It is a statistical index showing the distribution of luminance around the Mean. So, 0.42 in Standard Deviation says almost all noises have luminance between 0 to 1.50 (~ 0.19 + 3*0.42).
  • Median: If we sort the pixels by their luminance, the pixel just in the middle is Median. Median of 0 means the middle pixel is pure dark.
  • Noise Count: It simply shows the total number of noisy pixels. In this experiment all the pixels except pure darks are counted in this index. I made this index in percentage to understand it better. The D3200 Nikon has 24064000 pixels (24 Mega-pixel), so 4502401 noisy pixels fill %18.71 of the frame.
  • Max. Noise Luminance: The luminance of “noisiest” pixel. I didn’t use this index in my analysis.

The Mean percentage and Noise Count percentage are the keys to this experiment. The Mean indicate the intensity of noises. The higher Mean, the higher luminance in noisy pixels. You can guess, the Noise Count easily shows the distribution of noisy pixels.

Frame ISO Exposure Mean Mean percentage Standard Deviation Median Noise Count Noise Count percentage Max. Noise Luminance
5139 100 1 0.19 0.07% 0.42 0 4502401 18.71% 15
5140 100 2 0.15 0.06% 0.38 0 3525642 14.65% 46
5141 100 5 0.19 0.07% 0.43 0 4309046 17.91% 31
5142 100 10 0.17 0.07% 0.46 0 3564641 14.81% 58
5143 100 20 0.32 0.13% 0.62 0 6592974 27.40% 89
5144 100 30 0.30 0.12% 0.74 0 5526129 22.96% 123
5146 100 60 0.55 0.22% 1.23 0 7730614 32.13% 180
5147 100 120 0.98 0.38% 2.22 0 9201876 38.24% 228
5148 100 180 1.66 0.65% 3.29 0 11287190 46.90% 241
5149 100 300 2.96 1.16% 5.21 1 13501242 56.11% 255
5150 100 600 6.65 2.61% 9.33 3 17144496 71.25% 255
5151 100 1200 14.18 5.56% 16.72 9 19622153 81.54% 255
5152 100 1800 29.48 11.56% 26.21 23 22934707 95.31% 255
5153 100 3600 53.75 21.08% 40.75 43 23676865 98.39% 255
5179 100 30 0.29 0.11% 0.72 0 5308021 22.06% 125
5180 200 30 0.5 0.20% 1.27 0 6615608 27.49% 183
5181 400 30 1.33 0.52% 2.57 0 10870764 45.17% 231
5182 800 30 2.81 1.10% 4.78 1 13951917 57.98% 240
5183 1600 30 5.43 2.13% 8.16 2 15351789 63.80% 255
5184 3200 30 9.07 3.56% 12.45 3 16702686 69.41% 255
5185 6400 30 15.70 6.16% 19.63 7 18612869 77.35% 255
5186 12800 30 31.02 12.16% 28.93 17 24050833 99.95% 255
5193 100 30 0.31 0.12% 0.85 0 4957425 20.60% 155
5194 100 30 0.39 0.15% 0.91 0 6304489 26.20% 154
5195 100 30 0.55 0.22% 1.00 0 8840808 36.74% 154
5196 100 30 0.56 0.22% 1.02 0 8760061 36.40% 158
5197 100 30 0.49 0.19% 0.95 0 8054455 33.47% 158
5198 100 30 0.32 0.13% 0.86 0 5317931 22.10% 159
5199 100 30 0.37 0.15% 0.91 0 5997134 24.92% 159
5200 100 30 0.39 0.15% 0.94 0 6236514 25.92% 159
5201 100 30 0.43 0.17% 0.98 0 6703038 27.86% 161
5202 100 30 0.40 0.16% 0.97 0 5984595 24.87% 160

As you see in the table, the minimum Noise Count percentage is %14.65 in frame-5140. Do you want to see how do %14.65 noises affect the picture? I changed the pure dark pixels to pure white to show the noised better. However the Mean for this frame is 0.15, too little to affect the whole picture. You see, in higher exposure and higher ISO, we have both higher intensity and higher distribution of noises. Watch the two pictures below, frame-5152 and frame-5186. Here we have higher luminance in Red channel.

ISO 100 2s Pure dark replaced with white in frame 5140

ISO 100 2s
Pure dark replaced with pure white in frame 5140

ISO 100 1800s Frame 5152

ISO 100 1800s
Frame 5152

ISO 12800 30s Frame 5186

ISO 12800 30s
Frame 5186

Exposure - Noise diagram in ISO 100

Exposure – Noise diagram on ISO 100

ISO - Noise Diagram in Exposure 30s

ISO – Noise Diagram on Exposure 30s

You can see the diagrams for the exposure and ISO. Here I can conclude about the edges of my camera. The longest exposure in ISO 100 -for best performance of my camera- is about 30 to 60 seconds. I will never go farther in future. And the highest ISO for optimum performance is 200! Look at the higher numbers (ISO 400, 800, …) they are terrible! As I said before, the higher ISO amplify the electric signals/noises in CMOS. So you see the Mean in ISO diagram is doubled in every step, and it has linear trend.

Now we want to know if the Noise Reduction process reduce the noises or not. As I said before, the camera subtracts the luminance of dark frame from original frame. There’s a question: Do the noises repeat in the dark frame right after the original frame? Do the noises are occurred in particular “sick” pixels? To find the answer, I’ve done more analysis in Photoshop and my spreadsheet. Do you remember I took 10 frames in similar configuration? Now we want to see the diagram for the Mean percentage and Noise Count percentage.

Frame ISO Exposure Mean Mean percentage Standard Deviation Median Noise Count Noise Count percentage Max. Noise Luminance
5193-5194 100 30 0.12 0.05% 0.40 0 2359379 9.80% 41
5193-5194* 100 30 -0.05 -0.02% 0.65 0 5450840 22.65% 42
5193-5202 100 30 0.12 0.05% 0.41 0 2359121 9.80% 42
5193-5202* 100 30 -0.12 -0.05% 0.75 0 6620011 27.51% 41
5193-5202* Op. 100 30 0.00 0.00% 0.67 0 6255604 26.00% 66
5193-5202* Cr. 100 30 -0.11 -0.04% 0.69 0 2325616 11.93% 41
5193 R 100 30 0.94 0.37% 1.16 1 14807095 61.53% 143
5193 G 100 30 0.16 0.06% 0.66 0 2629810 10.93% 184
5193 B 100 30 0.71 0.28% 1.06 0 11701476 48.63% 149
Noise Control Chart for Frames 5193 to 5202

Noise Control Chart for Frames 5193 to 5202

As you see the Mean has been changed from %0.12 to %0.22; and the Noise Count from %20.60 to %33.47. I’ve done a statistical analysis to see if they had random behavior or not. We can assume the diagram as a control chart, so we can have Upper Control Limits and Lower Control Limits. The control chart show that the sample has almost random behavior.

In order to evaluate the performance of Noise Reduction, I’ve done the process in Photoshop; I added two frames (5193 and 5194) and chose Subtract in Blend Mode. The result was amazing. The Mean and Noise Count lowered consequently from %0.12 and %20.60 to %0.05 and %9.80! So I guess many noisy pixels are in the same location in both frames. I’ve done this process with non-consequent frames (5193-5202) and the result was the same…

But, there’s an error in this analysis… What if the Noise Reduction affect the correct pixels?! You know, the process blindly subtracts luminance of dark frame from original frame. So there might be a non-noisy pixel in original frame affected by corresponding noisy pixel of dark frame. To consider this error, I shifted the histogram to the right, by adding the brightness in 100 levels. And subtract the dark frame… you can see the rows 5193-5194* and 5193-5202*. I was right about the error. The Noise Count is increased after the Noise Reduction process. But the Mean is reduced. And it means expansion in distribution and reduction in intensity. We have to notice that the Mean means average and it is reduced not only by removing noises, but also by the negative noises. There is another point, in the table; the Max. Noise Luminance is decreased from 155 to 42 in all processes. So we can guess the very noisy pixels are repeated in all frames. The Noise Reduction will remove them in most cases, at least it lower the intensity of them.

The Noise Reduction feature will reduce the intensity of noises and increase the distribution of that. As I compare the 5193-5194 and 5193-5194*, I can say in dark condition it works better. Also, I can say it is almost no difference between consequent dark frame and non-consequent one.

Let me go to the enhancement of process… How can we reduce the noises to optimum point? And what is the optimum?! I consider two indexes in this experiment, Mean and Noise Count. You see, the Noise Count is higher in 5193-5202* than 5193. So the if you want to optimize the distribution of noises, do not perform Noise Reduction! How about the Mean? I change the “Opacity” of dark frame in Photoshop to reach the zero in the Mean. At %50 opacity of 5202, the Mean is become 0.00. Watch the row “5193-5202* Op.” all the indexes get better except for the Max. Noise Luminance.

Did you noticed the noises are occurred in margins of frame more frequently? What if we crop %10 from width and hight of the frame? Watch the 5193-5202* Cr. row in the table. All the indexes are enhanced, especially the Noise Count percentage has lowered from %27.51 to %11.93! And we still have 19.5 million pixel in the photo.

How about channels? Are the noises occurred equally in every channel? The beloved histogram in Photoshop has separate charts for Red, Green and Blue channel. The RGB histogram is a little bit different than Luminosity histogram. So we can’t compare the channels and Luminosity. The data in the table shows that we have more noises in Red and Blue channel (5193 R, 5193 G, 5193 B). The noises in Red affected %61.53 of frame! I don’t know, if it is related to temperature or not…How about the Green noises. You know we have Bayer pattern in CMOS, and it means we have %25 red, %50 green, %25 blue sensors like the retina of human eye. Do you think the less noises in Green channel is related to Bayer pattern?

File:Bayer pattern on sensor.svg From Wikipedia, the free encyclopedia

A bayer pattern on a sensor in isometric perspective/projection

In conclusion, I want to mention the application of my findings:

  • Do not take long exposures over than 60 seconds (even in the minimum ISO 100).
  • Do not take long exposures in ISO 400 or higher.
  • The Noise Reduction is working better in dark conditions.
  • You can disable the Noise Reduction, take a dark frame and do it manually in the Photoshop to the optimum point.
  • Consider the %5 to 10% margins for the frame. You may want to crop the frame to remove more than half of the noises.
  • Render the black and white long exposure photos with Green channel.

There are some limits in my experiment:

  • I consider my samples both as original frame and dark frame. So the noises are occurred in dark conditions. If I had a lab, I design another experiment with middle-tone and high-tone frames…
  • I took all the frames without exactly the same battery charge.
  • I took all the frames with my D3200 Nikon, that has been taken +50,000 frames during the 1.5 years till now.

 

Hope you enjoyed my findings! Please engage in this issue, and talk about your experience with noise in digital photography

Advertisements