Digital Image Watermarking Technology Based on Matlab

Digital Image Watermarking Technology Based on Matlab


  1. Subject introduction

Digital watermarking technology involves many image processing algorithms and mathematical calculation tools. If the above algorithms are implemented with ordinary programming tools, it will take a lot of time. MathWorks, a simple, efficient, and powerful high-level language - MATLAB language, which has high-performance numerical computing capabilities, and a visual computing environment. Many complex computational problems can be solved in MATLAB with just a few lines of code.

  1. Concrete implementation of word watermarking

1 Embedding of digital watermark

Watermark embedding is to embed the watermark signal into the original image. The watermark embedding process is shown in the figure


v2-991bda7c41f668ced25e7d8e574333da_b.jpg


Figure 1 Watermark extraction process

Watermark embedding criteria include two criteria: H-method criterion and multiplication criterion. The penalty criterion has a strength factor. In order to ensure that the watermark is invisible, the strength of the embedded watermark should be increased as much as possible. The choice of intensity factor must take into account the nature of the image as well as the characteristics of the visual system.

2 Extraction and detection of digital watermark

In a watermarking system, the watermark can be extracted accurately, and this process is watermark extraction. For example, in the application of integrity verification, the embedded watermark must be extracted accurately, and the integrity of multimedia data must be confirmed through the integrity of the watermark. If the extracted watermark is partially changed, it is better to determine whether the original data has been tampered with through the position of the changed watermark. Watermark extraction and detection may or may not require the participation of the original image. However, when using watermarking technology for image network publishing and dissemination, it is a defect if the original image is required for detection. Therefore, most of the current watermark detection algorithms do not require the participation of the original image [2]. Figure 2 and Figure 3 are block diagrams of watermark extraction and detection respectively.


v2-991bda7c41f668ced25e7d8e574333da_b.jpg


Figure 2 Watermark extraction process



v2-d376cd442e4ce7f913275a8f369bd3c9_b.jpg


Figure 3 Watermark detection process

3 Using Matlab to realize image digital watermark loading algorithm

Watermarking an image is actually a process of modifying image data to hide information codes with specific meanings for the image. At present, the most common digital watermarking algorithms include: least significant bit algorithm LSB (Least significant bits), Patchwork method and texture block mapping coding method, methods based on transform domain, etc. Among them, the LSB algorithm has a large amount of information hiding, but the watermark is very fragile and easy to be erased. The Patchwork method and the texture block mapping coding method have better concealment, and have better resistance to lossy JPEG and filtering, compression and twisting operations, but they are only suitable for images with a large number of texture areas, and cannot be fully automated.

The method based on the transform domain has better robustness, and the transform includes: discrete cosine transform (DCT), wavelet transform (WT), Fourier transform (FFT) and Hamas transform, etc. Among them, the block-based DCT is one of the most commonly used transformations, because the still image compression standard JPEG currently adopted is also based on the block-based DCT.

This paper uses discrete cosine transform (DCT) to design the watermark embedding algorithm, and uses the binary image as the watermark signal, and uses Matlab (currently the most popular engineering and design software in China) to realize the algorithm.

4 Watermark attack test

Because digital watermarking may be attacked by various kinds in practical applications, the attack test on the algorithm is an important means to measure the quality of a watermarking algorithm. The second half of this program is a program of watermark attack and watermark extraction. First, JPEG compression is performed on the image embedded with watermark (a kind of watermark attack), and then the watermark is extracted from the compressed image.


v2-481d19b0e884193a52f1554c44a7892d_b.jpg


Figure 4 Original public image


v2-aee5ae2249df2c7faec1fc505966d8d6_b.jpg


Figure 5 Watermark image


v2-73c5ad08b291cc7185cb61a451f56702_b.jpg


Figure 6 Image after embedding watermark

v2-0f9f309c2bec6b07ba78fd72e50dd92a_b.jpg


Figure 7 Watermark image with Gaussian noise added

v2-c30311b897df484df5f7d28518e345c3_b.jpg


Figure 8 The watermarked image extracted from the watermarked image

5 source code implementation


clear 
clc
M =512;%原图像长度
N =64;%水印图像长度
K =8;
I=zeros(M,M);J=zeros(N,N);BLOCK=zeros(K,K);
%显示原图像
subplot(2,3,1);
I=imread('C:\Documents and Settings\Administrator\桌面\图像.jpg','jpg');imshow(I);title('原始公开图像');
%显示水印图像
subplot(2,3,2);
J=imread('C:\Documents and Settings\Administrator\桌面\水印.jpg','jpg');imshow(J);title ('水印图像');
%水印嵌入
for p=1:N
for q=1:N
x=(p-1)*K+1; y=(q-1)*K+1;
  BLOCK =I(x:x+K-1,y:y+K-1);BLOCK=dct2(BLOCK);
if J(p,q)==0
  a=-1;
else
  a=1;
end
BLOCK(1,1)=BLOCK(1,1)*(1+a*0.03);BLOCK=idct2(BLOCK);
I(x:x+K-1,y:y+K-1)=BLOCK;
end
end
%显示嵌入水印后的图像
subplot(2,3,3);
imshow(I);title('嵌入水印后的图像');
imwrite(I,'C:\Documents and Settings\Administrator\桌面\图像.jpg','jpg');
%从嵌入水印的图像中提取水印
I=imread('C:\Documents and Settings\Administrator\桌面\图像.jpg','jpg');
J=imread('C:\Documents and Settings\Administrator\桌面\水印.jpg','jpg');
J=imnoise(J,'gaussian',0,0.01);
subplot(2,3,4);imshow(J,[]);title('加入高斯噪声');
for p=1:N
for q=1:N
x=(p-1)*K+1;
y=(q-1)*K+1;
BLOCK1 =I(x:x+K-1,y:y+K-1);
BLOCK2 =J(x:x+K-1,y:y+K-1);
BLOCK1=dct2(BLOCK1);
BLOCK2=dct2(BLOCK2);
a = BLOCK2(1,1)/BLOCK1(1,1)-1;
if a<0
W(p,q)=0;
else
W(p,q)=1;
end
end
end
%显示提取的水印
subplot(2,3,5);
imshow(W);
title('从含水印图像中提取的水印');

Guess you like

Origin blog.csdn.net/TuTu998/article/details/120177065