✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
基于离散分数傅里叶变换(DFRFT)快速算法发展了一种分数傅里叶谱域图像水印算法.该算法根据分数傅里叶变换谱具有空域和频域双域信息表达能力,分别对原始图像和所加水印信息进行不同级次的分数傅里叶变换,提取水印分数傅里叶谱的低频成分并直接将其叠加到原始图像的分数傅里叶谱中的对角像元上,然后再进行逆变换得到水印图像.
⛄ 部分代码
function [d,threshold] = WMdetect(wm_image,keys,ix,L,M,var,powers)
%
% detect watermark using technique 1 (alternative)
% IN : wm_image : the image
% keys : the watermark real and imaginary part (complex vector)
% ix,L,M : watermark is supposedly embedded in FRFT(ix(L+1:L+M))
% var : variance of watermark
% powers : powers of FRFT used to embed watermark
% OUT: d : the detection value
% threshold: value that is used to compare d with
%
% usage [d,threshold] = WMdetect(wm_image,key,ix,96000,8000,0.4,0.8,0.8)
%
%
% choose numrand = the number of random watermarks to be generated
% setting debug = 0 suppresses the output of auxiliary results
%
numrand = 100;
debug = 1;
n = min([length(L),length(M),length(var)]);
% 2D-frft of watermarked image, and select appropriate coefficients
% that are supposedly watermarked
wmfrft = frft2d(wm_image,powers);
Swmt = wmfrft(:);
for i = 1:n
Swm = Swmt(ix(L(i)+1:L(i)+M(i)));
stdev = sqrt(var(i)/2);
% compute detection value for the correct watermark
if (length(keys{i}) == 2), % received the seeds, hence generate the random sequences
if (debug), disp('using seeds'), end
randn('seed',keys{i}(1));
markr = stdev*randn(M(i),1);
randn('seed',keys{i}(2));
marki = stdev*randn(M(i),1);
else % received the random sequences
if (debug), disp('no seeds'), end
markr = keys{i}(:,1);
marki = keys{i}(:,2);
end
d(i) = abs(sum((markr-j*marki).*Swm));
% generate N = numrand watermarks to find out its mean and std
for k = 1:numrand
key1 = normrnd(0,stdev,M(i),1);
key2 = normrnd(0,stdev,M(i),1);
d1(k,i) = abs(sum((key1-j*key2).*Swm));
end
% which defines the threshold
threshold(i) = mean(d1(:,i)) + 4*std(d1(:,i));
% Compare detection value of exact with threshold
% The correct watermark is detected if its detection value is more
% than 4*std away from the detection value of a random watermark
if (d(i) < threshold(i)), disp (['watermark ',int2str(i),' not found'])
else disp (['watermark ',int2str(i),' found'])
end
if (debug), global fignum
nplot = numrand+1; nplot2 = floor(nplot/2);
meanplot = mean(d1(:,i));
threshplot = threshold(i);
stdevplot = std(d1(:,i));
disp(sprintf(...
' numrand = %d\n mean = %5.2f\n st.dev = %5.2f\n threshold = %5.2f\n det.value = %5.2f',...
[numrand, meanplot, stdevplot, threshplot, d(i)]))
figure(fignum+i),
plot(1:nplot,[d1(1:nplot2,i).', d(i), d1(nplot2+1:end,i).'],'-r',...
1:nplot,ones(nplot,1)*threshplot,'--b',...
1:nplot,ones(nplot,1)*meanplot,'-b'...
), axis('tight')
indfalse = find(d1(:,i) > threshold(i));
nfalse = length(indfalse);
disp(sprintf(' false alarms = %d',nfalse))
end
end
⛄ 运行结果



⛄ 参考文献
[1] 王银花. 分数傅里叶变换的研究与应用[D]. 安徽大学.
[2] 刘正君, 赵海发, 朱邦和,等. 分数傅里叶域数字水印算法[J]. 光子学报, 2003, 32(3):4.
[3] Zhengjun L , Haifa Z , Banghe Z , et al. 分数傅里叶域数字水印算法[J]. 光子学报, 32(3).
[4] 何泉, 田瑞卿, 王彦敏. 分数傅里叶域图像数字水印方案[J]. 计算机工程与设计, 2006, 27(24):3.
⛳️ 完整代码
❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料
177

被折叠的 条评论
为什么被折叠?



