% make a demo of circle in square shadow [x,y]=meshgrid(1:32);x=x-16;y=y-16; circIm=x.^2+y.^2<8^2; % create 2*fnum+1 images of the same scene with different illumination. % specifically, create a square shadow and move it along the image % according to the index of the iamge. % bigIm1 is an array of input images. % Here we produce these images from the base image by applying different % illuminations. fnum=1; bigIm1=zeros(32,32,2*fnum+1); for i=-fnum:fnum im1=zeros(32); im1(i+16-10:i+16+10,i+16-10:i+16+10)=0.6; % this puts shadow im1=im1+circIm; bigIm1(:,:,i+fnum+1)=im1; end % and now get albedo % to debug bigIm1=bigIm1+1; % for boundary conditions we assume the boundary of the image % is set to zero bigIm1=zeroB(bigIm1,2); % Albedo is computed using the Intrinsic Images decomposition algorithm % (i.e. taking the median of the partial derivatives). % This is actually the heart of the program. % Images are created ahead as log images, and passed to getAlbedo % as such. [imR,dxs,dys,dx,dy]=getAlbedo(bigIm1); figure(1); show(bigIm1(:,:,1)); title('frame 1'); figure(2); show(imR); title('reflectance'); % to get lighting we subtract median lighting from the gradient % and reconstruct figure(3); %light1=reconsEdge3(dxs(:,:,1)-dx,dys(:,:,1)-dy);%,invKhat); light1 = solvePoisson(dxs(:,:,1)-dx,dys(:,:,1)-dy); show(light1); title('lighting frame 1');