Report Atul

download Report Atul

of 21

Transcript of Report Atul

  • 8/9/2019 Report Atul

    1/21

    O r i g i n al I m a g eD a t a

    DCT

    Q ua n tz er

    E n t r op yE n c od i n g

    C o m pr e s s edI m a g

    e

    IMPLEMENTATION

    Chapter 3 IMPLEMETATION

    3.1. JPEG COMPRESSION USING MATLAB 7.10.0

    3.1.1 Workflow

    We successfully compressed a black & white photograph (source: Dresden Image Database)

    implementing JP! algorithm in "atlab and compressed the images to #$% thof the original image sie'

    his was achieed by diiding the image in blocks of *+* pi,els and applying a discrete cosine

    transform (D-) on each partition of the images' he resulting coefficients were .uantied and less

    significant coefficients are set to ero' In order to omit redundancy in our algorithm/ we skipped the

    entropy encoding step/ since it proides lossless compression and thus not useful for forensic of the

    image' his is shown in figure 0'#'

    3.1.2 Block splitting

    1ormally/ the width and height of the image are a multiple of * and that the image is either gray

    scale or 2!3 (red/ green/ blue)' ach pi,el is assigned a alue between 4 and 566/ or a triplet of 2!3

    alues'

    Figure 3.1 Step of JPEG Compression

    #5

  • 8/9/2019 Report Atul

    2/21

    IMPLEMENTATION

    hus/ we split the image into *+* blocks' his is needed since the D- has no locality

    information whatsoeer' here is only fre.uency information aailable' We continued by shifting eery

    block by 7#5*/ this made the alues symmetric around ero with aerage close to ero'

    3.1.3 Qunti!tion

    8o far there had been no compression' We then proceeded by introducing eros in the arrays by

    means of 9uantiation' ery D- coefficient ;kwas diided by an integer 9;kand rounded to the

    nearest integer' he importance of the coefficients is dependent on the human isual system< the eye is

    much more sensitie to low fre.uencies' "easurements led to standard .uantiation tables listed below'

    9 = >#?/ ##/ #4/ #?/ 5%/ %4/ 6#/ ?##5/ #5/ #%/ #@/ 5?/ 6*/ ?4/ 66

    #%/ #0/ #?/ 5%/ %4/ 6A/ ?@/ 6?

    #%/ #A/ 55/ 5@/ 6#/ *A/ *4/ ?5

    #*/ 55/ 0A/ 6?/ ?*/ #4@/ #40/ AA5%/ 06/ 66/ ?%/ *#/ #4%/ ##0/ @5

    %@/ ?%/ A*/ *A/ #40/ #5#/ #54/ #4#

    A5/ @5/ @6/ **/ ##5/ #44/ #40/ @@B

    he .uantied D- coefficients was computed with

    B (j , k)=round {X(j , k)Q (j , k)} for ; = 4/#/5/C''A< k = 4/#/5/C'A

    (0'#)

    where X is the un.uantied D- coefficients< Q is the .uantiation matri, mentioned

    aboe< and B is the .uantied D- coefficients' Esing this .uantiation matri, with the D-

    coefficient matri, from aboe resulted in:

    #5

  • 8/9/2019 Report Atul

    3/21

    IMPLEMENTATION

    Figre 3.!" U#$a#ti%e& 'CT ()e**i(ie#t+

    Figre 3.3" ,a#ti%e& 'CT ()e**i(ie#t+

    3.1." #$co%pr$ssion

    Fs mention before/ we skipped entropy encoding step/ since it do not produce any finger print

    which can be used to deelop a forensic techni.ue' hus/ aboe mentioned were followed in bottom to

    up direction' Fn original image and its compressed ersion is shown in Gig'0'% and Gig'0'6/

    respectiely'

    #5

  • 8/9/2019 Report Atul

    4/21

    IMPLEMENTATION

    Figre 3.- C)pari+)# /etee# a2 Origi#a Iage a#&

    /2 Iage a*ter ipee#ti#g JPEG C)pre++i)# ith ,ait4 *a(t)r )* 50

    3.! ANTI FORENSIC FRAME6OR TO 8I'E JPEG COMPRESSION

    FINGERPRINTS

    We hae implemented the algorithm proposed by J' He/ ' in/ 'Wang/ and ' ang in their

    research paper KDetecting doctored JP! images ia D- coefficient analysisL to counter the forensic

    techni.ue which uses localied eidence of double JP! compression to identify image forgeries'

    3.2.1 &r%$work

    JP! is a lossy image compression techni.ues which operate by applying a twodimensional

    inertible transform/ such as the D- to an image as a whole/ or to each set of pi,els within an image

    that has been segmented into a series of dis;oint sets' Fs a result/ the image or set of pi,els is mapped

    into multiple subbands of transform coefficients/ where each transform coefficient is denoted '

    #5

  • 8/9/2019 Report Atul

    5/21

    IMPLEMENTATION

    Mnce obtained/ each transform coefficients must be mapped to a binary alue both for storage

    and to achiee lossy compression' his is achieed through the process of .uantiation/ in which the

    binary representation of the transform coefficientX is assigned the alue x according to the

    e.uation

    X=x if b (k) X b(k+1) (0'5)

    where b (k) and b (k+1 ) denote the boundaries of the .uantiation interal oer which

    maps to the alue ' 3ecause some subbands of transform coefficients are less perceptually important

    than others/ and thus can accommodate greater loss during the .uantiation process/ the set of

    .uantiation interal boundaries is chosen differently for each subband' Ffter each transform coefficient

    is gien a binary representation/ the binary alues are reordered into a single bit stream which is often

    sub;ected to lossless compression'

    When the image is decompressed/ the binary bit stream is first rearranged into its original two

    dimensional form' ach decompressed transform coefficient N is assigned a alue through

    de.uantiation' During this process/ each binary alue . is mapped to a .uantied transform coefficient

    alue belonging to the discrete set 9 = OC/ .#/.4/.#/C'' ach de.uantied transform coefficient

    alue can be directly related to its corresponding original transform coefficient alue by the e.uation

    Y=q (k) if b (k) X b (k+1) (0'0)

    Ffter de.uantiation/ the inerse transform is performed on the set of transform coefficients and

    the resulting alues are pro;ected back into the set of allowable pi,el alues P= O4/C/566' If the image

    was segmented/ this process is repeated for each segment and the decompressed segments are ;oined

    together to create the decompressed image< otherwise/ this process reconstructs the decompressed image

    as a whole'

    #5

  • 8/9/2019 Report Atul

    6/21

    IMPLEMENTATION

    3y performing image compression in this manner/ a distinct fingerprint is introduced into the

    transform coefficients of an image' When e,amining an unaltered imageQs transform coefficient alues

    within a particular subband/ they will likely be distributed according to a smooth/ continuous

    distribution'

    his is not the case for images which hae undergone image compression/ since the processes of

    .uantiation and de.uantiation force the transform coefficients of a compressed image to take alues

    within the discrete set 9' In practice/ the act of pro;ecting the decompressed pi,el alues perturbs the

    transform coefficient alues/ though the transform coefficients of a preiously compressed image still

    cluster tightly around elements of 9' hese fingerprints/ known as transform coefficient .uantiation

    artifacts/ are used by the ma;ority of compression artifactbased forensic techni.ues to identify single or

    double compression/ determine an imageQs origin/ or identify image forgeries' hey can be clearly seen

    in Gig'0'? & Gig'0'A/ which shows the histogram of one subband of D- coefficients from an image

    before and after JP! compression/ respectiely'

    Figre .3.9Histogram of D- coefficients Figre.3.7: Histogram of D- coefficients from

    from an uncompressed image' same image after JP! compression'

    #5

  • 8/9/2019 Report Atul

    7/21

    IMPLEMENTATION

    We hae used the following generalied framework to remoe transform coefficient .uantiation

    artifacts from a compressed'

    Girst/ we modeled the distribution of the transform coefficients for a gien subband prior to

    .uantiation using a parametric model P(=,) = f(,/R) with parameter R' 1e,t/ we estimated the alue

    of R from the .uantied transform coefficients' We then antiforensically modified each .uantied

    transform coefficient by adding specially designed noise/ which we refer to as nti'for$nsic (it)$r/ to its

    alue according to the e.uation

    = NSD (0'%)

    where D is the antiforensic dither and is the antiforensically modified coefficient'

    he distribution of the antiforensic dither is chosen so that it corresponds to a renormalied and

    recentered segment of the model distribution for that subband/ where the segment is centered at the

    #5

  • 8/9/2019 Report Atul

    8/21

    IMPLEMENTATION

    .uantied coefficient alue and the segmentQs length is e.ual to the length of the .uantiation interal'

    3ecause the probability that the .uantied coefficient alue is .(k) is gien by

    P [Y=q (k)]=b(k)

    b (k+1)

    f(x ,)dx (0'6)

    the antiforensic ditherQs distribution is gien by the formula

    P [D=dY=q (k)]= f(q ( k)+d ,)

    b (k)

    b(k+1)

    f(x ,)dx if b (k) q (k)+d b(k+1) (0'?)

    -hoosing the antiforensic dither distribution in this manner yields two main benefits< the anti

    forensically modified coefficient distribution will theoretically match the transform coefficient

    distribution before .uantiation and an upper bound can be placed on the distance between each

    un.uantied transform coefficient and its antiforensically modified counterpart' o proe the first

    property/ we make use of the fact that

    P [Z=zY=q (k)]=P [D=zq (k)Y=q (k)] (0'A)

    We then use the law of total probability to write an e,pression for the antiforensically modified

    coefficient distribution as

    P (Z=z )=k

    P ( Z=z|Y=q (k) )P(Y=q (k))

    #5

  • 8/9/2019 Report Atul

    9/21

    IMPLEMENTATION

    P (Z=z )=k

    f(q (k)+d ,)

    b(k)

    b (k+1)

    f(x ,)dx

    b (k)

    b(k+1 )

    f(x ,)dx if b (k) q (k)+d b(k+1)

    =

    k

    f(z ,)

    if b (k) q ( k)+d b(k+1) (0'*)

    his is important because it proes that forensic analysis of the transform coefficient distribution

    of an image should be unable to distinguish an unaltered image from an antiforensically modified one/

    proided that the distribution of unmodified coefficients is modeled accurately and the parameter is

    correctly estimated' Fssuming that each .uantied alue lies at the center of its corresponding

    .uantiation interal/ this distance can be triially bounded as follows:

    b (k)b(k+1) 2

    |XY|max (0'@)

    3ecause each antiforensically modified coefficient alue must lie within the .uantiation

    interal encompassing the modified .uantied coefficient alue/ the bound placed on TNT also holds

    for TNT'

    Fs a result/ the distance between an un.uantied and antiforensically modified transform

    coefficient alue is upper bounded by

    |XY|max|b (k)b (k+1 )| (0'#4)

    3.2.2 #*T *o$ffici$nt Qunti!tion &ing$rprint +$%o,l

    #5

  • 8/9/2019 Report Atul

    10/21

    IMPLEMENTATION

    In accordance with the antiforensic framework which is discussed earlier/ we begin by modeling

    the distribution of coefficient alues within a particular ac D- subband using the aplace distribution

    x

    P (X=x )=

    2e

    (0'##)

    hough we use this model for each ac subband of the D-/ each subband will hae its own

    uni.ue alue of' Esing this model and the .uantiation rule described aboe/ the coefficient alues of an

    ac subband of D- coefficients within a preiously JP! compressed image will be distributed

    according to the discrete aplace distribution

    P (Y=y ) =

    1eQ ( i, j )

    2 if y=0

    {y sinh {Q (i , j )

    2 },if y=kQ(i , j)e0otherwise

    wherekZ , k 0 (0'#5)

    o antiforensically modify a preiously JP! compressed image/ we first perform the initial

    steps in JP! compression (i'e'/ color space transformation/ segmentation into blocks/ D-) to obtain a

    set of D- coefficients from the image' 3ecause the final stages of JP! decompression inole

    pro;ecting the decompressed pi,el alues back into/ the D- coefficient alues obtained is

    Y=Q(i , j)round { Y

    Q(i , j )}'

    1e,t/ we obtain a ma,imum likelihood estimate the model Parameter independently for each

    ac subband of D- coefficients using the .uantied coefficients' 3y doing this/ we can use this model to

    obtain an estimate of each ac subbandQs coefficient distribution before JP! compression' We define 1

    #5

  • 8/9/2019 Report Atul

    11/21

    IMPLEMENTATION

    = 1(4)S 1(#)as the total number of obserations of the current D- subband 1(4)/ as the number D-

    subband of coefficients taking the alue ero/ 1(#) as the number of nonero alued coefficients/ and

    y (k)

    !=k=1

    "

    ' he model parameter estimate/ which we denote / is calculated using the e.uation

    =

    2Q( i , j )

    ln($) (0'#0)

    Where

    $="(0 ) Q(i , j )

    2"Q (i , j )+4 !+"(0 )

    2Q (i , j)2(2"(1 )Q (i , j )4 !)(2"Q (i , j )+4 !)

    2"Q+4 !

    (0'#%)

    Ffter

    has been estimated/ we add antiforensic dither to each D- coefficient in an ac

    subband' 3ecause we model the coefficient distribution before .uantiation using the aplace

    distribution/ the e,pression for the antiforensic ditherQs distribution gien in e.n' (0'#%) simplifies to

    one of two e.uations depending upon the magnitude of the .uantied D- coefficient alue to which

    the dither is added' Gor eroalued .uantied coefficients/ the antiforensic dither distribution is chosen

    to be

    d , if% Q(i , j)

    2 & d &

    Q(i , j)2

    P(D=dY=0)={ 1'0e0,otherwise (0'#6)

    where'0=1eQ(i , j)

    2 (0'#?)

    #5

  • 8/9/2019 Report Atul

    12/21

    IMPLEMENTATION

    he distribution of the anti forensic dither added to nonero .uantied D- coefficients is

    P(D=dY=q(k))=

    { 1

    '1 es(n( q (k)) (d+Q (i , j )/2)

    ,if

    %Q(i , j )2 & d&

    Q(i , j )2

    0,otherwise (0'#A)

    1e

    (1 )( Q(i , j))where'1=

    (0'#*)

    he e,pected alue was calculated using obtained probabilistic distribution

    D= dP(D=dY=q(k)) (0'#@)

    ,pected alue of dither was then added to D- coefficients of the compressed images to obtain

    antiforensically modified coefficients'

    3.3 I'ENTIFICATION OF 'IGITAL CAMERA IMAGE ORIGIN USING

    PRNU E:TRACTION AN' APPL;ING ANTIFORENSICS O

  • 8/9/2019 Report Atul

    13/21

    IMPLEMENTATION

    o estimate the spatial noise for a deice under inestigation/ we used "FF3 ersion A'#4'4'

    F -anon I,us 64 "odel was used to get a camera specific reference noise pattern called Gingerprint by

    aeraging oer #5#6 images of the same model and same sie(#45%UA?*)' hen we take a test image

    that maybe from the same model or a different camera and e,tract noise pattern (P21E) from the test

    image'

    Gurther we calculate P- (Peak to correlation energy) between the two set of noise patterns

    obtained each from the reference camera and the test image' If we get a high P- alue then the test

    image belongs to the reference camera otherwise not'

    ike normalied correlation/ Peakto-orrelation nergy ratio (P-) is a measure of similarity

    for two discrete signals' P- is especially suitable for 5dimensional camera fingerprints because

    presence of hidden periodic patterns (a latent source of false identification) decreases P-'

    #5

  • 8/9/2019 Report Atul

    14/21

    IMPLEMENTATION

    RESULTS

    JPEG Anti-Forensics

    o demonstrate that antiforensic D- coefficient .uantiation fingerprint remoal techni.ue can be

    used on an image without significantly impacting its isual .uality/ we show a typical

    image before and after antiforensic modification in Gig' %'5 & Gig' %'0/ respectiely' In Gig' %'5/ the

    image has undergone JP! compression using a .uality factor of 64 while the image in Gig'%'0 is theJP! compressed image after antiforensic dither has been added to its D- coefficients' 1o noticeable

    difference between these images is apparent after isual inspection' his is reinforced by the fact that the

    P812 between the two images is 5@'5? d3' "ore importantly/ the antiforensically modified imagecontains no isual indicators of either preious compression or antiforensic modification' 8ince a

    forensic e,aminer will not hae access to either the unaltered or compressed ersion of an anti

    forensically modified image/ these cannot be compared against the antiforensically modified image'Instead/ what is necessary is that the antiforensically modified image plausibly appear to hae neer

    been compressed'

    Inspection of the D- coefficient alue distributions of the images shown in Gig' %'# and Gig'%'0 yieldssimilar results' Gig' %'% shows a histogram of coefficient alues in the (5/5) D- subband in an

    uncompressed ersion of these images' he corresponding coefficient alue histograms from the JP!compressed and antiforensically modified images are shown in figure %'6 & %'?/ respectiely' While

    D- coefficient .uantiation fingerprints are present in the histograms taken from the JP! compressedimage/ these fingerprints are absent in the coefficient alue histograms corresponding to the

    uncompressed and antiforensically modified images' Fgain/ we note that in reality a forensic e,aminer

    will only hae access to the antiforensically modified image and will be unable to make note of minordifferences between the coefficient histograms of the uncompressed and antiforensically modified

    image' he fact that the D- coefficient alue histograms from the antiforensically modified image

    both fit our coefficient distribution model and contain no compression fingerprints suggests that ourproposed antiforensic techni.ue is capable of producing images that can be passed off as neer haing

    undergone JP! compression'

    #5

  • 8/9/2019 Report Atul

    15/21

    IMPLEMENTATION

    Figure 4.1 Original Image

    #5

  • 8/9/2019 Report Atul

    16/21

  • 8/9/2019 Report Atul

    17/21

    IMPLEMENTATION

    Figure 4.4 (istogram of coe)cient *alues from t!e +2,2- C/ su00and taen from anuncompressed *ersion of t!e image s!on in Fig. 4.1

    #5

  • 8/9/2019 Report Atul

    18/21

    IMPLEMENTATION

    Figure 4.$ (istogram of coe)cient *alues from t!e +2,2- C/ su00and taen from a compressed*ersion of t!e image s!on in Fig. 4.2 +left-

    #5

  • 8/9/2019 Report Atul

    19/21

    IMPLEMENTATION

    Figure 4. (istogram of coe)cient *alues from t!e +2,2- C/ su00and for a# a#ti=*)re#+i(a4 )&i*ie& ()p4 )*the JPEG ()pre++e& iage +h)# i# -.3 .

    Fppendi, :

    % input imageo=imread ('C:\Users\abhishek\Desktop\sailing.bmp');% coert image into black and !hite "orme=rgb#gra$(o);sie(e);

    e&int=int(e);sb=sie(e&int);m=#*ones(sb);% shi"ting pi+el alues b$ # to le"t, =e&int-int(m);=/00100#2021030;#0#02040#0301033;20500#20210360403;2060##0#40306010#;0##056030014015066;#20530330200120504#;240206060150#0#101;6#04#04300#0110150447;"un = 8(block&struct) block&struct.data.9;

    #5

  • 8/9/2019 Report Atul

    20/21

    IMPLEMENTATION

    "unc = 8(block&struct) dct#(block&struct.data);% Unuantied DC Coe""icients< = blockproc(,0/ 70"unc);% uantied DC Coe""icients=blockproc(

  • 8/9/2019 Report Atul

    21/21

    IMPLEMENTATION

    + = -#1:1.:#1;"igure(2)0 hist(