%%%%%%%%%%%%%%%%%%%%
%%   Pyramids
%%%%%%%%%%%%%%%%%%%%

cy = imread('cy.jpg');
imshow(cy)

P0 = cy;

P1= impyramid(P0, 'reduce');
figure; imshow(P1)

P2= impyramid(P1, 'reduce');
P3= impyramid(P2, 'reduce');

figure; imshow(P2)
figure; imshow(P3)


%% Compare that with just deleting every even row and column
cc = cy(1:2:end, 1:2:end, :);
figure; imshow(cc)

diff = abs(P1-cc);
figure; imshow(diff)

%% Expand
E3= P3;
E2= impyramid(P3, 'expand');
E1= impyramid(E2, 'expand');
E0= impyramid(E1, 'expand');

figure; imshow(E0)
figure; imshow(E1)
figure; imshow(E2)
figure; imshow(E3)

