分数傅里叶域中的数字水印matlab应用

✅作者简介:热爱科研的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电子书和数学建模资料

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值