이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How to remove frequency components in an image
조회 수: 19 (최근 30일)
이전 댓글 표시
How can I use the fourier transform to find out the frequency components which are responsible for the texture on the surface?
Then I have to remove them to have a smooth surface without texture.
Thanks in advance
댓글 수: 1
Walter Roberson
2012년 5월 10일
In one of your duplicate posts, which I have now deleted, Image Analyst commented,
'Like I said in a comment on one of your other numerous posts on this subject: "Jim, you've got to stop the duplicate posts. You do this frequently, and then people like Wayne waste their time telling you how to do a high pass filter when I've already told you that a high pass filter is not the way to go."'
답변 (1개)
Image Analyst
2012년 5월 9일
Take the 2D FFT. Look for spikes in the 2D FFT and zero them out. Inverse transform and display.
댓글 수: 31
Jim
2012년 5월 9일
--you mean fft2 of image
--what do you mean by spikes
--I used fft2 and got some complex values in work space
--when I used imshow to fft image,it is giving the black and white dots
can u please explain me in detail
Walter Roberson
2012년 5월 9일
fft2() is an implementation of the concept of 2D FFT.
A spike in the frequency domain is a frequency that has a large amplitude relative to the surrounding frequencies.
fft() and fft2() will almost always produce complex values. The complex component encodes phase of the frequency.
Are you using the [] option to imshow() so that the range of values is automatically scaled to use the full color map?
Jim
2012년 5월 10일
--can I use high pass filter here to remove spikes in the frequency domain of the image
--if it is?
---how to write a code to apply high pass filter
Image Analyst
2012년 5월 10일
No you cannot. You must remove the isolated spikes and only the isolated spikes from the spectrum. That is not what a high pass filter does.
Wayne King
2012년 5월 10일
Why the duplicate posts?
http://www.mathworks.com/matlabcentral/answers/37965-how-to-remove-high-frequency-components-in-an-image
Jim
2012년 5월 10일
So,
--Can I take the frequency components in an array
--And can I give some threshold to remove higher frequency components
from that array
Image Analyst
2012년 5월 10일
I think you mean frequency components with high power rather than high frequency components. I hope you realize that those are two different concepts. But your threshold would have to be locally adaptive because often with these kinds of textures, the spikes are on a downward sloping surface so you can't apply a global threshold. Imagine you stuck pencils in a volcano-shaped hill of dirt. A global threshold would get the whole top of the volcano and miss the pencils lower down on the slopes.
Walter Roberson
2012년 5월 10일
Jim, I get the impression that you still do not understand what a Fourier transform does. A Fourier transform analyzes a vector in terms of sine and cosine frequency components. By definition, sine and cosine frequency frequency components repeat at precise intervals. Your texture does not repeat at precise intervals: there are a lot of places in that image where the texture is locally absent. Simply removing (zeroing) some frequency components *might* remove the texture where it _is_, but that will damage the image in the places where the texture is absent.
Jim
2012년 5월 10일
--If I apply fft2 to the image, I will get complex values which will encodes the phase of the frequency
--But I need frequencies that has a large amplitude relative to the surrounding frequencies.
--first I used
abs(fft2(image)) to find magnitude of frequency components of image
--Now how to identify the frequencies with larger amplitude in the surrounding frequencies
Dr. Seis
2012년 5월 10일
You could run the values from "abs(fft2(image))" through a histogram. That way you can get an idea of how the majority of the amplitudes are behaving and an idea of what amplitudes are way outside the distribution. Once you identify an amplitude to set as a threshold (say "max_threshold") then it is just a matter of setting those amplitudes to zero [i.e., image_mag = abs(fft2(image)); image_mag(image_mag > max_threshold) = 0; new_image = ifft(image_mag.*exp(1i*angle(fft2(image)))); ].
Jim
2012년 5월 10일
Thank you for ur reply
--how to take histogram of the values of abs(fft2(image))
imhist(abs(fft2(image)))
Dr. Seis
2012년 5월 10일
I was thinking something more simplified, along the lines of:
image_mag = abs(fft2(image));
hist(image_mag(:));
Someone else may have a better solution.
Image Analyst
2012년 5월 10일
In the spectra I've seen, they look like a volcano with a periodic array of sticks stuck in the slopes, so viewing a histogram of that kind of image won't let you know that there are spikes at all, let alone where they are. The best way is to visualize the image. You can take the log of it to make the spikes more visible since that will suppress the large central main peak. Then you need to zero out those spikes. If you're really lucky with a high contrast texture (like a screen or grid or honeycomb) then you'll see a nice array of spikes without many low frequencies. A histogram may clue you in to there being spikes, but not as well as simply viewing the FFT image, and the histogram still won't tell you *where* they are, which is what you need to know if you want to zero them out. Perhaps some day I might have time to make up a texture removal demo.
Jim
2012년 5월 10일
Thank you for your reply
--I applied log(abs(fft2_image)) and used fftshift to move zero frequency components to the center
--Now I need to define low pass filter and move it to the center of the image
--Can you suggest me, which type of low pass filter,can I use here
--how to define it and move it to the center of the image
Image Analyst
2012년 5월 10일
I don't know what to say. I agree with Walter that you seem to need a lot more background in linear filtering because you don't seem to understand the situation. Let me try to make it more clear. You DO NOT need a low pass filter. You DO NOT need a high pass filter. What you need is a filter that zeros out small isolated areas at the location of each spike. That's not even a band pass filter - it's a special Fourier domain filter that is specially designed to remove a periodic signal. You need to find the spikes yourself and zero them out. There is no single MATLAB function to do that for you. You will have to string together a bunch of MATLAB code to accomplish that.
Walter Roberson
2012년 5월 10일
Jim, look at Wayne King's postings, as he often shows how to create low-pass and high-pass filters using the signal processing toolbox. You need to decide matters such as whether you want a FIR or IIR filter, and how sharp of a roll-off you want. See for example http://www.mathworks.com/matlabcentral/answers/37975-how-to-design-an-iir-low-pass-filter-with-matlab
To move a low-pass or high-pass filter "to the center of the image", do nothing: low pass and high pass filters are position independent.
Image Analyst: I think that Jim needs to go ahead an experiment with low pass and high pass filters in order to establish for himself the extent to which they are useful in this project.
Dr. Seis
2012년 5월 11일
Jim: Can you post another figure displaying the image in the frequency domain? Something like:
surf(fftshift(abs(fft2(image))),'EdgeColor','none');
Image Analyst
2012년 5월 11일
Although high pass and/or low pass filters won't remove the texture, experimenting with various filters is an excellent way to learn and get a good intuitive feel for how different operations affect the image.
Jim
2012년 5월 18일
Elige Grant :You can see the image of
surf(fftshift(abs(fft2(image))),'EdgeColor','none'); in the following link
http://magnitude2143.blogspot.se/
Jim
2012년 5월 18일
can you give me the code to fix this?
How this texture can be removed from the image?
Walter Roberson
2012년 5월 18일
Image Analyst has told you several times how to remove texture from the image.
Changing the DC offset (i.e. the mean) is something you've been shown more than once.
Jim
2012년 5월 18일
How can you say that the spike is from DC offset?
removing the mean is just like removing DC component from the fft image
making FFT(1,1)=0;
iS THIS CORRECT?
Walter Roberson
2012년 5월 18일
Yes, and be sure to do that before you do the fftshift()
How can I say the spike is from the DC offset? Experience. The DC is most often the largest absolute value in an fft (for mathematical reasons). The spike occurs half way along one side in the plot, which is exactly what one would expect if the spike was originally at (1,1) and had been fftshift()'d _once_. You would need to fftshift() along x and y separately to get your (1,1) to move to the center of the surf(), but only one fftshift() was done so it just moved to half-way along one edge.
Jim
2012년 5월 18일
If I need to make abs(frequencies) which are having less magnitudee to zero
then what I need to do?
Image Analyst
2012년 5월 18일
Huh? There are no frequencies that will be less than zero once you take their absolute value. If you want to set negative values to zero, you do array(array==0) = 0, but I'm pretty sure you know that already, so please explain.
MUHAMMAD ADNAN
2017년 11월 20일
hI @Image Analyst how can I set spikes to zero for certain repetitive structure like line or circle in image FFT domain ?Please can you give simple code for this process or guide me. Thanks
Nbillah
2019년 2월 19일
Hi, @Image Analyst, thank you very much for the code, very helpful. I have one question for you i.e how did you decide the value for amplitudethreshold=10.9?
Image Analyst
2019년 2월 20일
I tried experimenting around with some values and that's just what worked the best.
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)