![]() |
Visual Servoing Platform version 3.7.0
|
#include <vpColorHistogram.h>
Classes | |
| class | Builder |
Public Member Functions | |
| vpColorHistogram () | |
| vpColorHistogram (unsigned int N) | |
| void | setBinNumber (unsigned int N) |
| unsigned int | getBinNumber () const |
| unsigned int | getNumPixels () const |
| void | build (const vpImage< vpRGBa > &image, const vpImage< bool > &mask) |
| void | build (const std::vector< unsigned int > &counts) |
| void | merge (const vpColorHistogram &other, float alpha) |
| void | computeProbas (const vpImage< vpRGBa > &image, vpImage< float > &proba) const |
| void | computeProbas (const vpImage< vpRGBa > &image, vpImage< float > &proba, const vpRect &bb) const |
| unsigned int | colorToIndex (const vpRGBa &p) const |
| vpRGBa | indexToColor (unsigned int index) const |
| double | probability (const vpRGBa &color) const |
| double | kl (const vpColorHistogram &other) const |
| double | jsd (const vpColorHistogram &other) const |
| double | hellinger (const vpColorHistogram &other) const |
| std::vector< vpRGBa > | mostLikelyColors (unsigned int N) const |
Static Public Member Functions | |
| static void | computeSplitHistograms (const vpImage< vpRGBa > &image, const vpImage< bool > &mask, vpColorHistogram &inMask, vpColorHistogram &outsideMask) |
| static void | computeSplitHistograms (const vpImage< vpRGBa > &image, const vpImage< bool > &mask, const vpRect &bbInside, vpColorHistogram &insideMask, vpColorHistogram &outsideMask) |
Histogram representation of an RGB color distribution In this representation, probabilities are stored in evenly sized bins. It can then be used to compute the probability of a specific color given the approximated color distribution. The number of bins N should be a power of 2.
Definition at line 56 of file vpColorHistogram.h.
| vpColorHistogram::vpColorHistogram | ( | ) |
Definition at line 54 of file vpColorHistogram.cpp.
Referenced by vpColorHistogram::Builder::build(), computeSplitHistograms(), computeSplitHistograms(), hellinger(), jsd(), kl(), and merge().
| vpColorHistogram::vpColorHistogram | ( | unsigned int | N | ) |
Definition at line 57 of file vpColorHistogram.cpp.
References setBinNumber().
| void vpColorHistogram::build | ( | const std::vector< unsigned int > & | counts | ) |
Intermediate method to build an histogram, from a vector containing the occurence counts of each color bins. The vector should have N^3 values, each corresponding to a color bin. To get the color to index correspondence, see colorToIndex.
| counts | the color occurence counts |
Definition at line 91 of file vpColorHistogram.cpp.
References vpException::dimensionError.
Build the histogram representation and associated color probabilities given an image and a mask. From this image, only the pixels where the mask is true will be used to create the histogram.
| image | the input image |
| mask | the mask giving the pixels to use |
Definition at line 73 of file vpColorHistogram.cpp.
References vpImage< Type >::bitmap, colorToIndex(), and vpImage< Type >::getSize().
Referenced by computeSplitHistograms(), and computeSplitHistograms().
|
inline |
Convert an RGB color to an index that can be used to retrieve the probability of this color The alpha channel is ignored.
| p | the input color |
Definition at line 146 of file vpColorHistogram.h.
Referenced by build(), computeProbas(), computeProbas(), computeSplitHistograms(), computeSplitHistograms(), and probability().
| void vpColorHistogram::computeProbas | ( | const vpImage< vpRGBa > & | image, |
| vpImage< float > & | proba ) const |
Compute the probabilities of every pixel according to this histogram.
| image | the input image |
| proba | Output probability map |
Definition at line 124 of file vpColorHistogram.cpp.
References vpImage< Type >::bitmap, colorToIndex(), vpImage< Type >::getHeight(), vpImage< Type >::getSize(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().
| void vpColorHistogram::computeProbas | ( | const vpImage< vpRGBa > & | image, |
| vpImage< float > & | proba, | ||
| const vpRect & | bb ) const |
Compute the probabilities of pixels according to this histogram. This version only scores the pixels in the input bounding box.
| image | the input image |
| proba | Output probability map |
| bb | The bounding box where to score the pixels |
Definition at line 135 of file vpColorHistogram.cpp.
References colorToIndex(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().
|
static |
Definition at line 222 of file vpColorHistogram.cpp.
References vpException::badValue, vpImage< Type >::bitmap, build(), colorToIndex(), vpRect::getBottom(), vpRect::getLeft(), vpRect::getRight(), vpImage< Type >::getSize(), vpRect::getTop(), vpImage< Type >::getWidth(), and vpColorHistogram().
|
static |
Definition at line 191 of file vpColorHistogram.cpp.
References vpException::badValue, vpImage< Type >::bitmap, build(), colorToIndex(), vpImage< Type >::getSize(), and vpColorHistogram().
Referenced by vpColorHistogramMask::updateMask().
|
inline |
Definition at line 86 of file vpColorHistogram.h.
Referenced by vpColorHistogram::Builder::build().
|
inline |
Get the number of pixels used to compute this histogram. Can be useful when merging different histograms.
Definition at line 93 of file vpColorHistogram.h.
| double vpColorHistogram::hellinger | ( | const vpColorHistogram & | other | ) | const |
Definition at line 180 of file vpColorHistogram.cpp.
References vpColorHistogram().
|
inline |
Convert an index value to a color.
| index | an index value that should be between 0 and N^3 |
Definition at line 156 of file vpColorHistogram.h.
References vpRGBa::A, vpRGBa::B, vpRGBa::G, and vpRGBa::R.
Referenced by mostLikelyColors().
| double vpColorHistogram::jsd | ( | const vpColorHistogram & | other | ) | const |
Definition at line 169 of file vpColorHistogram.cpp.
References kl(), and vpColorHistogram().
| double vpColorHistogram::kl | ( | const vpColorHistogram & | other | ) | const |
Definition at line 155 of file vpColorHistogram.cpp.
References vpException::badValue, and vpColorHistogram().
Referenced by jsd().
| void vpColorHistogram::merge | ( | const vpColorHistogram & | other, |
| float | alpha ) |
Merge this histogram with an another. This histogram is modified. The probabilities are interpolated between this histogram's values and the other's.
| other | The histogram to merge with |
| alpha | the interpolation/importance factor of the other histogram. between 0 and 1. 1 completely replaces this histogram with other. |
Definition at line 106 of file vpColorHistogram.cpp.
References vpException::badValue, and vpColorHistogram().
|
inline |
Get the N most likely colors according to this histogram.
| N | the number of colors to retrieve |
Definition at line 191 of file vpColorHistogram.h.
References indexToColor().
|
inline |
Get the probability of an RGB color according to this histogram.
| color | the color |
Definition at line 172 of file vpColorHistogram.h.
References colorToIndex().
Referenced by vpProbaComputer::vpProbaComputer().
| void vpColorHistogram::setBinNumber | ( | unsigned int | N | ) |
Change the number of bins per color component that the histogram has After calling this method, the histogram will be reset and the values will not be kept.
| N | the number of bins per RGB component: the histogram will have N^3 bins in total. N should be a power of 2 between 1 and 128 |
Definition at line 62 of file vpColorHistogram.cpp.
References vpException::badValue.
Referenced by vpColorHistogram().