Unlock Hidden Messages in Images with MATLAB: A Beginnerโs Guide to Steganography ๐
Discover how to embed and extract secret data within digital images using LSB-based steganography in this easy-to-follow MATLAB tutorial. Perfect for beginners exploring digital security and data hiding techniques!

Knowledge Amplifier
9.6K views โข Oct 14, 2020

About this video
The goal of the project is to construct an introductory tutorial on the subject of steganography, mainly focused on embedding data in digital images. Steganography is a Greek word which means camouflaged piece. The word stegano infers verified and graphical infers forming. Appropriately, steganography isnโt only the specialty of hiding data yet furthermore disguising the truth of transmission of secret data.
Code:
clc
clear all
close all
warning off
a=imread('testimage.png');
subplot(2,2,1);
imshow(a);
title('Carrier Image');
x=imread('SECRET.jpg');
subplot(2,2,2);
imshow(x);
title('Secret Image');
[r c g]=size(a);
x=imresize(x,[r c]);
ra=a(:,:,1);
ga=a(:,:,2);
ba=a(:,:,3);
rx=x(:,:,1);
gx=x(:,:,2);
bx=x(:,:,3);
for i=1:r
for j=1:c
nc(i,j)= bitand(ra(i,j),254);
ns(i,j)= bitand(rx(i,j),128);
ds(i,j)=ns(i,j)/128;
fr(i,j)=nc(i,j)+ds(i,j);
end
end
redsteg=fr;
for i=1:r
for j=1:c
nc(i,j)= bitand(ga(i,j),254);
ns(i,j)= bitand(gx(i,j),128);
ds(i,j)=ns(i,j)/128;
fr(i,j)=nc(i,j)+ds(i,j);
end
end
greensteg=fr;
for i=1:r
for j=1:c
nc(i,j)= bitand(ba(i,j),254);
ns(i,j)= bitand(bx(i,j),128);
ds(i,j)=ns(i,j)/128;
fr(i,j)=nc(i,j)+ds(i,j);
end
end
bluesteg=fr;
finalsteg=cat(3,redsteg,greensteg,bluesteg);
redstegr=finalsteg(:,:,1);
greenstegr=finalsteg(:,:,2);
bluestegr=finalsteg(:,:,3);
subplot(2,2,3);
imshow(finalsteg);
title('Stegmented Image');
for i=1:r
for j=1:c
nc(i,j)=bitand(redstegr(i,j),1);
ms(i,j)=nc(i,j)*128;
end
end
recoveredr=ms;
for i=1:r
for j=1:c
nc(i,j)=bitand(greenstegr(i,j),1);
ms(i,j)=nc(i,j)*128;
end
end
recoveredg=ms;
for i=1:r
for j=1:c
nc(i,j)=bitand(bluestegr(i,j),1);
ms(i,j)=nc(i,j)*128;
end
end
recoveredb=ms;
output=cat(3,recoveredr,recoveredg,recoveredb);
subplot(2,2,4);
imshow(output);
title('Recovered Image');
MATLAB Image processing based project.
MATLAB project for Engineering Students.
MATLAB Based software project
Image Steganography and Cryptography.
M.tech Projects Based on MATLAB.
Learn Complete Machine Learning & Data Science using MATLAB:
https://www.youtube.com/playlist?list=PLjfRmoYoxpNoaZmR2OTVrh-72YzLZBlJ2
Learn Digital Signal Processing using MATLAB:
https://www.youtube.com/playlist?list=PLjfRmoYoxpNr3w6baU91ZM6QL0obULPig
Learn Complete Image Processing & Computer Vision using MATLAB:
https://www.youtube.com/playlist?list=PLjfRmoYoxpNostbIaNSpzJr06mDb6qAJ0
๐๐๐๐๐๐๐๐
YOU JUST NEED TO DO
3 THINGS to support my channel
LIKE
SHARE
&
SUBSCRIBE
TO MY YOUTUBE CHANNEL
Code:
clc
clear all
close all
warning off
a=imread('testimage.png');
subplot(2,2,1);
imshow(a);
title('Carrier Image');
x=imread('SECRET.jpg');
subplot(2,2,2);
imshow(x);
title('Secret Image');
[r c g]=size(a);
x=imresize(x,[r c]);
ra=a(:,:,1);
ga=a(:,:,2);
ba=a(:,:,3);
rx=x(:,:,1);
gx=x(:,:,2);
bx=x(:,:,3);
for i=1:r
for j=1:c
nc(i,j)= bitand(ra(i,j),254);
ns(i,j)= bitand(rx(i,j),128);
ds(i,j)=ns(i,j)/128;
fr(i,j)=nc(i,j)+ds(i,j);
end
end
redsteg=fr;
for i=1:r
for j=1:c
nc(i,j)= bitand(ga(i,j),254);
ns(i,j)= bitand(gx(i,j),128);
ds(i,j)=ns(i,j)/128;
fr(i,j)=nc(i,j)+ds(i,j);
end
end
greensteg=fr;
for i=1:r
for j=1:c
nc(i,j)= bitand(ba(i,j),254);
ns(i,j)= bitand(bx(i,j),128);
ds(i,j)=ns(i,j)/128;
fr(i,j)=nc(i,j)+ds(i,j);
end
end
bluesteg=fr;
finalsteg=cat(3,redsteg,greensteg,bluesteg);
redstegr=finalsteg(:,:,1);
greenstegr=finalsteg(:,:,2);
bluestegr=finalsteg(:,:,3);
subplot(2,2,3);
imshow(finalsteg);
title('Stegmented Image');
for i=1:r
for j=1:c
nc(i,j)=bitand(redstegr(i,j),1);
ms(i,j)=nc(i,j)*128;
end
end
recoveredr=ms;
for i=1:r
for j=1:c
nc(i,j)=bitand(greenstegr(i,j),1);
ms(i,j)=nc(i,j)*128;
end
end
recoveredg=ms;
for i=1:r
for j=1:c
nc(i,j)=bitand(bluestegr(i,j),1);
ms(i,j)=nc(i,j)*128;
end
end
recoveredb=ms;
output=cat(3,recoveredr,recoveredg,recoveredb);
subplot(2,2,4);
imshow(output);
title('Recovered Image');
MATLAB Image processing based project.
MATLAB project for Engineering Students.
MATLAB Based software project
Image Steganography and Cryptography.
M.tech Projects Based on MATLAB.
Learn Complete Machine Learning & Data Science using MATLAB:
https://www.youtube.com/playlist?list=PLjfRmoYoxpNoaZmR2OTVrh-72YzLZBlJ2
Learn Digital Signal Processing using MATLAB:
https://www.youtube.com/playlist?list=PLjfRmoYoxpNr3w6baU91ZM6QL0obULPig
Learn Complete Image Processing & Computer Vision using MATLAB:
https://www.youtube.com/playlist?list=PLjfRmoYoxpNostbIaNSpzJr06mDb6qAJ0
๐๐๐๐๐๐๐๐
YOU JUST NEED TO DO
3 THINGS to support my channel
LIKE
SHARE
&
SUBSCRIBE
TO MY YOUTUBE CHANNEL
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
9.6K
Likes
113
Duration
14:41
Published
Oct 14, 2020
User Reviews
4.4
(1) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.