1.RS算法主函数
%%
% Shuan
% shuanholmes@outlook.com
% <strong><span style="font-family:KaiTi_GB2312;font-size:14px;">Copyright@2016-2017 Shuan BUPT IS</span></strong>
% RSUmain
%%
clc;
clear;
%%
% Fig = imread('LenaGray.bmp');
Fig = imread('128pic_50%.bmp');
[x,y] = size(Fig);
Type1 = 2; % BlockSize
Type2 = 1; % 1:Row first 2:Col first 3:ZigZag
[Rm,Sm,Um,R1m,S1m,U1m] = RSU(Fig,x*y,Type1,Type2);
ComFig = bitxor(double(Fig),ones(x,y));
[CRm,CSm,CUm,CR1m,CS1m,CU1m] = RSU(ComFig,x*y,Type1,Type2);
d0 = Rm - Sm;
d1 = CRm - CSm;
d10 = R1m - S1m;
d11 = CR1m - CS1m;
a = 2*(d0 + d1);
b = d10 - d11 - d1 - 3*d0;
c = d0 - d10;
root = [a,b,c];
solutions = roots(root);
if abs(solutions(1)) > abs(solutions(2))
fprintf('Steganography Rate : %.5f\n',solutions(2)/(solutions(2)-1/2));
else
fprintf('Steganography Rate : %.5f\n',solutions(1)/(solutions(1)-1/2));
end
2.RS函数
%%
% Shuan
% shuanholmes@outlook.com
%
% Regula, Singular points calc
%%
function [R,S,U,R1,S1,U1] = RSU(A,bufsize,Type1,Type2)
R