Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

RgbLogMag.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_RgbLogMag_h
00002 #define Impala_Core_Array_Trait_RgbLogMag_h
00003 
00004 #include "Util/Math.h"
00005 #include "Core/Array/Element/E1Cast.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Array
00012 {
00013 namespace Trait
00014 {
00015 
00016 
00019 template<class ValT>
00020 class RgbLogMag
00021 {
00022 public:
00024     RgbLogMag(Real64 lowVal, Real64 highVal, Real64 logScale = 255.0)
00025     {
00026         mLowVal = lowVal;
00027         mHighVal = highVal;
00028         //Real64 sc1 = 255.0;
00029         Real64 sc1 = logScale;
00030         //Real64 sc1 = 16.0;
00031         mFactor = (sc1-1.0)/(mHighVal-mLowVal);
00032         mLowVal = (mLowVal*mFactor)-1.0;
00033         mSc2 = 255.0 / ::log(sc1);
00034     }
00035 
00037     void
00038     DoIt(const ValT& pixV, UInt8* rgbPtr)
00039     {
00040         Int32 x = (Int32)
00041             (::log(Element::E1Cast(pixV, Real64()) * mFactor - mLowVal) * mSc2);
00042         *rgbPtr++ = x;
00043         *rgbPtr++ = x;
00044         *rgbPtr++ = x;
00045     }
00046 
00047 private:
00048     Real64              mLowVal;
00049     Real64              mHighVal;
00050     Real64              mFactor;
00051     Real64              mSc2;
00052 };
00053 
00054 } // namespace Trait
00055 } // namespace Array
00056 } // namespace Core
00057 } // namespace Impala
00058 
00059 #endif

Generated on Fri Mar 19 09:31:00 2010 for ImpalaSrc by  doxygen 1.5.1