3 n = 10^6; % size of the cover
\r
4 h = 10; % constraint height - default is 10 - drives the complexity/quality tradeof
\r
5 wetness = 0.6; % relative wetness of the channel
\r
6 alpha = 0.5; % relative payload on the dry pixels
\r
8 wet = rand(n, 1) < wetness;
\r
9 dn = n - sum(wet); % number of dry pixels
\r
10 m = floor(dn * alpha);
\r
12 cover = uint8(rand(n, 1));
\r
13 message = uint8(rand(m, 1));
\r
14 profile = ones(n, 1); % constant profile
\r
15 profile(wet) = Inf; % Wet pixels are assigned a weight of infinity, so they are never flipped.
\r
18 [dist, stego] = stc_embed(cover, message, profile, h);
\r
19 fprintf('distortion per dry cover element = %f\n', dist / dn);
\r
20 fprintf(' embedding efficiency = %f\n', alpha / (dist / dn));
\r
21 fprintf(' throughput = %1.1f Kbits/sec\n', n / toc() / 1024);
\r
23 message2 = stc_extract(stego, m, h); % extract message
\r
24 if all(message == message2)
\r
25 disp('Message has been extracted correctly.');
\r
27 error('Some error occured in the extraction process.');
\r