function decode_bmp(b_hat,origImage)
% Decode bmp

char_vector = char(b_hat + '0');

% Reshape back into col-vector of binary strings.
bin_array = reshape(char_vector, 8,[]).';

% Convert binary strings into corresponding chars
% Transpose to make readable.
image_ints = bin2dec(bin_array).';

reshaped_image_ints = reshape(image_ints, 64,64,3); % BMP dimensions.

decoded_bmp = uint8(reshaped_image_ints);

figure
subplot(121)
imshow(origImage); 
title('Original Image');
subplot(122)
imshow(decoded_bmp);
title('Received Image');