Pattern Noise Reduction

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
use strict;
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;
system(”
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”);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: