41 #ifndef VP_HISTOGRAM_H
42 #define VP_HISTOGRAM_H
46 #include <visp3/core/vpConfig.h>
47 #include <visp3/core/vpColor.h>
48 #include <visp3/core/vpHistogramPeak.h>
49 #include <visp3/core/vpHistogramValey.h>
50 #include <visp3/core/vpImage.h>
138 if (level < m_size) {
139 return m_histogram[level];
142 std::stringstream ss;
143 ss <<
"Level is > to size (" << m_size <<
") !";
168 if (level < m_size) {
169 return m_histogram[level];
172 std::stringstream ss;
173 ss <<
"Level is > to size (" << m_size <<
") !";
196 inline unsigned get(
const unsigned char level)
const
198 if (level < m_size) {
199 return m_histogram[level];
202 std::stringstream ss;
203 ss <<
"Level is > to size (" << m_size <<
") !";
224 inline void set(
const unsigned char level,
unsigned int value)
226 if (level < m_size) {
227 m_histogram[level] = value;
230 std::stringstream ss;
231 ss <<
"Level is > to size (" << m_size <<
") !";
255 unsigned int maxValue_ = 0);
257 void smooth(
unsigned int fsize = 3);
258 unsigned getPeaks(std::list<vpHistogramPeak> &peaks);
261 unsigned getValey(std::list<vpHistogramValey> &valey);
265 unsigned sort(std::list<vpHistogramPeak> &peaks);
267 bool write(
const std::string &filename);
268 bool write(
const char *filename);
278 inline unsigned getSize()
const {
return m_size; };
308 inline unsigned int getTotal() {
return m_total; };
311 void init(
unsigned size = 256);
313 unsigned int *m_histogram;
316 unsigned int m_total;
Class to define RGB colors available for display functionalities.
static const vpColor white
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
Declaration of the peak (maximum value) in a gray level image histogram.
Declaration of the valey (minimum value) in a gray level image histogram.
Class to compute a gray level image histogram.
unsigned int getTotal()
Get the total number of pixels in the input image.
unsigned operator()(const unsigned char level) const
unsigned operator[](const unsigned char level) const
void set(const unsigned char level, unsigned int value)
void setMask(const vpImage< bool > *p_mask)
Set a mask to ignore pixels for which the mask is false.
unsigned get(const unsigned char level) const