Ee 4780
Download
1 / 19

EE 4780 - PowerPoint PPT Presentation


  • 100 Views
  • Uploaded on

EE 4780. Bilateral Filter. Bilateral Filter. K is the normalization constant. Intensity (range) proximity. Spatial (domain) proximity. N is a fixed value used to define the spatial neighborhood of the filter. Bilateral Filter – Matlab implementation.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'EE 4780' - ostinmannual


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Ee 4780

EE 4780

Bilateral Filter


Bilateral filter
Bilateral Filter

K is the normalization constant

Intensity (range)

proximity

Spatial (domain)

proximity

N is a fixed value used to define the spatial neighborhood of the filter


Bilateral filter matlab implementation
Bilateral Filter – Matlab implementation

n=1:1:500; % Generate a vector from 1 to 500; the increment is 1.

I0=zeros(size(n)); % Generate a vector of zeros; the size of the vector is equal to the size of n.

I0(1:250)=15; I0(251:end)=10; % Set the first 250 values to 15, and the rest to 10.

I = I0 + 0.5*randn(size(I0)); % 0.5 is the standard deviation of the noise

figure;

subplot(2,1,1); plot(n,I0); axis ([190 310 6 18]); title('Original signal');

subplot(2,1,2); plot(n,I); axis ([190 310 6 18]); title('Noisy signal');


Bilateral filter matlab implementation1
Bilateral Filter – Matlab implementation

sigma_d=10;

N=round(4*sigma_d); % N determines the spatial neighborhood

sigma_r=1.3;

d = -N:1:N;

weights_d = exp(-d.*d/(2*sigma_d*sigma_d));

The weights depend on the spatial distance (to the center pixel x) only; therefore, it is calculated once and saved.


Bilateral filter matlab implementation2
Bilateral Filter – Matlab implementation

sigma_d=10;

N=round(4*sigma_d); % N determines the spatial neighborhood

sigma_r=1.3;

d = -N:1:N;

weights_d = exp(-d.*d/(2*sigma_d*sigma_d));

x=260; % An example

pixels = I(x-N:x+N); % Put the pixels within the neighborhood of the center pixel into a vector.

weights = weights_d .* exp(-(pixels-I(x)).*(pixels-I(x))/(2*sigma_r*sigma_r)) + 0.0001;

weights = weights./sum(weights);

Add a small number in case weights=0;


Bilateral filter matlab implementation3
Bilateral Filter – Matlab implementation

sigma_d=10;

N=round(4*sigma_d); % N determines the spatial neighborhood

sigma_r=1.3;

d = -N:1:N;

weights_d = exp(-d.*d/(2*sigma_d*sigma_d));

x=260;

pixels = I(x-N:x+N); % Put the pixels within the neighborhood of the center pixel into a vector.

weights = weights_d .* exp(-(pixels-I(x)).*(pixels-I(x))/(2*sigma_r*sigma_r)) + 0.0001;

weights = weights./sum(weights); % Normalize the weights so that its sum is equal to 1.

I_output(x) = sum(weights.*pixels);


Bilateral filter1
Bilateral Filter

figure; plot([x-N:x+N],weights)


Bilateral filter matlab implementation4
Bilateral Filter – Matlab implementation

d = -N:1:N;

weights_d = exp(-d.*d/(2*sigma_d*sigma_d));

% Repeat for all pixels

I_output = I;

for i=1+N:length(I)-N, % Be careful with the borders; do not exceed the dimensions.

pixels = I(i-N:i+N);

weights = weights_d .* exp(-(pixels-I(i)).*(pixels-I(i))/(2*sigma_r*sigma_r)) + 0.0001;

weights = weights./sum(weights);

I_output(i) = sum(weights.*pixels);

end

figure; plot(n,I_output);


Bilateral filter2
Bilateral Filter

Input

Gaussian

Bilateral


Bilateral filter vs gaussian lpf
Bilateral Filter vs. Gaussian LPF

Gaussian

MSE=49.8

MSE=100.0

sigma_d=10

MSE=99.57

MSE=30.3

MSE=42.5


Wiener filter
Wiener Filter

Noisy

image

Original

image

Noise

Wiener Filter

Signal variance

Noise variance

When sigma_x << sigma_w, (noise is very large), X goes to 0.

When sigma_x >> sigma_w, (noise is very small), X goes to Y.


Wiener filter1
Wiener Filter

is estimated by

Estimate manually by looking at the variance in a smooth region.

Since variance is nonnegative, it is modified as

Estimate signal variance locally:

N

N


Wiener filter2
Wiener Filter

Denoised (3x3neighborhood)

Mean Squared Error is 56

Noisy, =10

wiener2 in Matlab


Image enhancement
Image Enhancement

This is an high-pass filter.

It removes low-frequency components.


Image enhancement1
Image Enhancement

  • High-boost or high-frequency-emphasis filter

    • Sharpens the image but does not remove the low-frequency components unlike high-pass filtering


Image enhancement2
Image Enhancement

  • High-boost or high-frequency-emphasis filter

    • High pass = Original – low pass

    • High boost = A*(Original) + High pass

       Part of the low-frequency components are added back to the high frequency components


Image enhancement3
Image Enhancement

A high-pass filter

A high-boost filter


Image enhancement4
Image Enhancement

  • High-boost or high-frequency-emphasis filter



ad