annotate Meerwald/wm_frid2_d.c @ 4:9cf6ec970448 v0.5

mention filter param.
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Tue, 14 Aug 2007 21:13:11 +0200
parents be303a3f5ea8
children f83ef905a63d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
1 #include "wm.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
2 #include "dct.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
3 #include "pgm.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
4 #include "signature.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
5 #include "frid2_common.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
6
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
7 char *progname;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
8
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
9 void usage(void) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
10 fprintf(stderr, "usage: %s [-a n] [-h] [-b n] [-n n] [-o file] [-v n] -s file file\n\n", progname);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
11 fprintf(stderr, "\t-a n\t\talpha factor low freq. embedding strength\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
12 fprintf(stderr, "\t-b n\t\tbeta factor for weighted correlation (default 0)\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
13 fprintf(stderr, "\t-h\t\tprint usage\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
14 fprintf(stderr, "\t-n n\t\tnormalisation factor (default 1024.0)\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
15 fprintf(stderr, "\t-o file\t\tfile for extracted watermark information\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
16 fprintf(stderr, "\t-s file\t\toriginal signature file\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
17 fprintf(stderr, "\t-v n\t\tverbosity level\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
18 exit(0);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
19 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
20
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
21 int main(int argc, char *argv[]) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
22 FILE *in = stdin;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
23 FILE *out = stdout;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
24 FILE *sig = NULL;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
25
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
26 char output_name[MAXPATHLEN] = "(stdout)";
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
27 char input_name[MAXPATHLEN] = "(stdin)";
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
28 char signature_name[MAXPATHLEN];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
29
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
30 int c;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
31 int row, col;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
32 int n;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
33 double normalization = 1024.0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
34 int seed, format;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
35
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
36 double alpha = 0.0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
37 double beta = 0.0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
38
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
39 double correlation;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
40
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
41 gray **image;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
42 double **coeffs;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
43
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
44 double mean, derivation, mult_factor;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
45 int rows, cols;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
46
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
47 gray maxval;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
48 int verbose = 0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
49
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
50 progname = argv[0];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
51
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
52 pgm_init(&argc, argv); wm_init2();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
53
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
54 while ((c = getopt(argc, argv, "a:b:n:h?s:o:v:")) != EOF) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
55 switch (c) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
56 case 'a':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
57 alpha = atof(optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
58 if (alpha <= 0.0) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
59 fprintf(stderr, "%s: alpha factor %f out of range\n", progname, alpha);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
60 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
61 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
62 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
63 case 'b':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
64 beta = atof(optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
65 if (beta <= 0.0) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
66 fprintf(stderr, "%s: beta factor %f out of range\n", progname, beta);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
67 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
68 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
69 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
70 case 'n':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
71 normalization = atof(optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
72 if (normalization < 0) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
73 fprintf(stderr, "%s: normalisation factor %f out of range\n", progname, normalization);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
74 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
75 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
76 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
77 case 'h':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
78 case '?':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
79 usage();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
80 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
81 case 'o':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
82 if ((out = fopen(optarg, "wb")) == NULL) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
83 fprintf(stderr, "%s: unable to open output file %s\n", progname, optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
84 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
85 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
86 strcpy(output_name, optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
87 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
88 case 's':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
89 if ((sig = fopen(optarg, "r")) == NULL) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
90 fprintf(stderr, "%s: unable to open signature file %s\n", progname, optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
91 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
92 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
93 strcpy(signature_name, optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
94 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
95 case 'v':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
96 verbose = atoi(optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
97 if (verbose < 0) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
98 fprintf(stderr, "%s: verbosity level %d out of range\n", progname, verbose);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
99 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
100 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
101 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
102 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
103 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
104
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
105 argc -= optind;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
106 argv += optind;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
107
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
108 if (argc > 1) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
109 usage();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
110 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
111 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
112
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
113 if (argc == 1 && *argv[0] != '-')
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
114 if ((in = fopen(argv[0], "rb")) == NULL) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
115 fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
116 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
117 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
118 else
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
119 strcpy(input_name, argv[0]);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
120
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
121 if (sig) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
122 char line[32];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
123 fgets(line, sizeof(line), sig);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
124 if (strspn(line, "FR2SG") >= 5) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
125 fscanf(sig, "%d\n", &nbit_signature1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
126 if (alpha == 0.0)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
127 fscanf(sig, "%lf\n", &alpha);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
128 else
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
129 fscanf(sig, "%*lf\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
130 fscanf(sig, "%*lf\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
131 fscanf(sig, "%d\n", &seed);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
132 n_signature1 = NBITSTOBYTES(nbit_signature1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
133 fread(signature1, sizeof(char), n_signature1, sig);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
134 fscanf(sig, "\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
135 srandom(seed);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
136 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
137 else {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
138 fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
139 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
140 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
141 fclose(sig);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
142 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
143 else {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
144 fprintf(stderr, "%s: signature file not specified, use -s file option\n", progname);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
145 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
146 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
147
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
148 pgm_readpgminit(in, &cols, &rows, &maxval, &format);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
149 image = pgm_allocarray(cols, rows);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
150 for (row = 0; row < rows; row++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
151 pgm_readpgmrow(in, image[row], cols, maxval, format);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
152 fclose(in);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
153
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
154 // calculate mean malue
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
155 mean = 0.0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
156 for (row = 0; row < rows; row++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
157 for (col = 0; col < cols; col++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
158 mean += image[row][col];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
159
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
160 mean /= cols * rows;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
161
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
162 // calculate derivation
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
163 derivation = 0.0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
164 for (row = 0; row < rows; row++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
165 for (col = 0; col < cols; col++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
166 derivation += sqr(image[row][col] - mean);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
167
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
168 derivation = sqrt(derivation / (cols * rows - 1));
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
169 mult_factor = normalization / (sqrt(cols * rows) * derivation);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
170
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
171 if (verbose > 5)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
172 fprintf(stderr, "%s: mean %f, derivation %f, mult_factor %f\n", progname, mean, derivation, mult_factor);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
173
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
174 // normalize image
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
175 coeffs = alloc_coeffs(cols, rows);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
176 for (row = 0; row < rows; row++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
177 for (col = 0; col < cols; col++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
178 coeffs[row][col] = (image[row][col] - mean) * mult_factor;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
179
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
180 if (rows == cols) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
181 init_dct_NxN(cols, rows);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
182 fdct_inplace_NxN(coeffs);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
183 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
184 // else {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
185 // init_dct_NxM(cols, rows);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
186 // fdct_NxM(coeffs);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
187 // }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
188
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
189
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
190 fprintf(out, "FR2WM\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
191
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
192 fprintf(out, "%d\n", nbit_signature1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
193 correlation = detect_low_freq(coeffs, cols, rows, alpha, beta, verbose);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
194 if (verbose > 2)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
195 fprintf(stderr, "low_freq correlation: %f\n", correlation);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
196 fwrite(signature2, sizeof(char), NBITSTOBYTES(nbit_signature1), out);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
197 fprintf(out, "\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
198
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
199 fprintf(out, "%d\n", nbit_signature1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
200 correlation = detect_med_freq(coeffs, cols, rows, seed, verbose);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
201 if (verbose > 2)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
202 fprintf(stderr, "med_freq correlation: %f\n", correlation);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
203 fwrite(signature2, sizeof(char), NBITSTOBYTES(nbit_signature1), out);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
204 fprintf(out, "\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
205
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
206 fclose(out);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
207
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
208 free_coeffs(coeffs);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
209 pgm_freearray(image, rows);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
210
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
211 exit(0);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
212 }

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.