SMIL 1.1.2
|
Histogram evaluation and applications. More...
Histogram evaluation and applications.
This module contains functions to evaluate image histograms and some applications such as contrast enhancement, histogram manipulation and thresholding
Functions | |
template<class T > | |
histogram (const Image< T > &imIn, size_t *h) | |
Image histogram. | |
template<class T > | |
RES_T | histogram (const Image< T > &imIn, const Image< T > &imMask, size_t *h) |
Image histogram. | |
template<class T > | |
std::map< T, UINT > | histogram (const Image< T > &imIn, bool fullRange=false) |
histogram() - Image histogram | |
template<class T > | |
std::map< T, UINT > | histogram (const Image< T > &imIn, const Image< T > &imMask, bool fullRange=false) |
histogram() - Image histogram with a mask image. | |
template<class T , class T_out > | |
RES_T | threshold (const Image< T > &imIn, T minVal, T maxVal, T_out trueVal, T_out falseVal, Image< T_out > &imOut) |
threshold() - Image threshold | |
template<class T , class T_out > | |
RES_T | threshold (const Image< T > &imIn, T minVal, T maxVal, Image< T_out > &imOut) |
threshold() - Image threshold | |
template<class T , class T_out > | |
RES_T | threshold (const Image< T > &imIn, T minVal, Image< T_out > &imOut) |
threshold() - Image threshold | |
template<class T , class T_out > | |
RES_T | threshold (const Image< T > &imIn, Image< T_out > &imOut) |
threshold() - Otsu Image threshold | |
template<class T1 , class T2 > | |
RES_T | stretchHistogram (const Image< T1 > &imIn, T1 inMinVal, T1 inMaxVal, Image< T2 > &imOut, T2 outMinVal=numeric_limits< T2 >::min(), T2 outMaxVal=numeric_limits< T2 >::max()) |
stretchHistogram() - Stretch histogram | |
template<class T1 , class T2 > | |
RES_T | stretchHistogram (const Image< T1 > &imIn, Image< T2 > &imOut, T2 outMinVal, T2 outMaxVal) |
stretchHistogram() - Stretch histogram | |
template<class T1 , class T2 > | |
RES_T | stretchHistogram (const Image< T1 > &imIn, Image< T2 > &imOut) |
stretchHistogram() - Stretch histogram | |
template<class T > | |
vector< T > | histogramRange (const Image< T > &imIn, double ignorePercent, bool cumulative=true) |
histogramRange() - Min and Max values of an histogram ignoring left/right low values (lower than a given height/cumulative height). | |
template<class T > | |
RES_T | enhanceContrast (const Image< T > &imIn, Image< T > &imOut, double saturation=0.25) |
enhanceContrast() - Enhance contrast | |
template<class T > | |
vector< T > | otsuThresholdValues (map< T, UINT > &hist, UINT threshLevels=1) |
otsuThresholdValues() - Return threshold values and the value of the resulting variance between classes | |
template<class T > | |
vector< T > | otsuThresholdValues (const Image< T > &im, UINT threshLevels=1) |
otsuThresholdValues() - Return threshold values and the value of the resulting variance between classes | |
template<class T > | |
vector< T > | otsuThresholdValues (const Image< T > &im, const Image< T > &imMask, UINT threshLevels=1) |
otsuThresholdValues() - Return threshold values and the value of the resulting variance between classes | |
template<class T , class T_out > | |
vector< T > | otsuThreshold (const Image< T > &imIn, Image< T_out > &imOut, UINT nbrThresholds) |
otsuThreshold() - Otsu Threshold | |
template<class T , class T_out > | |
T | otsuThreshold (const Image< T > &imIn, Image< T_out > &imOut) |
otsuThreshold() - Otsu Threshold | |
template<class T , class T_out > | |
vector< T > | otsuThreshold (const Image< T > &imIn, const Image< T > &imMask, Image< T_out > &imOut, UINT nbrThresholds=1) |
otsuThreshold() - Otsu Threshold | |
histogram | ( | const Image< T > & | imIn, |
size_t * | h | ||
) |
Image histogram.
Calculate the histogram of the image
[in] | imIn | : input image |
[out] | h | : vector with histogram |
RES_T histogram | ( | const Image< T > & | imIn, |
const Image< T > & | imMask, | ||
size_t * | h | ||
) |
Image histogram.
Returns the histogram of the image in the region defined by the image mask.
[in] | imIn | : input image |
[in] | imMask | : image mask |
[out] | h | : vector with histogram |
std::map< T, UINT > histogram | ( | const Image< T > & | imIn, |
bool | fullRange = false |
||
) |
histogram() - Image histogram
[in] | imIn | : input image |
[in] | fullRange | : result contains all possible values in the image type range |
std::map< T, UINT > histogram | ( | const Image< T > & | imIn, |
const Image< T > & | imMask, | ||
bool | fullRange = false |
||
) |
histogram() - Image histogram with a mask image.
Returns the histogram of the image in the region defined by the image mask.
[in] | imIn | : input image |
[in] | imMask | : image mask |
[in] | fullRange | : result contains all possible values in the image type range |
RES_T threshold | ( | const Image< T > & | imIn, |
T | minVal, | ||
T | maxVal, | ||
T_out | trueVal, | ||
T_out | falseVal, | ||
Image< T_out > & | imOut | ||
) |
threshold() - Image threshold
Image threshold based on a range of values defined by [minVal, maxVal].
The result is a image where :
imOut(x) = (imIn(x) >= minVal && imIn(x) < maxVal ? trueVal : falseVal)
[in] | imIn | : input image |
[in] | minVal,maxVal | : interest range of pixel values |
[in] | trueVal | : value to assign to pixels in the interest range |
[in] | falseVal | : value to assign to pixels outside the interest range |
[out] | imOut | : output image |
RES_T threshold | ( | const Image< T > & | imIn, |
T | minVal, | ||
T | maxVal, | ||
Image< T_out > & | imOut | ||
) |
threshold() - Image threshold
Image threshold based on a range of values defined by [minVal, maxVal].
The result is a image where :
imOut(x) = (imIn(x) >= minVal && imIn(x) < maxVal ? max(T) : min(T))
[in] | imIn | : input image |
[in] | minVal,maxVal | : interest range of pixel values |
[out] | imOut | : output image |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
RES_T threshold | ( | const Image< T > & | imIn, |
T | minVal, | ||
Image< T_out > & | imOut | ||
) |
threshold() - Image threshold
Image threshold based on some threshold.
The result is a image where :
imOut(x) = (imIn(x) >= minVal ? max(T) : men(T))
[in] | imIn | : input image |
[in] | minVal | : threshold |
[out] | imOut | : output image |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
RES_T threshold | ( | const Image< T > & | imIn, |
Image< T_out > & | imOut | ||
) |
threshold() - Otsu Image threshold
[in] | imIn | : input image |
[out] | imOut | : output image |
RES_T stretchHistogram | ( | const Image< T1 > & | imIn, |
T1 | inMinVal, | ||
T1 | inMaxVal, | ||
Image< T2 > & | imOut, | ||
T2 | outMinVal = numeric_limits<T2>::min() , |
||
T2 | outMaxVal = numeric_limits<T2>::max() |
||
) |
stretchHistogram() - Stretch histogram
Create a new image based on a linear transformation of the histogram of the input image.
The output image is created by the following rules :
coef = (outMaxVal - outMinVal) / (inMaxVal - inMinVal)
imOut(x) = coeff * (imIn(x) - inMinVal) + outMinVal
[min(T2), max(T2)]
[in] | imIn | : input image |
[in] | inMinVal,inMaxVal | : input range coefficient |
[out] | imOut | : output image |
[out] | outMinVal,outMaxVal | : output range |
RES_T stretchHistogram | ( | const Image< T1 > & | imIn, |
Image< T2 > & | imOut, | ||
T2 | outMinVal, | ||
T2 | outMaxVal | ||
) |
stretchHistogram() - Stretch histogram
Create a new image based on a linear transformation of the histogram of the input image.
As before but the range values in the input image are taken from the range of its histogram.
The output image is created by the following rules :
(inMinVal, inMaxVal) = range(imIn)
. See rangeVal()coef = (outMaxVal - outMinVal) / (inMaxVal - inMinVal)
imOut(x) = coeff * (imIn(x) - inMinVal) + outMinVal
[min(T2), max(T2)]
[in] | imIn | : input image |
[out] | imOut | : output image |
[out] | outMinVal,outMaxVal | : output range |
RES_T stretchHistogram | ( | const Image< T1 > & | imIn, |
Image< T2 > & | imOut | ||
) |
stretchHistogram() - Stretch histogram
Create a new image based on a linear transformation of the histogram of the input image.
As before but the range values in the input image are taken from the range of its histogram and the range values in the output image are the range defined by the data type.
The output image is created by the following rules :
(inMinVal, inMaxVal) = range(imIn)
. See rangeVal()coef = (max(T2) - min(T2)) / (inMaxVal - inMinVal)
imOut(x) = coeff * (imIn(x) - inMinVal) + min(T2)
[in] | imIn | : input image |
[out] | imOut | : output image |
vector< T > histogramRange | ( | const Image< T > & | imIn, |
double | ignorePercent, | ||
bool | cumulative = true |
||
) |
histogramRange() - Min and Max values of an histogram ignoring left/right low values (lower than a given height/cumulative height).
If cumulative is true, it stops when the integral of the histogram values reaches ignorePercent * NbrPixels. Otherwise, it stops at the first value of the histogram higher than ignorePercent * max(histogram)
[in] | imIn | : input image |
[in] | ignorePercent | : explained above |
[in] | cumulative | : explained above |
RES_T enhanceContrast | ( | const Image< T > & | imIn, |
Image< T > & | imOut, | ||
double | saturation = 0.25 |
||
) |
enhanceContrast() - Enhance contrast
[in] | imIn | : input image |
[out] | imOut | : output image |
[in] | saturation | : |
vector< T > otsuThresholdValues | ( | map< T, UINT > & | hist, |
UINT | threshLevels = 1 |
||
) |
otsuThresholdValues() - Return threshold values and the value of the resulting variance between classes
[in] | hist | : image histogram |
[in] | threshLevels | : number of threshold levels (default : 1) |
vector< T > otsuThresholdValues | ( | const Image< T > & | im, |
UINT | threshLevels = 1 |
||
) |
otsuThresholdValues() - Return threshold values and the value of the resulting variance between classes
[in] | im | : image |
[in] | threshLevels | : number of threshold levels (default : 1) |
vector< T > otsuThresholdValues | ( | const Image< T > & | im, |
const Image< T > & | imMask, | ||
UINT | threshLevels = 1 |
||
) |
otsuThresholdValues() - Return threshold values and the value of the resulting variance between classes
[in] | im | : image |
[in] | imMask | : image mask |
[in] | threshLevels | : number of threshold levels (default : 1) |
vector< T > otsuThreshold | ( | const Image< T > & | imIn, |
Image< T_out > & | imOut, | ||
UINT | nbrThresholds | ||
) |
otsuThreshold() - Otsu Threshold
Image threshold based on the Otsu algorithm.
[in] | imIn | : input image |
[out] | imOut | : output image |
[in] | nbrThresholds | : number of thresholds. The output image will have nbrThresholds + 1 classes. |
Example
T otsuThreshold | ( | const Image< T > & | imIn, |
Image< T_out > & | imOut | ||
) |
otsuThreshold() - Otsu Threshold
Image threshold based on the Otsu algorithm.
Output image will have only two classes.
[in] | imIn | : input image |
[out] | imOut | : output image |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
vector< T > otsuThreshold | ( | const Image< T > & | imIn, |
const Image< T > & | imMask, | ||
Image< T_out > & | imOut, | ||
UINT | nbrThresholds = 1 |
||
) |
otsuThreshold() - Otsu Threshold
Image threshold based on the Otsu algorithm (a mask will be applied before threshold).
[in] | imIn | : input image |
[in] | imMask | : mask image |
[out] | imOut | : output image |
[in] | nbrThresholds | : number of thresholds. The output image will have nbrThresholds + 1 classes. |
Example