• 大小: 3.37MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-10
  • 语言: Matlab
  • 标签: DCT  DWT  

资源简介

本程序是首先对图像进行DWT变换,然后对细节子图进行DCT变换的一种数字水印方案

资源截图

代码片段和文件信息



% embedding data through DWT technique



[filename pathname] = uigetfile(‘*.bmp‘ ‘Pick an M-file‘);

if isequal(filename0) || isequal(pathname0)

    warndlg(‘Image is not selected‘);
else
    a=imread(filename);
    a=imresize(a[512512]);
     imshow(a);
end

[filename pathname] = uigetfile(‘*.bmp‘ ‘Pick an M-file‘);

if isequal(filename0) || isequal(pathname0)

    warndlg(‘Image is not selected‘);
else
    secret=imread(filename);
    imshow(secret);
end

[LL LH HL HH]=dwt2(a‘haar‘);
[LL1 LH1 HL1 HH1]=dwt2(HL‘haar‘);
cover_object=HL1;
[Mc Nc]=size(HL1);


k=50;                           % set gain factor for embeding
blocksize=4;                    % set the dct blocksize

midband=[   0001;   % defines the mid-band frequencies of an 8x8 dct
            0011;
            0111;
            1110];
        
cover_object=double(HL1);
Mc=size(cover_object1);         %Height
Nc=size(cover_object2);         %Width

% determine maximum message size based on cover object and blocksize
max_message=Mc*Nc/(blocksize^2);

% read in the message image
message=double(secret);
Mm=size(message1);                 %Height
Nm=size(message2);                 %Width

% reshape the message to a vector
message=round(reshape(messageMm*Nm1)./256);

% check that the message isn‘t too large for cover
if (length(message) > max_message)
    error(‘Message too large to fit in Cover object‘)
end

% pad the message out to the maximum message size with ones‘s
message_vector=ones(1max_message);
message_vector(1:length(message))=message;

% generate shell of watermarked image
watermarked_image=cover_object;

% read in key for PN generator
file_name=‘_key.bmp‘;
% key=double(imread(file_name))./256;

% reset MATLAB‘s PN generator to state “key“
 rand(‘state‘35);

% generate PN sequence
pn_sequence_zero=round(2*(rand(1sum(sum(midband)))-0.5));
pn_sequence_one=round(2*(rand(1sum(sum(midband)))-0.5));

HLL=idwt2(LL1LH1watermarked_imageHH1‘haar‘);
watermarked_image_int=idwt2(LLLHHLLHH‘haar‘);
imwrite(uint8(watermarked_image_int)‘DwtdctHL2_watermarked.bmp‘‘bmp‘);

a=double(a);
psnr=psnr3(awatermarked_image_intNcMc)
imshow(watermarked_image_int[])
title(‘Watermarked Image‘)


% =========================================================================


% Retrieval through DWT technique\


% blocksize=4;                    % set the dct blocksize

% midband=[   0001;   % defines the mid-band frequencies of an 8x8 dct
%             0011;
%             0111;
%             1110];
%         
% % read in the watermarked object
% file_name=‘DwtdctHL2_watermarked.bmp‘;
% watermarked_image2=double(imread(file_name));
% [LL LH HL HH]=dwt2(watermarked_image2‘haar‘);
% [LL1 LH1 HL1 HH1]=dwt2(HL‘haar‘);
% watermarked_image=HL1;


% % determine size of watermarked image
% Mw=size(watermarked_image1);         %Height
% N

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    1501334  2011-03-15 15:05  dct-dwt\Combined DWT-DCT Digital Image Watermarking.pdf

     文件       3643  2011-03-15 15:05  dct-dwt\dw.asv

     文件       3723  2011-03-15 15:05  dct-dwt\dw.m

     文件     263222  2011-03-15 16:10  dct-dwt\DwtdctHL2_watermarked.bmp

     文件     263222  2011-03-15 16:10  dct-dwt\Filtered.bmp

     文件      15904  2011-03-15 15:15  dct-dwt\g.asv

     文件      15950  2011-03-15 16:06  dct-dwt\g.m

     文件      24304  2011-03-15 15:05  dct-dwt\guidemo.asv

     文件      12938  2011-03-15 15:05  dct-dwt\guidemo.fig

     文件      26953  2011-03-15 15:05  dct-dwt\guidemo.m

     文件    2332672  2011-03-15 15:05  dct-dwt\Hidden Bits.doc

     文件       6092  2011-03-15 15:19  dct-dwt\image water marking.m

     文件       1220  2011-03-15 15:05  dct-dwt\key.bmp

     文件      66614  2011-03-15 15:05  dct-dwt\lena.bmp

     文件        795  2011-03-15 15:05  dct-dwt\psnr3.asv

     文件        795  2011-03-15 15:05  dct-dwt\psnr3.m

     文件        551  2011-03-15 15:05  dct-dwt\third.asv

     文件        551  2011-03-15 15:05  dct-dwt\third.m

    ..A.SH.     59904  2011-04-15 15:44  dct-dwt\Thumbs.db

     文件       2120  2011-03-15 15:05  dct-dwt\_copyright.bmp

     文件     263222  2011-03-15 15:05  dct-dwt\_copyright_large.bmp

     目录          0  2012-03-06 21:52  dct-dwt

----------- ---------  ---------- -----  ----

              4865729                    22


评论

共有 条评论