clear; clc;
a= imread ('c2.jpg'); I1=rgb2gray(a);
f = double(I1);
f= f-128; [mf, nf]= size(f); mb=mf/8; nb=nf/8;
Ff = blkproc(f, [8 8],'dct2');
quanttable=1*[16 11 10 16 24 40 51 61;
12 12 14 19 26 58 60 55;
14 13 16 24 40 57 69 56;
14 17 22 29 51 87 80 62;
18 22 37 56 68 109 103 77;
24 35 55 64 81 104 113 92;
49 64 78 87 103 121 120 101;
72 92 95 98 112 100 103 99];
Fq= round (blkproc(Ff,[8 8], @(x)x./quanttable));
imwrite(Fq, 'Compressed.jpg');
RFf= round(blkproc (Ff,[8 8], @(x)x.*quanttable));
invdct= @idct2;
x= blkproc(RFf,[8 8],invdct);
imwrite(x, 'cover.jpg');
Cover=imread('cover.jpg');
b='dima';
c=double(b);
d=dec2bin(c);
[q w]=size(d);
siz=q*w;%% first pixel
for i=1:siz
x=dec2bin(Cover(i));
x(8)=d(i);
y=bin2dec(x);
Cover(i)=y;
end
Cover(256,256)=q;
%%
for i=1:siz
X=dec2bin(Cover(i));
D(i)=X(8);
end
data=char(bin2dec(reshape(D,q,w))); data=data';
msgbox(data);
imwrite(Cover,'stego.jpg');
Stegoimage=imread ('stego.jpg');
%%
subplot(211);imshow(Cover);title('cover');
subplot(212);imshow(Stegoimage);title('stego');