Fast UV histogram supporting back projection. More...
#include <HistogramUV.h>
Public Member Functions | |
void | add (const HistogramUV &other) |
void | addImage (ColorImageUV8 &imageUV, GrayLevelImage8 &graimageY, Box2D< int > bBox, unsigned minY=1, unsigned maxY=254) |
Add the values of an image within the bounding box to the histogram. | |
void | addImage (ColorImageUV8 &imageUV, GrayLevelImage8 &graimageY, unsigned minY=1, unsigned maxY=254) |
Add the values of an image to the histogram. | |
void | applyThreshold (float thresholdFactor=1.0, float dilationRadius=0.0) |
Sets all entries below thresholdFactor*meanValue to zero and applies a dilation filter. | |
void | clear () |
Set all histogram values to 0. | |
void | clearCenter (unsigned int range) |
Erase the center of the histogram with the given range. | |
EntryT | distance (HistogramUV &other) const |
Compares two histogram and return the mean squared difference. | |
void | divideBy (const HistogramUV ÷nt) |
Entry-wise division by the values of divident. | |
unsigned | getBinSize () const |
const EntryT * | getData () const |
float | getDeviation () |
void | getImage (ColorImageRGB8 &imageRGB, float exponent=0.5) const |
Calculates an RGB image representing the histogram values. | |
ImageMask * | getMask (ColorImageUV8 &imageUV, GrayLevelImage8 &imageY, unsigned minY=20, unsigned maxY=235) const |
Calculate a binary image mask. If the color of the pixel is contained in the histogram, the mask is set to 255, 0 otherwise. | |
const Matrix< EntryT > & | getMatrix () const |
EntryT | getMaxValue () const |
EntryT | getMeanValue () const |
HistogramUV (unsigned binSize) | |
The constructor. | |
HistogramUV () | |
HistogramUV (const HistogramUV &other) | |
Copy constructor. | |
void | normalizeMax () |
Normalize the histogram to max=1. | |
HistogramUV & | operator= (const HistogramUV &other) |
Assign operator. | |
void | printOn (std::ostream &strm) |
Deserialize from stream. | |
void | substract (float value) |
Substract a constant value, clipping at 0. | |
~HistogramUV () | |
The destructor. | |
Private Member Functions | |
bool | checkInit () const |
int | correct (int val, int y) const |
Private Attributes | |
unsigned | m_BinSize |
Size of one bin. | |
EntryT * | m_Data |
Pointer to the raw data of m_Matrix. | |
unsigned | m_DataLength |
Byte length of the histogram data. | |
Matrix< EntryT > | m_Matrix |
Holds the histogram data. | |
unsigned | m_NumBins |
Number of bins per channel. |
Fast UV histogram supporting back projection.
Definition at line 39 of file HistogramUV.h.
HistogramUV::HistogramUV | ( | unsigned | binSize | ) |
The constructor.
binSize | determines how much neighbored u and v values are treated as identical |
HistogramUV::HistogramUV | ( | const HistogramUV & | other | ) |
Copy constructor.
The destructor.
void HistogramUV::add | ( | const HistogramUV & | other | ) |
void HistogramUV::addImage | ( | ColorImageUV8 & | imageUV, |
GrayLevelImage8 & | graimageY, | ||
Box2D< int > | bBox, | ||
unsigned | minY = 1 , |
||
unsigned | maxY = 254 |
||
) |
Add the values of an image within the bounding box to the histogram.
imageUV,imageY | images to be added |
minY,maxY | range of valid Luminance values. Pixels with an Y value outside of these boundaries are ignored. |
bBox | bounding box in the image |
void HistogramUV::addImage | ( | ColorImageUV8 & | imageUV, |
GrayLevelImage8 & | graimageY, | ||
unsigned | minY = 1 , |
||
unsigned | maxY = 254 |
||
) |
Add the values of an image to the histogram.
void HistogramUV::applyThreshold | ( | float | thresholdFactor = 1.0 , |
float | dilationRadius = 0.0 |
||
) |
Sets all entries below thresholdFactor*meanValue to zero and applies a dilation filter.
bool HistogramUV::checkInit | ( | ) | const [private] |
void HistogramUV::clear | ( | ) |
Set all histogram values to 0.
void HistogramUV::clearCenter | ( | unsigned int | range | ) |
Erase the center of the histogram with the given range.
int HistogramUV::correct | ( | int | val, |
int | y | ||
) | const [inline, private] |
Convert to internal u/v representation
EntryT HistogramUV::distance | ( | HistogramUV & | other | ) | const |
Compares two histogram and return the mean squared difference.
void HistogramUV::divideBy | ( | const HistogramUV & | divident | ) |
Entry-wise division by the values of divident.
unsigned HistogramUV::getBinSize | ( | ) | const [inline] |
Definition at line 122 of file HistogramUV.h.
const EntryT* HistogramUV::getData | ( | ) | const [inline] |
Definition at line 120 of file HistogramUV.h.
float HistogramUV::getDeviation | ( | ) |
void HistogramUV::getImage | ( | ColorImageRGB8 & | imageRGB, |
float | exponent = 0.5 |
||
) | const |
Calculates an RGB image representing the histogram values.
imageRGB | output image |
exponent | if not 1, perform non-linear value scaling |
ImageMask* HistogramUV::getMask | ( | ColorImageUV8 & | imageUV, |
GrayLevelImage8 & | imageY, | ||
unsigned | minY = 20 , |
||
unsigned | maxY = 235 |
||
) | const |
Calculate a binary image mask. If the color of the pixel is contained in the histogram, the mask is set to 255, 0 otherwise.
const Matrix<EntryT>& HistogramUV::getMatrix | ( | ) | const [inline] |
Definition at line 117 of file HistogramUV.h.
EntryT HistogramUV::getMaxValue | ( | ) | const |
EntryT HistogramUV::getMeanValue | ( | ) | const |
void HistogramUV::normalizeMax | ( | ) |
Normalize the histogram to max=1.
HistogramUV& HistogramUV::operator= | ( | const HistogramUV & | other | ) |
Assign operator.
void HistogramUV::printOn | ( | std::ostream & | strm | ) |
Deserialize from stream.
Serialize to stream Print object information
void HistogramUV::substract | ( | float | value | ) |
Substract a constant value, clipping at 0.
unsigned HistogramUV::m_BinSize [private] |
EntryT* HistogramUV::m_Data [private] |
Pointer to the raw data of m_Matrix.
Definition at line 153 of file HistogramUV.h.
unsigned HistogramUV::m_DataLength [private] |
Byte length of the histogram data.
Definition at line 156 of file HistogramUV.h.
Matrix<EntryT> HistogramUV::m_Matrix [private] |
Holds the histogram data.
Definition at line 150 of file HistogramUV.h.
unsigned HistogramUV::m_NumBins [private] |
Number of bins per channel.
Definition at line 147 of file HistogramUV.h.