Filter löschen
Filter löschen

Low pass filter on Y U and V bands

3 Ansichten (letzte 30 Tage)
rest12
rest12 am 16 Okt. 2013
Bearbeitet: Yatin am 17 Okt. 2013
I want to implement low pass filter on Y, U and V bands of image by a factor of 3 in both horizontal and vertical directions. I write a code but i want to confirm that whether the code which I write is correct or not? Please confirm. Code is written below:
rgbImage = imread('fav.png');
R = rgbImage(:, :, 1);
G = rgbImage(:, :, 2);
B = rgbImage(:, :, 3);
Y = 0.299*R + 0.587*G + 0.114*B;
U = - 0.14713*R - 0.28886*G + 0.436*B;
V = 0.615*R - 0.51499*G - 0.10001*B;
subplot(2,2,1);
imshow(rgbImage);
title('Original Image');
hsize = 3;
H = fspecial('average', hsize);
filteredY = imfilter(Y, H);
subplot(2,2,2);
imshow(filteredY);
title('filteredY');
filteredU = imfilter(U, H);
subplot(2,2,3);
imshow(filteredU);
title('filteredU');
filteredV = imfilter(V, H);
subplot(2,2,4);
imshow(filteredV);
title('filteredV');
  1 Kommentar
Walter Roberson
Walter Roberson am 17 Okt. 2013
When you display the bands, what colormap are you wanting to use?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Yatin
Yatin am 17 Okt. 2013
Bearbeitet: Yatin am 17 Okt. 2013
Hello,
Your code seems to work correctly and it certainly does low-pass filtering on Y, U and V. You can also however, try using the gaussian low pass filter and compare the result for different sigma values with the results from the averaging filter.
You can have a look at the documentation here:

Weitere Antworten (0)

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by