TLIB documentation
 

tlHist.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  This file is part of the TLIB computer vision library.
00004 //  Copyright (C) 2003-2008 Sebastien Grange
00005 //  Copyright (C) 2003-2007 VRAI Group, EPFL
00006 //  All rights reserved.
00007 // 
00008 //  This library is free software; you can redistribute it and/or modify
00009 //  it under the terms of the GNU General Public License("GPL") version 2
00010 //  as published by the Free Software Foundation.
00011 // 
00012 //  <http://www.tuyphon.com/tlib>
00013 //
00014 /////////////////////////////////////////////////////////////////////////////////
00015 
00016 
00017 #ifndef __TLHISTOGRAM_H__
00018 #define __TLHISTOGRAM_H__
00019 
00020 
00021 #include "tlVision.h"
00022 
00023 
00024 class tlHist
00025 {
00026 private:
00027 
00028   int         length;                   // histogram length (i.e. number of elements)
00029   int         offset;                   // data offset (i.e. first index)
00030   int         min;                              // index of min value
00031   int         max;                              // index of max value
00032   int         mean;       // mean (integer) value
00033   int         weight;     // histogram weight (sum of all elements)
00034   float       stdDev;     // standard deviation
00035   tlHistData  minVal;                   // min value
00036   tlHistData  maxVal;                   // max value
00037 
00038   int create      (int length, int offset);
00039   int deleteData  ();
00040 
00041 public:
00042 
00043   int         channel;    // for information only
00044   tlHistData  *data;                    // pointer to histogram data
00045   tlHistData  *rank;      // pointer to histogram ranking information
00046 
00047     
00048   // constructors
00049   tlHist  ();
00050   tlHist  (int length, int offset = 0);
00051   virtual ~tlHist ();
00052 
00053   // initialization
00054   int   init       (int length, int offset = 0);
00055   int   clear      ();
00056   int   update     ();
00057 
00058   // set data
00059   int   setChannel (int channel);
00060 
00061   // read data
00062   int   getVal      (int index);
00063   int   getRank     (int index);
00064   int   getMean     () { return mean;   };
00065   float getStdDev   () { return stdDev; };
00066   int   getMaxVal   () { return maxVal; };
00067   int   getMinVal   () { return minVal; };
00068   int   getMaxIndex () { return max;    };
00069   int   getMinIndex () { return min;    };
00070   int   getOffset   () { return offset; };
00071   int   getLength   () { return length; };
00072 
00073   // set data
00074   int   setVal (int index, int val);
00075   int   incVal (int index);
00076   int   decVal (int index);
00077 
00078   // normalize [% peak]
00079   int   normalize (int max = 100);
00080 
00081   // normalize [% sum]
00082   int   integrate (int sum = 100);
00083 
00084   // compare
00085   float compare (tlHist *hist);
00086 
00087   // build histogram
00088   int   build (tlPixel *data, int len);
00089   int   build (tlPixel *data, int len, int length, int offset = 0);
00090   int   build (tlPixel *src, int width, int height, int pixelWidth, tlPixel *mask, int channel, tlRect *rect);
00091 
00092   // build histogram for high-resolution images
00093   int   build (tlHRPixel *data, int len);
00094   int   build (tlHRPixel *data, int len, int length, int offset = 0);
00095   int   build (tlHRPixel *src, int width, int height, int pixelWidth, tlPixel *mask, int channel, tlRect *rect);
00096 };
00097 
00098 
00099 #endif


TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.