I am trying to use IM to produce the frequency spectrum of a linear array.
Code: Select all
w=`wc -l <$DATA`
mid=$(($w/2))
(echo "P2 ${w} 1 65535 " && cat $INTDATA) | \
convert - -scale ${w}x${w}! -fft -delete 1 -crop ${w}x1+0+$(($w/2)) +repage PGM: - | pnmtopnm -plain
Code: Select all
convert: improper image header `' @ error/pnm.c/ReadPNMImage/290.
P2
306 1
65535
0 26 24 24 33 30 20 25 17 15 14 6 9 6 14
8 4 8 7 21 19 16 41 47 41 56 41 29 34 31
40 19 24 37 8 6 17 28 14 24 40 16 9 13 37
24 17 19 14 14 36 37 20 12 3 19 21 40 33 15
19 12 15 6 21 33 30 38 48 39 45 39 22 14 11
15 10 47 35 18 26 39 15 47 64 19 31 55 103 65
27 41 20 60 93 24 59 58 66 81 35 39 88 25 85
119 99 76 69 42 27 36 49 110 125 58 17 118 122 95
54 43 29 136 119 76 157 226 181 104 373 344 44 201 337
191 125 663 386 823 994 345 643 1308 1374 65 1329 1701 2774 3476
1093 1603 4629 36881 4629 1603 1093 3476 2774 1701 1329 65 1374 1308 643
345 994 823 386 663 125 191 337 201 44 344 373 104 181 226
157 76 119 136 29 43 54 95 122 118 17 58 125 110 49
36 27 42 69 76 99 119 85 25 88 39 35 81 66 58
59 24 93 60 20 41 27 65 103 55 31 19 64 47 15
39 26 18 35 47 10 15 11 14 22 39 45 39 48 38
30 33 21 6 15 12 19 15 33 40 21 19 3 12 20
37 36 14 14 19 17 24 37 13 9 16 40 24 14 28
17 6 8 37 24 19 40 31 34 29 41 56 41 47 41
16 19 21 7 8 4 8 14 6 9 6 14 15 17 25
20 30 33 24 24 0
Could I use something like kerneltoimage to plot this directly using IM ?
As a side issue I would like to know why there is the error message, it seems IM is producing something not totally expected by the netpbm tools.
Thanks for any advice.