image processing - fft2 function with reveresed matrix matlab -


i'm reading article 'deriving intrinsic images image sequences'. i'm trying results article.

fnr reversed filter of fn:fn(x,y)=fnr(-x,-y). use fourier , pseudo-inverse solve equation , find

g : g*(sigma(fnr*fn)=delta 

(sigma on n , '*' convulotion everywhere),

%% fnt_fn_conv=sigma(fnr*fn) fftr = fft2(fnr_fn_conv);    % find g  fftrp = pinv(fftr);  g = delta_fft x fftrp; (matrix mul)  g = ifft2(g); 

my problem g*(sigma(fnr*fn) **!=** delta, g wrong ! how should build fnr ? fnr=rot90(fn, 2) sufficient, or have change center of fnr 0 padding fourier function work correctly ?

update :

the filtered images looks fine... used 2 derivative filters ( horizental , vertical).

% given dx dy reconstruct image % here convolutions using fft2   function [im,invkhat,k]=reconsedge3(dx,dy,invkhat)    im=zeros(size(dx)); [sx,sy]=size(dx); mxsize=max(sx,sy);  if ~exist('invkhat')   [invk,k]=invdel2(2*mxsize);   invkhat=fft2(invk);   %fourier convolotion  g end  %% %% sigma fnr*r_n 2 filters imx=conv2(dx,fliplr([0 1 -1]),'same'); imy=conv2(dy,flipud([0;1;-1]),'same');  ims=imx+imy;  sigma  %%  imshat=fft2(ims,2*mxsize,2*mxsize); im=real(ifft2(invkhat.*imshat));       %r im=im(mxsize+1:mxsize+sx,mxsize+1:mxsize+sy);     function [invk,k]=invdel2(isize)   %sigma(7) fnr*fn   k=zeros(isize);  k(isize/2,isize/2)=-4;  k(isize/2+1,isize/2)=1;  k(isize/2,isize/2+1)=1;  k(isize/2-1,isize/2)=1;  k(isize/2,isize/2-1)=1;   khat=fft2(k);  %fourier sigma(7)   %add 1 inverse without zeros  i=find(khat==0);   % find zeros in khat  khat(i)=1;     % put 1 zeros   invkhat=1./khat;   % inverse  invkhat(i)=0;  %dec 1 added  invk=ifft2(invkhat);  invk=-real(invk);  % invk , delta not in same dim, convolve  % , use transform fourier invk in reconsedge3  invk=conv2(invk,[1 0 0;0 0 0;0 0 0],'same'); 

note: conv2(invkhat,k)!=delta why ?!

https://imgproc2014.github.io/shadow_removal/

implemented article , finished project !

thanks anyways...


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -