-
Notifications
You must be signed in to change notification settings - Fork 0
/
initstego.m
124 lines (111 loc) · 3.63 KB
/
initstego.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% initstego
% Стего
bitn=2;
color=1;
line = 2;
% line = round(height/2);
lfirst = line;
llast = line;
ff=0;
ymin=-80;
ymax=80;
percent=90;
%%%%%%%%%% R %%%%%%%%%%%%%%%%%%%%%%%%
color=1;
IR=get2DBitSignal(IMG(:,:,color));
% IG=get2DBitSignal(IMG(:,:,2));
% IB=get2DBitSignal(IMG(:,:,3));
%Message='Йоссариан лежал в госпитале с болями в печени. Подозрение падало на желтуху. Однако для настоящей ';
%Message = uint8(randIndex(0,255));
% Message = genRndMessage(width*height/8);
%Mlen = length(Message);
%IMGS=writeStego(IMG,Message,bitn,line,1,1);
% IMGS=writeStego(IMG,Message,bitn,line,1); % в 1 бит, 4 строка
% IMGS=writeStego(IMG,Message,bitn,[1 3]); % в 1 бит, все строки
IMGS=writeStegoRnd(IMG,percent,lfirst,llast,bitn,color);
disp '%%%%%%%%%% R %%%%%%%%%%%%%%%%%%%%%%%%'
ISR=get2DBitSignal(IMGS(:,:,color));
% ISG=get2DBitSignal(IMGS(:,:,2));
% ISB=get2DBitSignal(IMGS(:,:,3));
sIR=std(IR(line,:,bitn))
sISR=std(ISR(line,:,bitn))
sIR2=std(IR(line,:,bitn+1))
pr=(sIR2-sIR)/sIR2*100
prs=(sIR2-sISR)/sIR2*100
disp 'end'
%%%%%%%%%% G %%%%%%%%%%%%%%%%%%%%%%%%
color=2;
IG=get2DBitSignal(IMG(:,:,color));
% IG=get2DBitSignal(IMG(:,:,2));
% IB=get2DBitSignal(IMG(:,:,3));
%Message='Йоссариан лежал в госпитале с болями в печени. Подозрение падало на желтуху. Однако для настоящей ';
%Message = uint8(randIndex(0,255));
% Message = genRndMessage(width*height/8);
%Mlen = length(Message);
%IMGS=writeStego(IMG,Message,bitn,line,1,1);
% IMGS=writeStego(IMG,Message,bitn,line,1); % в 1 бит, 4 строка
% IMGS=writeStego(IMG,Message,bitn,[1 3]); % в 1 бит, все строки
IMGS=writeStegoRnd(IMG,percent,lfirst,llast,bitn,color);
disp '%%%%%%%%%% G %%%%%%%%%%%%%%%%%%%%%%%%'
ISG=get2DBitSignal(IMGS(:,:,color));
% ISG=get2DBitSignal(IMGS(:,:,2));
% ISB=get2DBitSignal(IMGS(:,:,3));
sIG=std(IG(line,:,bitn))
sISG=std(ISG(line,:,bitn))
sIG2=std(IG(line,:,bitn+1))
pg=(sIG2-sIG)/sIG2*100
pgs=(sIG2-sISG)/sIG2*100
disp 'end'
%%%%%%%%%% B %%%%%%%%%%%%%%%%%%%%%%%%
color=3;
IB=get2DBitSignal(IMG(:,:,color));
% IG=get2DBitSignal(IMG(:,:,2));
% IB=get2DBitSignal(IMG(:,:,3));
%Message='Йоссариан лежал в госпитале с болями в печени. Подозрение падало на желтуху. Однако для настоящей ';
%Message = uint8(randIndex(0,255));
% Message = genRndMessage(width*height/8);
%Mlen = length(Message);
%IMGS=writeStego(IMG,Message,bitn,line,1,1);
% IMGS=writeStego(IMG,Message,bitn,line,1); % в 1 бит, 4 строка
% IMGS=writeStego(IMG,Message,bitn,[1 3]); % в 1 бит, все строки
IMGS=writeStegoRnd(IMG,percent,lfirst,llast,bitn,color);
disp '%%%%%%%%%% B %%%%%%%%%%%%%%%%%%%%%%%%'
ISB=get2DBitSignal(IMGS(:,:,color));
% ISG=get2DBitSignal(IMGS(:,:,2));
% ISB=get2DBitSignal(IMGS(:,:,3));
sIB=std(IB(line,:,bitn))
sISB=std(ISB(line,:,bitn))
sIB2=std(IB(line,:,bitn+1))
pb=(sIB2-sIB)/sIB2*100
pbs=(sIB2-sISB)/sIB2*100
disp 'end'
% % DCT над стего
% CIS2=zeros(height, width, bits);
% disp 'DCT 2 :'
% % for i=1:height
% %for i=line-1:line+1
% i=line;
% for j=1:bits
% CIS2(i,:,j)=dct(IS2(i,:,j));
%
% end
% % end
% disp 'yes'
%
% disp 'FFT2 :'
% FIS2=fft(IS2(line,:,bitn));
% FIS2=fftshift(FIS2);
% FIS2=abs(FIS2);
% disp 'yes'
% FFT над стего
% FIS2=zeros(height, width, bits);
% disp 'FFT2 :'
% for i=1:height
% for j=1:bits
% FIS2(i,:,j)=fft(IS2(i,:,j));
% FIS2(i,:,j)=fftshift(FIS2(i,:,j));
% FIS2=abs(FIS2);
% end
% end
% disp 'yes'
% plotBitSignals(FIS2,1); % 6