about summary refs log tree commit diff
path: root/test/pammixmulti-identity.test
blob: 21136fbe5d94b4a012ce20e27a1ad94bc92bda81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#! /bin/sh
# This script tests: pammixmulti
# Also requires: pgmnoise pnminvert pamsumm

tmpdir=${tmpdir:-/tmp}

# Test 1.  Should print 1926073387 101484 six times
echo Test 1.

pammixmulti testimg.ppm | cksum
pammixmulti testimg.ppm testimg.ppm | cksum
pammixmulti testimg.ppm testimg.ppm testimg.ppm | cksum
pammixmulti -blend=average testimg.ppm testimg.ppm | cksum
pammixmulti -blend=average testimg.ppm testimg.ppm testimg.ppm | cksum
pammixmulti -blend=random -randomseed=1 \
    testimg.ppm testimg.ppm testimg.ppm | cksum


# Test 2.  Should print 1926073387 101484 three times
echo Test 2.

mask_pgm=${tmpdir}/mask.pgm
pgmnoise -maxval=2 -randomseed=1 227 149 > ${mask_pgm}

for sd in 0.5 1.2 3.0 
  do
  pammixmulti -blend=mask -maskfile=${mask_pgm} -stdev=${sd} \
      testimg.ppm testimg.ppm testimg.ppm | cksum
  done
rm ${mask_pgm}

# Test 3.  Should print
echo Test 3.

noise_pgm=${tmpdir}/noise.pgm
pgmnoise --randomseed=1 227 149 > ${noise_pgm}

pammixmulti -blend=mask -maskfile=${noise_pgm} \
    testimg.ppm testimg.ppm | cksum
pammixmulti -blend=mask -maskfile=${noise_pgm} \
    testimg.ppm testimg.ppm testimg.ppm | cksum
pammixmulti -blend=mask -maskfile=${noise_pgm} \
    testimg.ppm testimg.ppm testimg.ppm testimg.ppm | cksum
rm ${noise_pgm}


# Test 4.

# Mix image with its own inverse.
# Output should be a monotone gray sheet.
#  Should print 127 six times
echo Test 4.

invert_ppm=${tmpdir}/invert.ppm
monotone_ppm=${tmpdir}/monotone.ppm

pnminvert testimg.ppm > ${invert_ppm}

pammixmulti -blend=average testimg.ppm ${invert_ppm} | tee ${monotone_ppm} | \
  pamsumm -brief -max &&
  pamsumm -brief -min ${monotone_ppm}
rm ${monotone_ppm}

pammixmulti -blend=average \
    testimg.ppm ${invert_ppm} testimg.ppm ${invert_ppm} | \
  tee ${monotone_ppm} | \
  pamsumm -brief -max &&
  pamsumm -brief -min ${monotone_ppm}
rm ${monotone_ppm}

pammixmulti -blend=average \
    testimg.ppm testimg.ppm ${invert_ppm} ${invert_ppm} | \
  tee ${monotone_ppm} | \
  pamsumm -brief -max &&
  pamsumm -brief -min ${monotone_ppm}

rm ${monotone_ppm} ${invert_ppm}