MATLAB: Extracting a message from a picture

homeworkImage Processing Toolboxsteganography

In the attached document, Im really stuck on what its asking. Could someone please help me better understand it, and what it wants me to do. I would really appreciate that, Thanks! Confused on the the last two parts. I dont know what code to use for the for loop to run through the rows and columns of the difference.
This is all I got so far.
pic=imread('Cat.png')
pic1=imread('CodedCat.png')
origpic=double(pic)
cpic=double(pic1)
[nrow ncol]=size(origpic)
Difference=ab(pic-cpic)

Best Answer

Note that the decoding can be achieved much more efficiently with these three lines of codes:
cat = double(imread('Cat.png'));
codedcat = double(imread('CodedCat.png'));
message = char(bin2dec(char(reshape(abs(cat - codedcat)' == 1, 8, [])' + '0'))');
This is probably even more efficient since there's no number -> char -> number conversion to compute the ascii code of each character:
message = char(sum(bsxfun(@times, reshape(abs(cat - codedcat)' == 1, 8, []), 2 .^ (7:-1:0)')));