필터 지우기
필터 지우기

How can I recover a hidden text in a Picture

조회 수: 1 (최근 30일)
Jadem Molina
Jadem Molina 2014년 11월 5일
편집: Geoff Hayes 2014년 11월 14일
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
Geoff Hayes
Geoff Hayes 2014년 11월 6일
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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by