Clear Filters
Clear Filters

this is the first part to hide image in image using lsb. how to get the messege from the cove ? i tried to get it but i coudn't ... please i want it in my study

1 view (last 30 days)
close all;
imtool close all;
clear;
workspace;
cover = imread('pigs.tif');
message = imread('dpg.tif');
%display on screen the two images
figure(1), imshow(cover); title('Cover Image');
figure(2), imshow(message);title('Message Image');
%change to double to work with addition below
cover=double(cover);
message=double(message);
%imbed = no. of bits of message image to embed in cover image
imbed=4;
%shift the message image over (8-imbed) bits to right
%messageshift=bitshift(message,-(8-imbed));
%show the message image with only embed bits on screen
%must shift from LSBs to MSBs
messageshift=uint8(bitshift(message,-(8-imbed)));
showmess=uint8(messageshift);
showmess=bitshift(showmess,8-imbed);
figure(3),imshow(showmess);title('4 Bit Image to Hide');
%now zero out imbed bits in cover image
coverzero = cover;
for i=1:imbed
coverzero=bitset(coverzero,i,0);
end
cove=uint8(coverzero);
%now add message image and cover image
stego = imadd(cove,messageshift);
figure(4),imshow(stego);title('Stego image');
%save files if need to
%4 bit file that was embedded = same as file extracted
imwrite(stego,'stego22.tif');
  2 Comments
Guillaume
Guillaume on 13 Dec 2016
By using bitshift with an offset of 4 on your message, you're destroying half of the bits of your message. It is therefore impossible to recover it.
Also, why is the message initially converted to double if you're then going to convert it (twice!) to uint8. Also, what is the purpose of showmess that is never used anywhere (and is just the initial message with bits 0:imbed set to 0)

Sign in to comment.

Answers (0)

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!