1

我正在使用离散小波变换(DWT)和加密进行图像水印项目。它是按以下步骤进行的

1.) 选定的主机图像(将隐藏水印的图像)。
2.) 选择水印。
3.)使用以下代码(Matlab代码)加密水印

    b= strcat(b,a);   %String Concatenation
    c=imread(b);     %Image is read and stored in the variable c
    [p,q,r]=size(c); %displaying the dimensions of Image
    % Cipher watermark %
    % this is a randperm method which generated  random values
    scrambleOrder = randperm(p*q); 
    redChannel = c(:, :, 1);  % Extraction of red channel
    greenChannel = c(:, :, 2); % Extraction of green channel
    blueChannel = c(:, :, 3); % Extraction of blue channel
    redChannel = redChannel(scrambleOrder); % Red channel scrambling
    greenChannel = greenChannel(scrambleOrder); % Green channel scrambling
    blueChannel = blueChannel(scrambleOrder); % Blue channel scrambling
    redChannel = reshape(redChannel, [p,q]);  % reshaping red channel 
    greenChannel = reshape(greenChannel, [p,q]); % reshaping green channel 
    blueChannel = reshape(blueChannel, [p,q]); % reshaping blue channel 
    s = cat(3, redChannel, greenChannel, blueChannel); % cat command for concatenation

4.) 使用 DWT 加水印。

5.) 使用恢复公式恢复加密水印。

6.) 使用以下代码解密水印。

     % it will generate the 2 columns having maximum value u*v and  where u and v are dimensions(width and height) of recovered watermark from watermarked image. 
     recoverOrder = zeros([u*v], 2); 
     recoverOrder(:, 1) = 1 : (u*v); % make the first column value from 1: u*v 
     recoverOrder(:, 2) = scrambleOrder; % make second column value of randon permutation generated during encryption
     newOrder1 = sortrows(recoverOrder, 2); % sort rows of column1 and column 2
     newOrder = newOrder1(:,1); Eliminate column2
     redChannel = redChannel(newOrder); % New order value into red channel
     greenChannel = greenChannel(newOrder); % New order value into green channel
     blueChannel = blueChannel(newOrder); % New order value into blue channel
     redChannel = reshape(redChannel, [u, v]); % reshape red channel
     greenChannel = reshape(greenChannel, [u, v]); % reshape green channel
     blueChannel = reshape(blueChannel, [u, v]); % reshape blue channel
     D = cat(3, redChannel, greenChannel, blueChannel); % cat RGB and store it in D

我的问题是我对水印图像进行了许多攻击,例如旋转、缩放、裁剪,但(水印和解密水印)之间的 PSNR 和 MSE 没有改变。我认为在解密过程中,我使用了用于加密图像的相同 rand 排列。

任何有价值的建议都会有助于理解其背后的原因。

4

0 回答 0