MATLAB: How to extract a watermark in matlab

extractionImage Processing Toolboxwatermark

the matlab code which i have used is:-
clear all; close all; clc;
bit=input('Please define which bit you want to extract from? (8 | 7 | 6 | 5)'); image=imread('C:\Users\user\Desktop\wm pictures\lena.jpg');
imshow(image);
[row,col]=size(image);
Hlength=row*col;
i=1;
j=1;
k=1; row=128;
col=384;
wmimage=imread('C:\Users\user\Desktop\wm pictures\cameraman.jpg');
wm=dec2bin(wmimage);
Wlength=row*col*8;
host=dec2bin(image);
cnt=0;
while i <= Hlength
cnt=cnt+1;
if cnt>Wlength
break;
end
wm(j,k)=host(i,bit);
k=k+1;
if k>8
k=1;
j=j+1;
end
i=i+1;
end
wm1=bin2dec(wm);
wm2=reshape(wm1,row,col);
wmimage(1:row,1:col)=wm2(1:row,1:col);
imwrite(wmimage,'extracted.jpg');
imshow(wmimage);
This code is not giving the desired result.
If anyone can give me some other codes for extraction in spatial domain then please help me out.
thank you

Best Answer

  • If your watermark is just in one bitplane, then perhaps you'd be interested in my bitplane viewer, or in my LSB watermark demo, both attached.
  • Related Question