Borrar filtros
Borrar filtros

How can I recover a hidden text in a Picture

1 visualización (últimos 30 días)
Jadem Molina
Jadem Molina el 5 de Nov. de 2014
Editada: Geoff Hayes el 14 de Nov. de 2014
I got this code below to Hide a text in a Picture, but I can not recover the hidden text. Can someone help me please
c = imread('any_image.jpg');
message = 'hi this is sagar from nagpur..'
message = strtrim(message);
m = length(message) * 8;
AsciiCode = uint8(message);
binaryString = transpose(dec2bin(AsciiCode,8));
binaryString = binaryString(:);
N = length(binaryString);
b = zeros(N,1); %b is a vector of bits
for k = 1:N
if(binaryString(k) == '1')
b(k) = 1;
else
b(k) = 0;
end
end
s = c;
height = size(c,1);
width = size(c,2);
k = 1; Array=[];l=1;my=1;
for i = 1 : height
for j = 1 : width
LSB = mod(double(c(i,j)), 2);
if (k>m || LSB == b(k))
s(i,j) = c(i,j);
l=k+1;
else
if(LSB == 1)
s(i,j) = c(i,j) - 1;
else
s(i,j) = c(i,j) + 1;
Array(my)=l;
l=l+1;
my= my + 1;
end
k = k + 1;
end
end
end
imwrite(s, 'hiddenmsgimage.bmp');
k = 1;my=1;ur=1;
for i = 1 : height
for j = 1 : width
if( k<=m )
if (my<numel(Array) && Array(my)==ur)
b(k)=~(mod(double(s(i,j)),2));
else
b(k) = mod(double(s(i,j)),2);
end
k = k + 1;
my= my + 1;
end
ur=ur+1;
end
end
  1 comentario
Geoff Hayes
Geoff Hayes el 6 de Nov. de 2014
Jadem - you should first verify that the algorithm to embed the secret text is what you and/or makes sense. It seems that it only embeds one bit of the secret message whenever the bit that you want to add does not match the least significant bit (lsb) of the kth image pixel. And every time a zero lsb is replaced with a one, then the Array is updated. What is the intent behind this array?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by