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);

 採用された回答

Gova ReDDy
Gova ReDDy 2011 年 10 月 17 日

0 投票

Actually this discontinuous line is a edge in the original image. As EDGES are high frequency components so I thought to suppress DC components...... So how can I extract frequency components by shifting the discontinuous line.

5 件のコメント

Image Analyst
Image Analyst 2011 年 10 月 17 日
You already have the line, so further Fourier analysis of it is pointless. And I don't see how you can get high frequency components by shifting that line. If you want to do a high pass filter on the original gray scale image you can use conv2() with a kernel of all -1/9 except for 8/9 at the center, or you can do it with multiplication in the Fourier domain.
Image Analyst
Image Analyst 2011 年 10 月 18 日
Just display it like this:
imshow(fil, []);
The [] is important because it's a floating point image. Once you are able to see it, it should be obvious. You might also use the 'same' option to conv2() so that the image is the same size.
Gova ReDDy
Gova ReDDy 2011 年 10 月 24 日
thankyou Image Analyst..
kamran
kamran 2019 年 5 月 26 日
Can any one guide me to find the high frequency image by descrete fourier transformation
kamran
kamran 2019 年 5 月 26 日
I want a an output image not a graph of an images

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
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
Gova ReDDy 2011 年 11 月 4 日
finally I was able to get the continous line like this
http://tinypic.com/view.php?pic=5x08io&s=5
Now can someone explain me how to get the frequecy values corresponding to this line only not for the entire image...
Image Analyst
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
Gova ReDDy 2011 年 11 月 5 日
yes I remember that previously you explained me that the spectrum of a line segment or straight line will be a *sinc function* and it contains multiple frequencies.But I want to extract all the multiple frequencies corresponding to that line and to analyse the variations in them by applying standard deviation for multiple lines detected in multiple frames where each line(in a frame) contains multiple frequencies like you explained.
So could you please explain me how to get these multiple frequencies from the line.
Image Analyst
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
Gova ReDDy 2011 年 11 月 5 日
Yes..offcourse it wont solve my problem but I am trying to anlayze the results from different methods like I previously used *slope* method and now this *frequency* method.
Image Analyst
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
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
Gova ReDDy 2011 年 11 月 6 日
I think here *spectrumOfX* contains all the frequencies of x(sinc function) and because the sinc function varies from -ve to +ve intervals it is containing both values.
Just a last doubt..is it possible to get only frequencies in x with a value of 1 from entire x?
Walter Roberson
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
Gova ReDDy 2011 年 11 月 6 日
Here the value of 1 means the x has a values of 1 for a width of 40 as given in the above example of Image Analyst.
Doing fft for the entire image will result in the frequencies of entire image..right.
But Im asking this question for a long time*Extracting only the frequencies of line from the entire image*.How to do this..
Image Analyst
Image Analyst 2011 年 11 月 6 日
Sorry. I consider this a dead end. I'm done. I suggest you take a different approach.

サインインしてコメントする。

製品

質問済み:

2011 年 10 月 16 日

コメント済み:

2019 年 5 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by