Lena Image Fourier Transform

Can any one transform the image into its fourier transformation using matlab?
Thanks

回答 (2 件)

Wayne King
Wayne King 2012 年 9 月 20 日
編集済み: Wayne King 2012 年 9 月 20 日

0 投票

Yes, use fft2()
This question seems identical (but with less detail) to this one:
It is not good practice to simply keep creating a new thread for the same question. I think you will get much more help if you show what you have tried; the code you have written.

6 件のコメント

Algorithms Analyst
Algorithms Analyst 2012 年 9 月 21 日
編集済み: Algorithms Analyst 2012 年 9 月 21 日
Thanks for your suggestion my code is given below..I am facing the problem which is from graayscale image to rgb image.What I did here I am basically taking the lena color image and doing a fourier transform.I found the magnitude of it I found the phase of the same image but when I do the inverse fourier transform I am seeing the grayscale image it sgould be color image.I need ur help please.my code is given below.
Wayne King
Wayne King 2012 年 9 月 21 日
Please format your code
Algorithms Analyst
Algorithms Analyst 2012 年 9 月 21 日
I just formatted it..kindly give me some suggestions
Wayne King
Wayne King 2012 年 9 月 21 日
編集済み: Wayne King 2012 年 9 月 21 日
You seemed to have deleted it. The code is missing.
Algorithms Analyst
Algorithms Analyst 2012 年 9 月 21 日
my code is here.
imageA=imread('lena.bmp');
figure,imshow(imageA)
title('Original Grayscale Lena Image');
imageA=double(rgb2gray(imageA));
fftA=fft2(imageA);
figure,imagesc(abs(fftshift(fftA)));
colormap gray;
imagesc(log(abs(fftshift(fftA))));
title('RGB lena Image Magnitude throught Fourier Transforms');
figure,imshow(angle(fftshift(fftA)),[-pi,pi]),colormap gray
title('RGB Lena Image Phase through fourier transform');
fftB = abs(fftA).*exp(i*angle(fftA));
imageB=ifft2(fftB);
cmin=min(min(abs(imageB)));
cmax=max(max(abs(imageB)));
figure,imshow(abs(imageB),[cmin cmax]); colormap in2rgb;
Walter Roberson
Walter Roberson 2012 年 9 月 21 日
There is no colormap named "in2rgb"

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

Dr. Deepak Kumar Rout
Dr. Deepak Kumar Rout 2012 年 9 月 21 日

0 投票

to the above code you have to add syntax so as to multiply (-1)^(x+y) that will center the low frequency components

12 件のコメント

Algorithms Analyst
Algorithms Analyst 2012 年 9 月 21 日
where should I need to multiply it kindly refer me complete code.thanks
Image Analyst
Image Analyst 2012 年 9 月 21 日
fftshift() will center the DC component to the middle of the image. I just can't figure out why he's transforming the full RGB image instead of each color channel individually. I'm not sure how to interpret that or what you'd even do with it.
Algorithms Analyst
Algorithms Analyst 2012 年 9 月 21 日
I dont want to bring it to the center as fftshift command would bring it to the center I have a coordinates like F(u-N/2,v-N/2).So without fftshift i can solve but problem is with the rgb now..thanks help me plz..
Image Analyst
Image Analyst 2012 年 9 月 21 日
Did you see the second part of my comment?
Algorithms Analyst
Algorithms Analyst 2012 年 9 月 21 日
No.can you send me the correct coding format of it.....coz my conceot is here that I have a lena color image.I want to find out its magnitude and phase then i want to find its inverse fourier transform the resultant final image should be the original one rgb..this is what I am doing..you can do ur own coding but write the coding plz....
Image Analyst
Image Analyst 2012 年 9 月 21 日
Here's a snippet that will help you.
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Algorithms Analyst
Algorithms Analyst 2012 年 9 月 22 日
not woring boss.....try it yourself and integrate it wid my coding
Image Analyst
Image Analyst 2012 年 9 月 22 日
What about
fftOfRedChannel = fft(redChannel);
didn't work?
Algorithms Analyst
Algorithms Analyst 2012 年 9 月 23 日
no...
Rick Rosson
Rick Rosson 2012 年 9 月 23 日
Image Analyst is right. Please try what he is suggesting.
It is not possible to convert a gray scale image back to rgb. An rgb image has 3 channels for each pixel, whereas gray scale only 1 channel. The gray scale is in effect a weighted average of the three colors. It is mathematically impossible to go from an average to the individual components without additional information.
Image Analyst
Image Analyst 2012 年 9 月 23 日
I think you misunderstood. I did not ask "Did this code work?", I asked "What about the code did not work?". In other words, I assume you tried what I suggested and am asking why it didn't work, for example you had an error message or unexpected results and what was the error message or unexpected result.
Usually people try to help people who are trying to help them. One word answers tell people that they're not interested in investing enough time to allow people to help them, which leads us volunteers to not help. I can't solve problems with single words so if you give them, and want responses just as terse, then I'm not your man. You get what you give.
Algorithms Analyst
Algorithms Analyst 2012 年 9 月 24 日
I can understand you.may be you are right.But where should I integrate this code
fftofChannel=fft(redchannel)
where should I integrate it with my code.As fftB = abs(fftA).*exp(i*angle(fftA)); imageB=ifft2(fftb)
where should I add it. Thanks

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

カテゴリ

質問済み:

2012 年 9 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by