matlab - How to calculate 1D power spectrum from 2D noise power spectrum by radial averaging -


guys trying calculate 1d power spectrum 2d fft of image. did horizontal averaging looking @ graph it's not making me sense. can please suggest how radial averaging on 2d data set reach 1d representation of noise power spectrum. thank appreciate help.

here code $

 fid = fopen('c:\users\3772khobrap\desktop\project  related\nps_cal_data_ub\100000006.raw','r'); img = fread(fid,[512 512],'uint16'); roi = zeros(64); avg = zeros(64); ux= 0.0075;% pixel size uy = 0.0075;% pixel size %% block of code subdividing imaage smaller roi , averaging purpose r = 1:8      r_shift = (r-1)*64;     c = 1:8          c_shift = (c-1)*64;         = 1:64              j = 1:64                 p = img(i+r_shift,j+c_shift);                 roi(i,j) = p;             end         end         avg = avg+roi;     end end avg = avg./64; %%actual process of nps calculation scale = (ux*uy)./(64*64);%scaling fator per nps calculation formula f_x = 1/(2*ux);%nyquiest frequecy along x direction f_y = 1/(2*ux);%nyquiest frequecy along y direction fft_2d = (fftshift(fft2(avg))).^2;% power spectrum calculation nps = abs(fft_2d).*scale; %% 2d nps  f = linspace(-f_x,f_y,64);% x-axis  vector 1d nps  x_img = linspace(-f_x,f_x,512);% x axis of nps image y_img = linspace(-f_x,f_x,512);% y axis of nps image  figure(1) subplot(2,2,1) imagesc(x_img,y_img,img) colormap gray xlabel('x [cm]'); ylabel('y [cm]') title('noise image') subplot(2,2,2) imagesc(f,f,log(nps)) colormap gray xlabel('frequency [cm^{-1}]'); ylabel('frequency [cm^{-1}]'); title('2d nps') subplot(2,2,3) plot(f_p,nps(:,32)) xlabel('frequency [cm^{-2}]'); ylabel('nps [cm^{-2}]') title('1d nps central slice') subplot(2,2,4) plot(f_p,mean(nps,2)) xlabel('frequency [cm^{-2}]'); ylabel('nps [cm^2]') title('1d nps along x direction') 


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -