//******************************************************************* // Copyright (C) 2000 ImageLinks Inc. // // License: MIT // // See LICENSE.txt file in the top level directory for more details. // // Author: Garrett Potts // //************************************************************************* // $Id: ossimHistogramEqualization.h 23664 2015-12-14 14:17:27Z dburken $ #ifndef ossimHistogramEqualization_HEADER #define ossimHistogramEqualization_HEADER #include class OSSIMDLLEXPORT ossimHistogramEqualization : public ossimImageSourceHistogramFilter { public: ossimHistogramEqualization(); ossimHistogramEqualization(ossimImageSource* inputSource, ossimRefPtr histogram); ossimHistogramEqualization(ossimImageSource* inputSource, ossimRefPtr histogram, bool inverseFlag); virtual ossimRefPtr getTile(const ossimIrect& tileRect, ossim_uint32 resLevel=0); virtual void setHistogram(ossimRefPtr histogram); virtual bool setHistogram(const ossimFilename& filename); virtual bool getInverseFlag()const; virtual void initialize(); virtual void setInverseFlag(bool inverseFlag); virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=NULL); virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=NULL)const; virtual std::ostream& print(std::ostream& out) const; protected: virtual ~ossimHistogramEqualization(); /** * Called on first getTile, will initialize all data needed. */ void allocate(); ossimRefPtr theTile; /*! * This will be used in some of the histogram * based operations. */ ossimRefPtr theAccumulationHistogram; /*! * Indicates if you should equalize or unequalize an input stream. * If the inverse flag is true then it will indicate that we should * assume that the input stream is already equalized and we should * invert based on the current accumulation histogram. * * * This flag is defaulted to false. */ bool theInverseFlag; /*! * We will create a LUT for each band that directly maps * an input value to an equalized output. */ vector theForwardLut; /*! * We will create a LUT for each band that directly maps * an input value to an un-equalized output. */ vector theInverseLut; std::vector theBandList; virtual void computeAccumulationHistogram(); template ossimRefPtr runEqualizationAlgorithm(T dummyVariable, ossimRefPtr tile); /*! * We will pre-compute the luts for the forward and inverse * equalization. Note: the inverse is a little more tricky * and since we must fill the empty spots missed by the * inverse. We use a linear interpolation between valid * values for this. */ virtual void initializeLuts(); virtual void deleteLuts(); TYPE_DATA }; #endif /* #ifndef ossimHistogramEqualization_HEADER */