lsb_recover.m
上传用户:haoweisi88
上传日期:2010-02-03
资源大小:1950k
文件大小:1k
源码类别:

图形图象

开发平台:

Matlab

  1. %Name: Chris Shoemaker
  2. %Course: EER-280 - Digital Watermarking
  3. %Project:  Least Significant Bit Substitution 
  4. %           Watermark Recovery
  5. clear all;
  6. % save start time
  7. start_time=cputime;
  8. % read in watermarked image
  9. file_name='lsb_watermarked.bmp';
  10. %file_name='_lena_std_bw.bmp';
  11. watermarked_image=imread(file_name);
  12. % determine size of watermarked image
  13. Mw=size(watermarked_image,1); %Height
  14. Nw=size(watermarked_image,2); %Width
  15. % use lsb of watermarked image to recover watermark
  16. for ii = 1:Mw
  17.     for jj = 1:Nw
  18.         watermark(ii,jj)=bitget(watermarked_image(ii,jj),1);
  19.     end
  20. end
  21. % scale the recovered watermark
  22. watermark=2*double(watermark);
  23. % display processing time
  24. elapsed_time=cputime-start_time,
  25. % read in original watermark
  26. %file_name='_copyright_large.bmp';
  27. %orig_watermark=imread(file_name);
  28. % scale and display recovered watermark
  29. figure(2)
  30. imshow(watermark,[])
  31. title('Recovered Watermark')