function [imR,dxs,dys,dx,dy]=getAlbedo(bigIm1) % Here we apply the intrinsic images decomposition algorithm: % we differentiate the images using convolution. dxs=0*bigIm1; dys=0*bigIm1; for i=1:size(bigIm1,3) dx=conv2(bigIm1(:,:,i),[0 1 -1],'same'); dy=conv2(bigIm1(:,:,i),[0 1 -1]','same'); dxs(:,:,i)=dx; dys(:,:,i)=dy; end dx=median(dxs,3); dy=median(dys,3); % after the correct derivative was computed, now we need to reconstruct % the original image: imR = solvePoisson(dx,dy); % if ~exist('invKhat') % [imR,invKhat]=reconsEdge3(dx,dy); % else % imR=reconsEdge3(dx,dy,invKhat); % end %