i need a code for hiding a text in an image using lsb technique
이전 댓글 표시
hello, i need a code to hide a message in an image using lsb technique(Steganography).... im new user to use a matlab... i just only knew the basic command of matlab.... plzzzzzzzzz help
댓글 수: 17
sagar hepat
2014년 10월 28일
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
try this dude enjoy
Jadem Molina
2014년 11월 4일
hello, How can I get the hidden data on the Image. Thanks!
vaishali sharma
2015년 4월 9일
이동: DGM
2023년 2월 5일
hello sir m beginner and m implementing lsb but i didnt get why we are using : for k = 1:N if(binaryString(k) == '1') b(k) = 1; else b(k) = 0; end end
Akhil Ram Sai
2016년 4월 3일
can you also comment the code for reconstruction of the text
Walter Roberson
2016년 4월 3일
Akhil Ram Sai, who are you addressing that to? sagar hepat is unlikely to see your request a year and half after they posted the question, and the volunteers who read this are likely to refer you to http://www.mathworks.com/matlabcentral/answers/?term=tag%3A%22steganography%22 as a number of other people have already commented their reconstruction code.
hudof najeeb
2016년 12월 4일
can you give me the decoded to return back the hidden text from the original and the encoded image ...please
hudof najeeb
2016년 12월 5일
sir,it was very interesting program but it used gray-level image .I want color image.how i can get it and if I want to get the hide text from cover image what i must do ?I mean the second part when I have original and cover image thx
Walter Roberson
2016년 12월 5일
Reshape your color image to rows by (columns * 3) and now the code cannot tell it was not just a wide gray image. Afterwards, reshape() it back.
Image Analyst
2016년 12월 5일
Or you can just extract one color channel, encode the text into it, then stick it back in.
Amal
2022년 11월 12일
i need a code for hiding a text in an image using lsb technique ?
Image Analyst
2022년 11월 12일
@Amal see attached
Image Analyst
2022년 11월 12일
이동: DGM
2023년 2월 5일
What do you mean by the image is inside the button? How can you have an image inside the button? You mean a button with a little picture or icon on it? An image that could fit inside a button would most likely not have enough pixels in it to hide anything. Then there's the problem of getting the image out of the button. Why do you want/need to do this anyway?
Walter Roberson
2022년 11월 13일
이동: DGM
2023년 2월 5일
If you have a uicontrol style 'edit' (traditional figures), or if you have a uitext (uifigures) and those have text in them, then matlab does not provide any way itself to find out what text is selected.
The same is true for edit fields.
You can find out which cells of a table are selected, or which entries of a list box or drop box are selected, but not what text is selected within a field.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!