• 大小: 302KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-31
  • 语言: Matlab
  • 标签: LSB  水印  matlab  

资源简介

LSB数字水印的matlab源程序,有两个文件,一个嵌入水印文件,一个提取水印文件

资源截图

代码片段和文件信息

%Name:		Chris Shoemaker
%Course: EER-280 - Digital Watermarking
%Project:  Least Significant Bit Substitution
%           Watermark embeding

clear all;

% save start time
start_time=cputime;

% read in the cover object
file_name=‘_lena_std_bw.bmp‘;
[cover_objectmap]=imread(file_name);

% read in the message image
file_name=‘key.bmp‘;
[messagemap1]=imread(file_name);
message1=message;

% convert to double for normalization then back again
message=double(message);
message=fix(message./2);
message=uint8(message);

% determine size of cover object
Mc=size(cover_object1); %Height
Nc=size(cover_object2); %Width

% determine size of message object
Mm=size(message1);         %Height
Nm=size(message2);         %Width

% title the message object out to cover object size to generate watermark
for ii = 1:Mc
    for jj = 1:Nc
        watermark(iijj)=message(mod(iiMm)+1mod(jjNm)+1);
    end
end

% now we set the lsb of cover_object(iijj) to the value of watermark(iijj)
watermarked_image=cover_object;
for ii = 1:Mc
    for jj = 1:Nc
        watermarked_image(iijj)=bitset(watermarked_image(iijj)1watermark(iijj));
    end
end

% write the watermarked image out to a file
imwrite(watermarked_image‘lsb_watermarked.bmp‘‘bmp‘);

% display processing time
elapsed_time=cputime-start_time

% calculate the PSNR
psnr=psnr(cover_objectwatermarked_imageMcNc)

% display watermarked image
figure(1)
imshow(watermarked_image[])
title(‘Watermarked Image‘)
figure(2)
imshow(cover_object[])
title(‘original  image‘)
for ii = 1:Mc
    for jj = 1:Nc
        watermark1(iijj)=message1(mod(iiMm)+1mod(jjNm)+1);
    end
end
%watermark1=watermark1*256;
%message1=message1*256;
figure(3)
imshow(watermark1[])
title(‘the watermark‘)
figure(4)
imshow(message1[])
title(‘the watermark‘)

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

     文件        801  2002-11-12 18:37  watermark LSB\fig11.gif

     文件     147630  2002-11-12 18:37  watermark LSB\fig13s.gif

     文件      14622  2002-11-18 09:33  watermark LSB\key.bmp

     文件      66614  2002-11-20 09:46  watermark LSB\lena.bmp

     文件      71115  2002-11-02 16:05  watermark LSB\lena3.gif

     文件       1873  2002-11-19 20:13  watermark LSB\lsb_embed.m

     文件        958  2002-11-13 14:06  watermark LSB\lsb_recover.m

     文件      11416  2003-06-25 13:15  watermark LSB\test.jpg

    ..A.SH.     36864  2010-05-10 16:56  watermark LSB\Thumbs.db

     文件      42240  2001-03-25 15:47  watermark LSB\_key.bmp

     目录          0  2010-04-24 20:54  watermark LSB

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

               394133                    11


评论

共有 条评论