% getcompressedimage.m   created by: Dion Monstavicius
%
% This Function takes an edge map and an original image
% It returns the values in image that are within one pixel
% of non zero points in edgemap
%
% The purpose of this function is to create an image
% that could be reconstructed by the decoder.  It does
% not try to compress the data in any way.

function output = getcompressedimage(edgemap, image)


[A, B] = find(edgemap ~= 0);
output = zeros(size(image));

for i = 1:length(A)
output(A(i),B(i)) = image(A(i),B(i));
output(A(i)+1,B(i)) = image(A(i)+1,B(i));
output(A(i),B(i)+1) = image(A(i),B(i)+1);
output(A(i)-1,B(i)) = image(A(i)-1,B(i));
output(A(i),B(i)-1) = image(A(i),B(i)-1);
end

[A B] = size(image);

output(1,:) = image(1,:);
output(A,:) = image(A,:);
output(:,1) = image(:,1);
output(:,B) = image(:,B);
