Can someone please look at this document I attached, and also my code. Im not sure if my code is correct or not. I do get the two pictures with very minimal change at the end. I just want some insight into whether my code looks good or not, it feels like im missing something.
pic=imread('Cat.png')imshow(pic) title('original picture')[nrow ncol]=size(pic)cpic=picMi=input('Input message:','s')M=double(Mi)bin_m=dec2bin(8)bin_m=bin_m'bin_m=bin_m(:)if length(M)>nrow*ncol error('The message is too long!')endk=1for r=1:nrow for c=1:ncol if strcmpi(bin_m(k),'0'); cpic(r,c)=cpic(r,c); elseif strcmpi(bin_m(k),'1') && cpic(r,c)==255; cpic(r,c)=cpic(r,c)-1; else cpic(r,c)=cpic(r,c)+1; end endendimshow(pic)figure;imshow(cpic)
Best Answer