image_processing.rst 33.4 KB

Image Processing

gpu::meanShiftFiltering

Performs mean-shift filtering for each point of the source image.

It maps each point of the source image into another point. As a result, you have a new color and new position of each point.

gpu::meanShiftProc

Performs a mean-shift procedure and stores information about processed points (their colors and positions) in two images.

gpu::meanShiftSegmentation

Performs a mean-shift segmentation of the source image and eliminates small segments.

gpu::integral

Computes an integral image.

gpu::sqrIntegral

Computes a squared integral image.

gpu::columnSum

Computes a vertical (column) sum.

gpu::cornerHarris

Computes the Harris cornerness criteria at each image pixel.

gpu::cornerMinEigenVal

Computes the minimum eigen value of a 2x2 derivative covariation matrix at each pixel (the cornerness criteria).

gpu::mulSpectrums

Performs a per-element multiplication of two Fourier spectrums.

gpu::mulAndScaleSpectrums

Performs a per-element multiplication of two Fourier spectrums and scales the result.

gpu::dft

Performs a forward or inverse discrete Fourier transform (1D or 2D) of the floating point matrix.

Use to handle real matrices ( CV32FC1 ) and complex matrices in the interleaved format ( CV32FC2 ).

The source matrix should be continuous, otherwise reallocation and data copying is performed. The function chooses an operation mode depending on the flags, size, and channel count of the source matrix:

  • If the source matrix is complex and the output is not specified as real, the destination matrix is complex and has the dft_size size and CV_32FC2 type. The destination matrix contains a full result of the DFT (forward or inverse).
  • If the source matrix is complex and the output is specified as real, the function assumes that its input is the result of the forward transform (see the next item). The destination matrix has the dft_size size and CV_32FC1 type. It contains the result of the inverse DFT.
  • If the source matrix is real (its type is CV_32FC1 ), forward DFT is performed. The result of the DFT is packed into complex ( CV_32FC2 ) matrix. So, the width of the destination matrix is dft_size.width / 2 + 1 . But if the source is a single column, the height is reduced instead of the width.

gpu::ConvolveBuf

Class providing a memory buffer for :ocv:func:`gpu::convolve` function, plus it allows to adjust some specific parameters.

struct CV_EXPORTS ConvolveBuf
{
    Size result_size;
    Size block_size;
    Size user_block_size;
    Size dft_size;
    int spect_len;

    GpuMat image_spect, templ_spect, result_spect;
    GpuMat image_block, templ_block, result_data;

    void create(Size image_size, Size templ_size);
    static Size estimateBlockSize(Size result_size, Size templ_size);
};

You can use field user_block_size to set specific block size for :ocv:func:`gpu::convolve` function. If you leave its default value Size(0,0) then automatic estimation of block size will be used (which is optimized for speed). By varying user_block_size you can reduce memory requirements at the cost of speed.

gpu::ConvolveBuf::create

Constructs a buffer for :ocv:func:`gpu::convolve` function with respective arguments.

gpu::convolve

Computes a convolution (or cross-correlation) of two images.

gpu::MatchTemplateBuf

Class providing memory buffers for :ocv:func:`gpu::matchTemplate` function, plus it allows to adjust some specific parameters.

struct CV_EXPORTS MatchTemplateBuf
{
    Size user_block_size;
    GpuMat imagef, templf;
    std::vector<GpuMat> images;
    std::vector<GpuMat> image_sums;
    std::vector<GpuMat> image_sqsums;
};

You can use field user_block_size to set specific block size for :ocv:func:`gpu::matchTemplate` function. If you leave its default value Size(0,0) then automatic estimation of block size will be used (which is optimized for speed). By varying user_block_size you can reduce memory requirements at the cost of speed.

gpu::matchTemplate

Computes a proximity map for a raster template and an image where the template is searched for.

gpu::remap

Applies a generic geometrical transformation to an image.

The function transforms the source image using the specified map:

\texttt{dst} (x,y) =  \texttt{src} (xmap(x,y), ymap(x,y))

Values of pixels with non-integer coordinates are computed using the bilinear interpolation.

gpu::cvtColor

Converts an image from one color space to another.

3-channel color spaces (like HSV, XYZ, and so on) can be stored in a 4-channel image for better performance.

gpu::swapChannels

Exchanges the color channels of an image in-place.

The methods support arbitrary permutations of the original channels, including replication.

gpu::threshold

Applies a fixed-level threshold to each array element.

gpu::resize

Resizes an image.

gpu::warpAffine

Applies an affine transformation to an image.

gpu::buildWarpAffineMaps

Builds transformation maps for affine transformation.

gpu::warpPerspective

Applies a perspective transformation to an image.

gpu::buildWarpPerspectiveMaps

Builds transformation maps for perspective transformation.

gpu::rotate

Rotates an image around the origin (0,0) and then shifts it.

gpu::copyMakeBorder

Forms a border around an image.

gpu::rectStdDev

Computes a standard deviation of integral images.

gpu::evenLevels

Computes levels with even distribution.

gpu::histEven

Calculates a histogram with evenly distributed bins.

gpu::histRange

Calculates a histogram with bins determined by the levels array.

gpu::calcHist

Calculates histogram for one channel 8-bit image.

gpu::equalizeHist

Equalizes the histogram of a grayscale image.

gpu::buildWarpPlaneMaps

Builds plane warping maps.

gpu::buildWarpCylindricalMaps

Builds cylindrical warping maps.

gpu::buildWarpSphericalMaps

Builds spherical warping maps.

gpu::pyrDown

Smoothes an image and downsamples it.

gpu::pyrUp

Upsamples an image and then smoothes it.

gpu::blendLinear

Performs linear blending of two images.

gpu::alphaComp

Composites two images using alpha opacity values contained in each image.

gpu::Canny

Finds edges in an image using the [Canny86]_ algorithm.