天天看點

【圖像隐藏】基于 DCT算法實作彩色數字水印嵌入提取含Matlab源碼

1 簡介

文章對DCT(離散餘弦變換)域圖像數字水印算法進行了研究,并用matlab工具進行實驗,結果表明該算法使水印的嵌入達到了較好的魯棒性和不可見性.對原始信号做 DCT 的算法:Cox 和 Piva 等人提出的 DCT 技術的經典之作。Cox 利用随機數發生器産生标準正态序列作為水印資訊對圖像進行整體 DCT 變換後,選取除去 DC 系數之外部分較低頻率系數疊加水印資訊;Piva 則修改整幅圖像的中頻部分。對原始信号分塊後,再作 DCT 的算法:Hsu 和 Wu 把圖像進行 8*8 分塊,将一個二進制序列作為水印放入 DCT 的中頻區;有些學者則計算整個圖像的 DCT,把一個實數序列嵌入DCT 的中頻系數上。選擇中頻區的好處是一方面盡量減少嵌入資訊對圖像主觀視覺的影響;同時,盡量避免有損壓縮對水印資訊可能帶來的損失。

2 部分代碼

clear,clc     
%{
%------------------------------------------------------------------
%加入水印
%------------------------------------------------------------------
Watermarking='./Test picture/test_1.jpg';
WM=imread(Watermarking);                         %水印圖像
figure,imshow(WM),title('Watermarking');
%-----------------------------------------------
Image_name  ='./Test picture/test_2.jpg';
IM=imread(Image_name);                           %原始載體
figure,imshow(IM),title('Original drawing');
%-----------------------------------------------
Add_Watermarking(Watermarking,Image_name);       %添加水印
%-----------------------------------------------
At_Watermarking_picture='./Watermarking picture/At Watermarking picture.png';
AWM=imread(At_Watermarking_picture);             %添加水印後的圖檔
figure,imshow(AWM),title('After watermarking picture');
%------------------------------------------------------------------
%加密
%------------------------------------------------------------------
Modulation_Key=0.362000000001;                            %加密密鑰
Image_name='./Watermarking picture/At Watermarking picture.png';
W_encryption_picture=imread(Image_name);                  %将加密的圖像
figure,imshow(W_encryption_picture),title('Before the encryption');
%-----------------------------------------------
Image_Encryption(Modulation_Key,Image_name);              %混沌加密函數
%-----------------------------------------------
encryption_picture='./Encryption picture/encryption picture.png';
image_encryption=imread(encryption_picture);              %加密後圖像
figure,imshow(image_encryption),title('After encrypted');
%------------------------------------------------------------------
%解密
%------------------------------------------------------------------
Modulation_Key;                                           %解密密鑰
Image_name='./Encryption picture/encryption picture.png';
image_encryption=imread(Image_name);                      %被加密的圖像
figure,imshow(image_encryption),title('Before the decryption');
%-----------------------------------------------
Image_Decryption(Modulation_Key,Image_name)               %解密函數
%-----------------------------------------------
decryption_picture='./Decryption picture/decryption picture.png';
image_Decryption=imread(decryption_picture);              %解密後的圖像
figure,imshow(image_Decryption),title('After decrypted');
%}
%------------------------------------------------------------------
%提取水印
%------------------------------------------------------------------
Image_name='./Decryption picture/decryption picture.png';
A_Watermarking_Picture=imread(Image_name);                %提取水印前的圖像
figure,imshow(A_Watermarking_Picture),title('Before extract Watermarking');
%-----------------------------------------------
Extract_Watermarking(Image_name)
%-----------------------------------------------
Watermarking_picture='./Watermarking picture/Watermarking picture.png';
A_Watermarking_Picture=imread(Watermarking_picture);       %提取的水印圖像
figure,imshow(A_Watermarking_Picture),title('Watermarked image');
%------------------------------------------------------------------      

3 仿真結果

【圖像隐藏】基于 DCT算法實作彩色數字水印嵌入提取含Matlab源碼

4 參考文獻

部落客簡介:擅長智能優化算法、神經網絡預測、信号處理、元胞自動機、圖像處理、路徑規劃、無人機等多種領域的Matlab仿真,相關matlab代碼問題可私信交流。

部分理論引用網絡文獻,若有侵權聯系部落客删除。

繼續閱讀