Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef UVHISTOGRAM_H
00013 #define UVHISTOGRAM_H
00014
00015 #include "../../Workers/Puma2/ColorImageRGB8.h"
00016 #include "../../Workers/Puma2/GrayLevelImage8.h"
00017 #include "Matrix.h"
00018
00019 #include "../../Workers/Puma2/ColorImageUV8.h"
00020 #include "../../Workers/Puma2/ImageMask.h"
00021
00022
00023
00024 #include "Workers/Math/Box2D.h"
00025
00026
00027 using namespace puma2;
00028
00029
00031 typedef double EntryT;
00032
00039 class HistogramUV
00040 {
00041
00042 public:
00043
00048 HistogramUV ( unsigned binSize );
00049
00050 HistogramUV( );
00051
00053 HistogramUV ( const HistogramUV& other );
00054
00056 ~HistogramUV();
00057
00059 HistogramUV& operator= ( const HistogramUV& other );
00060
00062 void clear();
00063
00070 void addImage ( ColorImageUV8 &imageUV, GrayLevelImage8 &graimageY, Box2D<int> bBox, unsigned minY=1, unsigned maxY=254 );
00071
00076 void addImage ( ColorImageUV8 &imageUV, GrayLevelImage8 &graimageY, unsigned minY=1, unsigned maxY=254 );
00077
00079 void substract ( float value );
00080
00082 void divideBy ( const HistogramUV& divident );
00083
00084 void add ( const HistogramUV& other );
00085
00087 void normalizeMax();
00088
00090 void applyThreshold ( float thresholdFactor=1.0, float dilationRadius=0.0 );
00091
00093 void clearCenter ( unsigned int range );
00094
00096 float getDeviation();
00097
00099 ImageMask* getMask ( ColorImageUV8 &imageUV, GrayLevelImage8 &imageY, unsigned minY=20, unsigned maxY=235 ) const;
00100
00102 EntryT getMaxValue() const;
00103
00105 EntryT getMeanValue() const;
00106
00111 void getImage ( ColorImageRGB8& imageRGB, float exponent=0.5 ) const;
00112
00114 EntryT distance ( HistogramUV& other ) const;
00115
00117 const Matrix<EntryT>& getMatrix() const { return m_Matrix; }
00118
00120 const EntryT* getData() const { return m_Data; }
00121
00122 unsigned getBinSize() const { return m_BinSize; }
00123
00124
00125
00126
00127
00128
00129
00131 void printOn ( std::ostream& strm );
00132
00133 private:
00134
00135 bool checkInit() const;
00136
00138 inline int correct ( int val, int y ) const;
00139
00144 unsigned m_BinSize;
00145
00147 unsigned m_NumBins;
00148
00150 Matrix<EntryT> m_Matrix;
00151
00153 EntryT* m_Data;
00154
00156 unsigned m_DataLength;
00157
00158 };
00159
00160
00161
00162 #endif