Research Article

Proving Reliability of Image Processing Techniques in Digital Forensics Applications

Listing 9

Definitions of operations over pixels and images.
Definition eqbcol (c1 c2: color): bool :=
match c1, c2 with
 |white, white ⇒ true
 |black, black ⇒ true
 |_, _ ⇒ false
end.
Definition negcolor (c: color): color:=
match c with
 |white ⇒ black
 |black ⇒ white
end.
Definition negpix (p: pixel): pixel:=
match p with
 |Br,c,col ⇒ Br,c, negcolor col
end.
Fixpoint negimage (pic: image): image:=
match pic with
 |nil ⇒ nil
 |cons p tl ⇒ cons (negpix p) (negimage tl)
end.
Fixpoint eqpixel (p1 p2: pixel): bool :=
match p1, p2 with
 |Br,c,col, Brʹ,cʹ,colʹ ⇒
  andb (andb (r = ? rʹ) (c = ? cʹ)) (eqbcol col colʹ)
end.
Fixpoint negpiximg (p: pixel) (img: image): image:=
match img with
 |nil ⇒ nil
 |cons pʹ ⇒ if eqpixel p pʹ then
  cons (negpix pʹ) (negpiximg p tl)
  else cons pʹ (negpiximg p tl)
end.