0% found this document useful (0 votes)
43 views

Noise

The document discusses different types of noise that can affect digital images, including salt and pepper noise, impulse noise, and Gaussian noise. It explains that Gaussian noise involves adding variations to pixel intensities that are drawn from a Gaussian normal distribution. The document also covers various methods for filtering noise, including averaging filters using a moving window, weighted moving averages, and Gaussian filters. Gaussian filters are preferred for smoothing since they are smooth and circularly symmetric, approximating the blurring of a point spread by an out-of-focus camera. The size and shape of the Gaussian kernel, as well as the standard deviation of Gaussian noise, determine the degree of smoothing or noise.

Uploaded by

misbah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Noise

The document discusses different types of noise that can affect digital images, including salt and pepper noise, impulse noise, and Gaussian noise. It explains that Gaussian noise involves adding variations to pixel intensities that are drawn from a Gaussian normal distribution. The document also covers various methods for filtering noise, including averaging filters using a moving window, weighted moving averages, and Gaussian filters. Gaussian filters are preferred for smoothing since they are smooth and circularly symmetric, approximating the blurring of a point spread by an out-of-focus camera. The size and shape of the Gaussian kernel, as well as the standard deviation of Gaussian noise, determine the degree of smoothing or noise.

Uploaded by

misbah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

NOISE

Noise
Noise is simply a function that is combined
with the original function to get a new.
Common Types of Noise
Salt and pepper noise: random occurrences of
black and white pixels
Common Types of Noise
Impulse noise: random occurrences of white
pixels

Original Impulse noise


Common Types of Noise
Gaussian noise: variations in intensity drawn
from a Gaussian normal distribution

Original Gaussian noise


A
Gaussian noise

noise = randn(size(img)).*sigma;
Output = noise + img;

Fig: M. Hebert
Filtering
Gaussian noise

noise =randn(size(img)).*sigma;
output = img + noise;
Removing Noise

• IF replacing each pixel with the average


of the values in the neighborhood.
1D Illustration
Replace each pixel with an average of all the values
in its neighborhood – ongoing proc…..

from: S. Marschner
1D Illustration- moving average with moving window
Replace each pixel with an average of all the values
in its neighborhood – ongoing proc…..

from: S. Marschner
1D Illustration
Replace each pixel with an average of all the values
in its neighborhood – ongoing proc…..

from: S. Marschner
1D Illustration
Replace each pixel with an average of all the values
in its neighborhood – ongoing proc…..

from: S. Marschner
Bunch of random nos. so called noise.
Bunch of random nos. so called noise.

Gaussian or Random Normal Distribution

The standard deviation is a measure of how spread out the distribution is.

How we know randn is actually sampling from a Gaussian distribution????


How we know randn is actually sampling from a Gaussian distribution????
//Instead of displaying the numbers directly, let's compute a histogram.
Hist accepts a vector or matrix of numbers as a first argument and as an optional
second argument, we can pass in bin centers.

Hist returns two values.

• One is the count of elements, which we want, and


• the second is the bin centers.

As expected, the center has a high count,


and the ends have low, in fact, zero counts.
Effect of σ on Gaussian noise
Noise images: Images noise = randn(size(im)).*sigma
showing noise values
generated with
different sigma

σ = 2,8,32,64 sigma = 2 sigma = 8

sigma = 32 sigma = 64
This is because the values that
randn generated are really small
compared to the image.
Removing Noise

• IF replacing each pixel with the average


of the values in the neighborhood.
1D Illustration
Replace each pixel with an average of all the values
in its neighborhood – ongoing proc…..

from: S. Marschner
1D Illustration- moving average with moving window
Replace each pixel with an average of all the values
in its neighborhood – ongoing proc…..

from: S. Marschner
1D Illustration
Replace each pixel with an average of all the values
in its neighborhood – ongoing proc…..

from: S. Marschner
1D Illustration
Replace each pixel with an average of all the values
in its neighborhood – ongoing proc…..

from: S. Marschner
Averaging ….why (Assumptions here)
• The "true" value of pixels are similar to the true value of
pixels nearby.

• The noise added to each pixel is done independently.


Moving Average (Weighted)
• Adding weights to moving average
• Weights [1, 1, 1, 1, 1] / 5 >> uniformly Dist.
Weighted Moving Average – ‘smoothness’

• The closer a pixel is to some reference pixel, the more


similar it would be.

• So the more it should contribute to an average.


Weighted Moving Average
• Non-uniform weights [1, 4, 6, 4, 1] / 16
Moving Average (Weighted)
• Adding weights to moving average
• Weights [1, 1, 1, 1, 1] / 5 >> uniformly Dist.
Weighted Moving Average
• Non-uniform weights [1, 4, 6, 4, 1] / 16
Moving Average In 2D

F(x,y) G(x,y)

image: S. Seitz
Moving Average In 2D
F(x, y) G(x,y)
Moving Average In 2D
F(x,y) G(x,y)
Moving Average In 2D

F(x, y) G(x,y)
Moving Average In 2D

F(x, y) G(x,y)
Moving Average In 2D
F(x, y) G(x,y)
Correlation filtering - uniform weights

Say the averaging window size is 2k+1 x 2k+1:

Uniform Loop over all pixels in


weight for neighborhood around
each pixel image pixel F[i, j]
Correlation filtering - nonuniform weights

Now generalize to allow different weights depending on


neighboring pixel’s relative position:

Non-uniform weights
This is called cross-correlation, denoted G = H ⊗ F
The filter “kernel” or “mask” H[u, v] is the matrix of weights
in the linear combination.
Averaging filter
F(x,y) ⊗ H(u,v) = G(x,y)

1 1 1
1/9 1 1 1
1 1 1
“box filter”

G = H ⊗F
Smoothing by box averaging

Cause square are not smooth

original filtered
Averaging filter: Weaknesses

As squares aren't smooth and filtering an


image with a filter that is not "smooth" seems wrong if
we're trying to "blur" the image.

• Now simply think about a single spot of light viewed by an


out of focus camera the image would look something
like this:
Blurry spot as a function

D. Forsyth
Gaussian filter
Nearest neighboring pixels have the most influence

This kernel is an approximation


F(x, y) of a Gaussian function:
Smoothing with a Gaussian (circularly symmetric)
Smoothing with not a Gaussian
Smoothing with Gaussian, and not a Gaussian
Gaussian filter: Shape vs. Size

• The Gaussian we showed was isotropic – circularly Semetric


so it had only one parameter (sigma).

• On a computer, we need to talk about the size of


the filter (3x3, 5x5, 11x11) and then the shape of
the filter values (Gaussian distribution).
Gaussian filters

Standard deviation (𝜎) - determines extent of smoothing

𝜎 = 2 with 30 x 30 kernel 𝜎 = 5 with 30 x 30 kernel


Gaussian filters

Size of kernel or mask is not variance, larger with more smooth effect

𝜎 = 5 with 10 x 10 𝜎 = 5 with 30 x 30
kernel kernel
Now finalizing the two Gaussians

• Sigma as a width of a the Gaussian filter, as the


variance of a noise function.

• In one case - the filter - sigma is a width in space


where as;

• With noise it's a variance in value. The bigger


the noise sigma was the more likely that large values of
noise can be created.
Keeping the two Gaussians straight...

More Gaussian noise (like earlier) 𝜎

Wider Gaussian smoothing kernel >>

You might also like