How to extract watermark using Correlation for Spread Spectrum Watermarking
1 回表示 (過去 30 日間)
古いコメントを表示
% Genereate Spreading Sequence of 32-bit length
lengthofcode = 32;
goldcode=goldcodegenerator( lengthofcode);% GenerateSpreadingSequence(lengthofcode);
minuspluscode = zeros(1,lengthofcode);% utilised for - and + code generation
%Spreading the message with the Gold code
genkey='';
for i=1:lengthofcode
if goldcode(1,i)==1
genkey = strcat(genkey,'1');
minuspluscode(1,i)=-1;
else
minuspluscode(1,i)=1;
genkey = strcat(genkey,'0');
end
end
% ============WATERMARK EMBEDDING USING DCT OR DWT ====================
subplot(3,2,3) imshow(im) title('\bf DICOM Cover Image')
% d=dct2(ca) % Check if there is enough space for embedding entire watermark [row col] = size(ch);% size of HL sub-band blocklengthrequired=lengthofcode*msglength watermark=zeros(1,blocklengthrequired);
if (row*col) < blocklengthrequired error('All watermark bits cannot be embedded in the HL subband'); else warning('Watermark embedding in the HL sub-band...') end HLvector = reshape(ch,1,row*col);
k=1; % Watermark generation for i=1:msglength if msg(1,i)==0 spread = c*minuspluscode;%c*minuspluscode; else spread = -c*minuspluscode; end for j=1:lengthofcode watermark(1,k)= spread(1,j); k=k+1; end end k=1; % Watermark embedding for i=1:blocklengthrequired HLvector(1,i)= HLvector(1,i)+watermark(1,k);%Watermark embedding done here end chorig=ch;% Original HL sub-band values ch=reshape(HLvector,row,col); stego = idwt2(ca,ch,cv,cd,'haar'); diff = sum(sum(chorig-ch)) imwrite(uint8(stego),'sspectrumstego.tiff') sim = ssim(uint8(stego),im) % simch = ssim(uint8(chorig),uint8(ch)) psn = psnr(uint8(stego),
The values of the DWT Coeffient changes when I try to extract the watermark using the stego image created from the above code. I get useless set of characters that is not what I embedded. Please can anyone identify what is wrong.
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!