Program for steganography and retrieval of secret message using Matlab
The art and science of hiding information by embedding
messages within other, seemingly harmless messages. Steganography works by
replacing bits of useless or unused data in regular computer files (such as
graphics, sound, text, HTML) with bits of different, invisible information.
This hidden information can be plain text, cipher text, or even images.
PROGRAM:
%Program for Steganography
clc;
img1=imread('D:\sample.jpg');
img1=rgb2gray(img1);
[row,col]=size(img1);
img2=imread('D:\secret.jpg');
img2=imresize(img2,[row,col]);
img2=rgb2gray(img2);
img2=double(img2);
for x=1:1:row
for y=1:1:col
temp1=dec2bin(img1(x,y),8);
temp2=dec2bin(img2(x,y),8);
temp1(8)=temp2(1);
steg(x,y)=bin2dec(temp1);
end
end
steg=uint8(steg);
imwrite(steg,'D:\stego.tif');
subplot(2,2,1);
imshow(uint8(img1));
title('CARRIER IMAGE');
subplot(2,2,2);
imshow(uint8(img2));
title('SECRET DATA');
subplot(2,2,3);
imshow(steg);
title('STEGO IMAGE');
Output:
%Program for Retrieval
clc;
img=imread('D:\stego.tif');
[row,col]=size(img);
for x=1:1:row
for y=1:1:col
temp=dec2bin(img(x,y),8);
if(temp(8)=='0')
temp='00000000';
img2(x,y)=bin2dec(temp);
else
temp='11111111';
img2(x,y)=bin2dec(temp);
end
end
end
figure(1);
imshow(img2);
title('Retrieved Image');
Output:
Download Program:
No comments:
Post a Comment