~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to apps/gdalenhance.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: gdalenhance.cpp 17553 2009-08-21 14:27:19Z rouault $
 
2
 * $Id: gdalenhance.cpp 22783 2011-07-23 19:28:16Z rouault $
3
3
 *
4
4
 * Project:  GDAL Utilities
5
5
 * Purpose:  Commandline application to do image enhancement. 
32
32
#include "cpl_conv.h"
33
33
#include "cpl_multiproc.h"
34
34
#include "vrt/vrtdataset.h"
 
35
#include "commonutils.h"
35
36
 
36
 
CPL_CVSID("$Id: gdalenhance.cpp 17553 2009-08-21 14:27:19Z rouault $");
 
37
CPL_CVSID("$Id: gdalenhance.cpp 22783 2011-07-23 19:28:16Z rouault $");
37
38
 
38
39
static int
39
40
ComputeEqualizationLUTs( GDALDatasetH hDataset,  int nLUTBins,
87
88
    GDALDatasetH        hDataset, hOutDS;
88
89
    int                 i;
89
90
    const char          *pszSource=NULL, *pszDest=NULL, *pszFormat = "GTiff";
 
91
    int bFormatExplicitelySet = FALSE;
90
92
    GDALDriverH         hDriver;
91
93
    GDALDataType        eOutputType = GDT_Unknown;
92
94
    char                **papszCreateOptions = NULL;
99
101
    int               **papanLUTs = NULL;
100
102
    int                 iBand;
101
103
    const char         *pszConfigFile = NULL;
 
104
    int                 bQuiet = FALSE;
102
105
 
103
106
    /* Check strict compilation and runtime library version as we use C++ API */
104
107
    if (! GDAL_CHECK_VERSION(argv[0]))
124
127
            return 0;
125
128
        }
126
129
        else if( EQUAL(argv[i],"-of") && i < argc-1 )
 
130
        {
127
131
            pszFormat = argv[++i];
 
132
            bFormatExplicitelySet = TRUE;
 
133
        }
128
134
 
129
135
        else if( EQUAL(argv[i],"-ot") && i < argc-1 )
130
136
        {
144
150
            {
145
151
                printf( "Unknown output pixel type: %s\n", argv[i+1] );
146
152
                Usage();
147
 
                GDALDestroyDriverManager();
148
 
                exit( 2 );
149
153
            }
150
154
            i++;
151
155
        }
186
190
        else if( EQUAL(argv[i],"-quiet") )
187
191
        {
188
192
            pfnProgress = GDALDummyProgress;
 
193
            bQuiet = TRUE;
189
194
        }
190
195
 
191
196
        else if( argv[i][0] == '-' )
193
198
            printf( "Option %s incomplete, or not recognised.\n\n", 
194
199
                    argv[i] );
195
200
            Usage();
196
 
            GDALDestroyDriverManager();
197
 
            exit( 2 );
198
201
        }
199
202
        else if( pszSource == NULL )
200
203
        {
209
212
        {
210
213
            printf( "Too many command options.\n\n" );
211
214
            Usage();
212
 
            GDALDestroyDriverManager();
213
 
            exit( 2 );
214
215
        }
215
216
    }
216
217
 
217
218
    if( pszSource == NULL )
218
219
    {
219
220
        Usage();
220
 
        GDALDestroyDriverManager();
221
 
        exit( 10 );
222
221
    }
223
222
 
224
223
/* -------------------------------------------------------------------- */
263
262
        }
264
263
        printf( "\n" );
265
264
        Usage();
266
 
        
267
 
        GDALClose( hDataset );
268
 
        GDALDestroyDriverManager();
269
 
        CSLDestroy( argv );
270
 
        CSLDestroy( papszCreateOptions );
271
 
        exit( 1 );
272
265
    }
273
266
 
 
267
    if (!bQuiet && pszDest != NULL && !bFormatExplicitelySet)
 
268
        CheckExtensionConsistency(pszDest, pszFormat);
 
269
 
274
270
/* -------------------------------------------------------------------- */
275
271
/*      If histogram equalization is requested, do it now.              */
276
272
/* -------------------------------------------------------------------- */
623
619
        iBin = MAX(0,MIN(psEInfo->nLUTBins-1,iBin));
624
620
 
625
621
        if( psEInfo->panLUT )
626
 
            pabyOutImage[iPixel] = psEInfo->panLUT[iBin];
 
622
            pabyOutImage[iPixel] = (GByte) psEInfo->panLUT[iBin];
627
623
        else
628
 
            pabyOutImage[iPixel] = iBin;
 
624
            pabyOutImage[iPixel] = (GByte) iBin;
629
625
    }
630
626
 
631
627
    CPLFree( pafSrcImage );