tlHist provides a histogram class compatible with TLIB images and objects. It offers simple functions such as ranking, normalization and scaling, building from images and data manipulation.
Public Member Functions | |
tlHist () | |
tlHist (int length, int offset=0) | |
virtual | ~tlHist () |
int | init (int length, int offset=0) |
int | clear () |
int | update () |
int | setChannel (int channel) |
int | getVal (int index) |
int | getRank (int index) |
int | getMean () |
float | getStdDev () |
int | getMaxVal () |
int | getMinVal () |
int | getMaxIndex () |
int | getMinIndex () |
int | getOffset () |
int | getLength () |
int | setVal (int index, int val) |
int | incVal (int index) |
int | decVal (int index) |
int | normalize (int max=100) |
int | integrate (int sum=100) |
float | compare (tlHist *hist) |
int | build (tlPixel *data, int len) |
int | build (tlPixel *data, int len, int length, int offset=0) |
int | build (tlPixel *src, int width, int height, int pixelWidth, tlPixel *mask, int channel, tlRect *rect) |
int | build (tlHRPixel *data, int len) |
int | build (tlHRPixel *data, int len, int length, int offset=0) |
int | build (tlHRPixel *src, int width, int height, int pixelWidth, tlPixel *mask, int channel, tlRect *rect) |
Public Attributes | |
int | channel |
tlHistData * | data |
tlHistData * | rank |
tlHist::tlHist | ( | ) |
tlHist::tlHist | ( | int | length, | |
int | offset = 0 | |||
) |
Constructor, create a histogram with a given length, where the first element starts at a given offset. For example, to create a histogram ranging between 10 and 30, call tlHist(20,10).
length | number of values in histogram | |
offset | first index of the histogram |
tlHist::~tlHist | ( | ) | [virtual] |
int tlHist::init | ( | int | length, | |
int | offset = 0 | |||
) |
Initialize an existing histogram object to a different size. Memory array is reallocated, every index is set to 0.
length | number of values in histogram | |
offset | first index of the histogram |
int tlHist::clear | ( | ) |
Clear an existing histogram object. That is, set all index to 0.
int tlHist::update | ( | ) |
Force recomputation of all internal data such as minima, maxima, and ranking information.
int tlHist::setChannel | ( | int | channel | ) |
Set color channel contained in the histogram. This is provided as as an reference tool and does not affect the content or the processing of the histogram.
channel | the desired channel as described in tlVision. |
int tlHist::getVal | ( | int | index | ) |
Get the value of a given histogram index.
index | the index to poll |
int tlHist::getRank | ( | int | index | ) |
Get the rank of a given histogram index. getRank(0) returns the index of the highest histogram value. getRank(length) returns the index of the smallest histogram value.
index | the rank index to poll |
int tlHist::getMean | ( | ) | [inline] |
Return the mean of the data in the histogram.
int tlHist::getStdDev | ( | ) | [inline] |
Return the standard deviation of the data in the histogram.
int tlHist::getMaxVal | ( | ) | [inline] |
Return the highest value in the histogram.
int tlHist::getMinVal | ( | ) | [inline] |
Return the lowest value in the histogram.
int tlHist::getMaxIndex | ( | ) | [inline] |
Return the index of the highest value in the histogram.
int tlHist::getMinIndex | ( | ) | [inline] |
Return the index of the lowest value in the histogram.
int tlHist::getOffset | ( | ) | [inline] |
Return the offset of the first histogram index.
int tlHist::getLength | ( | ) | [inline] |
Return the length of the histogram.
int tlHist::setVal | ( | int | index, | |
int | val | |||
) |
Set the value of a given histogram index.
index | the index to set | |
val | the new value of the index |
int tlHist::incVal | ( | int | index | ) |
Increment the value of a given histogram index.
index | the index to increment |
int tlHist::decVal | ( | int | index | ) |
Decrement the value of a given histogram index
index | the index to decrement |
int tlHist::normalize | ( | int | newMax = 100 |
) |
Scale all histogram values proportionally so that the greatest value matches a desired value. The default (newMax=100) sets all index to their weight in the histogram in [%].
newMax | the desired greatest value |
int tlHist::integrate | ( | int | sum = 100 |
) |
Scale all histogram values proportionally so that the sum of all values matches a desired value (as closely as possible).
sum | the desired sum value |
float tlHist::compare | ( | tlHist * | hist | ) |
Compare the histogram with another histogram.
hist | the histogram to compare with |
int tlHist::build | ( | tlPixel * | src, | |
int | len | |||
) |
Build a histogram from a tlPixel array.
src | pixel data set to build upon | |
len | pixel data set length |
int tlHist::build | ( | tlPixel * | src, | |
int | len, | |||
int | length, | |||
int | offset = 0 | |||
) |
Build a histogram from a tlPixel array.
src | pixel data set to build upon | |
len | pixel data set length | |
length | number of values in histogram | |
offset | first index of the histogram |
int tlHist::build | ( | tlPixel * | src, | |
int | width, | |||
int | height, | |||
int | pixelWidth, | |||
tlPixel * | mask, | |||
int | channel, | |||
tlRect * | rect | |||
) |
Build a histogram from the given channel of a portion of a given pixel array.
src | the pixel array | |
width | image width | |
height | image height | |
pixelWidth | bytes per pixel | |
mask | pixel mask | |
channel | the channel to consider | |
rect | the portion of the image to consider |
int tlHist::build | ( | tlHRPixel * | src, | |
int | len | |||
) |
Build a histogram from a high-resolution pixel array.
src | pixel data set to build upon | |
len | pixel data set length |
int tlHist::build | ( | tlHRPixel * | src, | |
int | len, | |||
int | length, | |||
int | offset = 0 | |||
) |
Build a histogram from a high-resolution pixel array.
src | pixel data set to build upon | |
len | pixel data set length | |
length | number of values in histogram | |
offset | first index of the histogram |
int tlHist::build | ( | tlHRPixel * | src, | |
int | width, | |||
int | height, | |||
int | pixelWidth, | |||
tlPixel * | mask, | |||
int | channel, | |||
tlRect * | rect | |||
) |
Build a histogram from the given channel of a portion of a given high-resolution pixel array.
src | the pixel array | |
width | image width | |
height | image height | |
pixelWidth | bytes per pixel | |
mask | pixel mask | |
channel | the channel to consider | |
rect | the portion of the image to consider |
int tlHist::channel |
Desribe the color channel the histogram was built from (R, G, B, etc.)
int * tlHist::data |
Contain the histogram data.
int * tlHist::rank |
Contain the index of the histogram values sorted in reversed order. (rank[0] = index of the highest peak in the histogram)