"Shaojie " <zarachis@gmail.com> wrote in message <gnuai6$clg$1@fred.mathworks.com>...
> "Bjorn Gustavsson" <bjonr@irf.se> wrote in message <gntq3a$r49$1@fred.mathworks.com>...
> > "Shaojie " <zarachis@gmail.com> wrote in message <gnt6s9$p7r$1@fred.mathworks.com>...
> > > % I is a NxN image
> > > % first compute the power spectrum of the image
> > > fftI=fftshift(fft2(I));
> > > Suv=fftI.*conj(fftI)/prod(size(I));
> > > 
> > > then, how to sum the power spectrum over all orientation and obtain the slope?
> > > Thanks!
> > >
> > I'd try something like this
> >
> > f_x = [size(I,2)/2:(size(I,2)/21)];
> > f_y = [size(I,1)/2:(size(I,1)/21)];
> > [f_x,f_y] = meshgrid(f_x,f_y);
> > Pf_r = polyfit(abs(fftl(:)).^2,(f_x(:).^2+f_y(:).^2).^.5,1);
> >
> > you'd better check that the DC component gets to the right point...
> >
> > HTH,
> > Bjoern
> don't understand, would you pls explain it,thanks!
>
> the definition of slope is:
> first compute the fft and power spectrum,
> S(u,v)=FFT(I)/N^2
> then, represent them in polar coordinate and sum them over all directions:
> S(f)=sum_theta{S(f,theta)}.=Af^(alpha)
> the *alpha* is called the slope of power spectrum and it is what i want to estimate
>
Oh, I see. I'd thunk that would be the exponent, guess I missguessed then. In my suggested solution I happily avoided reinterpolating the fft, since that adds discretizationtype "noise"  and I honestly don't know how to do optimally. (Others might come with more detailed insight on this point.) Thus I just made a direct polynomial fit to the 2D fft as a function of "radial" frequency. This should be identical, possibly with a factor of f_R off in my solution.
If you want the exponent then you could do something like this instead of my direct polyfit:
P = polyfit(log((f_x(:).^2+f_y(:).^2).^.5),log(abs(fftl(:))),1)
Further, maybe you should add some frequencydependent weight to the log(abs(fftI)) as well.
HTH,
Bjoern
