is my code correct for this question? Get the Fourier transform of image3 using the fft2() command. If the result does not seem to be interesting, center the spectrum of the r

2 ビュー (過去 30 日間)
Hind Aljallaf
Hind Aljallaf 2022 年 12 月 7 日
回答済み: Varun 2023 年 3 月 24 日
Get the Fourier transform of image3 using the fft2() command.
If the result does not seem to be interesting, center the spectrum of the result using the fftshift() command.
A=fft2(img3)
X=fftshift(img3)
image3=abs(A)
plot(image3)
imshow(image3,[])
image32=abs(X)
plot(image32)
imshow(image32,[])

回答 (1 件)

Varun
Varun 2023 年 3 月 24 日
Hello!
As per my understanding, you want to apply the 2D fast Fourier transform using “fft2” on your image and then call the “fftshift” function to centre the spectrum. I think there’s an error in your code. The input argument to the “fftshift” function must be the result of the “fft2” that has been called in the previous line. So, insteading of passing "img3" to "fftshift",
X=fftshift(A)
should do the job. As for plotting the image, plot only works for 2D data, while the image you may be using this on can be 3D, so that can lead to an error. But imshow()should be sufficient to display the image. You can pass the resulting image ‘X’ as the input argument after each step to see the outcome.
imshow(X,[])
You may refer to the following documentation for more details:

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by