add text to photos please check my code, latest_dat​a(i,j,k)=c​andidate_I​mage(i,j,k​)-mod(cand​idate_Imag​e(i,j,k),2​)+M(count,​1);

1 visualización (últimos 30 días)
candidate_Image=('apa.jpg'); %load the image
M = 'rahasia.txt'
rahasia=fopen (M,'rb'); %open secret file
[M,L] = fread(rahasia,'ubit1'); %read secret file as bin array
% L is the length of secret file
[n,m]=size(candidate_Image); %n is width, m is height*3
m=m/3;
%m*n is the max size to save secret
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 %width
for j=1:n %height
for k=1:3 %RGB
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

Respuestas (1)

Image Analyst
Image Analyst el 22 de Nov. de 2019
What does that way under-commented code do? Is it steganography where you're hiding/encoding text in the image pixels? If so, see my attached example.
  6 comentarios

Iniciar sesión para comentar.

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by