candidate_Image=('apa.jpg');
M = 'rahasia.txt'
rahasia=fopen (M,'rb');
[M,L] = fread(rahasia,'ubit1');
[n,m]=size(candidate_Image);
m=m/3;
if (m*n*3<L)
msg=msgbox('your picture is too small','size error','modal');
pause (1);
if (ishandle (msg))
close (msg);
end
end
latest_data=candidate_Image;
count=1;
for i=1:m
for j=1:n
for k=1:3
latest_data(i,j,k)=candidate_Image(i,j,k)-mod(candidate_Image(i,j,k),2)+M(count,1);
if count==L
break;
end
count=count+1;
end
if count==L
break;
end
end
if (L==count)
break;
end
end
imwrite(latest_data, 'encrypted_Image.jpg', 'bmp');
CC=M;
countl=l;
for i=l:m
for j=l:n
for k=l:3
CC(countl)=latest_data(i,j,k)-candidate_Image(i,j,k);
if countl==L
break
end
countl=countl+l
end
if countl==L
break
end
end
if countl==L
break
end
end
0 Comments
Sign in to comment.