Leptonica 1.68
C Image Processing Library

morphseq_reg.c

Go to the documentation of this file.
00001 /*====================================================================*
00002  -  Copyright (C) 2001 Leptonica.  All rights reserved.
00003  -  This software is distributed in the hope that it will be
00004  -  useful, but with NO WARRANTY OF ANY KIND.
00005  -  No author or distributor accepts responsibility to anyone for the
00006  -  consequences of using this software, or for whether it serves any
00007  -  particular purpose or works at all, unless he or she says so in
00008  -  writing.  Everyone is granted permission to copy, modify and
00009  -  redistribute this source code, for commercial or non-commercial
00010  -  purposes, with the following restrictions: (1) the origin of this
00011  -  source code must not be misrepresented; (2) modified versions must
00012  -  be plainly marked as such; and (3) this notice may not be removed
00013  -  or altered from any source or modified source distribution.
00014  *====================================================================*/
00015 
00016 /*
00017  * morphseq_reg.c
00018  *
00019  *    Simple regression test for binary morph sequence (interpreter),
00020  *    showing display mode and rejection of invalid sequence components.
00021  */
00022 
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include "allheaders.h"
00026 
00027 #define  VALID_SEQUENCE   "O1.3 + C3.1 + R22 + D2.2 + X4"
00028 #define  BAD_SEQUENCE     "O1.+D8 + E2.4 + e.4 + r25 + R + R.5 + X "\
00029                           " + x5 + y7.3"
00030 
00031 
00032 main(int    argc,
00033      char **argv)
00034 {
00035 PIX         *pixs, *pixd;
00036 static char  mainName[] = "morphseq_reg";
00037 
00038     if (argc != 1)
00039         exit(ERROR_INT(" Syntax:  morphseq_reg", mainName, 1));
00040 
00041     pixs = pixRead("feyn.tif");
00042 
00043     fprintf(stderr, "Valid sequence: %s:\n", VALID_SEQUENCE);
00044     pixd = pixMorphSequence(pixs, VALID_SEQUENCE, 250);
00045     pixWrite("/tmp/junkpixd.png", pixd, IFF_PNG);
00046     pixDestroy(&pixd);
00047 
00048     fprintf(stderr, "\nBad sequence: %s:\n", BAD_SEQUENCE);
00049     pixd = pixMorphSequence(pixs, BAD_SEQUENCE, 50);
00050     pixDestroy(&pixd);
00051 
00052     pixDestroy(&pixs);
00053     exit(0);
00054 }
00055 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines