Leptonica 1.68
C Image Processing Library
|
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 * dwalineargen.c 00018 * 00019 * This generates the C code for the full set of linear Sels, 00020 * for dilation, erosion, opening and closing, and for both 00021 * horizontal and vertical operations, from length 2 to 63. 00022 * 00023 * These are put in files: 00024 * dwalinear.3.c 00025 * dwalinearlow.3.c 00026 * 00027 * Q. Why is this C code generated here in prog, and not placed 00028 * in the library where it can be linked in with all programs? 00029 * A. Because the two files it generates have 17K lines of code! 00030 * We also make this code available here ("out of the box") so that you 00031 * can build and run dwamorph1_reg and dwamorph2_reg, without 00032 * first building and running dwalineargen.c 00033 * 00034 * Q. Why do we build code for operations up to 63 in width and height? 00035 * A. Atomic DWA operations work on Sels that have hits and misses 00036 * that are not larger than 31 pixel positions from the origin. 00037 * Thus, they can implement a horizontal closing up to 63 pixels 00038 * wide if the origin is in the center. 00039 * 00040 * Note the word "atomic". DWA operations can be done on arbitrarily 00041 * large Sels using the *ExtendDwa() functions. See morphdwa.c 00042 * for details. 00043 */ 00044 00045 #include "allheaders.h" 00046 00047 main(int argc, 00048 char **argv) 00049 { 00050 SELA *sela; 00051 static char mainName[] = "dwalineargen"; 00052 00053 if (argc != 1) 00054 exit(ERROR_INT(" Syntax: dwalineargen", mainName, 1)); 00055 00056 /* Generate the linear sel dwa code */ 00057 sela = selaAddDwaLinear(NULL); 00058 if (fmorphautogen(sela, 3, "dwalinear")) 00059 return 1; 00060 selaDestroy(&sela); 00061 return 0; 00062 } 00063