Leptonica  1.77.0
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 
68 #include <string.h>
69 #include "allheaders.h"
70 
71 extern l_int32 NumImageFileFormatExtensions;
72 extern const char *ImageFileFormatExtensions[];
73 
74 static char *getRootNameFromArgv0(const char *argv0);
75 
76 
77 /*--------------------------------------------------------------------*
78  * Regression test utilities *
79  *--------------------------------------------------------------------*/
118 l_ok
119 regTestSetup(l_int32 argc,
120  char **argv,
121  L_REGPARAMS **prp)
122 {
123 char *testname, *vers;
124 char errormsg[64];
125 L_REGPARAMS *rp;
126 
127  PROCNAME("regTestSetup");
128 
129  if (argc != 1 && argc != 2) {
130  snprintf(errormsg, sizeof(errormsg),
131  "Syntax: %s [ [compare] | generate | display ]", argv[0]);
132  return ERROR_INT(errormsg, procName, 1);
133  }
134 
135  if ((testname = getRootNameFromArgv0(argv[0])) == NULL)
136  return ERROR_INT("invalid root", procName, 1);
137 
138  setLeptDebugOK(1); /* required for testing */
139 
140  if ((rp = (L_REGPARAMS *)LEPT_CALLOC(1, sizeof(L_REGPARAMS))) == NULL) {
141  LEPT_FREE(testname);
142  return ERROR_INT("rp not made", procName, 1);
143  }
144  *prp = rp;
145  rp->testname = testname;
146  rp->index = -1; /* increment before each test */
147 
148  /* Initialize to true. A failure in any test is registered
149  * as a failure of the regression test. */
150  rp->success = TRUE;
151 
152  /* Make sure the lept/regout subdirectory exists */
153  lept_mkdir("lept/regout");
154 
155  /* Only open a stream to a temp file for the 'compare' case */
156  if (argc == 1 || !strcmp(argv[1], "compare")) {
157  rp->mode = L_REG_COMPARE;
158  rp->tempfile = stringNew("/tmp/lept/regout/regtest_output.txt");
159  rp->fp = fopenWriteStream(rp->tempfile, "wb");
160  if (rp->fp == NULL) {
161  rp->success = FALSE;
162  return ERROR_INT("stream not opened for tempfile", procName, 1);
163  }
164  } else if (!strcmp(argv[1], "generate")) {
165  rp->mode = L_REG_GENERATE;
166  lept_mkdir("lept/golden");
167  } else if (!strcmp(argv[1], "display")) {
168  rp->mode = L_REG_DISPLAY;
169  rp->display = TRUE;
170  } else {
171  LEPT_FREE(rp);
172  snprintf(errormsg, sizeof(errormsg),
173  "Syntax: %s [ [generate] | compare | display ]", argv[0]);
174  return ERROR_INT(errormsg, procName, 1);
175  }
176 
177  /* Print out test name and both the leptonica and
178  * image libarary versions */
179  fprintf(stderr, "\n////////////////////////////////////////////////\n"
180  "//////////////// %s_reg ///////////////\n"
181  "////////////////////////////////////////////////\n",
182  rp->testname);
183  vers = getLeptonicaVersion();
184  fprintf(stderr, "%s : ", vers);
185  LEPT_FREE(vers);
186  vers = getImagelibVersions();
187  fprintf(stderr, "%s\n", vers);
188  LEPT_FREE(vers);
189 
190  rp->tstart = startTimerNested();
191  return 0;
192 }
193 
194 
207 l_ok
209 {
210 char result[512];
211 char *results_file; /* success/failure output in 'compare' mode */
212 char *text, *message;
213 l_int32 retval;
214 size_t nbytes;
215 
216  PROCNAME("regTestCleanup");
217 
218  if (!rp)
219  return ERROR_INT("rp not defined", procName, 1);
220 
221  fprintf(stderr, "Time: %7.3f sec\n", stopTimerNested(rp->tstart));
222 
223  /* If generating golden files or running in display mode, release rp */
224  if (!rp->fp) {
225  LEPT_FREE(rp->testname);
226  LEPT_FREE(rp->tempfile);
227  LEPT_FREE(rp);
228  return 0;
229  }
230 
231  /* Compare mode: read back data from temp file */
232  fclose(rp->fp);
233  text = (char *)l_binaryRead(rp->tempfile, &nbytes);
234  LEPT_FREE(rp->tempfile);
235  if (!text) {
236  rp->success = FALSE;
237  LEPT_FREE(rp->testname);
238  LEPT_FREE(rp);
239  return ERROR_INT("text not returned", procName, 1);
240  }
241 
242  /* Prepare result message */
243  if (rp->success)
244  snprintf(result, sizeof(result), "SUCCESS: %s_reg\n", rp->testname);
245  else
246  snprintf(result, sizeof(result), "FAILURE: %s_reg\n", rp->testname);
247  message = stringJoin(text, result);
248  LEPT_FREE(text);
249  results_file = stringNew("/tmp/lept/reg_results.txt");
250  fileAppendString(results_file, message);
251  retval = (rp->success) ? 0 : 1;
252  LEPT_FREE(results_file);
253  LEPT_FREE(message);
254 
255  LEPT_FREE(rp->testname);
256  LEPT_FREE(rp);
257  return retval;
258 }
259 
260 
270 l_ok
272  l_float32 val1,
273  l_float32 val2,
274  l_float32 delta)
275 {
276 l_float32 diff;
277 
278  PROCNAME("regTestCompareValues");
279 
280  if (!rp)
281  return ERROR_INT("rp not defined", procName, 1);
282 
283  rp->index++;
284  diff = L_ABS(val2 - val1);
285 
286  /* Record on failure */
287  if (diff > delta) {
288  if (rp->fp) {
289  fprintf(rp->fp,
290  "Failure in %s_reg: value comparison for index %d\n"
291  "difference = %f but allowed delta = %f\n",
292  rp->testname, rp->index, diff, delta);
293  }
294  fprintf(stderr,
295  "Failure in %s_reg: value comparison for index %d\n"
296  "difference = %f but allowed delta = %f\n",
297  rp->testname, rp->index, diff, delta);
298  rp->success = FALSE;
299  }
300  return 0;
301 }
302 
303 
314 l_ok
316  l_uint8 *string1,
317  size_t bytes1,
318  l_uint8 *string2,
319  size_t bytes2)
320 {
321 l_int32 i, fail;
322 char buf[256];
323 
324  PROCNAME("regTestCompareStrings");
325 
326  if (!rp)
327  return ERROR_INT("rp not defined", procName, 1);
328 
329  rp->index++;
330  fail = FALSE;
331  if (bytes1 != bytes2) fail = TRUE;
332  if (fail == FALSE) {
333  for (i = 0; i < bytes1; i++) {
334  if (string1[i] != string2[i]) {
335  fail = TRUE;
336  break;
337  }
338  }
339  }
340 
341  /* Output on failure */
342  if (fail == TRUE) {
343  /* Write the two strings to file */
344  snprintf(buf, sizeof(buf), "/tmp/lept/regout/string1_%d_%lu", rp->index,
345  (unsigned long)bytes1);
346  l_binaryWrite(buf, "w", string1, bytes1);
347  snprintf(buf, sizeof(buf), "/tmp/lept/regout/string2_%d_%lu", rp->index,
348  (unsigned long)bytes2);
349  l_binaryWrite(buf, "w", string2, bytes2);
350 
351  /* Report comparison failure */
352  snprintf(buf, sizeof(buf), "/tmp/lept/regout/string*_%d_*", rp->index);
353  if (rp->fp) {
354  fprintf(rp->fp,
355  "Failure in %s_reg: string comp for index %d; "
356  "written to %s\n", rp->testname, rp->index, buf);
357  }
358  fprintf(stderr,
359  "Failure in %s_reg: string comp for index %d; "
360  "written to %s\n", rp->testname, rp->index, buf);
361  rp->success = FALSE;
362  }
363  return 0;
364 }
365 
366 
380 l_ok
382  PIX *pix1,
383  PIX *pix2)
384 {
385 l_int32 same;
386 
387  PROCNAME("regTestComparePix");
388 
389  if (!rp)
390  return ERROR_INT("rp not defined", procName, 1);
391  if (!pix1 || !pix2) {
392  rp->success = FALSE;
393  return ERROR_INT("pix1 and pix2 not both defined", procName, 1);
394  }
395 
396  rp->index++;
397  pixEqual(pix1, pix2, &same);
398 
399  /* Record on failure */
400  if (!same) {
401  if (rp->fp) {
402  fprintf(rp->fp, "Failure in %s_reg: pix comparison for index %d\n",
403  rp->testname, rp->index);
404  }
405  fprintf(stderr, "Failure in %s_reg: pix comparison for index %d\n",
406  rp->testname, rp->index);
407  rp->success = FALSE;
408  }
409  return 0;
410 }
411 
412 
440 l_ok
442  PIX *pix1,
443  PIX *pix2,
444  l_int32 mindiff,
445  l_float32 maxfract,
446  l_int32 printstats)
447 {
448 l_int32 w, h, factor, similar;
449 
450  PROCNAME("regTestCompareSimilarPix");
451 
452  if (!rp)
453  return ERROR_INT("rp not defined", procName, 1);
454  if (!pix1 || !pix2) {
455  rp->success = FALSE;
456  return ERROR_INT("pix1 and pix2 not both defined", procName, 1);
457  }
458 
459  rp->index++;
460  pixGetDimensions(pix1, &w, &h, NULL);
461  factor = L_MAX(w, h) / 400;
462  factor = L_MAX(1, L_MIN(factor, 4)); /* between 1 and 4 */
463  pixTestForSimilarity(pix1, pix2, factor, mindiff, maxfract, 0.0,
464  &similar, printstats);
465 
466  /* Record on failure */
467  if (!similar) {
468  if (rp->fp) {
469  fprintf(rp->fp,
470  "Failure in %s_reg: pix similarity comp for index %d\n",
471  rp->testname, rp->index);
472  }
473  fprintf(stderr, "Failure in %s_reg: pix similarity comp for index %d\n",
474  rp->testname, rp->index);
475  rp->success = FALSE;
476  }
477  return 0;
478 }
479 
480 
506 l_ok
508  const char *localname)
509 {
510 char *ext;
511 char namebuf[256];
512 l_int32 ret, same, format;
513 PIX *pix1, *pix2;
514 
515  PROCNAME("regTestCheckFile");
516 
517  if (!rp)
518  return ERROR_INT("rp not defined", procName, 1);
519  if (!localname) {
520  rp->success = FALSE;
521  return ERROR_INT("local name not defined", procName, 1);
522  }
523  if (rp->mode != L_REG_GENERATE && rp->mode != L_REG_COMPARE &&
524  rp->mode != L_REG_DISPLAY) {
525  rp->success = FALSE;
526  return ERROR_INT("invalid mode", procName, 1);
527  }
528  rp->index++;
529 
530  /* If display mode, no generation and no testing */
531  if (rp->mode == L_REG_DISPLAY) return 0;
532 
533  /* Generate the golden file name; used in 'generate' and 'compare' */
534  splitPathAtExtension(localname, NULL, &ext);
535  snprintf(namebuf, sizeof(namebuf), "/tmp/lept/golden/%s_golden.%02d%s",
536  rp->testname, rp->index, ext);
537  LEPT_FREE(ext);
538 
539  /* Generate mode. No testing. */
540  if (rp->mode == L_REG_GENERATE) {
541  /* Save the file as a golden file */
542  ret = fileCopy(localname, namebuf);
543 #if 0 /* Enable for details on writing of golden files */
544  if (!ret) {
545  char *local = genPathname(localname, NULL);
546  char *golden = genPathname(namebuf, NULL);
547  L_INFO("Copy: %s to %s\n", procName, local, golden);
548  LEPT_FREE(local);
549  LEPT_FREE(golden);
550  }
551 #endif
552  return ret;
553  }
554 
555  /* Compare mode: test and record on failure. This can be used
556  * for all image formats, as well as for all files of serialized
557  * data, such as boxa, pta, etc. In all cases except for
558  * GIF compressed images, we compare the files to see if they
559  * are identical. GIF doesn't support RGB images; to write
560  * a 32 bpp RGB image in GIF, we do a lossy quantization to
561  * 256 colors, so the cycle read-RGB/write-GIF is not idempotent.
562  * And although the read/write cycle for GIF images with bpp <= 8
563  * is idempotent in the image pixels, it is not idempotent in the
564  * actual file bytes; tests comparing file bytes before and after
565  * a GIF read/write cycle will fail. So for GIF we uncompress
566  * the two images and compare the actual pixels. PNG is both
567  * lossless and idempotent in file bytes on read/write, so it is
568  * not necessary to compare pixels. (Comparing pixels requires
569  * decompression, and thus would increase the regression test
570  * time. JPEG is lossy and not idempotent in the image pixels,
571  * so no tests are constructed that would require it. */
572  findFileFormat(localname, &format);
573  if (format == IFF_GIF) {
574  same = 0;
575  pix1 = pixRead(localname);
576  pix2 = pixRead(namebuf);
577  pixEqual(pix1, pix2, &same);
578  pixDestroy(&pix1);
579  pixDestroy(&pix2);
580  } else {
581  filesAreIdentical(localname, namebuf, &same);
582  }
583  if (!same) {
584  fprintf(rp->fp, "Failure in %s_reg, index %d: comparing %s with %s\n",
585  rp->testname, rp->index, localname, namebuf);
586  fprintf(stderr, "Failure in %s_reg, index %d: comparing %s with %s\n",
587  rp->testname, rp->index, localname, namebuf);
588  rp->success = FALSE;
589  }
590 
591  return 0;
592 }
593 
594 
613 l_ok
615  l_int32 index1,
616  l_int32 index2)
617 {
618 char *name1, *name2;
619 char namebuf[256];
620 l_int32 same;
621 SARRAY *sa;
622 
623  PROCNAME("regTestCompareFiles");
624 
625  if (!rp)
626  return ERROR_INT("rp not defined", procName, 1);
627  if (index1 < 0 || index2 < 0) {
628  rp->success = FALSE;
629  return ERROR_INT("index1 and/or index2 is negative", procName, 1);
630  }
631  if (index1 == index2) {
632  rp->success = FALSE;
633  return ERROR_INT("index1 must differ from index2", procName, 1);
634  }
635 
636  rp->index++;
637  if (rp->mode != L_REG_COMPARE) return 0;
638 
639  /* Generate the golden file names */
640  snprintf(namebuf, sizeof(namebuf), "%s_golden.%02d", rp->testname, index1);
641  sa = getSortedPathnamesInDirectory("/tmp/lept/golden", namebuf, 0, 0);
642  if (sarrayGetCount(sa) != 1) {
643  sarrayDestroy(&sa);
644  rp->success = FALSE;
645  L_ERROR("golden file %s not found\n", procName, namebuf);
646  return 1;
647  }
648  name1 = sarrayGetString(sa, 0, L_COPY);
649  sarrayDestroy(&sa);
650 
651  snprintf(namebuf, sizeof(namebuf), "%s_golden.%02d", rp->testname, index2);
652  sa = getSortedPathnamesInDirectory("/tmp/lept/golden", namebuf, 0, 0);
653  if (sarrayGetCount(sa) != 1) {
654  sarrayDestroy(&sa);
655  rp->success = FALSE;
656  LEPT_FREE(name1);
657  L_ERROR("golden file %s not found\n", procName, namebuf);
658  return 1;
659  }
660  name2 = sarrayGetString(sa, 0, L_COPY);
661  sarrayDestroy(&sa);
662 
663  /* Test and record on failure */
664  filesAreIdentical(name1, name2, &same);
665  if (!same) {
666  fprintf(rp->fp,
667  "Failure in %s_reg, index %d: comparing %s with %s\n",
668  rp->testname, rp->index, name1, name2);
669  fprintf(stderr,
670  "Failure in %s_reg, index %d: comparing %s with %s\n",
671  rp->testname, rp->index, name1, name2);
672  rp->success = FALSE;
673  }
674 
675  LEPT_FREE(name1);
676  LEPT_FREE(name2);
677  return 0;
678 }
679 
680 
706 l_ok
708  PIX *pix,
709  l_int32 format)
710 {
711 char namebuf[256];
712 
713  PROCNAME("regTestWritePixAndCheck");
714 
715  if (!rp)
716  return ERROR_INT("rp not defined", procName, 1);
717  if (!pix) {
718  rp->success = FALSE;
719  return ERROR_INT("pix not defined", procName, 1);
720  }
721  if (format < 0 || format >= NumImageFileFormatExtensions) {
722  rp->success = FALSE;
723  return ERROR_INT("invalid format", procName, 1);
724  }
725 
726  /* Generate the local file name */
727  snprintf(namebuf, sizeof(namebuf), "/tmp/lept/regout/%s.%02d.%s",
728  rp->testname, rp->index + 1, ImageFileFormatExtensions[format]);
729 
730  /* Write the local file */
731  if (pixGetDepth(pix) < 8)
732  pixSetPadBits(pix, 0);
733  pixWrite(namebuf, pix, format);
734 
735  /* Either write the golden file ("generate") or check the
736  local file against an existing golden file ("compare") */
737  regTestCheckFile(rp, namebuf);
738 
739  return 0;
740 }
741 
742 
772 l_ok
774  void *data,
775  size_t nbytes,
776  const char *ext)
777 {
778 char namebuf[256];
779 
780  PROCNAME("regTestWriteDataAndCheck");
781 
782  if (!rp)
783  return ERROR_INT("rp not defined", procName, 1);
784  if (!data || nbytes == 0) {
785  rp->success = FALSE;
786  return ERROR_INT("data not defined or size == 0", procName, 1);
787  }
788 
789  /* Generate the local file name */
790  snprintf(namebuf, sizeof(namebuf), "/tmp/lept/regout/%s.%02d.%s",
791  rp->testname, rp->index + 1, ext);
792 
793  /* Write the local file */
794  l_binaryWrite(namebuf, "w", data, nbytes);
795 
796  /* Either write the golden file ("generate") or check the
797  local file against an existing golden file ("compare") */
798  regTestCheckFile(rp, namebuf);
799  return 0;
800 }
801 
802 
823 char *
825  l_int32 index,
826  l_int32 format)
827 {
828 char buf[64];
829 l_int32 ind;
830 
831  PROCNAME("regTestGenLocalFilename");
832 
833  if (!rp)
834  return (char *)ERROR_PTR("rp not defined", procName, NULL);
835 
836  ind = (index >= 0) ? index : rp->index;
837  snprintf(buf, sizeof(buf), "/tmp/lept/regout/%s.%02d.%s",
838  rp->testname, ind, ImageFileFormatExtensions[format]);
839  return stringNew(buf);
840 }
841 
842 
859 static char *
860 getRootNameFromArgv0(const char *argv0)
861 {
862 l_int32 len;
863 char *root;
864 
865  PROCNAME("getRootNameFromArgv0");
866 
867  splitPathAtDirectory(argv0, NULL, &root);
868  if ((len = strlen(root)) <= 4) {
869  LEPT_FREE(root);
870  return (char *)ERROR_PTR("invalid argv0; too small", procName, NULL);
871  }
872 
873 #ifndef _WIN32
874  {
875  char *newroot;
876  l_int32 loc;
877  if (stringFindSubstr(root, "-", &loc)) {
878  newroot = stringNew(root + loc + 1); /* strip out "lt-" */
879  LEPT_FREE(root);
880  root = newroot;
881  len = strlen(root);
882  }
883  }
884 #else
885  if (strstr(root, ".exe") != NULL)
886  len -= 4;
887 #endif /* ! _WIN32 */
888 
889  root[len - 4] = '\0'; /* remove the suffix */
890  return root;
891 }
L_TIMER startTimerNested(void)
startTimerNested(), stopTimerNested()
Definition: utils1.c:901
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()
Definition: utils2.c:1944
FILE * fp
Definition: regutils.h:119
l_int32 mode
Definition: regutils.h:122
l_ok splitPathAtExtension(const char *pathname, char **pbasename, char **pextension)
splitPathAtExtension()
Definition: utils2.c:2607
l_ok regTestWritePixAndCheck(L_REGPARAMS *rp, PIX *pix, l_int32 format)
regTestWritePixAndCheck()
Definition: regutils.c:707
char * genPathname(const char *dir, const char *fname)
genPathname()
Definition: utils2.c:2880
l_ok fileCopy(const char *srcfile, const char *newfile)
fileCopy()
Definition: utils2.c:1561
char * stringNew(const char *src)
stringNew()
Definition: utils2.c:215
char * getImagelibVersions()
getImagelibVersions()
Definition: libversions.c:101
static char * getRootNameFromArgv0(const char *argv0)
getRootNameFromArgv0()
Definition: regutils.c:860
Definition: array.h:116
l_ok regTestCheckFile(L_REGPARAMS *rp, const char *localname)
regTestCheckFile()
Definition: regutils.c:507
l_ok l_binaryWrite(const char *filename, const char *operation, const void *data, size_t nbytes)
l_binaryWrite()
Definition: utils2.c:1429
L_TIMER tstart
Definition: regutils.h:126
l_uint8 * l_binaryRead(const char *filename, size_t *pnbytes)
l_binaryRead()
Definition: utils2.c:1212
char * getLeptonicaVersion()
getLeptonicaVersion()
Definition: utils1.c:810
l_ok regTestCompareStrings(L_REGPARAMS *rp, l_uint8 *string1, size_t bytes1, l_uint8 *string2, size_t bytes2)
regTestCompareStrings()
Definition: regutils.c:315
l_ok regTestSetup(l_int32 argc, char **argv, L_REGPARAMS **prp)
regTestSetup()
Definition: regutils.c:119
l_ok fileAppendString(const char *filename, const char *str)
fileAppendString()
Definition: utils2.c:1619
l_ok pixSetPadBits(PIX *pix, l_int32 val)
pixSetPadBits()
Definition: pix2.c:1307
l_int32 display
Definition: regutils.h:125
l_ok findFileFormat(const char *filename, l_int32 *pformat)
findFileFormat()
Definition: readfile.c:580
l_ok regTestWriteDataAndCheck(L_REGPARAMS *rp, void *data, size_t nbytes, const char *ext)
regTestWriteDataAndCheck()
Definition: regutils.c:773
char * sarrayGetString(SARRAY *sa, l_int32 index, l_int32 copyflag)
sarrayGetString()
Definition: sarray1.c:681
l_ok regTestCompareValues(L_REGPARAMS *rp, l_float32 val1, l_float32 val2, l_float32 delta)
regTestCompareValues()
Definition: regutils.c:271
void pixDestroy(PIX **ppix)
pixDestroy()
Definition: pix1.c:543
l_ok regTestCompareFiles(L_REGPARAMS *rp, l_int32 index1, l_int32 index2)
regTestCompareFiles()
Definition: regutils.c:614
SARRAY * getSortedPathnamesInDirectory(const char *dirname, const char *substr, l_int32 first, l_int32 nfiles)
getSortedPathnamesInDirectory()
Definition: sarray1.c:1717
l_int32 success
Definition: regutils.h:124
l_ok splitPathAtDirectory(const char *pathname, char **pdir, char **ptail)
splitPathAtDirectory()
Definition: utils2.c:2540
l_ok regTestCleanup(L_REGPARAMS *rp)
regTestCleanup()
Definition: regutils.c:208
l_ok filesAreIdentical(const char *fname1, const char *fname2, l_int32 *psame)
filesAreIdentical()
Definition: utils1.c:244
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
Definition: pix1.c:1065
FILE * fopenWriteStream(const char *filename, const char *modestring)
fopenWriteStream()
Definition: utils2.c:1700
l_int32 sarrayGetCount(SARRAY *sa)
sarrayGetCount()
Definition: sarray1.c:621
PIX * pixRead(const char *filename)
pixRead()
Definition: readfile.c:190
l_ok regTestComparePix(L_REGPARAMS *rp, PIX *pix1, PIX *pix2)
regTestComparePix()
Definition: regutils.c:381
Definition: pix.h:718
char * stringJoin(const char *src1, const char *src2)
stringJoin()
Definition: utils2.c:509
Definition: pix.h:134
l_ok 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
l_ok pixEqual(PIX *pix1, PIX *pix2, l_int32 *psame)
pixEqual()
Definition: compare.c:150
l_int32 stringFindSubstr(const char *src, const char *sub, l_int32 *ploc)
stringFindSubstr()
Definition: utils2.c:858
char * tempfile
Definition: regutils.h:121
l_int32 index
Definition: regutils.h:123
l_ok regTestCompareSimilarPix(L_REGPARAMS *rp, PIX *pix1, PIX *pix2, l_int32 mindiff, l_float32 maxfract, l_int32 printstats)
regTestCompareSimilarPix()
Definition: regutils.c:441
char * regTestGenLocalFilename(L_REGPARAMS *rp, l_int32 index, l_int32 format)
regTestGenLocalFilename()
Definition: regutils.c:824
void sarrayDestroy(SARRAY **psa)
sarrayDestroy()
Definition: sarray1.c:355
char * testname
Definition: regutils.h:120