Leptonica 1.68
C Image Processing Library

reducetest.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  * reducetest.c
00018  *
00019  *    Carries out a rank binary cascade of up to four 2x reductions.
00020  *    This requires all four rank levels to be input; to stop the
00021  *    cascade, use 0 for the final rank level(s).
00022  */
00023 
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include "allheaders.h"
00027 
00028 
00029 main(int    argc,
00030      char **argv)
00031 {
00032 PIX         *pixs, *pixd;
00033 l_int32      level1, level2, level3, level4;
00034 char        *filein, *fileout;
00035 static char  mainName[] = "reducetest";
00036 
00037     if (argc != 7)
00038         exit(ERROR_INT(" Syntax:  reducetest filein fileout l1 l2 l3 l4",
00039                     mainName, 1));
00040 
00041     filein = argv[1];
00042     fileout = argv[2];
00043     level1 = atoi(argv[3]);
00044     level2 = atoi(argv[4]);
00045     level3 = atoi(argv[5]);
00046     level4 = atoi(argv[6]);
00047 
00048     if ((pixs = pixRead(filein)) == NULL)
00049         exit(ERROR_INT("pixs not made", mainName, 1));
00050             
00051 #if 1
00052     pixd = pixReduceRankBinaryCascade(pixs, level1, level2, level3, level4);
00053 #endif  
00054 
00055 #if 0
00056     pixd = pixReduce2(pixs, NULL);
00057 #endif  
00058 
00059     pixWrite(fileout, pixd, IFF_PNG);
00060 
00061     exit(0);
00062 }
00063 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines