1- Hide a binary picture in a RGB picture so that 7 bits given for the actual picture and the 8th bit will carry the data of the binary image, for the later, you can take a random screenshot for a text and convert it to binary using matlab.
2- In matlab code make a string variable and put in it any sentence "message", then encode this string to binary and put it in the 8th bit of the RGB picture data bits, just like the first binary image.
3- Extract the binary image back from the first requirement, and the text message from the second.

3 Kommentare

Yongjian Feng
Yongjian Feng am 19 Nov. 2021
Try it yourself first please. We can then help to make it work.
Ramiz Siam
Ramiz Siam am 19 Nov. 2021
This code works to hide text in an image. I need to hide a picture in a picture
DGM
DGM am 20 Nov. 2021
What's the difference between cramming a binary vector into the LSB plane and doing the same with a binary matrix?
The answer is that the only difference is a matter of indexing because one is a vector and one is a matrix.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

DGM
DGM am 20 Nov. 2021

0 Stimmen

For example:
% host image
A = imread('cameraman.tif');
sa = size(A);
% payload image
B = imread('hands1-mask.png');
B = imcrop(B,[1 1 min(size(B))-[1 1]]); % crop or resize as needed
B = char(B + char('0'));
sb = size(B);
% cram B into A
Ab = reshape(permute(dec2bin(A),[1 3 2]),[sa 8]);
Ab(1:sb(1),1:sb(2),8) = B; % insert into LSB plane
Ab = uint8(reshape(bin2dec(reshape(Ab,prod(sa),8,1)),sa));
imshow(Ab)
Note that A is larger than B
Recovering the image should be mostly just a matter of copying and pasting parts of the above code.

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 19 Nov. 2021

Beantwortet:

DGM
am 20 Nov. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by