图像隐写基于高斯模型的JPEG图像隐写matlab源码

Posted MatlabQQ1575304183

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了图像隐写基于高斯模型的JPEG图像隐写matlab源码相关的知识,希望对你有一定的参考价值。

一、简介

在这里插入图片描述
在这里插入图片描述

二、源代码

% This example demonstrates how to use the MG embedding function
clc
clear all
close all
% Read the input cover image
Cover = double(imread ('1.pgm'));
% Set the payload to 0.4 bpp
Payload = 0.4;
% MG embedding
tStart = tic;
[Stego, pChange, ChangeRate] = MG( Cover, Payload );
tEnd = toc(tStart);
fprintf('MG embedding is done in: %f (sec)\\n',tEnd);
%%
figure;
imshow (Cover,[]);
title ('Cover image');
 
function [Stego, pChange, ChangeRate] = MG ( Cover, Payload )
% -------------------------------------------------------------------------
% Multivariate Gaussian Embedding    |   September 2015    |   version 1.0 
% -------------------------------------------------------------------------
% INPUT:
%  - Cover - Path to the cover image or the cover image itself.
%  - Payload - Embedding payload in bits per pixel (bpp).
% OUTPUT:
%  - Stego - Resulting image with embedded payload
%  - pChange - Embedding change probabilities. 
%  - ChangeRate - Average number of changed pixels
% -------------------------------------------------------------------------
% Copyright (c) 2015 DDE Lab, Binghamton University, NY.
% All Rights Reserved.
% -------------------------------------------------------------------------
% Permission to use, copy, modify, and distribute this software for
% educational, research and non-profit purposes, without fee, and without a
% written agreement is hereby granted, provided that this copyright notice
% appears in all copies. The program is supplied "as is," without any
% accompanying services from DDE Lab. DDE Lab does not warrant the
% operation of the program will be uninterrupted or error-free. The
% end-user understands that the program was developed for research purposes
% and is advised not to rely exclusively on the program for any reason. In
% no event shall Binghamton University or DDE Lab be liable to any party
% for direct, indirect, special, incidental, or consequential damages,
% including lost profits, arising out of the use of this software. DDE Lab
% disclaims any warranties, and has no obligations to provide maintenance,
% support, updates, enhancements or modifications.
% -------------------------------------------------------------------------
% Contact: vsedigh1@binghamton.edu | fridrich@binghamton.edu
%          September 2015
%          http://dde.binghamton.edu/download/
% -------------------------------------------------------------------------
% References:
% [1] - J. Fridrich and J. Kodovsky. Multivariate Gaussian model for 
% designing additive distortion for steganography. Proc. IEEE, ICASSP, 
% Vancouver, Canada, May 26-31, 2013.
% -------------------------------------------------------------------------
% Read and convert the input cover image into double format
if ischar( Cover )
    Cover = double( imread(Cover) );
else
    Cover = double( Cover );
end
% Compute Variance and do the flooring for numerical stability
Variance = VarianceEstimation(Cover);
Variance(Variance< 1) = 1;
% Compute Fisher information and smooth it
FisherInformation = 1./Variance.^2;
% Compute embedding change probabilities and execute embedding
FI = FisherInformation(:)';
    
% Ternary embedding change probabilities
beta = TernaryProbs(FI,Payload);
% Simulate embedding
Stego = Cover;
beta = 2 * beta;
r = rand(1,numel(Cover));
ModifPM1 = (r < beta);                % Cover elements to be modified by +-1
r = rand(1,numel(Cover));
Stego(ModifPM1) = Cover(ModifPM1) + 2*(round(r(ModifPM1))) - 1; % Modifying X by +-1
Stego(Stego>255) = 253;                    % Taking care of boundary cases
Stego(Stego<0)   = 2;
ChangeRate = sum(ModifPM1(:))/numel(Cover); % Computing the change rate
pChange = reshape(beta/2,size(Cover));
 
end

三、运行结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、备注

完整代码或者仿真咨询添加QQ1575304183

以上是关于图像隐写基于高斯模型的JPEG图像隐写matlab源码的主要内容,如果未能解决你的问题,请参考以下文章

图像隐写基于matlab GUI DCT变换图像隐写含Matlab源码 1380期

图像隐写基于matlab区域性像素等值图像隐写含Matlab源码 2413期

图像隐藏基于 DCT的图像隐写matlab源码

图像隐藏基于 DCT的图像隐写matlab源码

图像隐写基于matlab FFT数字水印嵌入含Matlab源码 1670期

图像隐写基于matlab DWT+IDWT数字水印嵌入+提取含Matlab源码 1530期