### Navigation

- index
- next |
- previous |
- OpenCV 3.0.0.0-dev documentation »
- OpenCV API Reference »
- gpuimgproc. GPU-accelerated Image Processing »

# Histogram Calculation

## gpu::calcHist

Calculates histogram for one channel 8-bit image.

C++:`` void `gpu::``calcHist`(InputArray src, OutputArray hist, Stream& stream=Stream::Null())

  Parameters: | src – Source image with `CV_8UC1` type. hist – Destination histogram with one row, 256 columns, and the `CV_32SC1` type. stream – Stream for the asynchronous version.

## gpu::equalizeHist

Equalizes the histogram of a grayscale image.

C++:`` void `gpu::``equalizeHist`(InputArray src, OutputArray dst, Stream& stream=Stream::Null())

C++:`` void `gpu::``equalizeHist`(InputArray src, OutputArray dst, InputOutputArray buf, Stream& stream=Stream::Null())

  Parameters: | src – Source image with `CV_8UC1` type. dst – Destination image. buf – Optional buffer to avoid extra memory allocations (for many calls with the same sizes). stream – Stream for the asynchronous version.

See also

`equalizeHist()`

## gpu::CLAHE

class `gpu::``CLAHE` : public `cv::``CLAHE`

Base class for Contrast Limited Adaptive Histogram Equalization.

    class CV_EXPORTS CLAHE : public cv::CLAHE
    {
    public:
        using cv::CLAHE::apply;
        virtual void apply(InputArray src, OutputArray dst, Stream& stream) = 0;
    };

## gpu::CLAHE::apply

Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization.

C++:`` void `gpu::CLAHE::``apply`(InputArray src, OutputArray dst)

C++:`` void `gpu::CLAHE::``apply`(InputArray src, OutputArray dst, Stream& stream)

  Parameters: | src – Source image with `CV_8UC1` type. dst – Destination image. stream – Stream for the asynchronous version.

## gpu::createCLAHE

Creates implementation for `gpu::CLAHE` .

C++:`` Ptr<gpu::CLAHE> `createCLAHE`(double clipLimit=40.0, Size tileGridSize=Size(8, 8))

  Parameters: | clipLimit – Threshold for contrast limiting. tileGridSize – Size of grid for histogram equalization. Input image will be divided into equally sized rectangular tiles. `tileGridSize` defines the number of tiles in row and column.

## gpu::evenLevels

Computes levels with even distribution.

C++:`` void `gpu::``evenLevels`(OutputArray levels, int nLevels, int lowerLevel, int upperLevel)

  Parameters: | levels – Destination array. `levels` has 1 row, `nLevels` columns, and the `CV_32SC1` type. nLevels – Number of computed levels. `nLevels` must be at least 2. lowerLevel – Lower boundary value of the lowest level. upperLevel – Upper boundary value of the greatest level.

## gpu::histEven

Calculates a histogram with evenly distributed bins.

C++:`` void `gpu::``histEven`(InputArray src, OutputArray hist, int histSize, int lowerLevel, int upperLevel, Stream& stream=Stream::Null())

C++:`` void `gpu::``histEven`(InputArray src, OutputArray hist, InputOutputArray buf, int histSize, int lowerLevel, int upperLevel, Stream& stream=Stream::Null())

C++:`` void `gpu::``histEven`(InputArray src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream=Stream::Null())

C++:`` void `gpu::``histEven`(InputArray src, GpuMat hist[4], InputOutputArray buf, int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream=Stream::Null())

  Parameters: | src – Source image. `CV_8U`, `CV_16U`, or `CV_16S` depth and 1 or 4 channels are supported. For a four-channel image, all channels are processed separately. hist – Destination histogram with one row, `histSize` columns, and the `CV_32S` type. histSize – Size of the histogram. lowerLevel – Lower boundary of lowest-level bin. upperLevel – Upper boundary of highest-level bin. buf – Optional buffer to avoid extra memory allocations (for many calls with the same sizes). stream – Stream for the asynchronous version.

## gpu::histRange

Calculates a histogram with bins determined by the `levels` array.

C++:`` void `gpu::``histRange`(InputArray src, OutputArray hist, InputArray levels, Stream& stream=Stream::Null())

C++:`` void `gpu::``histRange`(InputArray src, OutputArray hist, InputArray levels, InputOutputArray buf, Stream& stream=Stream::Null())

C++:`` void `gpu::``histRange`(InputArray src, GpuMat hist[4], const GpuMat levels[4], Stream& stream=Stream::Null())

C++:`` void `gpu::``histRange`(InputArray src, GpuMat hist[4], const GpuMat levels[4], InputOutputArray buf, Stream& stream=Stream::Null())

  Parameters: | src – Source image. `CV_8U` , `CV_16U` , or `CV_16S` depth and 1 or 4 channels are supported. For a four-channel image, all channels are processed separately. hist – Destination histogram with one row, `(levels.cols-1)` columns, and the `CV_32SC1` type. levels – Number of levels in the histogram. buf – Optional buffer to avoid extra memory allocations (for many calls with the same sizes). stream – Stream for the asynchronous version.

## Help and Feedback

You did not find what you were looking for?

- Ask a question on the Q&A forum.
- If you think something is missing or wrong in the documentation, please file a bug report.

### Navigation

- index
- next |
- previous |
- OpenCV 3.0.0.0-dev documentation »
- OpenCV API Reference »
- gpuimgproc. GPU-accelerated Image Processing »