Leptonica  1.73
Image processing and image analysis suite
regutils.c
Go to the documentation of this file.
1 /*====================================================================*
2  - Copyright (C) 2001 Leptonica. All rights reserved.
3  -
4  - Redistribution and use in source and binary forms, with or without
5  - modification, are permitted provided that the following conditions
6  - are met:
7  - 1. Redistributions of source code must retain the above copyright
8  - notice, this list of conditions and the following disclaimer.
9  - 2. Redistributions in binary form must reproduce the above
10  - copyright notice, this list of conditions and the following
11  - disclaimer in the documentation and/or other materials
12  - provided with the distribution.
13  -
14  - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15  - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16  - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17  - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
18  - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22  - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *====================================================================*/
26 
27 
64 #include <string.h>
65 #include "allheaders.h"
66 
67 extern l_int32 NumImageFileFormatExtensions;
68 extern const char *ImageFileFormatExtensions[];
69 
70 static char *getRootNameFromArgv0(const char *argv0);
71 
72 
73 /*--------------------------------------------------------------------*
74  * Regression test utilities *
75  *--------------------------------------------------------------------*/
114 l_int32
115 regTestSetup(l_int32 argc,
116  char **argv,
117  L_REGPARAMS **prp)
118 {
119 char *testname, *vers;
120 char errormsg[64];
121 L_REGPARAMS *rp;
122 
123  PROCNAME("regTestSetup");
124 
125  if (argc != 1 && argc != 2) {
126  snprintf(errormsg, sizeof(errormsg),
127  "Syntax: %s [ [compare] | generate | display ]", argv[0]);
128  return ERROR_INT(errormsg, procName, 1);
129  }
130 
131  if ((testname = getRootNameFromArgv0(argv[0])) == NULL)
132  return ERROR_INT("invalid root", procName, 1);
133 
134  if ((rp = (L_REGPARAMS *)LEPT_CALLOC(1, sizeof(L_REGPARAMS))) == NULL) {
135  LEPT_FREE(testname);
136  return ERROR_INT("rp not made", procName, 1);
137  }
138  *prp = rp;
139  rp->testname = testname;
140  rp->index = -1; /* increment before each test */
141 
142  /* Initialize to true. A failure in any test is registered
143  * as a failure of the regression test. */
144  rp->success = TRUE;
145 
146  /* Make sure the lept/regout subdirectory exists */
147  lept_mkdir("lept/regout");
148 
149  /* Only open a stream to a temp file for the 'compare' case */
150  if (argc == 1 || !strcmp(argv[1], "compare")) {
151  rp->mode = L_REG_COMPARE;
152  rp->tempfile = stringNew("/tmp/lept/regout/regtest_output.txt");
153  rp->fp = fopenWriteStream(rp->tempfile, "wb");
154  if (rp->fp == NULL) {
155  rp->success = FALSE;
156  return ERROR_INT("stream not opened for tempfile", procName, 1);
157  }
158  } else if (!strcmp(argv[1], "generate")) {
159  rp->mode = L_REG_GENERATE;
160  lept_mkdir("lept/golden");
161  } else if (!strcmp(argv[1], "display")) {
162  rp->mode = L_REG_DISPLAY;
163  rp->display = TRUE;
164  } else {
165  LEPT_FREE(rp);
166  snprintf(errormsg, sizeof(errormsg),
167  "Syntax: %s [ [generate] | compare | display ]", argv[0]);
168  return ERROR_INT(errormsg, procName, 1);
169  }
170 
171  /* Print out test name and both the leptonica and
172  * image libarary versions */
173  fprintf(stderr, "\n################ %s_reg ###############\n",
174  rp->testname);
175  vers = getLeptonicaVersion();
176  fprintf(stderr, "%s\n", vers);
177  LEPT_FREE(vers);
178  vers = getImagelibVersions();
179  fprintf(stderr, "%s\n", vers);
180  LEPT_FREE(vers);
181 
182  rp->tstart = startTimerNested();
183  return 0;
184 }
185 
186 
199 l_int32
201 {
202 char result[512];
203 char *results_file; /* success/failure output in 'compare' mode */
204 char *text, *message;
205 l_int32 retval;
206 size_t nbytes;
207 
208  PROCNAME("regTestCleanup");
209 
210  if (!rp)
211  return ERROR_INT("rp not defined", procName, 1);
212 
213  fprintf(stderr, "Time: %7.3f sec\n", stopTimerNested(rp->tstart));
214  fprintf(stderr, "################################################\n");
215 
216  /* If generating golden files or running in display mode, release rp */
217  if (!rp->fp) {
218  LEPT_FREE(rp->testname);
219  LEPT_FREE(rp->tempfile);
220  LEPT_FREE(rp);
221  return 0;
222  }
223 
224  /* Compare mode: read back data from temp file */
225  fclose(rp->fp);
226  text = (char *)l_binaryRead(rp->tempfile, &nbytes);
227  LEPT_FREE(rp->tempfile);
228  if (!text) {
229  rp->success = FALSE;
230  LEPT_FREE(rp->testname);
231  LEPT_FREE(rp);
232  return ERROR_INT("text not returned", procName, 1);
233  }
234 
235  /* Prepare result message */
236  if (rp->success)
237  snprintf(result, sizeof(result), "SUCCESS: %s_reg\n", rp->testname);
238  else
239  snprintf(result, sizeof(result), "FAILURE: %s_reg\n", rp->testname);
240  message = stringJoin(text, result);
241  LEPT_FREE(text);
242  results_file = stringNew("/tmp/lept/reg_results.txt");
243  fileAppendString(results_file, message);
244  retval = (rp->success) ? 0 : 1;
245  LEPT_FREE(results_file);
246  LEPT_FREE(message);
247 
248  LEPT_FREE(rp->testname);
249  LEPT_FREE(rp);
250  return retval;
251 }
252 
253 
263 l_int32
265  l_float32 val1,
266  l_float32 val2,
267  l_float32 delta)
268 {
269 l_float32 diff;
270 
271  PROCNAME("regTestCompareValues");
272 
273  if (!rp)
274  return ERROR_INT("rp not defined", procName, 1);
275 
276  rp->index++;
277  diff = L_ABS(val2 - val1);
278 
279  /* Record on failure */
280  if (diff > delta) {
281  if (rp->fp) {
282  fprintf(rp->fp,
283  "Failure in %s_reg: value comparison for index %d\n"
284  "difference = %f but allowed delta = %f\n",
285  rp->testname, rp->index, diff, delta);
286  }
287  fprintf(stderr,
288  "Failure in %s_reg: value comparison for index %d\n"
289  "difference = %f but allowed delta = %f\n",
290  rp->testname, rp->index, diff, delta);
291  rp->success = FALSE;
292  }
293  return 0;
294 }
295 
296 
307 l_int32
309  l_uint8 *string1,
310  size_t bytes1,
311  l_uint8 *string2,
312  size_t bytes2)
313 {
314 l_int32 i, fail;
315 char buf[256];
316 
317  PROCNAME("regTestCompareStrings");
318 
319  if (!rp)
320  return ERROR_INT("rp not defined", procName, 1);
321 
322  rp->index++;
323  fail = FALSE;
324  if (bytes1 != bytes2) fail = TRUE;
325  if (fail == FALSE) {
326  for (i = 0; i < bytes1; i++) {
327  if (string1[i] != string2[i]) {
328  fail = TRUE;
329  break;
330  }
331  }
332  }
333 
334  /* Output on failure */
335  if (fail == TRUE) {
336  /* Write the two strings to file */
337  snprintf(buf, sizeof(buf), "/tmp/lept/regout/string1_%d_%lu", rp->index,
338  (unsigned long)bytes1);
339  l_binaryWrite(buf, "w", string1, bytes1);
340  snprintf(buf, sizeof(buf), "/tmp/lept/regout/string2_%d_%lu", rp->index,
341  (unsigned long)bytes2);
342  l_binaryWrite(buf, "w", string2, bytes2);
343 
344  /* Report comparison failure */
345  snprintf(buf, sizeof(buf), "/tmp/lept/regout/string*_%d_*", rp->index);
346  if (rp->fp) {
347  fprintf(rp->fp,
348  "Failure in %s_reg: string comp for index %d; "
349  "written to %s\n", rp->testname, rp->index, buf);
350  }
351  fprintf(stderr,
352  "Failure in %s_reg: string comp for index %d; "
353  "written to %s\n", rp->testname, rp->index, buf);
354  rp->success = FALSE;
355  }
356  return 0;
357 }
358 
359 
373 l_int32
375  PIX *pix1,
376  PIX *pix2)
377 {
378 l_int32 same;
379 
380  PROCNAME("regTestComparePix");
381 
382  if (!rp)
383  return ERROR_INT("rp not defined", procName, 1);
384  if (!pix1 || !pix2) {
385  rp->success = FALSE;
386  return ERROR_INT("pix1 and pix2 not both defined", procName, 1);
387  }
388 
389  rp->index++;
390  pixEqual(pix1, pix2, &same);
391 
392  /* Record on failure */
393  if (!same) {
394  if (rp->fp) {
395  fprintf(rp->fp, "Failure in %s_reg: pix comparison for index %d\n",
396  rp->testname, rp->index);
397  }
398  fprintf(stderr, "Failure in %s_reg: pix comparison for index %d\n",
399  rp->testname, rp->index);
400  rp->success = FALSE;
401  }
402  return 0;
403 }
404 
405 
433 l_int32
435  PIX *pix1,
436  PIX *pix2,
437  l_int32 mindiff,
438  l_float32 maxfract,
439  l_int32 printstats)
440 {
441 l_int32 w, h, factor, similar;
442 
443  PROCNAME("regTestCompareSimilarPix");
444 
445  if (!rp)
446  return ERROR_INT("rp not defined", procName, 1);
447  if (!pix1 || !pix2) {
448  rp->success = FALSE;
449  return ERROR_INT("pix1 and pix2 not both defined", procName, 1);
450  }
451 
452  rp->index++;
453  pixGetDimensions(pix1, &w, &h, NULL);
454  factor = L_MAX(w, h) / 400;
455  factor = L_MAX(1, L_MIN(factor, 4)); /* between 1 and 4 */
456  pixTestForSimilarity(pix1, pix2, factor, mindiff, maxfract, 0.0,
457  &similar, printstats);
458 
459  /* Record on failure */
460  if (!similar) {
461  if (rp->fp) {
462  fprintf(rp->fp,
463  "Failure in %s_reg: pix similarity comp for index %d\n",
464  rp->testname, rp->index);
465  }
466  fprintf(stderr, "Failure in %s_reg: pix similarity comp for index %d\n",
467  rp->testname, rp->index);
468  rp->success = FALSE;
469  }
470  return 0;
471 }
472 
473 
496 l_int32
498  const char *localname)
499 {
500 char *ext;
501 char namebuf[256];
502 l_int32 ret, same, format;
503 PIX *pix1, *pix2;
504 
505  PROCNAME("regTestCheckFile");
506 
507  if (!rp)
508  return ERROR_INT("rp not defined", procName, 1);
509  if (!localname) {
510  rp->success = FALSE;
511  return ERROR_INT("local name not defined", procName, 1);
512  }
513  if (rp->mode != L_REG_GENERATE && rp->mode != L_REG_COMPARE &&
514  rp->mode != L_REG_DISPLAY) {
515  rp->success = FALSE;
516  return ERROR_INT("invalid mode", procName, 1);
517  }
518  rp->index++;
519 
520  /* If display mode, no generation and no testing */
521  if (rp->mode == L_REG_DISPLAY) return 0;
522 
523  /* Generate the golden file name; used in 'generate' and 'compare' */
524  splitPathAtExtension(localname, NULL, &ext);
525  snprintf(namebuf, sizeof(namebuf), "/tmp/lept/golden/%s_golden.%02d%s",
526  rp->testname, rp->index, ext);
527  LEPT_FREE(ext);
528 
529  /* Generate mode. No testing. */
530  if (rp->mode == L_REG_GENERATE) {
531  /* Save the file as a golden file */
532  ret = fileCopy(localname, namebuf);
533 #if 0 /* Enable for details on writing of golden files */
534  if (!ret) {
535  char *local = genPathname(localname, NULL);
536  char *golden = genPathname(namebuf, NULL);
537  L_INFO("Copy: %s to %s\n", procName, local, golden);
538  LEPT_FREE(local);
539  LEPT_FREE(golden);
540  }
541 #endif
542  return ret;
543  }
544 
545  /* Compare mode: test and record on failure. This can be used
546  * for all image formats, as well as for all files of serialized
547  * data, such as boxa, pta, etc. In all cases except for
548  * GIF compressed images, we compare the files to see if they
549  * are identical. GIF doesn't support RGB images; to write
550  * a 32 bpp RGB image in GIF, we do a lossy quantization to
551  * 256 colors, so the cycle read-RGB/write-GIF is not idempotent.
552  * And although the read/write cycle for GIF images with bpp <= 8
553  * is idempotent in the image pixels, it is not idempotent in the
554  * actual file bytes; tests comparing file bytes before and after
555  * a GIF read/write cycle will fail. So for GIF we uncompress
556  * the two images and compare the actual pixels. PNG is both
557  * lossless and idempotent in file bytes on read/write, so it is
558  * not necessary to compare pixels. (Comparing pixels requires
559  * decompression, and thus would increase the regression test
560  * time. JPEG is lossy and not idempotent in the image pixels,
561  * so no tests are constructed that would require it. */
562  findFileFormat(localname, &format);
563  if (format == IFF_GIF) {
564  same = 0;
565  pix1 = pixRead(localname);
566  pix2 = pixRead(namebuf);
567  pixEqual(pix1, pix2, &same);
568  pixDestroy(&pix1);
569  pixDestroy(&pix2);
570  } else {
571  filesAreIdentical(localname, namebuf, &same);
572  }
573  if (!same) {
574  fprintf(rp->fp, "Failure in %s_reg, index %d: comparing %s with %s\n",
575  rp->testname, rp->index, localname, namebuf);
576  fprintf(stderr, "Failure in %s_reg, index %d: comparing %s with %s\n",
577  rp->testname, rp->index, localname, namebuf);
578  rp->success = FALSE;
579  }
580 
581  return 0;
582 }
583 
584 
603 l_int32
605  l_int32 index1,
606  l_int32 index2)
607 {
608 char *name1, *name2;
609 char namebuf[256];
610 l_int32 same;
611 SARRAY *sa;
612 
613  PROCNAME("regTestCompareFiles");
614 
615  if (!rp)
616  return ERROR_INT("rp not defined", procName, 1);
617  if (index1 < 0 || index2 < 0) {
618  rp->success = FALSE;
619  return ERROR_INT("index1 and/or index2 is negative", procName, 1);
620  }
621  if (index1 == index2) {
622  rp->success = FALSE;
623  return ERROR_INT("index1 must differ from index2", procName, 1);
624  }
625 
626  rp->index++;
627  if (rp->mode != L_REG_COMPARE) return 0;
628 
629  /* Generate the golden file names */
630  snprintf(namebuf, sizeof(namebuf), "%s_golden.%02d", rp->testname, index1);
631  sa = getSortedPathnamesInDirectory("/tmp/lept/golden", namebuf, 0, 0);
632  if (sarrayGetCount(sa) != 1) {
633  sarrayDestroy(&sa);
634  rp->success = FALSE;
635  L_ERROR("golden file %s not found\n", procName, namebuf);
636  return 1;
637  }
638  name1 = sarrayGetString(sa, 0, L_COPY);
639  sarrayDestroy(&sa);
640 
641  snprintf(namebuf, sizeof(namebuf), "%s_golden.%02d", rp->testname, index2);
642  sa = getSortedPathnamesInDirectory("/tmp/lept/golden", namebuf, 0, 0);
643  if (sarrayGetCount(sa) != 1) {
644  sarrayDestroy(&sa);
645  rp->success = FALSE;
646  LEPT_FREE(name1);
647  L_ERROR("golden file %s not found\n", procName, namebuf);
648  return 1;
649  }
650  name2 = sarrayGetString(sa, 0, L_COPY);
651  sarrayDestroy(&sa);
652 
653  /* Test and record on failure */
654  filesAreIdentical(name1, name2, &same);
655  if (!same) {
656  fprintf(rp->fp,
657  "Failure in %s_reg, index %d: comparing %s with %s\n",
658  rp->testname, rp->index, name1, name2);
659  fprintf(stderr,
660  "Failure in %s_reg, index %d: comparing %s with %s\n",
661  rp->testname, rp->index, name1, name2);
662  rp->success = FALSE;
663  }
664 
665  LEPT_FREE(name1);
666  LEPT_FREE(name2);
667  return 0;
668 }
669 
670 
696 l_int32
698  PIX *pix,
699  l_int32 format)
700 {
701 char namebuf[256];
702 
703  PROCNAME("regTestWritePixAndCheck");
704 
705  if (!rp)
706  return ERROR_INT("rp not defined", procName, 1);
707  if (!pix) {
708  rp->success = FALSE;
709  return ERROR_INT("pix not defined", procName, 1);
710  }
711  if (format < 0 || format >= NumImageFileFormatExtensions) {
712  rp->success = FALSE;
713  return ERROR_INT("invalid format", procName, 1);
714  }
715 
716  /* Generate the local file name */
717  snprintf(namebuf, sizeof(namebuf), "/tmp/lept/regout/%s.%02d.%s",
718  rp->testname, rp->index + 1, ImageFileFormatExtensions[format]);
719 
720  /* Write the local file */
721  if (pixGetDepth(pix) < 8)
722  pixSetPadBits(pix, 0);
723  pixWrite(namebuf, pix, format);
724 
725  /* Either write the golden file ("generate") or check the
726  local file against an existing golden file ("compare") */
727  regTestCheckFile(rp, namebuf);
728 
729  return 0;
730 }
731 
732 
762 l_int32
764  void *data,
765  size_t nbytes,
766  const char *ext)
767 {
768 char namebuf[256];
769 
770  PROCNAME("regTestWriteDataAndCheck");
771 
772  if (!rp)
773  return ERROR_INT("rp not defined", procName, 1);
774  if (!data || nbytes == 0) {
775  rp->success = FALSE;
776  return ERROR_INT("data not defined or size == 0", procName, 1);
777  }
778 
779  /* Generate the local file name */
780  snprintf(namebuf, sizeof(namebuf), "/tmp/lept/regout/%s.%02d.%s",
781  rp->testname, rp->index + 1, ext);
782 
783  /* Write the local file */
784  l_binaryWrite(namebuf, "w", data, nbytes);
785 
786  /* Either write the golden file ("generate") or check the
787  local file against an existing golden file ("compare") */
788  regTestCheckFile(rp, namebuf);
789  return 0;
790 }
791 
792 
811 char *
812 regTestGenLocalFilename(L_REGPARAMS *rp,
813  l_int32 index,
814  l_int32 format)
815 {
816 char buf[64];
817 l_int32 ind;
818 
819  PROCNAME("regTestGenLocalFilename");
820 
821  if (!rp)
822  return (char *)ERROR_PTR("rp not defined", procName, NULL);
823 
824  ind = (index >= 0) ? index : rp->index;
825  snprintf(buf, sizeof(buf), "/tmp/lept/regout/%s.%02d.%s",
826  rp->testname, ind, ImageFileFormatExtensions[format]);
827  return stringNew(buf);
828 }
829 
830 
847 static char *
848 getRootNameFromArgv0(const char *argv0)
849 {
850 l_int32 len;
851 char *root;
852 
853  PROCNAME("getRootNameFromArgv0");
854 
855  splitPathAtDirectory(argv0, NULL, &root);
856  if ((len = strlen(root)) <= 4) {
857  LEPT_FREE(root);
858  return (char *)ERROR_PTR("invalid argv0; too small", procName, NULL);
859  }
860 
861 #ifndef _WIN32
862  {
863  char *newroot;
864  l_int32 loc;
865  if (stringFindSubstr(root, "-", &loc)) {
866  newroot = stringNew(root + loc + 1); /* strip out "lt-" */
867  LEPT_FREE(root);
868  root = newroot;
869  len = strlen(root);
870  }
871  }
872 #else
873  if (strstr(root, ".exe") != NULL)
874  len -= 4;
875 #endif /* ! _WIN32 */
876 
877  root[len - 4] = '\0'; /* remove the suffix */
878  return root;
879 }
L_TIMER startTimerNested(void)
startTimerNested(), stopTimerNested()
Definition: utils1.c:891
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()
Definition: utils2.c:1880
FILE * fp
Definition: regutils.h:119
l_int32 mode
Definition: regutils.h:122
l_int32 regTestCompareValues(L_REGPARAMS *rp, l_float32 val1, l_float32 val2, l_float32 delta)
regTestCompareValues()
Definition: regutils.c:264
char * genPathname(const char *dir, const char *fname)
genPathname()
Definition: utils2.c:2759
l_int32 regTestSetup(l_int32 argc, char **argv, L_REGPARAMS **prp)
regTestSetup()
Definition: regutils.c:115
l_int32 regTestCheckFile(L_REGPARAMS *rp, const char *localname)
regTestCheckFile()
Definition: regutils.c:497
l_int32 fileCopy(const char *srcfile, const char *newfile)
fileCopy()
Definition: utils2.c:1497
char * stringNew(const char *src)
stringNew()
Definition: utils2.c:202
l_int32 regTestCompareFiles(L_REGPARAMS *rp, l_int32 index1, l_int32 index2)
regTestCompareFiles()
Definition: regutils.c:604
l_int32 splitPathAtDirectory(const char *pathname, char **pdir, char **ptail)
splitPathAtDirectory()
Definition: utils2.c:2419
l_int32 filesAreIdentical(const char *fname1, const char *fname2, l_int32 *psame)
filesAreIdentical()
Definition: utils1.c:234
char * getImagelibVersions()
getImagelibVersions()
Definition: libversions.c:101
static char * getRootNameFromArgv0(const char *argv0)
regTestGenLocalFilename()
Definition: regutils.c:848
l_int32 findFileFormat(const char *filename, l_int32 *pformat)
findFileFormat()
Definition: readfile.c:568
Definition: array.h:116
L_TIMER tstart
Definition: regutils.h:126
l_uint8 * l_binaryRead(const char *filename, size_t *pnbytes)
l_binaryRead()
Definition: utils2.c:1154
l_int32 splitPathAtExtension(const char *pathname, char **pbasename, char **pextension)
splitPathAtExtension()
Definition: utils2.c:2486
char * getLeptonicaVersion()
getLeptonicaVersion()
Definition: utils1.c:800
l_int32 fileAppendString(const char *filename, const char *str)
fileAppendString()
Definition: utils2.c:1555
l_int32 pixSetPadBits(PIX *pix, l_int32 val)
pixSetPadBits()
Definition: pix2.c:1295
l_int32 display
Definition: regutils.h:125
char * sarrayGetString(SARRAY *sa, l_int32 index, l_int32 copyflag)
sarrayGetString()
Definition: sarray1.c:675
l_int32 regTestCleanup(L_REGPARAMS *rp)
regTestCleanup()
Definition: regutils.c:200
void pixDestroy(PIX **ppix)
pixDestroy()
Definition: pix1.c:545
l_int32 regTestWriteDataAndCheck(L_REGPARAMS *rp, void *data, size_t nbytes, const char *ext)
regTestWriteDataAndCheck()
Definition: regutils.c:763
SARRAY * getSortedPathnamesInDirectory(const char *dirname, const char *substr, l_int32 first, l_int32 nfiles)
getSortedPathnamesInDirectory()
Definition: sarray1.c:1710
l_int32 success
Definition: regutils.h:124
FILE * fopenWriteStream(const char *filename, const char *modestring)
fopenWriteStream()
Definition: utils2.c:1636
l_int32 sarrayGetCount(SARRAY *sa)
sarrayGetCount()
Definition: sarray1.c:615
PIX * pixRead(const char *filename)
pixRead()
Definition: readfile.c:189
l_int32 l_binaryWrite(const char *filename, const char *operation, void *data, size_t nbytes)
l_binaryWrite()
Definition: utils2.c:1367
l_int32 pixEqual(PIX *pix1, PIX *pix2, l_int32 *psame)
pixEqual()
Definition: compare.c:150
l_int32 regTestCompareStrings(L_REGPARAMS *rp, l_uint8 *string1, size_t bytes1, l_uint8 *string2, size_t bytes2)
regTestCompareStrings()
Definition: regutils.c:308
l_int32 regTestComparePix(L_REGPARAMS *rp, PIX *pix1, PIX *pix2)
regTestComparePix()
Definition: regutils.c:374
Definition: pix.h:705
char * stringJoin(const char *src1, const char *src2)
stringJoin()
Definition: utils2.c:451
Definition: pix.h:134
l_int32 regTestWritePixAndCheck(L_REGPARAMS *rp, PIX *pix, l_int32 format)
regTestWritePixAndCheck()
Definition: regutils.c:697
l_int32 pixGetDimensions(PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
Definition: pix1.c:1052
l_int32 regTestCompareSimilarPix(L_REGPARAMS *rp, PIX *pix1, PIX *pix2, l_int32 mindiff, l_float32 maxfract, l_int32 printstats)
regTestCompareSimilarPix()
Definition: regutils.c:434
l_int32 stringFindSubstr(const char *src, const char *sub, l_int32 *ploc)
stringFindSubstr()
Definition: utils2.c:800
char * tempfile
Definition: regutils.h:121
l_int32 index
Definition: regutils.h:123
l_int32 pixTestForSimilarity(PIX *pix1, PIX *pix2, l_int32 factor, l_int32 mindiff, l_float32 maxfract, l_float32 maxave, l_int32 *psimilar, l_int32 details)
pixTestForSimilarity()
Definition: compare.c:1303
void sarrayDestroy(SARRAY **psa)
sarrayDestroy()
Definition: sarray1.c:349
char * testname
Definition: regutils.h:120