示例#1
0
main(int    argc,
     char **argv)
{
l_int32      i, index;
l_float32    cputime, epo;
char        *filein, *fileout;
PIX         *pixs, *pixd;
SEL         *sel;
SELA        *sela;
static char  mainName[] = "morphtest1";

    if (argc != 3)
	exit(ERROR_INT(" Syntax:  morphtest1 filein fileout", mainName, 1));

    filein = argv[1];
    fileout = argv[2];

    if ((pixs = pixRead(filein)) == NULL)
	exit(ERROR_INT("pix not made", mainName, 1));
    sela = selaAddBasic(NULL);

    /* ------------------------   Timing  -------------------------------*/
#if 1
    selaFindSelByName(sela, "sel_9h", &index, &sel);
    selWriteStream(stderr, sel);
    pixd = pixCreateTemplate(pixs);

    startTimer();
    for (i = 0; i < NTIMES; i++)  {
	pixDilate(pixd, pixs, sel);
/*	if ((i % 10) == 0) fprintf(stderr, "%d iters\n", i); */
    }
    cputime = stopTimer();
        /* Get the elementary pixel operations/sec */
    epo = BASIC_OPS * SEL_SIZE * NTIMES * IMAGE_SIZE /(cputime * CPU_SPEED);

    fprintf(stderr, "Time: %7.3f sec\n", cputime);
    fprintf(stderr, "Speed: %7.3f epo/cycle\n", epo);
    pixWrite(fileout, pixd, IFF_PNG);
    pixDestroy(&pixd);
#endif

    /* ------------------  Example operation from repository --------------*/
#if 1
	/* Select a structuring element */
    selaFindSelByName(sela, "sel_50h", &index, &sel);
    selWriteStream(stderr, sel);

        /* Do these operations.  See below for other ops
	 * that can be substituted here. */
    pixd = pixOpen(NULL, pixs, sel);
    pixXor(pixd, pixd, pixs);
    pixWrite(fileout, pixd, IFF_PNG);
    pixDestroy(&pixd);
#endif

    pixDestroy(&pixs);
    exit(0);
}
示例#2
0
main(int    argc,
     char **argv)
{
PIX          *pix;
SEL          *sel;
SELA         *sela1, *sela2;
L_REGPARAMS  *rp;

    if (regTestSetup(argc, argv, &rp))
        return 1;

        /* selaRead() / selaWrite()  */
    sela1 = selaAddBasic(NULL);
    selaWrite("/tmp/sel.0.sela", sela1);
    regTestCheckFile(rp, "/tmp/sel.0.sela");  /* 0 */
    sela2 = selaRead("/tmp/sel.0.sela");
    selaWrite("/tmp/sel.1.sela", sela2);
    regTestCheckFile(rp, "/tmp/sel.1.sela");  /* 1 */
    regTestCompareFiles(rp, 0, 1);  /* 2 */
    selaDestroy(&sela1);
    selaDestroy(&sela2);
    
	/* Create from file and display result */
    sela1 = selaCreateFromFile("flipsels.txt");
    pix = selaDisplayInPix(sela1, 31, 3, 15, 4);
    regTestWritePixAndCheck(rp, pix, IFF_PNG);  /* 3 */
    pixDisplayWithTitle(pix, 100, 100, NULL, rp->display);
    selaWrite("/tmp/sel.3.sela", sela1);
    regTestCheckFile(rp, "/tmp/sel.3.sela");  /* 4 */
    pixDestroy(&pix);
    selaDestroy(&sela1);

        /* Create the same set of Sels from compiled strings and compare */
    sela2 = selaCreate(4);
    sel = selCreateFromString(textsel1, 5, 6, "textsel1");
    selaAddSel(sela2, sel, NULL, 0);
    sel = selCreateFromString(textsel2, 5, 6, "textsel2");
    selaAddSel(sela2, sel, NULL, 0);
    sel = selCreateFromString(textsel3, 5, 6, "textsel3");
    selaAddSel(sela2, sel, NULL, 0);
    sel = selCreateFromString(textsel4, 5, 6, "textsel4");
    selaAddSel(sela2, sel, NULL, 0);
    selaWrite("/tmp/sel.4.sela", sela2);
    regTestCheckFile(rp, "/tmp/sel.4.sela");  /* 5 */
    regTestCompareFiles(rp, 4, 5);  /* 6 */
    selaDestroy(&sela2);

    return regTestCleanup(rp);
}
示例#3
0
int main(int argc,
         char **argv) {
    char *filename;
    l_int32 index;
    SELA *sela;
    static char mainName[] = "fmorphautogen";

    if (argc != 2 && argc != 3)
        return ERROR_INT(" Syntax:  fmorphautogen index <filename>",
                         mainName, 1);

    index = atoi(argv[1]);
    filename = NULL;
    if (argc == 3)
        filename = argv[2];

    sela = selaAddBasic(NULL);
    if (fmorphautogen(sela, index, filename))
        return 1;

    selaDestroy(&sela);
    return 0;
}
main(int    argc,
     char **argv)
{
char        *str;
char         buffer1[256];
char         buffer2[256];
l_int32      i, same, same2, factor1, factor2, diff, success;
PIX         *pixs, *pixsd, *pixt1, *pixt2, *pixt3;
SEL         *sel1, *sel2;
static char  mainName[] = "binmorph2_reg";

#if 1
    pixs = pixRead("rabi.png");
    pixsd = pixMorphCompSequence(pixs, "d5.5", 0);
    success = TRUE;
    for (i = 1; i < MAX_SEL_SIZE; i++) {
      
            /* Check if the size is exactly decomposable */
        selectComposableSizes(i, &factor1, &factor2);
        diff = factor1 * factor2 - i;
        fprintf(stderr, "%d: (%d, %d): %d\n", i, factor1, factor2, diff);

	    /* Carry out operations on identical sized Sels: dilation */
        sprintf(buffer1, "d%d.%d", i + diff, i + diff);
        sprintf(buffer2, "d%d.%d", i, i);
        pixt1 = pixMorphSequence(pixsd, buffer1, 0);
        pixt2 = pixMorphCompSequence(pixsd, buffer2, 0);
        pixEqual(pixt1, pixt2, &same);
	if (i < 64) {
            pixt3 = pixMorphCompSequenceDwa(pixsd, buffer2, 0);
            pixEqual(pixt1, pixt3, &same2);
	} else {
            pixt3 = NULL;
	    same2 = TRUE;
	}
        if (same && same2)
            writeResult(buffer1, 1);
        else {
            writeResult(buffer1, 0);
            success = FALSE;
        }
        pixDestroy(&pixt1);
        pixDestroy(&pixt2);
        pixDestroy(&pixt3);

	    /* ... erosion */
        sprintf(buffer1, "e%d.%d", i + diff, i + diff);
        sprintf(buffer2, "e%d.%d", i, i);
        pixt1 = pixMorphSequence(pixsd, buffer1, 0);
        pixt2 = pixMorphCompSequence(pixsd, buffer2, 0);
        pixEqual(pixt1, pixt2, &same);
	if (i < 64) {
            pixt3 = pixMorphCompSequenceDwa(pixsd, buffer2, 0);
            pixEqual(pixt1, pixt3, &same2);
	} else {
            pixt3 = NULL;
	    same2 = TRUE;
	}
        if (same && same2)
            writeResult(buffer1, 1);
        else {
            writeResult(buffer1, 0);
            success = FALSE;
        }
        pixDestroy(&pixt1);
        pixDestroy(&pixt2);
        pixDestroy(&pixt3);

	    /* ... opening */
        sprintf(buffer1, "o%d.%d", i + diff, i + diff);
        sprintf(buffer2, "o%d.%d", i, i);
        pixt1 = pixMorphSequence(pixsd, buffer1, 0);
        pixt2 = pixMorphCompSequence(pixsd, buffer2, 0);
        pixEqual(pixt1, pixt2, &same);
	if (i < 64) {
            pixt3 = pixMorphCompSequenceDwa(pixsd, buffer2, 0);
            pixEqual(pixt1, pixt3, &same2);
	} else {
            pixt3 = NULL;
	    same2 = TRUE;
	}
        if (same && same2)
            writeResult(buffer1, 1);
        else {
            writeResult(buffer1, 0);
            success = FALSE;
        }
        pixDestroy(&pixt1);
        pixDestroy(&pixt2);
        pixDestroy(&pixt3);

            /* ... closing */
        sprintf(buffer1, "c%d.%d", i + diff, i + diff);
        sprintf(buffer2, "c%d.%d", i, i);
        pixt1 = pixMorphSequence(pixsd, buffer1, 0);
        pixt2 = pixMorphCompSequence(pixsd, buffer2, 0);
        pixEqual(pixt1, pixt2, &same);
	if (i < 64) {
            pixt3 = pixMorphCompSequenceDwa(pixsd, buffer2, 0);
            pixEqual(pixt1, pixt3, &same2);
	} else {
            pixt3 = NULL;
	    same2 = TRUE;
	}
        if (same && same2)
            writeResult(buffer1, 1);
        else {
            writeResult(buffer1, 0);
            success = FALSE;
        }
        pixDestroy(&pixt1);
        pixDestroy(&pixt2);
        pixDestroy(&pixt3);

    }
    pixDestroy(&pixs);
    pixDestroy(&pixsd);

    if (success)
        fprintf(stderr, "\n---------- Success: no errors ----------\n");
    else
        fprintf(stderr, "\n---------- Failure: error(s) found -----------\n");
#endif


#if 0
    for (i = 1; i < 400; i++) {
        selectComposableSizes(i, &factor1, &factor2);
        diff = factor1 * factor2 - i;
        fprintf(stderr, "%d: (%d, %d): %d\n",
                  i, factor1, factor2, diff);
        selectComposableSels(i, L_HORIZ, &sel1, &sel2);
        selDestroy(&sel1);
        selDestroy(&sel2);
    }
#endif

#if 0
    selectComposableSels(68, L_HORIZ, &sel1, &sel2);  /* 17, 4 */
    str = selPrintToString(sel2);
    fprintf(stderr, str);
    selDestroy(&sel1);
    selDestroy(&sel2);
    FREE(str);
    selectComposableSels(70, L_HORIZ, &sel1, &sel2);  /* 10, 7 */
    str = selPrintToString(sel2);
    selDestroy(&sel1);
    selDestroy(&sel2);
    fprintf(stderr, str);
    FREE(str);
    selectComposableSels(85, L_HORIZ, &sel1, &sel2);  /* 17, 5 */
    str = selPrintToString(sel2);
    selDestroy(&sel1);
    selDestroy(&sel2);
    fprintf(stderr, str);
    FREE(str);
    selectComposableSels(96, L_HORIZ, &sel1, &sel2);  /* 12, 8 */
    str = selPrintToString(sel2);
    selDestroy(&sel1);
    selDestroy(&sel2);
    fprintf(stderr, str);
    FREE(str);

    { SELA *sela;
    sela = selaAddBasic(NULL);
    selaWrite("/tmp/junksela.sela", sela);
    selaDestroy(&sela);
    }
#endif

    return 0;
}
示例#5
0
main(int    argc,
     char **argv)
{
char        *selnameh, *selnamev;
l_int32      ok, same, w, h, i, bordercolor, extraborder;
l_int32      width[3] = {21, 1, 21};
l_int32      height[3] = {1, 7, 7};
PIX         *pixs, *pixref;
PIX         *pixt0, *pixt1, *pixt2, *pixt3, *pixt4;
SEL         *sel;
SELA        *sela;
static char  mainName[] = "binmorph3_reg";

    if (argc != 1)
	exit(ERROR_INT(" Syntax: binmorph3_reg", mainName, 1));

    if ((pixs = pixRead("feyn.tif")) == NULL)
	exit(ERROR_INT("pix not made", mainName, 1));

#if TEST_SYMMETRIC
    resetMorphBoundaryCondition(SYMMETRIC_MORPH_BC);
#endif  /* TEST_SYMMETRIC */

    for (i = 0; i < 3; i++) {
        w = width[i];
        h = height[i];
        sel = selCreateBrick(h, w, h / 2, w / 2, SEL_HIT);
	selnameh = NULL;
	selnamev = NULL;


	    /* Get the selnames for horiz and vert */
        sela = selaAddBasic(NULL);
        if (w > 1) {
            if ((selnameh = selaGetBrickName(sela, w, 1)) == NULL) {
                selaDestroy(&sela);
                return ERROR_INT("dwa hor sel not defined", mainName, 1);
            }
        }
        if (h > 1) {
            if ((selnamev = selaGetBrickName(sela, 1, h)) == NULL) {
                selaDestroy(&sela);
                return ERROR_INT("dwa vert sel not defined", mainName, 1);
            }
        }
	fprintf(stderr, "w = %d, h = %d, selh = %s, selv = %s\n",
                w, h, selnameh, selnamev);
        ok = TRUE;
        selaDestroy(&sela);

            /* ----------------- Dilation ----------------- */
        fprintf(stderr, "Testing dilation\n");
        pixref = pixDilate(NULL, pixs, sel);
        pixt1 = pixDilateBrickDwa(NULL, pixs, w, h);
        pixEqual(pixref, pixt1, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt1 !\n"); ok = FALSE;
	}
	pixDestroy(&pixt1);

	if (w > 1)
            pixt1 = pixMorphDwa_1(NULL, pixs, L_MORPH_DILATE, selnameh);
	else
            pixt1 = pixClone(pixs);
	if (h > 1)
            pixt2 = pixMorphDwa_1(NULL, pixt1, L_MORPH_DILATE, selnamev);
	else
            pixt2 = pixClone(pixt1);
        pixEqual(pixref, pixt2, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt2 !\n"); ok = FALSE;
	}
	pixDestroy(&pixt1);
	pixDestroy(&pixt2);

	pixt1 = pixAddBorder(pixs, 32, 0);
	if (w > 1)
            pixt2 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_DILATE, selnameh);
	else
            pixt2 = pixClone(pixt1);
        if (h > 1)
            pixt3 = pixFMorphopGen_1(NULL, pixt2, L_MORPH_DILATE, selnamev);
	else
            pixt3 = pixClone(pixt2);
	pixt4 = pixRemoveBorder(pixt3, 32);
        pixEqual(pixref, pixt4, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt4 !\n"); ok = FALSE;
	}
	pixDestroy(&pixref);
	pixDestroy(&pixt1);
	pixDestroy(&pixt2);
	pixDestroy(&pixt3);
	pixDestroy(&pixt4);

            /* ----------------- Erosion ----------------- */
        fprintf(stderr, "Testing erosion\n");
        pixref = pixErode(NULL, pixs, sel);
        pixt1 = pixErodeBrickDwa(NULL, pixs, w, h);
        pixEqual(pixref, pixt1, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt1 !\n"); ok = FALSE;
	}
	pixDestroy(&pixt1);

	if (w > 1)
            pixt1 = pixMorphDwa_1(NULL, pixs, L_MORPH_ERODE, selnameh);
	else
            pixt1 = pixClone(pixs);
	if (h > 1)
            pixt2 = pixMorphDwa_1(NULL, pixt1, L_MORPH_ERODE, selnamev);
	else
            pixt2 = pixClone(pixt1);
        pixEqual(pixref, pixt2, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt2 !\n"); ok = FALSE;
	}
	pixDestroy(&pixt1);
	pixDestroy(&pixt2);

	pixt1 = pixAddBorder(pixs, 32, 0);
	if (w > 1)
            pixt2 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_ERODE, selnameh);
	else
            pixt2 = pixClone(pixt1);
        if (h > 1)
            pixt3 = pixFMorphopGen_1(NULL, pixt2, L_MORPH_ERODE, selnamev);
	else
            pixt3 = pixClone(pixt2);
	pixt4 = pixRemoveBorder(pixt3, 32);
        pixEqual(pixref, pixt4, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt4 !\n"); ok = FALSE;
        }
	pixDestroy(&pixref);
	pixDestroy(&pixt1);
	pixDestroy(&pixt2);
	pixDestroy(&pixt3);
	pixDestroy(&pixt4);

            /* ----------------- Opening ----------------- */
        fprintf(stderr, "Testing opening\n");
        pixref = pixOpen(NULL, pixs, sel);
        pixt1 = pixOpenBrickDwa(NULL, pixs, w, h);
        pixEqual(pixref, pixt1, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt1 !\n"); ok = FALSE;
        }
        pixDestroy(&pixt1);

        if (h == 1)
            pixt2 = pixMorphDwa_1(NULL, pixs, L_MORPH_OPEN, selnameh);
        else if (w == 1)
            pixt2 = pixMorphDwa_1(NULL, pixs, L_MORPH_OPEN, selnamev);
        else {
            pixt1 = pixMorphDwa_1(NULL, pixs, L_MORPH_ERODE, selnameh);
            pixt2 = pixMorphDwa_1(NULL, pixt1, L_MORPH_ERODE, selnamev);
            pixMorphDwa_1(pixt1, pixt2, L_MORPH_DILATE, selnameh);
            pixMorphDwa_1(pixt2, pixt1, L_MORPH_DILATE, selnamev);
            pixDestroy(&pixt1);
        }
        pixEqual(pixref, pixt2, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt2 !\n"); ok = FALSE;
        }
        pixDestroy(&pixt2);

        pixt1 = pixAddBorder(pixs, 32, 0);
        if (h == 1)
            pixt3 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_OPEN, selnameh);
        else if (w == 1)
            pixt3 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_OPEN, selnamev);
        else {
            pixt2 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_ERODE, selnameh);
            pixt3 = pixFMorphopGen_1(NULL, pixt2, L_MORPH_ERODE, selnamev);
            pixFMorphopGen_1(pixt2, pixt3, L_MORPH_DILATE, selnameh);
            pixFMorphopGen_1(pixt3, pixt2, L_MORPH_DILATE, selnamev);
	    pixDestroy(&pixt2);
        }
        pixt4 = pixRemoveBorder(pixt3, 32);
        pixEqual(pixref, pixt4, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt4 !\n"); ok = FALSE;
	}
	pixDestroy(&pixref);
        pixDestroy(&pixt1);
        pixDestroy(&pixt3);
	pixDestroy(&pixt4);

            /* ----------------- Closing ----------------- */
        fprintf(stderr, "Testing closing\n");
        pixref = pixClose(NULL, pixs, sel);

	    /* Note: L_MORPH_CLOSE for h==1 or w==1 gives safe closing,
	     * so we can't use it here. */
        if (h == 1) {
            pixt1 = pixMorphDwa_1(NULL, pixs, L_MORPH_DILATE, selnameh);
            pixt2 = pixMorphDwa_1(NULL, pixt1, L_MORPH_ERODE, selnameh);
	}
        else if (w == 1) {
            pixt1 = pixMorphDwa_1(NULL, pixs, L_MORPH_DILATE, selnamev);
            pixt2 = pixMorphDwa_1(NULL, pixt1, L_MORPH_ERODE, selnamev);
	}
        else {
            pixt1 = pixMorphDwa_1(NULL, pixs, L_MORPH_DILATE, selnameh);
            pixt2 = pixMorphDwa_1(NULL, pixt1, L_MORPH_DILATE, selnamev);
            pixMorphDwa_1(pixt1, pixt2, L_MORPH_ERODE, selnameh);
            pixMorphDwa_1(pixt2, pixt1, L_MORPH_ERODE, selnamev);
        }
        pixDestroy(&pixt1);
        pixEqual(pixref, pixt2, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt2 !\n"); ok = FALSE;
        }
        pixDestroy(&pixt2);

	    /* Note: by adding only 32 pixels of border, we get
	     * the normal closing operation, even when calling
	     * with L_MORPH_CLOSE, because it requires 32 pixels
	     * of border to be safe. */
        pixt1 = pixAddBorder(pixs, 32, 0);
        if (h == 1)
            pixt3 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_CLOSE, selnameh);
        else if (w == 1)
            pixt3 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_CLOSE, selnamev);
        else {
            pixt2 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_DILATE, selnameh);
            pixt3 = pixFMorphopGen_1(NULL, pixt2, L_MORPH_DILATE, selnamev);
            pixFMorphopGen_1(pixt2, pixt3, L_MORPH_ERODE, selnameh);
            pixFMorphopGen_1(pixt3, pixt2, L_MORPH_ERODE, selnamev);
	    pixDestroy(&pixt2);
        }
        pixt4 = pixRemoveBorder(pixt3, 32);
        pixEqual(pixref, pixt4, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt4 !\n"); ok = FALSE;
	}
	pixDestroy(&pixref);
        pixDestroy(&pixt1);
        pixDestroy(&pixt3);
	pixDestroy(&pixt4);

            /* ------------- Safe Closing ----------------- */
        fprintf(stderr, "Testing safe closing\n");
        pixref = pixCloseSafe(NULL, pixs, sel);
        pixt0 = pixCloseSafeBrick(NULL, pixs, w, h);
        pixEqual(pixref, pixt0, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt0 !\n"); ok = FALSE;
        }
        pixDestroy(&pixt0);

        pixt1 = pixCloseBrickDwa(NULL, pixs, w, h);
        pixEqual(pixref, pixt1, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt1 !\n"); ok = FALSE;
        }
        pixDestroy(&pixt1);

        bordercolor = getMorphBorderPixelColor(L_MORPH_ERODE, 1);
        if (bordercolor == 0)   /* asymmetric b.c. */
            extraborder = 32;
        else   /* symmetric b.c. */
            extraborder = 0;

	    /* Note: for safe closing we need 64 border pixels.
	     * However, when we implement a separable Sel
	     * with pixMorphDwa_*(), we must do dilation and
	     * erosion explicitly, and these functions only
	     * add/remove a 32-pixel border.  Thus, for that
	     * case we must add an additional 32-pixel border
	     * before doing the operations.  That is the reason
	     * why the implementation in morphdwa.c adds the
	     * 64 bit border and then uses the lower-level
	     * pixFMorphopGen_*() functions. */
        if (h == 1)
            pixt3 = pixMorphDwa_1(NULL, pixs, L_MORPH_CLOSE, selnameh);
        else if (w == 1)
            pixt3 = pixMorphDwa_1(NULL, pixs, L_MORPH_CLOSE, selnamev);
        else {
            pixt0 = pixAddBorder(pixs, extraborder, 0);
            pixt1 = pixMorphDwa_1(NULL, pixt0, L_MORPH_DILATE, selnameh);
            pixt2 = pixMorphDwa_1(NULL, pixt1, L_MORPH_DILATE, selnamev);
            pixMorphDwa_1(pixt1, pixt2, L_MORPH_ERODE, selnameh);
            pixMorphDwa_1(pixt2, pixt1, L_MORPH_ERODE, selnamev);
	    pixt3 = pixRemoveBorder(pixt2, extraborder);
            pixDestroy(&pixt0);
            pixDestroy(&pixt1);
            pixDestroy(&pixt2);
        }
        pixEqual(pixref, pixt3, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt3 !\n"); ok = FALSE;
        }
        pixDestroy(&pixt3);

        pixt1 = pixAddBorder(pixs, 32 + extraborder, 0);
        if (h == 1)
            pixt3 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_CLOSE, selnameh);
        else if (w == 1)
            pixt3 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_CLOSE, selnamev);
        else {
            pixt2 = pixFMorphopGen_1(NULL, pixt1, L_MORPH_DILATE, selnameh);
            pixt3 = pixFMorphopGen_1(NULL, pixt2, L_MORPH_DILATE, selnamev);
            pixFMorphopGen_1(pixt2, pixt3, L_MORPH_ERODE, selnameh);
            pixFMorphopGen_1(pixt3, pixt2, L_MORPH_ERODE, selnamev);
	    pixDestroy(&pixt2);
        }
        pixt4 = pixRemoveBorder(pixt3, 32 + extraborder);
        pixEqual(pixref, pixt4, &same);
        if (!same) {
            fprintf(stderr, "pixref != pixt4 !\n"); ok = FALSE;
	}
	pixDestroy(&pixref);
        pixDestroy(&pixt1);
        pixDestroy(&pixt3);
	pixDestroy(&pixt4);

        if (ok)
            fprintf(stderr, "All morph tests OK!\n");
	selDestroy(&sel);
	lept_free(selnameh);
	lept_free(selnamev);

    }

    pixDestroy(&pixs);
    return 0;
}