Image encoding matlab code
Afficher commentaires plus anciens
hello
this code is working perfectly but it is embedding secret message in upper left square only. but I want to embedd on every block i.e i have 64x64 blocks , in each bloock there are 8x8 blocks. I am a bit confused but would be grateful for any help because i am a beginner level of matlab.
mark=imbinarize(Watermark_Image);
marksize=size(mark);
rm=marksize(1); %rowMat is the number of lines of the watermark image
cm=marksize(2);
figure(1);subplot(2,3,2);imshow(Watermark_Image),title('Watermark image');
T = dctmtx(8);
alpha=105; %The scale factor, which controls the strength of the watermark addition, determines how much the frequency domain coefficients are modified
k1=randn(1,8); %Generate two different random sequences, ruturns nxm matrix of normally distributed random numbers
k2=randn(1,8);
Dct_Image=blkproc(Y,[8 8],'dct2');
Output_Image=Dct_Image;
for E=1:4096
for i=1:rm
for j=1:cm
x=(i-1)*8;
y=(j-1)*8;
if mark(i,j)==1
k=k1;
else
k=k2;
end
% Output_Image(x,y)=Dct_Image(x,y)+alpha*k;
Output_Image(x+1,y+8)=Dct_Image(x+1,y+8)+alpha*k(1);
Output_Image(x+2,y+7)=Dct_Image(x+2,y+7)+alpha*k(2);
Output_Image(x+3,y+6)=Dct_Image(x+3,y+6)+alpha*k(3);
Output_Image(x+4,y+5)=Dct_Image(x+4,y+5)+alpha*k(4);
Output_Image(x+5,y+4)=Dct_Image(x+5,y+4)+alpha*k(5);
Output_Image(x+6,y+3)=Dct_Image(x+6,y+3)+alpha*k(6);
Output_Image(x+7,y+2)=Dct_Image(x+7,y+2)+alpha*k(7);
Output_Image(x+8,y+1)=Dct_Image(x+8,y+1)+alpha*k(8);
end
end
end
% firsttX = blkproc(after,[8,8], 'P1*x', mask);
resultY=uint8(blkproc(Output_Image,[8 8], 'idct2'));

5 commentaires
KALYAN ACHARJYA
le 6 Déc 2020
Please share the complete code with images (attach).
Image Analyst
le 6 Déc 2020
How about if you resize your watermark image to match the size of the cover image before you encode it?
marie lasz
le 6 Déc 2020
marie lasz
le 6 Déc 2020
Rik
le 7 Déc 2020
I restored the original post from Google cache. @Marie, don't remove crucial parts of your question.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Watermarking dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
