load('Data.mat')

t=data.CP.CP1;
T=t(:,:,:)~=0;
m=T(:,:,1)+T(:,:,2)+T(:,:,3);

im=zeros(320,100);
im2=zeros(320,100);

l=10;
c=8;

for i=1:320
    im(i,:)=decompLine(m(i,:),ceil(i/40),l);
    im2(i,:)=decompLine2(m(i,:),l);
end

map=zeros(c*l,3);
map2=zeros(c*l,3);

for i=0:l-1
    for j=1:c
        map((i*c)+j,1)=j/c;
        map((i*c)+j,3)=1-(j/c);
        map((i*c)+j,2)=i/l;
        map2((i*c)+j,:)=j/c;
    end
end
map(1,:)=0;

subplot(1, 2, 2);
imshow(im2/l);

subplot(1, 2, 1); 
imshow(im, map);