How to remove objects from a gray scale image in frequency domain?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ruhul Amin
il 13 Dic 2015
Risposto: Horus Hormaeus
il 23 Ago 2022
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152600/image.jpeg)
I want to remove some objects of a gray scale image in frequency domain. I am transforming a gray scale image into frequency domain from spatial domain using fft2() and then i am doing fftshift() to shift zero frequency component to center of spectrum. I don't know i am going into right way or wrong? After doing fftshift() i am having a totally gray image with some unclear dotted center frequency component. I want to remove vertical line of that spectrum.
Sample image have some chop sticks and knives. I want to remove those chop sticks. I attached sample image and experimental image.
Here is my code:
if true
img = imread('sample.png');
figure,imshow(img,'InitialMagnification','fit');
imgB = im2bw(img,0.2);
figure,imshow(imgB,[],'InitialMagnification','fit');
imgF = fftshift(fft2(imgB));
figure, imshow(imgF,[],'InitialMagnification','fit');
end
I need some guideline to remove those chopsticks using frequency domain.
0 Commenti
Risposta accettata
Image Analyst
il 13 Dic 2015
You did not attach the images. But anyway, you cannot remove chopsticks and knives by filtering in the Fourier domain. Not sure why you thought you could.
2 Commenti
Image Analyst
il 13 Dic 2015
You can look for spikes in the Fourier domain and zero those out, but with this image the spikes would be buried in the noise and be hardly visible. Actually instead of spikes they'd be sinc functions which would make them even harder to find. Even if you did find them, erasing them would very slightly reduce the contrast but definitely not remove them totally. See my attached demo where I tried to remove very periodic ripples in an image.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/180760/image.jpeg)
Più risposte (1)
Horus Hormaeus
il 23 Ago 2022
like Image Analyst said, you can't remove a localized object in an image by just blocking some frequencies in its frequency spectrum. however, in this particular case, your chopsticks are horizontally positioned ,and other items are vertical, so if you really want to "remove" the chopsticks by cutting off some frequencies, you could achieve it by making the chopsticks so blurry that you basically can't see it, while the other items in the image are still resolved (but blurred too) -- it's kind of cheating.
so what you need to do is creating a very slim elliptical lowpass filter (or something equivalent), and filter the fourier spectrum of your image like this :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1105350/image.png)
and the reconstructed image (from the filtered spectrum) will look like this :
unfortunately the knives are too vertically blurred, but the chopsticks are "gone".
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1105355/image.png)
0 Commenti
Vedere anche
Categorie
Scopri di più su Spectral Measurements in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!