本文整理汇总了C++中pixEqual函数的典型用法代码示例。如果您正苦于以下问题:C++ pixEqual函数的具体用法?C++ pixEqual怎么用?C++ pixEqual使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pixEqual函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PixCompareDwa
void
PixCompareDwa(L_REGPARAMS *rp,
l_int32 size,
const char *type,
PIX *pix1,
PIX *pix2,
PIX *pix3,
PIX *pix4,
PIX *pix5,
PIX *pix6)
{
l_int32 same;
pixEqual(pix1, pix2, &same);
regTestCompareValues(rp, TRUE, same, 0);
if (!same)
fprintf(stderr, "%s (%d, 1) not same\n", type, size);
pixEqual(pix3, pix4, &same);
regTestCompareValues(rp, TRUE, same, 0);
if (!same)
fprintf(stderr, "%s (1, %d) not same\n", type, size);
pixEqual(pix5, pix6, &same);
regTestCompareValues(rp, TRUE, same, 0);
if (!same)
fprintf(stderr, "%s (%d, %d) not same\n", type, size, size);
}
开发者ID:chewi,项目名称:leptonica,代码行数:26,代码来源:binmorph5_reg.c
示例2: PixCompareDwa
l_int32
PixCompareDwa(l_int32 size,
const char *type,
PIX *pixt1,
PIX *pixt2,
PIX *pixt3,
PIX *pixt4,
PIX *pixt5,
PIX *pixt6)
{
l_int32 same, fail;
fail = FALSE;
pixEqual(pixt1, pixt2, &same);
if (!same) {
fail = TRUE;
fprintf(stderr, "%s (%d, 1) not same\n", type, size);
}
pixEqual(pixt3, pixt4, &same);
if (!same) {
fail = TRUE;
fprintf(stderr, "%s (1, %d) not same\n", type, size);
}
pixEqual(pixt5, pixt6, &same);
if (!same) {
fail = TRUE;
fprintf(stderr, "%s (%d, %d) not same\n", type, size, size);
}
return fail;
}
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:30,代码来源:binmorph5_reg.c
示例3: compareResults
static l_int32
compareResults(PIX *pixs,
PIX *pixt1,
PIX *pixt2,
l_int32 count1,
l_int32 count2,
const char *descr)
{
l_int32 ret, same;
ret = 0;
pixEqual(pixs, pixt1, &same);
if (!same) {
fprintf(stderr, "pixt1 != pixs in %s\n", descr);
ret = 1;
}
pixEqual(pixs, pixt2, &same);
if (!same) {
fprintf(stderr, "pixt2 != pixs in %s\n", descr);
ret = 1;
}
if (count1 != count2) {
fprintf(stderr, "Counts not same in %s\n", descr);
ret = 1;
} else
fprintf(stderr, "Counts equal in %s: %d\n", descr, count1);
pixClearAll(pixt1);
pixClearAll(pixt2);
if (!ret)
fprintf(stderr, "All OK for %s\n", descr);
return ret;
}
开发者ID:ErfanHasmin,项目名称:scope-ocr,代码行数:32,代码来源:lowaccess_reg.c
示例4: main
int main(int argc,
char **argv)
{
l_int32 i, nsels, same1, same2, ok;
char *filein, *selname;
PIX *pixs, *pixref, *pixt1, *pixt2, *pixt3, *pixt4;
SEL *sel;
SELA *sela;
static char mainName[] = "fhmtauto_reg";
if (argc != 2)
return ERROR_INT(" Syntax: fhmtauto_reg filein", mainName, 1);
filein = argv[1];
if ((pixs = pixRead(filein)) == NULL)
return ERROR_INT("pixs not made", mainName, 1);
sela = selaAddHitMiss(NULL);
nsels = selaGetCount(sela);
ok = TRUE;
for (i = 0; i < nsels; i++)
{
sel = selaGetSel(sela, i);
selname = selGetName(sel);
pixref = pixHMT(NULL, pixs, sel);
pixt1 = pixAddBorder(pixs, 32, 0);
pixt2 = pixFHMTGen_1(NULL, pixt1, selname);
pixt3 = pixRemoveBorder(pixt2, 32);
pixt4 = pixHMTDwa_1(NULL, pixs, selname);
pixEqual(pixref, pixt3, &same1);
pixEqual(pixref, pixt4, &same2);
if (same1 && same2)
fprintf(stderr, "hmt are identical for sel %d (%s)\n", i, selname);
else {
fprintf(stderr, "hmt differ for sel %d (%s)\n", i, selname);
ok = FALSE;
}
pixDestroy(&pixref);
pixDestroy(&pixt1);
pixDestroy(&pixt2);
pixDestroy(&pixt3);
pixDestroy(&pixt4);
}
if (ok)
fprintf(stderr, "\n ******** All hmt are correct *******\n");
else
fprintf(stderr, "\n ******** ERROR in at least one hmt *******\n");
pixDestroy(&pixs);
selaDestroy(&sela);
return 0;
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:59,代码来源:fhmtauto_reg.c
示例5: test_mem_png
/* Returns 1 on error */
static l_int32
test_mem_png(const char *fname)
{
l_uint8 *data = NULL;
l_int32 same;
size_t size = 0;
PIX *pixs;
PIX *pixd = NULL;
if ((pixs = pixRead(fname)) == NULL) {
fprintf(stderr, "Failure to read %s\n", fname);
return 1;
}
if (pixWriteMem(&data, &size, pixs, IFF_PNG)) {
fprintf(stderr, "Mem write fail for png\n");
return 1;
}
if ((pixd = pixReadMem(data, size)) == NULL) {
fprintf(stderr, "Mem read fail for png\n");
lept_free(data);
return 1;
}
pixEqual(pixs, pixd, &same);
if (!same)
fprintf(stderr, "Mem write/read fail for file %s\n", fname);
pixDestroy(&pixs);
pixDestroy(&pixd);
lept_free(data);
return (!same);
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:32,代码来源:pngio_reg.c
示例6: test_1bpp_color
static l_int32
test_1bpp_color(L_REGPARAMS *rp)
{
l_int32 same, transp;
FILE *fp;
PIX *pix1, *pix2;
PIXCMAP *cmap;
pix1 = pixRead("feyn-fract2.tif");
cmap = pixcmapCreate(1);
pixSetColormap(pix1, cmap);
pixcmapAddRGBA(cmap, 180, 130, 220, 255); /* color, opaque */
pixcmapAddRGBA(cmap, 20, 120, 0, 255); /* color, opaque */
pixWrite("/tmp/regout/1bpp-color.png", pix1, IFF_PNG);
pix2 = pixRead("/tmp/regout/1bpp-color.png");
pixEqual(pix1, pix2, &same);
if (same)
fprintf(stderr, "1bpp_color: success\n");
else
fprintf(stderr, "1bpp_color: bad output\n");
pixDisplayWithTitle(pix2, 700, 100, NULL, rp->display);
pixDestroy(&pix1);
pixDestroy(&pix2);
fp = fopenReadStream("/tmp/regout/1bpp-color.png");
fgetPngColormapInfo(fp, &cmap, &transp);
fclose(fp);
if (transp)
fprintf(stderr, "1bpp_color: error -- transparency found!\n");
else
fprintf(stderr, "1bpp_color: correct -- no transparency found\n");
if (rp->display) pixcmapWriteStream(stderr, cmap);
pixcmapDestroy(&cmap);
return same;
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:34,代码来源:pngio_reg.c
示例7: regTestComparePix
/*!
* regTestComparePix()
*
* Input: rp (regtest parameters)
* pix1, pix2 (to be tested for equality)
* Return: 0 if OK, 1 on error (a failure in comparison is not an error)
*
* Notes:
* (1) This function compares two pix for equality. On failure,
* this writes to stderr.
*/
l_int32
regTestComparePix(L_REGPARAMS *rp,
PIX *pix1,
PIX *pix2) {
l_int32 same;
PROCNAME("regTestComparePix");
if (!rp)
return ERROR_INT("rp not defined", procName, 1);
if (!pix1 || !pix2) {
rp->success = FALSE;
return ERROR_INT("pix1 and pix2 not both defined", procName, 1);
}
rp->index++;
pixEqual(pix1, pix2, &same);
/* Record on failure */
if (!same) {
if (rp->fp) {
fprintf(rp->fp, "Failure in %s_reg: pix comparison for index %d\n",
rp->testname, rp->index);
}
fprintf(stderr, "Failure in %s_reg: pix comparison for index %d\n",
rp->testname, rp->index);
rp->success = FALSE;
}
return 0;
}
开发者ID:mehulsbhatt,项目名称:MyOCRTEST,代码行数:41,代码来源:regutils.c
示例8: test_gif
static void
test_gif(const char *fname,
PIXA *pixa,
L_REGPARAMS *rp)
{
char buf[256];
l_int32 same;
PIX *pixs, *pix1, *pix2;
pixs = pixRead(fname);
snprintf(buf, sizeof(buf), "/tmp/lept/gif/gifio-a.%d.gif", rp->index + 1);
pixWrite(buf, pixs, IFF_GIF);
pix1 = pixRead(buf);
snprintf(buf, sizeof(buf), "/tmp/lept/gif/gifio-b.%d.gif", rp->index + 1);
pixWrite(buf, pix1, IFF_GIF);
pix2 = pixRead(buf);
regTestWritePixAndCheck(rp, pix2, IFF_GIF);
pixEqual(pixs, pix2, &same);
if (!same && rp->index < 6) {
fprintf(stderr, "Error for %s\n", fname);
rp->success = FALSE;
}
if (rp->display) {
fprintf(stderr,
" depth: pixs = %d, pix1 = %d\n", pixGetDepth(pixs),
pixGetDepth(pix1));
pixaAddPix(pixa, pix2, L_CLONE);
}
pixDestroy(&pixs);
pixDestroy(&pix1);
pixDestroy(&pix2);
return;
}
开发者ID:DanBloomberg,项目名称:leptonica,代码行数:34,代码来源:gifio_reg.c
示例9: testcomp
/* Returns 1 on error */
static l_int32
testcomp(const char *filename,
PIX *pix,
l_int32 comptype)
{
l_int32 format, sameformat, sameimage;
FILE *fp;
PIX *pixt;
fp = lept_fopen(filename, "rb");
findFileFormatStream(fp, &format);
sameformat = TRUE;
if (format != comptype) {
fprintf(stderr, "File %s has format %d, not comptype %d\n",
filename, format, comptype);
sameformat = FALSE;
}
lept_fclose(fp);
pixt = pixRead(filename);
pixEqual(pix, pixt, &sameimage);
pixDestroy(&pixt);
if (!sameimage)
fprintf(stderr, "Write/read fail for file %s with format %d\n",
filename, format);
return (!sameformat || !sameimage);
}
开发者ID:ErfanHasmin,项目名称:scope-ocr,代码行数:27,代码来源:ioformats_reg.c
示例10: test_mem_gif
/* Returns 1 on error */
static l_int32
test_mem_gif(const char *fname,
l_int32 index)
{
l_uint8 *data = NULL;
l_int32 same;
size_t size = 0;
PIX *pixs;
PIX *pixd = NULL;
if ((pixs = pixRead(fname)) == NULL) {
fprintf(stderr, "Failure to read gif file: %s\n", fname);
return 1;
}
if (pixWriteMem(&data, &size, pixs, IFF_GIF)) {
fprintf(stderr, "Mem gif write fail on image %d\n", index);
return 1;
}
if ((pixd = pixReadMem(data, size)) == NULL) {
fprintf(stderr, "Mem gif read fail on image %d\n", index);
lept_free(data);
return 1;
}
pixEqual(pixs, pixd, &same);
pixDestroy(&pixs);
pixDestroy(&pixd);
lept_free(data);
if (!same && index < 6) {
fprintf(stderr, "Mem gif write/read fail for file %s\n", fname);
return 1;
}
else
return 0;
}
开发者ID:DanBloomberg,项目名称:leptonica,代码行数:36,代码来源:gifio_reg.c
示例11: test_8bpp_trans
static l_int32
test_8bpp_trans(L_REGPARAMS *rp)
{
l_int32 same, transp;
FILE *fp;
PIX *pix1, *pix2, *pix3;
PIXCMAP *cmap;
pix1 = pixRead("wyom.jpg");
pix2 = pixColorSegment(pix1, 75, 10, 8, 7);
cmap = pixGetColormap(pix2);
pixcmapSetAlpha(cmap, 0, 0); /* set blueish sky color to transparent */
pixWrite("/tmp/regout/8bpp-trans.png", pix2, IFF_PNG);
pix3 = pixRead("/tmp/regout/8bpp-trans.png");
pixEqual(pix2, pix3, &same);
if (same)
fprintf(stderr, "8bpp_trans: success\n");
else
fprintf(stderr, "8bpp_trans: bad output\n");
pixDisplayWithTitle(pix3, 700, 0, NULL, rp->display);
pixDestroy(&pix1);
pixDestroy(&pix2);
pixDestroy(&pix3);
fp = fopenReadStream("/tmp/regout/8bpp-trans.png");
fgetPngColormapInfo(fp, &cmap, &transp);
fclose(fp);
if (transp)
fprintf(stderr, "8bpp_trans: correct -- transparency found\n");
else
fprintf(stderr, "8bpp_trans: error -- no transparency found!\n");
if (rp->display) pixcmapWriteStream(stderr, cmap);
pixcmapDestroy(&cmap);
return same;
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:34,代码来源:pngio_reg.c
示例12: main
main(int argc,
char **argv)
{
l_int32 i, j, w, h, same, width, height, cx, cy;
l_uint32 val;
PIX *pixs, *pixse, *pixd1, *pixd2;
SEL *sel;
static char mainName[] = "rasterop_reg";
if (argc != 1)
return ERROR_INT(" Syntax: rasterop_reg", mainName, 1);
pixs = pixRead("feyn.tif");
for (width = 1; width <= 25; width += 3) {
for (height = 1; height <= 25; height += 4) {
cx = width / 2;
cy = height / 2;
/* Dilate using an actual sel */
sel = selCreateBrick(height, width, cy, cx, SEL_HIT);
pixd1 = pixDilate(NULL, pixs, sel);
/* Dilate using a pix as a sel */
pixse = pixCreate(width, height, 1);
pixSetAll(pixse);
pixd2 = pixCopy(NULL, pixs);
w = pixGetWidth(pixs);
h = pixGetHeight(pixs);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
pixGetPixel(pixs, j, i, &val);
if (val)
pixRasterop(pixd2, j - cx, i - cy, width, height,
PIX_SRC | PIX_DST, pixse, 0, 0);
}
}
pixEqual(pixd1, pixd2, &same);
if (same == 1)
fprintf(stderr, "Correct for (%d,%d)\n", width, height);
else {
fprintf(stderr, "Error: results are different!\n");
fprintf(stderr, "SE: width = %d, height = %d\n", width, height);
pixWrite("/tmp/junkout1", pixd1, IFF_PNG);
pixWrite("/tmp/junkout2", pixd2, IFF_PNG);
return 1;
}
pixDestroy(&pixse);
pixDestroy(&pixd1);
pixDestroy(&pixd2);
selDestroy(&sel);
}
}
pixDestroy(&pixs);
return 0;
}
开发者ID:ErfanHasmin,项目名称:scope-ocr,代码行数:58,代码来源:rasterop_reg.c
示例13: PixTestEqual
void
PixTestEqual(PIX *pixs1,
PIX *pixs2,
PIX *pixm,
l_int32 set,
l_int32 connectivity)
{
l_int32 same;
PIX *pixc11, *pixc12, *pixc21, *pixc22, *pixmi;
pixmi = pixInvert(NULL, pixm);
pixc11 = pixCopy(NULL, pixs1);
pixc12 = pixCopy(NULL, pixs1);
pixc21 = pixCopy(NULL, pixs2);
pixc22 = pixCopy(NULL, pixs2);
/* Test inverse seed filling */
pixSeedfillGrayInv(pixc11, pixm, connectivity);
pixSeedfillGrayInvSimple(pixc12, pixm, connectivity);
pixEqual(pixc11, pixc12, &same);
if (same)
fprintf(stderr, "\nSuccess for inv set %d\n", set);
else
fprintf(stderr, "\nFailure for inv set %d\n", set);
/* Test seed filling */
pixSeedfillGray(pixc21, pixm, connectivity);
pixSeedfillGraySimple(pixc22, pixm, connectivity);
pixEqual(pixc21, pixc22, &same);
if (same)
fprintf(stderr, "Success for set %d\n", set);
else
fprintf(stderr, "Failure for set %d\n", set);
/* Display the filling results */
/* pixDisplay(pixc11, 220 * (set - 1), 100);
pixDisplay(pixc21, 220 * (set - 1), 320); */
pixDestroy(&pixmi);
pixDestroy(&pixc11);
pixDestroy(&pixc12);
pixDestroy(&pixc21);
pixDestroy(&pixc22);
return;
}
开发者ID:ErfanHasmin,项目名称:scope-ocr,代码行数:45,代码来源:grayfill_reg.c
示例14: main
int main(int argc,
char **argv)
{
char *filein, *fileout;
char bigbuf[512];
l_int32 iplot, same;
l_float32 gam;
l_float64 gamma[] = {.5, 1.0, 1.5, 2.0, 2.5, -1.0};
GPLOT *gplot;
NUMA *na, *nax;
PIX *pixs, *pixd;
static char mainName[] = "gammatest";
if (argc != 4)
return ERROR_INT(" Syntax: gammatest filein gam fileout", mainName, 1);
lept_mkdir("lept/gamma");
filein = argv[1];
gam = atof(argv[2]);
fileout = argv[3];
if ((pixs = pixRead(filein)) == NULL)
return ERROR_INT("pixs not made", mainName, 1);
startTimer();
pixd = pixGammaTRC(NULL, pixs, gam, MINVAL, MAXVAL);
fprintf(stderr, "Time for gamma: %7.3f sec\n", stopTimer());
pixGammaTRC(pixs, pixs, gam, MINVAL, MAXVAL);
pixEqual(pixs, pixd, &same);
if (!same)
fprintf(stderr, "Error in pixGammaTRC!\n");
pixWrite(fileout, pixs, IFF_JFIF_JPEG);
pixDestroy(&pixs);
na = numaGammaTRC(gam, MINVAL, MAXVAL);
gplotSimple1(na, GPLOT_PNG, "/tmp/lept/gamma/trc", "gamma trc");
l_fileDisplay("/tmp/lept/gamma/trc.png", 100, 100, 1.0);
numaDestroy(&na);
/* Plot gamma TRC maps */
gplot = gplotCreate("/tmp/lept/gamma/corr", GPLOT_PNG,
"Mapping function for gamma correction",
"value in", "value out");
nax = numaMakeSequence(0.0, 1.0, 256);
for (iplot = 0; gamma[iplot] >= 0.0; iplot++) {
na = numaGammaTRC(gamma[iplot], 30, 215);
sprintf(bigbuf, "gamma = %3.1f", gamma[iplot]);
gplotAddPlot(gplot, nax, na, GPLOT_LINES, bigbuf);
numaDestroy(&na);
}
gplotMakeOutput(gplot);
gplotDestroy(&gplot);
l_fileDisplay("/tmp/lept/gamma/corr.png", 100, 100, 1.0);
numaDestroy(&nax);
return 0;
}
开发者ID:MaTriXy,项目名称:tess-two,代码行数:56,代码来源:gammatest.c
示例15: test_writemem
/* Returns 1 on error */
static l_int32
test_writemem(PIX *pixs,
l_int32 format,
char *psfile)
{
l_uint8 *data = NULL;
l_int32 same;
size_t size = 0;
PIX *pixd = NULL;
if (format == IFF_PS) {
pixWriteMemPS(&data, &size, pixs, NULL, 0, 1.0);
l_binaryWrite(psfile, "w", data, size);
lept_free(data);
return 0;
}
/* Fail silently if library is not available */
#if !HAVE_LIBJPEG
if (format == IFF_JFIF_JPEG)
return 0;
#endif /* !HAVE_LIBJPEG */
#if !HAVE_LIBPNG
if (format == IFF_PNG)
return 0;
#endif /* !HAVE_LIBPNG */
#if !HAVE_LIBTIFF
if (format == IFF_TIFF)
return 0;
#endif /* !HAVE_LIBTIFF */
if (pixWriteMem(&data, &size, pixs, format)) {
fprintf(stderr, "Mem write fail for format %d\n", format);
return 1;
}
if ((pixd = pixReadMem(data, size)) == NULL) {
fprintf(stderr, "Mem read fail for format %d\n", format);
lept_free(data);
return 1;
}
if (format == IFF_JFIF_JPEG) {
fprintf(stderr, "jpeg size = %ld\n", size);
pixDisplayWrite(pixd, 1);
same = TRUE;
}
else {
pixEqual(pixs, pixd, &same);
if (!same)
fprintf(stderr, "Mem write/read fail for format %d\n", format);
}
pixDestroy(&pixd);
lept_free(data);
return (!same);
}
开发者ID:ErfanHasmin,项目名称:scope-ocr,代码行数:55,代码来源:ioformats_reg.c
示例16: main
main(int argc,
char **argv)
{
l_int32 i, j, equal;
PIX *pixs, *pixt, *pixd;
static char mainName[] = "rasteropip_reg";
pixs = pixRead("test8.jpg");
pixt = pixCopy(NULL, pixs);
/* Copy, in-place and one COLUMN at a time, from the right
side to the left side. */
for (j = 0; j < 200; j++)
pixRasterop(pixs, 20 + j, 20, 1, 250, PIX_SRC, pixs, 250 + j, 20);
pixDisplay(pixs, 50, 50);
/* Copy, in-place and one ROW at a time, from the right
side to the left side. */
for (i = 0; i < 250; i++)
pixRasterop(pixt, 20, 20 + i, 200, 1, PIX_SRC, pixt, 250, 20 + i);
pixDisplay(pixt, 620, 50);
/* Test */
pixEqual(pixs, pixt, &equal);
if (equal)
fprintf(stderr, "OK: images are the same\n");
else
fprintf(stderr, "Error: images are different\n");
pixWrite("/tmp/junkpix.png", pixs, IFF_PNG);
pixDestroy(&pixs);
pixDestroy(&pixt);
/* Show the mirrored border, which uses the general
pixRasterop() on an image in-place. */
pixs = pixRead("test8.jpg");
pixt = pixRemoveBorder(pixs, 40);
pixd = pixAddMirroredBorder(pixt, 25, 25, 25, 25);
pixDisplay(pixd, 50, 550);
pixDestroy(&pixs);
pixDestroy(&pixt);
pixDestroy(&pixd);
return 0;
}
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:46,代码来源:rasteropip_reg.c
示例17: pixCompare
/* simple comparison function */
static void pixCompare(PIX *pix1,
PIX *pix2,
const char *msg1,
const char *msg2) {
l_int32 same;
pixEqual(pix1, pix2, &same);
if (same) {
fprintf(stderr, "%s\n", msg1);
pixDisplayWrite(pix1, 1);
}
else {
fprintf(stderr, "%s\n", msg2);
pixDisplayWrite(pix1, 1);
pixDisplayWrite(pix2, 1);
}
return;
}
开发者ID:mehulsbhatt,项目名称:MyOCRTEST,代码行数:18,代码来源:graymorph1_reg.c
示例18: testcomp_mem
/* Returns 1 on error */
static l_int32
testcomp_mem(PIX *pixs,
PIX **ppixt,
l_int32 index,
l_int32 format)
{
l_int32 sameimage;
PIX *pixt;
pixt = *ppixt;
pixEqual(pixs, pixt, &sameimage);
if (!sameimage)
fprintf(stderr, "Mem Write/read fail for file %d with format %d\n",
index, format);
pixDestroy(&pixt);
*ppixt = NULL;
return (!sameimage);
}
开发者ID:ErfanHasmin,项目名称:scope-ocr,代码行数:19,代码来源:ioformats_reg.c
示例19: Compare
void Compare(PIX *pix1,
PIX *pix2,
l_int32 *perror) {
l_int32 same;
if (!pix1 || !pix2) {
fprintf(stderr, "pix not defined\n");
*perror = 1;
return;
}
pixEqual(pix1, pix2, &same);
if (same)
fprintf(stderr, "OK\n");
else {
fprintf(stderr, "Fail: not equal\n");
*perror = 1;
}
return;
}
开发者ID:mehulsbhatt,项目名称:MyOCRTEST,代码行数:19,代码来源:pixmem_reg.c
示例20: regTestComparePix
/*!
* regTestComparePix()
*
* Input: stream (for output; use NULL to generate golden files)
* argv ([0] == name of reg test)
* pix1, pix2 (to be tested for equality)
* index (of the pix pair test; 0-based for the reg test)
* &success (<return> 0 on failure; input value on success)
* Return: 0 if OK, 1 on error (a failure in comparison is not an error)
*
* Notes:
* (1) This function compares two pix for equality. When called
* with @fp == NULL, it records success or failure to stderr.
* Otherwise, it writes on failure to @fp.
* (2) This function can be called repeatedly in a single reg test.
* (3) The value for @success is initialized to TRUE in the reg test
* setup before this function is called for the first time.
* A failure in any pix comparison is registered as a failure
* of the regression test.
*/
l_int32
regTestComparePix(FILE *fp,
char **argv,
PIX *pix1,
PIX *pix2,
l_int32 index,
l_int32 *psuccess)
{
l_int32 same;
PROCNAME("regTestComparePix");
if (!psuccess)
return ERROR_INT("&success not defined", procName, 1);
if (index < 0)
return ERROR_INT("index is negative", procName, 1);
if (!pix1 || !pix2)
return ERROR_INT("pix1 and pix2 not both defined", procName, 1);
pixEqual(pix1, pix2, &same);
if (!fp) { /* just output result to stderr */
if (same)
fprintf(stderr, "%s: Success in comparison %d\n", argv[0], index);
else
fprintf(stderr, "Failure in comparison %d\n", index);
return 0;
}
/* Record on failure */
if (!same) {
fprintf(fp, "Failure in %s: pix comparison %d\n", argv[0], index);
fprintf(stderr, "Failure in %s: pix comparison %d\n", argv[0], index);
*psuccess = 0;
}
return 0;
}
开发者ID:ONLYOFFICE,项目名称:core,代码行数:56,代码来源:regutils.cpp
注:本文中的pixEqual函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论