gml_ColorModel.h

00001 // gml_ColorModel.h --
00002 // 
00003 //    Declares the "gml_TColorModel" class. Object of this class represent the model
00004 //    of a color that is used to track objects of this color.
00005 // 
00006 //  Copyright (c) 1996-2004 CLIPS-IMAG
00007 // 
00008 //  See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00009 //  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010 // 
00011 //  August 5, 2004: rewritten from gml (FB).
00012 //
00013 //  Created on June 1996 (FB).
00014 //    Gaussian model inspired from N. Oliver.
00015 
00016 #ifndef __GML_COLORMODEL___
00017 #define __GML_COLORMODEL___
00018 
00019 #include "gml/base/gml_Types.h"
00020 #include "gml/base/gml_Errors.h"
00021 #include "gml/image/gml_Bitmap.h"
00022 
00023 
00024 
00025 
00026 const UInt32       gml_kColorModel_DefHistoReso         = 256;
00027 
00028 // gml_TColorModel error codes --
00029 
00030 extern gml_TError  gml_gColorModel_IsUndefined;
00031 extern gml_TError  gml_gColorModel_HistoNot2D;
00032 extern gml_TError  gml_gColorModel_HistoResosNotSame;
00033 extern gml_TError  gml_gColorModel_BitmapSampleNotInitialized;
00034 
00035 
00036 
00037 // gml_TColorModel --
00038 
00039 class gml_TColorModel {
00040 public:
00041 
00042   gml_TError              Init ();
00043   void                    Dispose ();
00044 
00045   gml_TError              InitBitmapSamples  (gml_TBitmap*    maskBM,
00046                                         UInt32*         resolution  = (UInt32*)NULL);
00047 
00048   gml_TError              AddSamples (gml_TBitmap* sourceBM);
00049 
00050   gml_TError              Display (gml_TBitmap* displayBM);
00051 
00052   gml_TError              Apply  (gml_TBitmap* sourceBM, gml_TBitmap* destBM);
00053 
00054   gml_TBoolean            Defined ()
00055                             { return (gml_TBoolean)(fHistoLong != (UInt32*)NULL); }
00056 
00057   gml_TError              SetHistogram (UInt32 resolution, UInt32* histo);
00058 
00059   void                    GetHistogram (UInt32& resolution, UInt32*& histo);
00060 
00061   UInt32                  Resolution ()
00062                             { return fHistoReso; }
00063 
00064   void                    SetThreshold (Float32 threshold);
00065 
00066   Float32                 Threshold ()
00067                             { return fThreshold; }
00068 
00069 protected:
00070 
00071   static void             Initialize ();
00072   static gml_TBoolean     fInitialized;
00073 
00074   void                    ResetHistogram ();
00075   void                    UpdateHistogram ();
00076 
00077   UInt32*                 fHistoLong;
00078   UInt8*                  fHistoByte;
00079   UInt32                  fHistoReso;
00080   gml_TBoolean            fHistoDirty;
00081   UInt32                  fHistoCount;
00082   UInt32                  fHistoMax;
00083   UInt32                  fHistoMin;
00084 
00085   Float32                 fThreshold;
00086 
00087   gml_TBitmap*            fMaskBM;
00088   int                     fBMWidth;
00089   int                     fBMHeight;
00090 };
00091 
00092 
00093 #endif
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.