LSB substitution by verifying pixel values odd or even

1 view (last 30 days)
for embedding a message b, keep the pixel value odd for bit 0 and even for bit 1. i have developed code in this manner. But output values are not getting as expected. Somebody plz help to figure out the mistake.
c=round(rand(2,12));
m=1:2;n=1:12;
a(m,n)=c(m,n);
disp(a);
b=dec2bin(128);
l=length(b);
for k=1:l
if b(k)==1
if mod(c(1,k),2)==1
c(1,k)=c(1,k);
else
c(1,k)=c(1,k)+1;
if mod(c(1,k),2)==0
c(1,k)=c(1,k);
else
c(1,k)=c(1,k)+1;
end
end
end
end
disp(c);

Answers (0)

Categories

Find more on Encryption / Cryptography 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!