3 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7 This HTML is auto-generated from an M-file.
8 To make changes, update the M-file and republish this document.
9 --><title>ex_stc</title><meta name="generator" content="MATLAB 7.9"><meta name="date" content="2010-12-07"><meta name="m-file" content="ex_stc"><style type="text/css">
12 background-color: white;
26 /* Make the text shrink to fit narrow windows, but not stretch too far in
28 p,h1,h2,div.content div {
31 width: auto !important; width: 600px;
39 pre.codeinput {word-wrap:break-word; width:100%;}
42 span.keyword {color: #0000FF}
43 span.comment {color: #228B22}
44 span.string {color: #A020F0}
45 span.untermstring {color: #B20000}
46 span.syscmd {color: #B28C00}
65 </style></head><body><div class="content"><pre class="codeinput">clc; clear;
67 n = 10^3; <span class="comment">% size of the cover</span>
68 alpha = 0.5; <span class="comment">% relative payload</span>
69 h = 8; <span class="comment">% constraint height - default is 10 - drives the complexity/quality tradeof</span>
71 cover = uint8(rand(n, 1));
72 m = round(n * alpha); <span class="comment">% number of message bits</span>
73 message = uint8(rand(m, 1));
77 [dist, stego] = stc_embed(cover, message, profile, h); <span class="comment">% embed message</span>
79 fprintf(<span class="string">'distortion per cover element = %f\n'</span>, dist / n);
80 fprintf(<span class="string">' embedding efficiency = %f\n'</span>, alpha / (dist / n));
81 fprintf(<span class="string">' throughput = %1.1f Kbits/sec\n'</span>, n / toc() / 1024);
83 message2 = stc_extract(stego, m, h); <span class="comment">% extract message</span>
84 <span class="keyword">if</span> all(message == message2)
85 disp(<span class="string">'Message has been extracted correctly.'</span>);
86 <span class="keyword">else</span>
87 error(<span class="string">'Some error occured in the extraction process.'</span>);
88 <span class="keyword">end</span>
89 </pre><pre class="codeoutput">distortion per cover element = 0.119000
90 embedding efficiency = 4.201681
91 throughput = 473.1 Kbits/sec
92 Message has been extracted correctly.
93 </pre><p class="footer"><br>
94 Published with MATLAB® 7.9<br></p></div><!--
95 ##### SOURCE BEGIN #####
98 n = 10^3; % size of the cover
\r
99 alpha = 0.5; % relative payload
\r
100 h = 8; % constraint height - default is 10 - drives the complexity/quality tradeof
\r
102 cover = uint8(rand(n, 1));
\r
103 m = round(n * alpha); % number of message bits
\r
104 message = uint8(rand(m, 1));
\r
105 profile = ones(n, 1);
\r
108 [dist, stego] = stc_embed(cover, message, profile, h); % embed message
\r
110 fprintf('distortion per cover element = %f\n', dist / n);
\r
111 fprintf(' embedding efficiency = %f\n', alpha / (dist / n));
\r
112 fprintf(' throughput = %1.1f Kbits/sec\n', n / toc() / 1024);
\r
114 message2 = stc_extract(stego, m, h); % extract message
\r
115 if all(message == message2)
\r
116 disp('Message has been extracted correctly.');
\r
118 error('Some error occured in the extraction process.');
\r
121 ##### SOURCE END #####