The example below is based on two functions which you should have implemented during exercises:
lsbhide which hides a message in an image and returns
a modified image (stegogramme)To make a test decission, chi2decide may be used.
The demo produces ten plots which are listed below. Random binary messages are embedded, having lengths 10%, 30%, 60% and 100% of capacity. For each stegogramme, and for the covertext, chi2stat and chi2p are plotted.
css1hs@tweek:67$ matlab -nodesktop
< M A T L A B >
Copyright 1984-2006 The MathWorks, Inc.
Version 7.3.0.298 (R2006b)
August 03, 2006
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
>> path ( '../chi2', path )
>> path ( '..', path )
>>
>> X = imread ( 'image.pnm' ) ;
>>
>> S1 = size ( X )
S1 =
384 256
>> S = prod(S1)
S =
98304
>>
>> msg10 = round ( rand ( floor ( 10*S/100 ),1 ) ) ;
>> msg30 = round ( rand ( floor ( 30*S/100 ),1 ) ) ;
>> msg60 = round ( rand ( floor ( 60*S/100 ),1 ) ) ;
>> msg100 = round ( rand ( floor ( S ),1 ) ) ;
>>
>> fplot ( @(a)chi2stat(X,a), [ 100 S ] ) ;
>> print -dpng 'chi2-0.png' ;
>> fplot ( @(a)chi2p(X,a), [ 100 S ] ) ;
>> print -dpng 'p-0.png' ;
>>
>> Y = lsbhide ( X, msg10 ) ;
Message length: 9830. Image size: 384 x 256 (98304 pixels).
>> fplot ( @(a)chi2stat(Y,a), [ 100 S ] ) ;
>> print -dpng 'chi2-10.png' ;
>> fplot ( @(a)chi2p(Y,a), [ 100 S ] ) ;
>> print -dpng 'p-10.png' ;
>>
>> Y = lsbhide ( X, msg30 ) ;
Message length: 29491. Image size: 384 x 256 (98304 pixels).
>> fplot ( @(a)chi2stat(Y,a), [ 100 S ] ) ;
>> print -dpng 'chi2-30.png' ;
>> fplot ( @(a)chi2p(Y,a), [ 100 S ] ) ;
>> print -dpng 'p-30.png' ;
>>
>> Y = lsbhide ( X, msg60 ) ;
Message length: 58982. Image size: 384 x 256 (98304 pixels).
>> fplot ( @(a)chi2stat(Y,a), [ 100 S ] ) ;
>> print -dpng 'chi2-60.png' ;
>> fplot ( @(a)chi2p(Y,a), [ 100 S ] ) ;
>> print -dpng 'p-60.png' ;
>>
>> Y = lsbhide ( X, msg100 ) ;
Message length: 98304. Image size: 384 x 256 (98304 pixels).
>> fplot ( @(a)chi2stat(Y,a), [ 100 S ] ) ;
>> print -dpng 'chi2-100.png' ;
>> fplot ( @(a)chi2p(Y,a), [ 100 S ] ) ;
>> print -dpng 'p-100.png' ;
>>
| Message length | chi2stat | chi2p |
|---|---|---|
| 0% | ![]() |
![]() |
| 10% | ![]() |
![]() |
| 30% | ![]() |
![]() |
| 60% | ![]() |
![]() |
| 100% | ![]() |
![]() |