1/f amplitude frequency plot

1 次查看(过去 30 天)
Ayesha Batool
Ayesha Batool 2019-2-5
I'm running an image analysis using fourier transform.
I want to use spectral amplitude as a measure of naturalness of an image.
It is said that the i/f amplitude-frequency scaling is modulated by the naturalness of scenes, with steeper slops for naturalistics compared to artifactual scenes.
I just want to run this in matlab and test on two images, naturalistic and artifactual to see how it is.
Please share a simple code to read an image and run this 1/f amplitude - frequency scaling.
I'm here so far:
clear all; close all; clc
imdata = imread('C:\....\ab.jpg');
figure(1);imshow(imdata); title('Original Image');
imdata = rgb2gray(imdata);
figure(2); imshow(imdata); title('Gray Image');
%get fourier transform of an image
F = fft2(imdata);
%fourier transform of an image
S = abs(F);
figure(3);imshow(S,[]);title('Fourier Transform of an Image');
%get the centered spectrium
Fsh = fftshift(F);
figure(4);imshow(abs(Fsh),[]);title('Centered Fourier Transform of Image')
%apply log transform
S2 = log(1+abs(Fsh));
figure(5);imshow(S2,[]);title('log transformed image')
%reconstruct our image
F = ifftshift(Fsh);
f =ifft2(F);
figure(6);imshow(f,[]),title('reconstruct image')
If I'm missing something, too, please explain how to go about it.

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by