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 * livre_makefigs.c 00018 * 00019 * This makes all the figures in Chapter 18, "Document Image Applications", 00020 * of the book "Mathematical morphology: from theory to applications", 00021 * edited by Laurent Najman and hugues Talbot. Published by Hermes 00022 * Scientific Publishing, Ltd, 2010. 00023 */ 00024 00025 #include "allheaders.h" 00026 00027 00028 main(int argc, 00029 char **argv) 00030 { 00031 char buf[256]; 00032 l_int32 ignore; 00033 static char mainName[] = "livre_makefigs"; 00034 00035 if (argc != 1) 00036 exit(ERROR_INT(" Syntax: livre_makefigs", mainName, 1)); 00037 00038 /* Generate Figure 1 (page segmentation) */ 00039 ignore = system("livre_seedgen"); 00040 snprintf(buf, sizeof(buf), "cp /tmp/seedgen.png /tmp/dia_fig1.png"); 00041 ignore = system(buf); 00042 00043 /* Generate Figures 2-5 (page segmentation) */ 00044 snprintf(buf, sizeof(buf), "livre_pageseg pageseg2.tif"); 00045 ignore = system(buf); 00046 snprintf(buf, sizeof(buf), "cp /tmp/segout.1.png /tmp/dia_fig2.png"); 00047 ignore = system(buf); 00048 snprintf(buf, sizeof(buf), "cp /tmp/segout.2.png /tmp/dia_fig3.png"); 00049 ignore = system(buf); 00050 snprintf(buf, sizeof(buf), "cp /tmp/segout.3.png /tmp/dia_fig4.png"); 00051 ignore = system(buf); 00052 snprintf(buf, sizeof(buf), "cp /tmp/segout.4.png /tmp/dia_fig5.png"); 00053 ignore = system(buf); 00054 00055 /* Generate Figure 6 (hmt sels for text orientation) */ 00056 ignore = system("livre_orient"); 00057 snprintf(buf, sizeof(buf), "cp /tmp/orient.png /tmp/dia_fig6.png"); 00058 ignore = system(buf); 00059 00060 /* Generate Figure 7 (hmt sel for fancy "Tribune") */ 00061 ignore = system("livre_hmt 1 8"); 00062 snprintf(buf, sizeof(buf), "cp /tmp/hmt.png /tmp/dia_fig7.png"); 00063 ignore = system(buf); 00064 00065 /* Generate Figure 8 (hmt sel for fancy "T") */ 00066 ignore = system("livre_hmt 2 4"); 00067 snprintf(buf, sizeof(buf), "cp /tmp/hmt.png /tmp/dia_fig8.png"); 00068 ignore = system(buf); 00069 00070 /* Generate Figure 9 (tophat background cleaning) */ 00071 ignore = system("livre_tophat"); 00072 snprintf(buf, sizeof(buf), "cp /tmp/tophat.jpg /tmp/dia_fig9.jpg"); 00073 ignore = system(buf); 00074 00075 /* Run livre_adapt to generate an expanded version of Figure 9 */ 00076 ignore = system("livre_adapt"); 00077 00078 return 0; 00079 } 00080