Dark Frame Subtraction


When I began taking long-exposure photos of the night sky last year, I noticed that any shot over three seconds required an equal amount of time before the camera was able to take another shot.  This was a mild annoyance at three seconds, but it became a real problem as my exposure times approached one minute.  At first, I thought the camera was running some complex compression algorithm, but a little research on the internet told me that it was due to Dark Frame Subtraction (or DFS).

What Is DFS?

My technical knowledge of camera sensors is limited, but here’s the basis of my understanding:  When a camera takes a long exposure, the sensor begins to generate enough heat to affect the image.  This creates a purple haze and random hot pixels, as in the photo below.

To compensate for the unwanted noise, the camera takes a second photo of equal length without actually exposing the sensor.  The image produced contains only the unwanted noise and is called a “dark frame.”  Here’s what a 50 second dark frame looks like from my camera.  Click on the image to see all of the hot pixels.

After both photos are taken, the camera automatically subtracts the noise in the dark frame from the original image.  The resulting image looks like this:

How Does DFS Affect Time Lapse?

If you snap a few pictures a night, in-camera DFS might benefit you.  If you want to make time lapse videos, DFS is prohibitively long.  Star photography with a point-and-shoot might require one minute exposures, so a five second video could take over three hours to photograph.  Without DFS, that same video would take one and a half hours.  Even if your battery would last for hours of constant use, the sky doesn’t stay completely dark all night.

The Solution

The good news about DFS is that the same dark frame can be used on all of your photos as long as the exposure time stays the same and the camera doesn’t change temperature too much.

Begin by acclimating your camera to the outside temperature.  Then, turn off DFS.  You can check your manual to see if this is possible, or you can set the “Dark Frame Subtraction” in CHDK to “Off” if you have it installed on your camera.  You can find this setting from the main menu under “RAW parameters,” but you don’t have to shoot in RAW.

Next, choose how long you want your exposure to last.  Once this is determined, take a dark photo by leaving your lens cap on or by otherwise completely blocking light from reaching the sensor.  Now that you have your dark frame, take your photos as normal.

Manually Subtracting the Dark Frame

I went through a bunch of websites and trial software before I found this website with a simple Photoshop action that does the trick.  The Photoshop action is about halfway down the page.  The website also has a good overview of DFS that’s probably worth reading if you have any further questions.

Finally, batch process all of your photos using the DFS action and you should have a pretty good series of photos that took only half as long to photograph.

Related posts:

5 thoughts on “Dark Frame Subtraction

  1. “When a camera takes a long exposure, the sensor begins to generate enough heat to affect the image”.
    Friendly slight correction: The camera and sensor don’t get any hotter during the exposure. “Hot” pixels are brighter simply due to imperfections in the CCD sensor chip whereby pixels (and often just the R, G, or B “channel” of those pixels) produces a falsely high reading due to electrical leakage, etc. The “haze” is due to electrical noise in the sensor, and that noise does decrease with temperature. But it doesn’t go away until you get the sensor down to absolute zero (minus 273.something degrees C!). So the short solution: Take a dark frame and subtract :-).

Leave a Reply

Your email address will not be published. Required fields are marked *

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box