![]() |
The Machine Perception Toolbox |
|
#include <histogram_hue.h>
Collaboration diagram for histogram_hue:
Public Member Functions | |
void | add_uniform (double weight=1.0) |
void | addtobin (const RGBTRIPLE &rgb, const double value=1.0) |
double * | begin () |
void | clear () |
histogram_hue & | copy (histogram_hue &hist) |
const double * | end () |
double & | get_prob (const RGBTRIPLE &rgb) |
histogram_hue () | |
void | load_from_file (ifstream &is) |
void | normalize () |
double & | operator[] (const int &bin) |
void | print_values (std::ostream &os) |
void | save_to_file (ofstream &os) |
double | sum () |
void | weighted_add (histogram_hue &hist, const double &weight) |
Private Member Functions | |
void | addtobin (const int &bin, double value=1.0) |
double & | get_prob (const int &bin) |
void | rgb2bin (const RGBTRIPLE &rgb, int &bin) |
Private Attributes | |
MPColorTools | m_color |
double | m_hist [BINSIZE] |
int | m_numBins |
int | m_numColors |
int | m_totalMemSize |
|
Definition at line 35 of file histogram_hue.h. 00035 { 00036 m_numBins = BINSIZE; 00037 m_totalMemSize = m_numBins * sizeof(double); 00038 m_numColors = 256; 00039 clear(); 00040 }
|
|
Definition at line 90 of file histogram_hue.h. References end. 00090 { 00091 const double uniform = weight*(1.0/static_cast<double>(m_numBins)); 00092 for (double *it = begin(); it != end(); it++) 00093 *it = uniform + *it*(1-weight); 00094 }
|
|
Definition at line 54 of file histogram_hue.h.
|
|
Definition at line 30 of file histogram_hue.h. 00030 { 00031 m_hist[bin] += value; 00032 }
|
|
Definition at line 42 of file histogram_hue.h. Referenced by weighted_add(). 00042 { 00043 return (&(m_hist[0])); 00044 }
|
|
Definition at line 66 of file histogram_hue.h. 00066 { 00067 memset(m_hist, 0, m_totalMemSize); 00068 }
|
|
Definition at line 70 of file histogram_hue.h. References m_hist. 00070 { 00071 memcpy(hist.m_hist, m_hist, m_totalMemSize); 00072 return(hist); 00073 }
|
|
Definition at line 46 of file histogram_hue.h. 00046 { 00047 return(&(m_hist[BINSIZE])); 00048 }
|
|
Definition at line 60 of file histogram_hue.h.
|
|
Definition at line 18 of file histogram_hue.h. 00018 { 00019 return(m_hist[bin]); 00020 }
|
|
Definition at line 110 of file histogram_hue.h. References end.
|
|
Definition at line 75 of file histogram_hue.h. 00075 { 00076 double s = sum(); 00077 for (double *it = begin(); it != end(); it++) { 00078 if (*it) 00079 *it /= s; 00080 } 00081 }
|
|
Definition at line 50 of file histogram_hue.h. 00050 { 00051 return(m_hist[bin]); 00052 }
|
|
Definition at line 101 of file histogram_hue.h. References end. 00101 { 00102 int count = 1; 00103 for (double *it = begin(); it != end(); it++) { 00104 count++; 00105 os << *it << endl; 00106 } 00107 count; 00108 }
|
|
Definition at line 22 of file histogram_hue.h. References MPColorTools::RGBtoHSV(), s, and v. 00022 { 00023 const double alpha = 0.0; // -0.5 left edge of distribution 00024 const double binwidth = static_cast<double>(m_numColors)/static_cast<double>(BINSIZE); 00025 float h = 0.0, s = 0.0, v = 0.0; 00026 m_color.RGBtoHSV(&rgb, h, s, v); 00027 bin = (int) (h*m_numBins/360.0); 00028 }
|
Here is the call graph for this function:
|
Definition at line 116 of file histogram_hue.h. 00116 { 00117 print_values (os); 00118 }
|
|
Definition at line 83 of file histogram_hue.h. 00083 { 00084 double s = 0.0; 00085 for (double *it = begin(); it != end(); it++) 00086 s += *it; 00087 return (s); 00088 }
|
|
Definition at line 96 of file histogram_hue.h. 00096 { 00097 for (double *toptr = begin(), *fromptr = hist.begin(); toptr != end(); toptr++, fromptr++) 00098 *toptr = *toptr*weight + *fromptr*(1-weight); 00099 }
|
Here is the call graph for this function:
|
Definition at line 16 of file histogram_hue.h. |
|
Definition at line 12 of file histogram_hue.h. Referenced by copy(). |
|
Definition at line 14 of file histogram_hue.h. |
|
Definition at line 15 of file histogram_hue.h. |
|
Definition at line 13 of file histogram_hue.h. |