Extracting frequency components of line in a image
古いコメントを表示
Hi.. I want to extract the only frequency components of discontinuous line in the image shown here http://tinypic.com/r/2va11fc/7 while removing all other frequencies Can i do like this
I = imread(image);
imshow(I);
FT = fft2(I);
FT(1,1) = 0;
I2 = ifft2(FT);
imshow(I2);
採用された回答
その他の回答 (1 件)
Walter Roberson
2011 年 10 月 16 日
0 投票
Straight lines (or line segments) have frequency components at all frequencies. Zeroing the DC component would at best shift the line segments. Zeroing any other frequency component would result in a wiggly line after reverse transformation.
11 件のコメント
Gova ReDDy
2011 年 11 月 4 日
Image Analyst
2011 年 11 月 4 日
What are you talking about? The spectrum of a line segment (like a rectangular pulse) is just a sinc function (Google it). I doubt that's what you want or need. Do you mean the spectrum of the IMAGE under the line? Why do you think you need frequency components, either of the line or the underlying image? What would you do if you had it?
Gova ReDDy
2011 年 11 月 5 日
Image Analyst
2011 年 11 月 5 日
Sorry, but I don't want to send you on a wild goose chase. You'd have to explain to me how that would solve your problem (because I don't think it will).
Gova ReDDy
2011 年 11 月 5 日
Image Analyst
2011 年 11 月 6 日
Then take the FFT of it, and you'll see sinc(x).
x = zeros(151,1);
midPoint = ceil(length(x)/2)
width = 40;
x(midPoint-width/2 : midPoint+width/2) = 1;
subplot(2,1,1);
plot(x, 'LineWidth', 3);
ylim([0 2]);
xlim([1 length(x)]);
grid on;
title('X, spatial domain', 'FontSize', 30);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
spectrumOfX = fft(x);
subplot(2,1,2);
plot(real(fftshift(spectrumOfX)), 'LineWidth', 3);
grid on;
title('FFT(X), frequency domain', 'FontSize', 30);
Image Analyst
2011 年 11 月 6 日
Please let me know if this is helpful because I really feel you're wasting all of our time by continuing down this path. I just don't think you have the background concepts understood enough yet to realize what you're asking.
Gova ReDDy
2011 年 11 月 6 日
Walter Roberson
2011 年 11 月 6 日
What does it mean for a frequency to have a value of 1 ? Please keep in mind that the result of fft is generally a vector of complex values. The fft of a straight line (or approximation thereto) has phase components that you cannot neglect.
The magnitude of the coefficient of any frequency element does not often come out to be exactly 1.
If you are looking for relative peaks, then use a peak finder (once you work out the complex-number issues.)
Gova ReDDy
2011 年 11 月 6 日
Image Analyst
2011 年 11 月 6 日
Sorry. I consider this a dead end. I'm done. I suggest you take a different approach.
カテゴリ
ヘルプ センター および File Exchange で Image Filtering についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!