Image Filtering and Noise Models - lect 6
Spatial Filtering
Last time, we discussed spatial filtering.
Spatial filtering is done by computers in photo editing software automatically.
Unsharp Masking
Unsharp masking is a filtering technique that sharpens edges.
Process:
Blur the original image.
Subtract the blurred version from the original to get sharp edges.
Multiply the sharp edges by a boosting factor.
Add the boosted edges back to the original image.
This strengthens or highlights the edges.
Other Linear Spatial Filters
Averaging filters soften or blur images.
Unsharp masking boosts edges.
Test images:
Test card.
Dilapidated house (chosen for vertical, diagonal, and horizontal edges).
Increasing Filter Mask Size
Increasing the averaging filter mask size increases blurring.
Example: 17x17 pixel mask.
Normalization factor: (1 divided by the number of elements in the mask) to maintain image brightness.
Ringing Artifact
Large averaging masks can cause a ringing artifact (stripes).
Ringing artifacts appear due to the large mask size.
To overcome ringing, use a mask with smaller values at the perimeter and larger values near the center, following a normal distribution (bell-shaped curve).
This achieves smoothing without ringing.
Vertical Difference Edge Detection Filter
A vertical difference mask highlights horizontal edges.
Important to remember this for the exam.
The filter responds to diagonal edges as well.
The weights in edge detection masks sum to zero, not one.
Horizontal Edge Detection
Configuration for horizontal edge detection:
Consider the expression:
The above mask does the same thing as the previous mask.
Vertical Edge Detection
Horizontal difference detects vertical edges.
Combining Filters
Filters can be combined to detect all edges (vertical, diagonal, and horizontal).
Boosting diagonal differences/edges is also possible.
Applications:
Computer vision systems: edges contain most of the useful information.
Preprocessing images for object detection.
Analyzing fingerprints by boosting ridges.
Median Filter
Non-linear spatial filters.
The spatial filters discussed are linear spatial filters. They operate on the image.
The median filter is good at removing specific types of image noise.
Process:
Take pixel intensity values from a neighborhood.
Order them in descending brightness.
The median value replaces the center pixel value.
Non-Local Means Filter
Developed in 2017.
Basic concept: find regions in the image similar in structure to the region being filtered.
Average those similar regions to estimate the denoised region.
Applied to the whole image.
Removes noise without causing too much distortion.
Weighted combination estimates what the image would look like without noise.
Image Noise Models
In forensic camera identification, noise can be a “fingerprint” for the camera.
Image noise: a speckly pattern, unwanted.
Analogy to audio noise (e.g., crackle on dusty records).
Correlated Noise
Some argue it's an artifact, not noise.
Correlated noise has structure (regular or irregular patterns).
Examples:
Electrical interference causing horizontal striping.
Halftone distortion: colored dots from a printer (cyan, magenta, yellow).
Viewed from a distance, the dots merge.
Screwing eyes up averages the colors.
Also explained that printers print colors close to each other to build up the color of the photo.
Random Noise
Photographs taken at different exposure times.
Short exposure times lead to a speckle pattern (image noise).
Due to shot noise or thermal noise.
Shot noise: particle nature of light; brightness controlled by Poisson distribution.
Thermal noise: random thermal motion of electrons in the camera sensor.
High light levels cause statistical fluctuations to average out, reducing noise.
Film cameras:
Silver halide grains record light intensity, but their finite size can cause a speckle pattern.
Poisson Probability
: Probability of X photons arriving at a photo site over a time duration.
: Average number of photons expected to arrive.
: Number of photons of interest.
: Euler's number (~2.71828)
: factorial
Other Noise Sources
Neuronal noise in the retina.
Quantization noise in digital photographs.
Mathematical Model for Output Image
: Output (noisy) image.
: Ideal (noise-free) image.
: Noise.
Image processing tries to recover from using filters.
Filters approximate .
Statistical Distributions of Noise
Gaussian (Normal) Noise:
Generated through shot noise or thermal noise.
Pixel values are distributed about the original intensity value (e.g., 127).
Physicists call this a Gaussian distribution, statisticians call it a normal distribution.
Uniform Noise:
Every pixel has equal probability.
May be due to quantization of intensity values.
Has equal probability of every shade of gray in between shades.
Salt and Pepper Noise:
Pixels have either minimum (0) or maximum (255) intensity.
Looks like salt and pepper sprinkled on the image.
May be due to transmission bit errors, photodiode leakage, or dead pixels.
Color Images
Noise can occur in red, green, and blue color planes.
Gaussian additive noise is added to the image.
Removing Noise
Averaging filters smooth the image, suppressing noise but also blurring edges.
The noise follows a speckle pattern.
Averaging filters are not very good at removing shot and thermal noise
Non-Local Means Filter:
Preserves edges better than averaging filters.
Removes noise and preserves the edges.
Needs properly set parameters to avoid excessive blurring.
Removing Salt and Pepper Noise with Median Filter
Non-linear spatial filter.
Returns the median value of pixels in a neighborhood.
Better at preserving edges than the mean filter.
Examples
Averaging filter:
Reasonable job of suppressing noise, but white speckles may still be visible.
Increasing filter size blurs the image too much.
Median filter (3x3):
Very good job of removing noise while preserving edges.
Larger median filter (5x5) may not be necessary.
Gaussian additive noise typically requires more complex filters.
Spatial Filtering
Spatial filtering is performed by computers in photo editing software.
Unsharp Masking
Unsharp masking sharpens edges by blurring the original image, subtracting the blurred version to get sharp edges, multiplying the edges by a boosting factor, and adding the boosted edges back to the original.
Other Linear Spatial Filters
Averaging filters soften or blur images; unsharp masking boosts edges.
Increasing the averaging filter mask size increases blurring. Normalization factor maintains image brightness.
Large averaging masks can cause ringing artifacts. Use masks with smaller values at the perimeter and larger values near the center to avoid ringing.
A vertical difference mask highlights horizontal edges; horizontal difference detects vertical edges. The weights in edge detection masks sum to zero.
Filters can be combined to detect all edges, useful in computer vision systems and image preprocessing.
Median Filter
The median filter is a non-linear spatial filter good at removing specific types of image noise. The median value replaces the center pixel value.
Non-Local Means Filter
Finds similar regions to the region being filtered, averaging them to estimate the denoised region, removing noise without causing distortion.
Image Noise Models
Image noise is a speckly pattern.
Correlated Noise
Correlated noise has structure, like electrical interference or halftone distortion.
Random Noise
Short exposure times lead to speckle patterns due to shot noise or thermal noise. High light levels reduce noise.
Poisson Probability
Other Noise Sources
Neuronal and quantization noise.
Mathematical Model for Output Image
Image processing recovers from using filters.
Statistical Distributions of Noise
Gaussian (Normal) Noise: Pixel values distributed about the original intensity value.
Uniform Noise: Every pixel has equal probability.
Salt and Pepper Noise: Pixels have minimum or maximum intensity.
Color Images
Noise can occur in red, green, and blue color planes.
Removing Noise
Averaging filters smooth images but blur edges. Non-Local Means Filter preserves edges better.
Removing Salt and Pepper Noise with Median Filter
Median filter preserves edges better than the mean filter.
Examples
Median filter (3x3) effectively removes salt and pepper noise while preserving edges.