This little algorithm seems to significantly reduce pattern noise in digital images. Instead of doing dark frame subtraction, the output value at each pixel is taken to be the average of the initial value with weight (1-dark) and the value of pixel in a gaussian blurred image with weighting of (dark). Where dark is an element of [0,1].
I wrote this because I wanted something I could apply to webcam images both night and day that would eliminate hot pixels in night shots and would not create dark spots in day shots. Seems to work pretty well.
This is pseudo perl, and calls the imagemagick library, but you get the idea.
# pseudo-code creative commons – attribution – share alike
# author Joseph Bylund
# i.e. please copy, please give to your friends, please modify, please give me credit
my $corrections = “pixel_corrections.png”;
my $mydark = “./dark_frames/dark_frame_avg.png”;
my $start = “webcam_pic.png”;
my $lessdark = “lessdark.png”;
my $startbydark = “startbydark.png”;
my $radius = 4;
convert -compose multiply -composite $mydark $start $startbydark
convert -evaluate Multiply 2.54 $startbydark $startbydark
convert -compose minus -composite $startbydark $start $lessdark
convert -gaussian-blur 20x$radius $lessdark $lessdark\_blur.png
convert -compose multiply -composite $mydark $lessdark\_blur.png $corrections
convert -evaluate Multiply 2.54 $corrections $corrections
convert -compose plus -composite $lessdark $corrections final.png”);