当前位置: 首页>>代码示例>>C++>>正文


C++ pixEqual函数代码示例

本文整理汇总了C++中pixEqual函数的典型用法代码示例。如果您正苦于以下问题:C++ pixEqual函数的具体用法?C++ pixEqual怎么用?C++ pixEqual使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pixEqual函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的pixEqual函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。