This interface provide functionalities of histogram calculation out of image. More...
Public Member Functions | |
void | Build (ILImage *img, ILRegion *region, int binCount, int lowerBound, int upperBound) |
void | BuildFromDataVec (LArray< double > dataVec, int binCount, double lowerBound, double upperBound) |
void | Draw (HDC hdc, LPVChartDrawFlags drawFlags, int xGridStep, int yGridStep) |
double | Item (int index) |
void | MeanStdDev (double *meanValue, double *stdDevValue) |
void | MinMax (int *minIdx, double *minValue, int *maxIdx, double *maxValue) |
Public Member Functions inherited from ILObject | |
ILObject * | Copy () |
LPVErrorCode | Load (LString filename) |
void | Reset () |
LPVErrorCode | Save (LString filename) |
BOOL | Valid () |
This interface provide functionalities of histogram calculation out of image.
Histogram collect count of data in provided image into a set of predefined bins. It is useful in a vision system for analysis and observe the frequency distributions of pixel intensity values, and later do detection or inspection based on it.
To use this interface, you should create a LHistogram object.
Build the histogram with the given image and region.
[in] | img | The input image. |
[in] | region | Input region. It's optional, could be null. |
[in] | binCount | The number of divisions in the histogram. It's recommended to be a factor of the total data range size, say 256 for a grayscale image. |
[in] | lowerBound | The lower bound of data, usually it's 0 for a 8bit grayscale image. |
[in] | upperBound | The upper bound of data, usually it's 255 for a 8bit grayscale image. |
void BuildFromDataVec | ( | LArray< double > | dataVec, |
int | binCount, | ||
double | lowerBound, | ||
double | upperBound | ||
) |
Build the histogram with the given data vector.
[in] | dataVec | The input data vector, it's a collection of double values. |
[in] | binCount | The number of divisions in the histogram. |
[in] | lowerBound | The lower bound of data. By default, both the lower and upper bound is set to 0, means we'll use the minimum and maximum value of the inputs as the bounds. |
[in] | upperBound | The upper bound of data. |
void Draw | ( | HDC | hdc, |
LPVChartDrawFlags | drawFlags, | ||
int | xGridStep, | ||
int | yGridStep | ||
) |
Draw the histogram as a data chart onto provide device context, using the index as x axis and the value as y axis.
[in] | hdc | Handle to the device context of the destination window or bitmap. |
[in] | drawFlags | Flags to control which part of a data chart should be drawn, see LPVChartDrawFlags for usage. |
[in] | xGridStep | Specify the step of label on x axis, 0 means we'll determine it on the fly according to the score data. |
[in] | yGridStep | Specify the step of label on y axis, 0 means we'll determine it on the fly according to the score data. This function is currently not available on Linux / MacOS platform. |
double Item | ( | int | index | ) |
Get value of a specified bin. It represents the count of data in that bin.
[in] | index | The index of the bin. |
value | Return the value of the bin. |
void MeanStdDev | ( | double * | meanValue, |
double * | stdDevValue | ||
) |
Calculate the mean and standard deviation of the histogram.
[out] | meanValue | Return the mean value. |
[out] | stdDevValue | Return the standard deviation value. |
void MinMax | ( | int * | minIdx, |
double * | minValue, | ||
int * | maxIdx, | ||
double * | maxValue | ||
) |
Find the bin of minimum or maximum value, report the value and bin index. If there's more than one bin with the same value, report the first one.
[out] | minIdx | Return the index of the bin of minimum value. |
[out] | minValue | Return the minimum value. |
[out] | maxIdx | Return the index of the bin of maximum value. |
[out] | maxValue | Return the maximum value。 |