Bandpass filter applied to an image

16 visualizzazioni (ultimi 30 giorni)
so my question is how do I make a bandpass filter. I have never used one. Bandpass docs online show only a version of sinals. how do I use it for a picture? thanks

Risposta accettata

Image Analyst
Image Analyst il 2 Dic 2019
Hints. One way is to fft2() the image, then zero out some portion of the spectrum, then ifft2().
A second way is to do a difference of Gaussians filter -- check out fspecial() and conv2().
  2 Commenti
Smit Patel
Smit Patel il 2 Dic 2019
Modificato: Smit Patel il 2 Dic 2019
%% Problem 4
a=imread('bookshelf.jpg');
a1=double(rgb2gray(a));
figure(1)
a2=fft2(a1);
imshow(a2,[0 10000]);
figure(2)
a3=imgaussfilt(a1,200);
imshow(a3,[0 100]);
a4=a2-a3;
figure(3)
imshow(a4,[0 10000]);
figure(4)
a5=ifftshift(a4);
imshow(a5,[0 10000]);
I tried but I don't get the desired image. can you tell me what I am doing wrong? pls? thanks!
Image Analyst
Image Analyst il 3 Dic 2019
You're trying to combine both methods that I told you into one. Don't do that. Do just one or the other. If you want to do the fft method, just zero out parts of the a2 arrays. Don't do anything with gaussian kernels for that method. Something like
ra2 = real(a2); % Get real part
ia2 = imag(a2); % Get imaginary part
ra2(row1:row2, col1:col2) = 0; % Repeat for other ranges. You determine the rows and columns.
% Same for ia2, then combine ra2 and ia2 back into complex array and call ifft2
See what you can do with that.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by