Dark Current and Dark Frame Subtraction.

0
861

All sensors during their operation produce a type of electric charge called Dark Current. The Dark Current arises from the thermal energy accumulated in the silicon structure of our sensors. This energy releases electrons that are captured by the photodetectors and added to the signal. Therefore, the longer a sensor remains active, the warmer it gets and the more dark current it produces.

This accumulation of electrons in the photodetectors does not occur uniformly, but produces more or less “hot” pixels, better known as Hot Pixels. Fortunately, this distribution of hot pixels forms fixed patterns, which vary depending on the operating time of the equipment, exposure, or ambient temperature, which is why good scientific camera sensors are cooled. However, although the distribution of Hot Pixels is fixed, their intensity is random, so it is usually not feasible to completely eliminate a Hot Pixel, although it can be greatly mitigated. We must not confuse a Hot Pixel, which is the result of an overexcited photodetector, with a Dead Pixel, which is the result of a faulty photodetector.

hot_pixelThe technique to eliminate these hot pixels resulting from long exposures at high ISOs is known as Dark Frame Subtraction (DFS).
These Dark Frames are obtained by taking an image under the same shooting conditions (exposure time, ambient temperature, usage time, etc.) as the scene we need to “clean” but without any light, that is, with the lens cap on and even the viewfinder cap also placed. In this way, we obtain an image where only the electrons from the dark current contribute to the signal.

Many photographic devices, if not almost all, incorporate this function more or less unclearly under approximate names such as “long exposure noise reduction,” “long exposure NR,” etc. What our device does internally is to shoot a Dark Frame immediately after our shot and subtract it from the resulting raw file. Be careful not to confuse this with noise reduction functions, which are based on smoothing algorithms, pattern removal, etc., of the image.

Although the Dark Frame is associated with noise removal, some authors argue that the concept is not very appropriate, since noise is any unwanted signal that appears with random patterns, whereas Hot Pixels form fixed patterns (in distribution but not in intensity). Therefore, the Dark Frame technique is simply the removal of unwanted signal rather than noise removal per se.

Unfortunately, subtracting a Dark Frame from an image helps greatly mitigate large intensity variations in certain pixels (Hot Pixels); however, at the same time, noise is added to the image. This is caused by the read noise of each pixel, which is random, so after a subtraction operation, it is not eliminated but rather added, experiencing an increase of 21/2. Therefore, instead of subtracting a single Dark Frame, it is sometimes advisable to average a small stack of them to minimize random noise, and then use this averaged Dark Frame for the subtraction operation.

Some practice with Dark Frame Subtraction

The practice of Dark Frame Subtraction is actually quite simple, especially if we do it on the camera itself, which only requires locating the menu that activates this process. When done in-camera, we must consider that it will take twice as long to take each photograph, since after each shot the camera executes another with the mirror down and shutter closed, obviously. However, there are several strategies that can help us improve the results:

The theory of Dark Frame Subtraction suggests that the operation should be performed in raw mode, since if done after demosaicing, this can affect the distribution of Hot Pixels. To generate a Dark Frame in DCRAW, we must use the following command:

dcraw -D -4 -j -t 0 Img0008.NEF

This generates an image file without demosaicing in pgm format. Then we can load it with:

dcraw -v -T -K Img0008.pgm Img0010.NEF

This way we incorporate our Dark Frame into the development process, obtaining an image free of hot pixels.

Most astrophotography programs (DeepSkyStacker, Linkeos, etc.), where this process is common, usually work directly with raw images and often give us the option to work with image stacks to create averages of these.

However, this process can also be performed with more or less success, and especially as an exercise to internalize the process, with imageJ and even with Photoshop layer blending.

substract images imageJIn imageJ, in the Process menu we have the Image Calculator option that allows us to perform basic mathematical operations between two loaded images, including Subtract or Difference.

If we want to experiment with averaging stacks of Dark Frames, we can load several Dark Frames, create a stack from the Stacks menu (Images to Stack), and in the Z Project menu we can use Average Intensity to create a new Dark Frame resulting from the average of the previous ones. This will allow us to have a new Dark Frame with reduced random noise.

With a little practice, we may not notice increases in noise of the random type, but we will realize that our images have a similar level of random noise, yet our Hot Pixels as well as certain patterns caused by dark current have disappeared.