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 * trctest.c 00018 * 00019 * Example: trctest wet-day.jpg 3.1 50 160 /tmp/junk.png 00020 */ 00021 00022 #include <stdio.h> 00023 #include <stdlib.h> 00024 #include "allheaders.h" 00025 00026 00027 main(int argc, 00028 char **argv) 00029 { 00030 PIX *pixs, *pixd; 00031 l_int32 minval, maxval; 00032 l_float32 gamma; 00033 char *filein, *fileout; 00034 static char mainName[] = "trctest"; 00035 00036 if (argc != 6) 00037 exit(ERROR_INT(" Syntax: trctest filein gamma minval maxval fileout", 00038 mainName, 1)); 00039 00040 filein = argv[1]; 00041 gamma = atof(argv[2]); 00042 minval = atoi(argv[3]); 00043 maxval = atoi(argv[4]); 00044 fileout = argv[5]; 00045 00046 if ((pixs = pixRead(filein)) == NULL) 00047 exit(ERROR_INT("pixs not made", mainName, 1)); 00048 00049 pixd = pixGammaTRC(NULL, pixs, gamma, minval, maxval); 00050 00051 pixWrite(fileout, pixd, IFF_PNG); 00052 pixDestroy(&pixs); 00053 pixDestroy(&pixd); 00054 return 0; 00055 } 00056