CVB++ 14.0
Cvb::Foundation::HistogramAnalyzer Namespace Reference

Collection of functions for analyzing the image histogram. More...

Classes

class  Histogram
 A single histogram result. More...
 

Functions

std::vector< HistogramCreateImageHistograms (const Image &image, Rect< int > aoi, double density=1.0)
 Creates a histogram for each plane of the aoi in the given image. More...
 
std::vector< HistogramCreateImageHistograms (const Image &image, Area2D aoi, double density=1.0)
 Creates a histogram for each plane of the aoi in the given image. More...
 
std::vector< HistogramCreateImageHistograms (const Image &image, double density=1.0)
 Creates a histogram for each plane of the whole image. More...
 
Histogram CreatePlaneHistogram (const ImagePlane &imagePlane, Rect< int > aoi, double density=1.0)
 Creates a histogram for the aoi in the given plane. More...
 
Histogram CreatePlaneHistogram (const ImagePlane &imagePlane, Area2D aoi, double density=1.0)
 Creates a histogram for the aoi in the given plane. More...
 
Histogram CreatePlaneHistogram (const ImagePlane &imagePlane, double density=1.0)
 Creates a histogram for the whole plane. More...
 
template<class HISTVAL , class RANGE >
TypedRange< std::vector< double >, double, RANGE >::type FilterHistogram (const std::vector< HISTVAL > &histogram, const RANGE &kernel)
 Filter a histogram array with the given kernel. At the beginning and end of the histogram, the histogram uses constant extension. More...
 
std::vector< int > FindHistogramPeaks (const std::vector< uint64_t > &histogram, int blurSize, int minDiff)
 Find peaks in the histogram identified by the supplied criteria. More...
 
uint64_t SumHistogramBetween (const std::vector< uint64_t > &histogram, int lowerLimit, int upperLimit)
 Count the number of pixels that lie between two limits in the histogram. More...
 

Detailed Description

Collection of functions for analyzing the image histogram.

Remarks
CMake users: Link to imported target CVB::CvbFoundationHistogramAnalyzer

Function Documentation

◆ CreateImageHistograms() [1/3]

std::vector< Histogram > CreateImageHistograms ( const Image image,
Area2D  aoi,
double  density = 1.0 
)
inline

Creates a histogram for each plane of the aoi in the given image.

Parameters
[in]imageImage to create histograms for.
[in]aoiArea of interest in CoordinateSystemType::ImageCoordinates.
[in]densityPercentage of pixels to process where 0 is 0% and 1.0 is 100%.
Returns
Vector containing the histograms for each image plane.
Exceptions
Anyexception derived from std::exception including CvbException.

Using the Area2D as an overlay uses the CoordinateSystemType::ImageCoordinates.

◆ CreateImageHistograms() [2/3]

std::vector< Histogram > CreateImageHistograms ( const Image image,
double  density = 1.0 
)
inline

Creates a histogram for each plane of the whole image.

Parameters
[in]imageImage to create histograms for.
[in]densityPercentage of pixels to process where 0 is 0% and 1.0 is 100%.
Returns
Vector containing the histograms for each image plane.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ CreateImageHistograms() [3/3]

std::vector< Histogram > CreateImageHistograms ( const Image image,
Rect< int >  aoi,
double  density = 1.0 
)
inline

Creates a histogram for each plane of the aoi in the given image.

Parameters
[in]imageImage to create histograms for.
[in]aoiArea of interest in CoordinateSystemType::PixelCoordinates.
[in]densityPercentage of pixels to process where 0 is 0% and 1.0 is 100%.
Returns
Vector containing the histograms for each image plane.
Exceptions
Anyexception derived from std::exception including CvbException.

Using the Rect<int> as an overlay uses the CoordinateSystemType::PixelCoordinates.

◆ CreatePlaneHistogram() [1/3]

Histogram CreatePlaneHistogram ( const ImagePlane imagePlane,
Area2D  aoi,
double  density = 1.0 
)
inline

Creates a histogram for the aoi in the given plane.

Parameters
[in]imagePlaneImage plane to create histogram for.
[in]aoiArea of interest in CoordinateSystemType::ImageCoordinates.
[in]densityPercentage of pixels to process where 0 is 0% and 1.0 is 100%.
Returns
Histogram for the given plane.
Exceptions
Anyexception derived from std::exception including CvbException.

Using the Rect<int> as an overlay uses the CoordinateSystemType::PixelCoordinates.

◆ CreatePlaneHistogram() [2/3]

Histogram CreatePlaneHistogram ( const ImagePlane imagePlane,
double  density = 1.0 
)
inline

Creates a histogram for the whole plane.

Parameters
[in]imagePlaneImage plane to create histogram for.
[in]densityPercentage of pixels to process where 0 is 0% and 1.0 is 100%.
Returns
Histogram for the given plane.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ CreatePlaneHistogram() [3/3]

Histogram CreatePlaneHistogram ( const ImagePlane imagePlane,
Rect< int >  aoi,
double  density = 1.0 
)
inline

Creates a histogram for the aoi in the given plane.

Parameters
[in]imagePlaneImage plane to create histogram for.
[in]aoiArea of interest in CoordinateSystemType::PixelCoordinates.
[in]densityPercentage of pixels to process where 0 is 0% and 1.0 is 100%.
Returns
Histogram for the given plane.
Exceptions
Anyexception derived from std::exception including CvbException.

Using the Rect<int> as an overlay uses the CoordinateSystemType::PixelCoordinates.

◆ FilterHistogram()

TypedRange< std::vector< double >, double, RANGE >::type FilterHistogram ( const std::vector< HISTVAL > &  histogram,
const RANGE &  kernel 
)
inline

Filter a histogram array with the given kernel. At the beginning and end of the histogram, the histogram uses constant extension.

Parameters
[in]histogramHistogram to be filtered.
[in]kernelKernel to be used.
Returns
Filter result.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ FindHistogramPeaks()

std::vector< int > FindHistogramPeaks ( const std::vector< uint64_t > &  histogram,
int  blurSize,
int  minDiff 
)
inline

Find peaks in the histogram identified by the supplied criteria.

Parameters
[in]histogramHistogram to analyze.
[in]blurSizeAveraging window size (must be >= 1).
[in]minDiffMinimum grey value difference between two peaks.
Returns
Peak positions in the histogram.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SumHistogramBetween()

uint64_t SumHistogramBetween ( const std::vector< uint64_t > &  histogram,
int  lowerLimit,
int  upperLimit 
)
inline

Count the number of pixels that lie between two limits in the histogram.

Parameters
[in]histogramHistogram to calculate the sum on.
[in]lowerLimitLower limit to count from.
[in]upperLimitUpper limit to count to (including).
Returns
Number of pixels with a gray value between lowerLimit and upperLimit.
Exceptions
Anyexception derived from std::exception including CvbException.