Lambert Zijp Make sure no signal arrives at the detector. If the detector is for example a camera, put a thick cloth around it. Make several exposures without signal. These are called 'dark images'. ...
Brilliant! You may also want to add that dark regions of a snapshot of a visual scene are mini-dark images. The pixels in these mini-dark regions have zero intensity. The dark image regions reveal parts of visual scene surfaces that absorb rather than reflect light.
Yes, it sounds pretty stupid what I wrote! But it is actually standard calibration procedure when calibrating array detectors such as amorphous silicon panels for detecting X-rays or gamma-rays.
The dark image (also called an offset image) is created as I described. This image is subtracted from every 'real' image made. There are two more calibration images: a gain image (also called a flood image) and a bad pixel map. The former corrects the (almost) linear response of each pixel so that they all give the same value when receiving the same amount of photons, it is a scaling. The latter is used to indicate pixels that are dead or are on the verge of dying; their pixel-values are ignored and interpolated from 'good' adjacent pixels.
Anitha Thomas , you wanted Matlab code to do the dark image correction; here you go :-) :
You don't need any filter or other piece of software. In Matlab or Octave, you can load the image you want to correct, and load the dark image. Subtract the second from the first, and DONE !