Leptonica 1.68
C Image Processing Library

pagesegtest1.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  * pagesegtest1.c
00018  *
00019  *   Use on, e.g.:   feyn1.tif, witten.tif,
00020  *                   pageseg1.tif, pageseg1.tif, pageseg3.tif, pageseg4.tif
00021  */
00022 
00023 #include "allheaders.h"
00024 
00025 main(int    argc,
00026      char **argv)
00027 {
00028 PIX         *pixs, *pixhm, *pixtm, *pixtb, *pixd;
00029 PIXA        *pixa;
00030 char        *filein;
00031 static char  mainName[] = "pagesegtest1";
00032 
00033     if (argc != 2)
00034         return ERROR_INT(" Syntax:  pagesegtest1 filein", mainName, 1);
00035 
00036     filein = argv[1];
00037 
00038     if ((pixs = pixRead(filein)) == NULL)
00039         exit(ERROR_INT("pixs not made", mainName, 1));
00040             
00041     pixGetRegionsBinary(pixs, &pixhm, &pixtm, &pixtb, 1);
00042     pixDestroy(&pixhm);
00043     pixDestroy(&pixtm);
00044     pixDestroy(&pixtb);
00045     pixDestroy(&pixs);
00046 
00047         /* Display intermediate images in a single image */
00048     pixa = pixaReadFiles("/tmp", "junk_write");
00049     pixd = pixaDisplayTiledAndScaled(pixa, 32, 400, 4, 0, 20, 3);
00050     pixWrite("junkpixd", pixd, IFF_PNG);
00051     pixaDestroy(&pixa);
00052     pixDestroy(&pixd);
00053     return 0;
00054 }
00055 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines