【图像隐写】基于matlab LBP数字水印嵌入攻击提取【含Matlab源码 1672期】

一、获取代码方式

获取代码方式1:
完整代码已上传我的资源:【图像隐写】基于matlab LBP数字水印嵌入攻击提取【含Matlab源码 1672期】

获取代码方式2:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。

备注:
订阅紫极神光博客付费专栏,可免费获得1份代码(有效期为订阅日起,三天内有效);

二、部分源代码

clear all
close all
clc
global mm nn rr tt
%[mm nn]=Size Original Image , [rr tt]= size logo
%rr*tt should be less than mm/3*nn/3

%Reading Original Image
[fn fp]=uigetfile('*.*');
I=rgb2gray(imread([fp,fn]));
[mm nn]=size(I);
figure, subplot(2,2,1),imshow(I)
title(' Original Image')

%Reading LogO
[fn fp]=uigetfile('*.*');
logo=rgb2gray(imread([fp,fn]));
[rr tt]=size(logo);

logo=im2bw(logo,.8);
logo=double(logo);
subplot(2,2,3),imshow(logo)
title(' Original Logo')
%*****************************embedding*****************************

block=zeros(3,3);
s_p=zeros(3,3);
m_p=zeros(3,3);
blocki=zeros(1,9);
s_pi=zeros(1,9);
m_pi=zeros(1,9);
n=2;
beta=0.07;
% Based on paper beta=0.08
Image=int16(I);
Image_waterMarked=Image;
for i=3:3:mm-3
    for j=3:3:nn-3
        Image_c=Image(i+1,j+1);
        f_xor=0;
        for k=0:2
            for l=0:2
                %%%%%%%%%%%%%%%%%%%LBP pattern%%%%%%%% 
                block(k+1,l+1)=Image(i+k,j+l);
                s_p(k+1,l+1) = Sng(block(k+1,l+1),Image_c);
                %%%%%%%%%%%%%%%%%%%%%%%%
                m_p(k+1,l+1)=abs( block(k+1,l+1)-Image_c);
                %%%%%%%%%%%%%%%%%%%5
                s_x= s_p(k+1,l+1);
                f_xor = xor(f_xor,s_x);
                %%%%%%%%%%%%%%%%%%%%%%%%
            end
        end
        %%%%%%%%%%%%%%%%%%%%%%%%%
            blocki=block(:);
            s_pi=s_p(:);
            m_pi=m_p(:);
        block_min=min(blocki);
        m_pi(5)=max(m_pi);
        m_pmin=min(m_pi);
        for h=1:9
            blockit=m_pi(h);
            if(blockit==m_pmin)
                x=h;
            end
        end
        index=blocki(x);       
        s_pmin=s_pi(x);      
        %%%%%%%%%%%%%%%%%%%%%%%%embedding%%%%%%%%%%%%%%%
        if i/3<=rr 
            if j/3<= tt
        if (f_xor==logo(i/3,j/3))
            for m=0:2
                for n=0:2
                    Image_waterMarked(i+m,j+n)=block(m+1,n+1);
                end
            end
        elseif s_pmin==1
            block_min1=(index-m_pmin)*(1-beta);
            blocki(x)=block_min1;
            block=reshape(blocki,3,3);
            for m=0:2
                for n=0:2
                    Image_waterMarked(i+m,j+n)=block(m+1,n+1);
                end
            end

三、运行结果

【图像隐写】基于matlab LBP数字水印嵌入攻击提取【含Matlab源码 1672期】

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1]韩纪庆,张磊,郑铁然.语音信号处理(第3版)[M].清华大学出版社,2019.
[2]柳若边.深度学习:语音识别技术实践[M].清华大学出版社,2019.
[3]宋俊辉,鲁骏.彩色图像数字水印嵌入和提取模型研究——基于DWT和DCT[J].现代商贸工业. 2011,23(17)

上一篇:【图像隐写】基于matlab FFT数字水印嵌入【含Matlab源码 1670期】


下一篇:photoshop之logo图标为透明色