Leptonica 1.68
C Image Processing Library

sharptest.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  * sharptest.c
00018  *
00019  *      sharptest filein smooth fract fileout
00020  *
00021  *      (1) Use smooth = 1 for 3x3 smoothing filter
00022  *              smooth = 2 for 5x5 smoothing filter, etc.
00023  *      (2) Use fract in typical range (0.2 - 0.7) 
00024  */
00025 
00026 #include <stdio.h>
00027 #include <stdlib.h>
00028 #include "allheaders.h"
00029 
00030 
00031 main(int    argc,
00032      char **argv)
00033 {
00034 PIX         *pixs, *pixd;
00035 l_int32      smooth;
00036 l_float32    fract;
00037 char        *filein, *fileout;
00038 static char  mainName[] = "sharptest";
00039 
00040     if (argc != 5)
00041         exit(ERROR_INT(" Syntax:  sharptest filein smooth fract fileout",
00042             mainName, 1));
00043 
00044     filein = argv[1];
00045     smooth = atoi(argv[2]);
00046     fract = atof(argv[3]);
00047     fileout = argv[4];
00048 
00049     if ((pixs = pixRead(filein)) == NULL)
00050         exit(ERROR_INT("pixs not made", mainName, 1));
00051             
00052     pixd = pixUnsharpMasking(pixs, smooth, fract);
00053 
00054     pixWrite(fileout, pixd, IFF_JFIF_JPEG);
00055 
00056     pixDestroy(&pixs);
00057     pixDestroy(&pixd);
00058     exit(0);
00059 }
00060 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines