[Wavelet-commit] Wavelet/tools pgmequalize.cc,1.2,1.3
Status: Beta
Brought to you by:
herbert
From: Herbert M. D. <he...@us...> - 2005-07-13 13:15:15
|
Update of /cvsroot/wavelet/Wavelet/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29349/tools Modified Files: pgmequalize.cc Log Message: Changes to Image::gammaCorrection(), it should now be faster even if the color range is beyond [0..255]. Removed CRs from line ends in pgmequalize.cc. Index: pgmequalize.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmequalize.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pgmequalize.cc 18 Feb 2005 12:12:25 -0000 1.2 --- pgmequalize.cc 13 Jul 2005 13:15:07 -0000 1.3 *************** *** 1,98 **** ! /* ! * Equalize an image ! * ! * $Date$ ! * $Revision$ ! * ! */ ! ! #include <iostream> ! #include <stdexcept> ! #include <stdio.h> ! #include <math.h> ! #include <assert.h> ! #include <WImage.hh> ! ! #ifndef __WATCOMC__ ! using namespace std; ! #endif ! ! int ! main (int argc, char *argv[]) ! { ! cout << "pgmequalize version " << WAVE_VERSION << " (c) 2001-2004 by Herbert" ! #ifdef PFI ! << " (pfi support enabled)" ! #endif ! << endl; ! ! char *infile; ! char *outfile; ! Image *image = NEW (StillImage ()); ! int yoffs = 0; ! int xoffs = 0; ! int ysize = 0; ! int xsize = 0; ! ! if (argc < 3 && argc != 7) ! { ! cerr << "Usage: pgmequalize <infile> <outfile> " ! << "[<yoffs> <xoffs> <ysize> <xsize>]" ! << endl; ! return 1; ! } ! ! infile = argv[1]; ! outfile = argv[2]; ! ! if (argc == 7) ! { ! if (sscanf (argv[3], "%d", &yoffs) != 1) ! { ! cerr << "Invalid yoffs: " << argv[3] << endl; ! return 1; ! } ! if (sscanf (argv[4], "%d", &xoffs) != 1) ! { ! cerr << "Invalid xoffs: " << argv[4] << endl; ! return 1; ! } ! if (sscanf (argv[5], "%d", &ysize) != 1) ! { ! cerr << "Invalid ysize: " << argv[5] << endl; ! return 1; ! } ! if (sscanf (argv[6], "%d", &xsize) != 1) ! { ! cerr << "Invalid xsize: " << argv[6] << endl; ! return 1; ! } ! } ! ! try ! { ! image->read (infile); ! } ! catch (const exception &error) ! { ! cerr << "Reading image: " << error.what () << endl; ! return 1; ! } ! ! image->histEqualization (yoffs, xoffs, ysize, xsize); ! ! try ! { ! image->write (outfile); ! } ! catch (const exception &error) ! { ! cerr << "Writing image: " << error.what () << endl; ! return 1; ! } ! ! DELETE (image); ! ! return 0; ! } ! --- 1,98 ---- ! /* ! * Equalize an image ! * ! * $Date$ ! * $Revision$ ! * ! */ ! ! #include <iostream> ! #include <stdexcept> ! #include <stdio.h> ! #include <math.h> ! #include <assert.h> ! #include <WImage.hh> ! ! #ifndef __WATCOMC__ ! using namespace std; ! #endif ! ! int ! main (int argc, char *argv[]) ! { ! cout << "pgmequalize version " << WAVE_VERSION << " (c) 2001-2004 by Herbert" ! #ifdef PFI ! << " (pfi support enabled)" ! #endif ! << endl; ! ! char *infile; ! char *outfile; ! Image *image = NEW (StillImage ()); ! int yoffs = 0; ! int xoffs = 0; ! int ysize = 0; ! int xsize = 0; ! ! if (argc < 3 && argc != 7) ! { ! cerr << "Usage: pgmequalize <infile> <outfile> " ! << "[<yoffs> <xoffs> <ysize> <xsize>]" ! << endl; ! return 1; ! } ! ! infile = argv[1]; ! outfile = argv[2]; ! ! if (argc == 7) ! { ! if (sscanf (argv[3], "%d", &yoffs) != 1) ! { ! cerr << "Invalid yoffs: " << argv[3] << endl; ! return 1; ! } ! if (sscanf (argv[4], "%d", &xoffs) != 1) ! { ! cerr << "Invalid xoffs: " << argv[4] << endl; ! return 1; ! } ! if (sscanf (argv[5], "%d", &ysize) != 1) ! { ! cerr << "Invalid ysize: " << argv[5] << endl; ! return 1; ! } ! if (sscanf (argv[6], "%d", &xsize) != 1) ! { ! cerr << "Invalid xsize: " << argv[6] << endl; ! return 1; ! } ! } ! ! try ! { ! image->read (infile); ! } ! catch (const exception &error) ! { ! cerr << "Reading image: " << error.what () << endl; ! return 1; ! } ! ! image->histEqualization (yoffs, xoffs, ysize, xsize); ! ! try ! { ! image->write (outfile); ! } ! catch (const exception &error) ! { ! cerr << "Writing image: " << error.what () << endl; ! return 1; ! } ! ! DELETE (image); ! ! return 0; ! } ! |