function [kd_r kd_g kd_b]=per_channel_albedo(dir)

l = get_light_directions();
n = solve_normals(dir, l);

im = imread(sprintf('psmImages/%s/%s.0.tga.ppm', dir, dir));
row=size(im,1);
col=size(im,2);
I_red=im(:,:,1);
I_green=im(:,:,2);
I_blue=im(:,:,3);

for i=1:11
    img = imread(sprintf('psmImages/%s/%s.%d.tga.ppm', dir, dir, i));
    I_red=cat(3,I_red,img(:,:,1));    
    I_green=cat(3,I_green,img(:,:,2));
    I_blue=cat(3,I_blue,img(:,:,3));
end


for i=1:row
    for j=1:col
        for k=1:3
            a(k)=n(i,j,k);
        end
        J(i,j,:)=l*a';
    end
end

        
        A=dot(J,J,3);
        kd_r=uint8(dot(double(I_red),J,3)./A);
        kd_g=uint8(dot(double(I_green),J,3)./A);
        kd_b=uint8(dot(double(I_blue),J,3)./A);
        
       
        
        