%%
% STDM算法实现主函数
% ShuanHolmes@outlook.com
%%
clc;
clear;
close all;
warning off;
d = 200; % 量化步长
Type = 1; % 平行投影 2:均匀 3:随机
%%
% Vp = ones(8,1); % 均匀投影向量
% Vp = Vp./sqrt(8);
%%
% Vp = randn(8,1);
% Vp = Vp./sqrt(sum(Vp.^2)); % 随机投影向量
%%
Carrier = imread('lena.bmp');
Msg = imread('logo_64.bmp');
Carrier = rgb2gray(Carrier);
figure(1);
subplot(1,3,1);
imshow(Carrier);
title('原始图像');
CarrierDCT = blkproc(Carrier,[8,8],@dct2);
[x,y] = size(CarrierDCT);
x = x/8;
y = y/8;
CarrierCellMat = cell(x,y);
VpCellMat = cell(x,y);
for i = 1:x
for j = 1:y
TmpMat = CarrierDCT((i-1)*8+1:i*8,(j-1)*8+1:j*8);
TmpDiagArray = diag(rot90(TmpMat));
if Type == 1 % 平行
Value = sum(TmpDiagArray.^2);
Vp = TmpDiagArray./sqrt(Value); % 平行投影
VpCellMat(i,j) = mat2cell(Vp);
elseif Type == 2 % 均匀
Vp = Vp; % 均匀投影向量
else % 随机
Vp = Vp; % 随机投影向量
end
V
STDM 数字水印算法
最新推荐文章于 2022-11-18 19:30:00 发布