[][src]Function opencv::imgproc::calc_hist

pub fn calc_hist(
    images: &dyn ToInputArray,
    channels: &VectorOfint,
    mask: &dyn ToInputArray,
    hist: &mut dyn ToOutputArray,
    hist_size: &VectorOfint,
    ranges: &VectorOffloat,
    accumulate: bool
) -> Result<()>

Calculates a histogram of a set of arrays.

The function cv::calcHist calculates the histogram of one or more arrays. The elements of a tuple used to increment a histogram bin are taken from the corresponding input arrays at the same location. The sample below shows how to compute a 2D Hue-Saturation histogram for a color image. : @include snippets/imgproc_calcHist.cpp

Parameters

  • images: Source arrays. They all should have the same depth, CV_8U, CV_16U or CV_32F , and the same size. Each of them can have an arbitrary number of channels.
  • nimages: Number of source images.
  • channels: List of the dims channels used to compute the histogram. The first array channels are numerated from 0 to images[0].channels()-1 , the second array channels are counted from images[0].channels() to images[0].channels() + images[1].channels()-1, and so on.
  • mask: Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size as images[i] . The non-zero mask elements mark the array elements counted in the histogram.
  • hist: Output histogram, which is a dense or sparse dims -dimensional array.
  • dims: Histogram dimensionality that must be positive and not greater than CV_MAX_DIMS (equal to 32 in the current OpenCV version).
  • histSize: Array of histogram sizes in each dimension.
  • ranges: Array of the dims arrays of the histogram bin boundaries in each dimension. When the histogram is uniform ( uniform =true), then for each dimension i it is enough to specify the lower (inclusive) boundary inline formula of the 0-th histogram bin and the upper (exclusive) boundary inline formula for the last histogram bin histSize[i]-1 . That is, in case of a uniform histogram each of ranges[i] is an array of 2 elements. When the histogram is not uniform ( uniform=false ), then each of ranges[i] contains histSize[i]+1 elements: inline formula . The array elements, that are not between inline formula and inline formula , are not counted in the histogram.
  • uniform: Flag indicating whether the histogram is uniform or not (see above).
  • accumulate: Accumulation flag. If it is set, the histogram is not cleared in the beginning when it is allocated. This feature enables you to compute a single histogram from several sets of arrays, or to update the histogram in time.

Overloaded parameters

C++ default parameters

  • accumulate: false