12
$\begingroup$

I am currently involved in a project involving programming an imaging sensor. Our sensor is giving us noise, so we want to correct for it. Someone else on the project came up with the idea to take a "black" image i.e. put the lens cap on and take an image that is meant to be all black. (Obviously it is not due to noise) At this point on subsequent captures he takes the pixel values from the black image and subtracts them from the regularly captured image.

The image does look better and most of the noise is removed, however I am not convinced that this is the best approach for removing the noise due to the following:

The range of the fixed image is [-172 194] (366 values), versus the standard range of [0 255]. When it is redrawn it gets ranged back to [0 255], and it does look better, however I believe this is incorrect.

I should mention that the new image is taken in low light.

Is this method correct for removing the noise? Why or why not?

$\endgroup$

migrated from stackoverflow.com Jan 6 '12 at 21:19

This question came from our site for professional and enthusiast programmers.

  • $\begingroup$ This particular method ("black" image) is a form of sensor calibration, which isn't pure DSP (it's also related to physics, for instance - you need to model physical defects). For instance, this particular approach tries to compensate for hot pixel defects. $\endgroup$ – MSalters Jan 6 '12 at 15:00
  • $\begingroup$ agree with @PaulR $\endgroup$ – Simon Bergot Jan 6 '12 at 15:11
  • $\begingroup$ you can check the solution in this link: ardueye.com/pmwiki.php?n=Main.StonymanLens $\endgroup$ – selma May 17 '13 at 6:54
  • $\begingroup$ if we deal with Sattelite Images, the methods of calculation will be same? I mean how to calculate Black/white image for getting the pure values of Offset and Gain? Is there any code description of FPN calculation in Matlab? Thank you for any tips!!! $\endgroup$ – user7371 Dec 24 '13 at 20:01
12
$\begingroup$

The black image is the sum of a fixed pattern and dark noise (which most likely follows a normal distribution since it usually arises from current fluctuations). You want to subtract the fixed pattern, but not the dark noise - subtracting random noise from a signal simply increases the overall noise, and thus decreases signal quality.

To get a good estimate for the fixed pattern, you should capture a sizeable number of frames (say 25, though 100 will of course leave you with only half the noise), and average them. Since the dark noise is (should be) uncorrelated in time, it averages out, so that you're left with a low-noise fixed pattern that you can subtract from your future images, and that will not increase the noise in your image.

Note that the fixed pattern usually depends on the exposure time (a CCD camera, for example, may accumulate electrons during shift operations), thus you'll have to do a calibration for each exposure time. If you vary exposure times often, and if it's feasible, you can set up your experiment to capture a series of dark frames after each experiment, which means that you get a calibration for each experiment.

If you subtract a low-noise (i.e. averaged) dark frame, you will get some negative values (because the dark noise occurring during image acquisition can have negative values), but the range of your image should not increase significantly. If it does, it is a sign that you have either not averaged enough dark frames, or that the fixed pattern has changed since you're using a different exposure time.

$\endgroup$
  • 1
    $\begingroup$ I totally second @Jonas. If now you want to lower the dark noise on top of removing the constant pattern, the only solution is to cool the sensor. $\endgroup$ – Jean-Yves Jan 9 '12 at 7:35
  • 1
    $\begingroup$ This assumes that the fixed pattern noise is only "offsets". Many sensors with FPN also have gain variations in each pixel also, so when exposed to a "pure white" scene, there will still be FPN even after removing the offsets measured in the dark... $\endgroup$ – Martin Thompson Jan 9 '12 at 16:24
  • $\begingroup$ @MartinThompson: It's a good point, though in practice it can be very challenging to guarantee a "pure white" scene. That's why I never use any gain if I can help it :). $\endgroup$ – Jonas Jan 9 '12 at 19:50
  • $\begingroup$ @MartinThompson Martin, what is the best practice for correcting gain parameters. I cannot think of an easy way to make everything white at given exposure duration. $\endgroup$ – Ktuncer Oct 12 '12 at 13:59
  • 1
    $\begingroup$ @Ktuncer: I don't think you have to make it pure white - the brighter you can make it, the better you can correct though. As long as it's a uniform brightness across the scene you can use the average pixel value as the "target" to correct to $\endgroup$ – Martin Thompson Oct 15 '12 at 8:59
7
$\begingroup$

this approach is valid and is in fact used in some high end cameras: the sensor first shoot a photo with the shutter closed, and substract it to the "true" photo. This has two advantages:

  • it corrects the fixed pattern noise
  • it makes the image linear

This method may give different results for different exposure times.

The photonic noise is left untouched.

$\endgroup$
4
$\begingroup$

I think this depends on the sensor you're using.

You could take a series of (e.g. 10000) images with the lens cap on and compare the mean/standard deviation for each pixel. If possible, you could do the same for a uniform "bright" image (no overexposure, just uniform brightness).

If there are significant differences between the "dark means", subtracting the dark mean for each pixel is a good idea. If there are significant differences between (bright mean - dark mean) for each pixel, dividing by that "mean white image" might be an improvement, too.

But you really have to make these statistics to find out what makes sense.

$\endgroup$
3
$\begingroup$

Usually, negative values should be truncated to zero when you subtract the dark frame.

I am surprised that dark frame subtraction gives you values of -172. It means that:

  • Your noise level is high - at least 172 somewhere
  • Your noise varies a lot from frame to frame. In this case, dark frame subtraction is not very effective.

Can you post images of a normal frame, dark frame, and then the subtracted version?

$\endgroup$
  • $\begingroup$ The camera may attempt to correct for the low-light conditions by increasing the capture time. As a result, hot pixels will accumulate more noise. Also, the sensor reading may be non-linear in which case you can't subtract them at all. $\endgroup$ – MSalters Jan 6 '12 at 15:05
  • $\begingroup$ negative values should be truncated to zero when you subtract the dark frame. You shouldn't do that, since it will prevent you from doing a good job at denoising the dark areas of your image. It is better to keep the noise 'natural' before you really attempt to remove it. $\endgroup$ – Simon Bergot Jan 6 '12 at 15:08
  • $\begingroup$ This was my issue with the method, if you don't truncate the values to zero then you are left with a larger range than an image should produce, so when you rescale it you seemingly gloss over data, versus truncating values which also seems to prevent you from getting a proper correction $\endgroup$ – Gordon Simpson Jan 6 '12 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.