Table of Contents

Class CudaInvoke

Namespace
Emgu.CV.Cuda
Assembly
Emgu.CV.dll

This class wraps the functional calls to the opencv_gpu module

public static class CudaInvoke
Inheritance
CudaInvoke
Inherited Members

Properties

HasCuda

Return true if Cuda is found on the system

public static bool HasCuda { get; }

Property Value

bool

Methods

Abs(IInputArray, IOutputArray, Stream)

Computes absolute value of each pixel in an image

public static void Abs(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

The source GpuMat, support depth of Int16 and float.

dst IOutputArray

The resulting GpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

AbsSum(IInputArray, IInputArray)

Returns the sum of absolute values for matrix elements.

public static MCvScalar AbsSum(IInputArray src, IInputArray mask = null)

Parameters

src IInputArray

Source image of any depth except for CV_64F.

mask IInputArray

optional operation mask; it must have the same size as src and CV_8UC1 type.

Returns

MCvScalar

The sum of absolute values for matrix elements.

Absdiff(IInputArray, IInputArray, IOutputArray, Stream)

Computes element-wise absolute difference of two GpuMats (c = abs(a - b)).

public static void Absdiff(IInputArray a, IInputArray b, IOutputArray c, Stream stream = null)

Parameters

a IInputArray

The first GpuMat

b IInputArray

The second GpuMat

c IOutputArray

The result of the element-wise absolute difference.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Add(IInputArray, IInputArray, IOutputArray, IInputArray, DepthType, Stream)

Adds one matrix to another (c = a + b).

public static void Add(IInputArray a, IInputArray b, IOutputArray c, IInputArray mask = null, DepthType depthType = DepthType.Default, Stream stream = null)

Parameters

a IInputArray

The first matrix to be added.

b IInputArray

The second matrix to be added.

c IOutputArray

The sum of the two matrix

mask IInputArray

The optional mask that is used to select a subarray. Use null if not needed

depthType DepthType

Optional depth of the output array.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

AddWeighted(IInputArray, double, IInputArray, double, double, IOutputArray, DepthType, Stream)

Computes the weighted sum of two arrays (dst = alphasrc1 + betasrc2 + gamma)

public static void AddWeighted(IInputArray src1, double alpha, IInputArray src2, double beta, double gamma, IOutputArray dst, DepthType depthType = DepthType.Default, Stream stream = null)

Parameters

src1 IInputArray

The first source GpuMat

alpha double

The weight for src1

src2 IInputArray

The second source GpuMat

beta double

The weight for src2

gamma double

The constant to be added

dst IOutputArray

The result

depthType DepthType

Optional depth of the output array.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

AlphaComp(IInputArray, IInputArray, IOutputArray, AlphaCompTypes, Stream)

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

public static void AlphaComp(IInputArray img1, IInputArray img2, IOutputArray dst, AlphaCompTypes alphaOp, Stream stream = null)

Parameters

img1 IInputArray

First image. Supports CV_8UC4 , CV_16UC4 , CV_32SC4 and CV_32FC4 types.

img2 IInputArray

Second image. Must have the same size and the same type as img1 .

dst IOutputArray

Destination image

alphaOp AlphaCompTypes

Flag specifying the alpha-blending operation

stream Stream

Stream for the asynchronous version

BilateralFilter(IInputArray, IOutputArray, int, float, float, BorderType, Stream)

Applies bilateral filter to the image.

public static void BilateralFilter(IInputArray src, IOutputArray dst, int kernelSize, float sigmaColor, float sigmaSpatial, BorderType borderType = BorderType.Default, Stream stream = null)

Parameters

src IInputArray

The source image

dst IOutputArray

The destination image; should have the same size and the same type as src

kernelSize int

The diameter of each pixel neighborhood, that is used during filtering.

sigmaColor float

Filter sigma in the color space. Larger value of the parameter means that farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting in larger areas of semi-equal color

sigmaSpatial float

Filter sigma in the coordinate space. Larger value of the parameter means that farther pixels will influence each other (as long as their colors are close enough; see sigmaColor). Then d>0, it specifies the neighborhood size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace.

borderType BorderType

Pixel extrapolation method, use DEFAULT for default

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

BitwiseAnd(IInputArray, IInputArray, IOutputArray, IInputArray, Stream)

Calculates per-element bit-wise logical and of two GpuMats: dst(I)=src1(I) & src2(I) if mask(I)!=0 In the case of floating-point GpuMats their bit representations are used for the operation. All the GpuMats must have the same type, except the mask, and the same size

public static void BitwiseAnd(IInputArray src1, IInputArray src2, IOutputArray dst, IInputArray mask = null, Stream stream = null)

Parameters

src1 IInputArray

The first source GpuMat

src2 IInputArray

The second source GpuMat

dst IOutputArray

The destination GpuMat

mask IInputArray

Mask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

BitwiseNot(IInputArray, IOutputArray, IInputArray, Stream)

Calculates per-element bit-wise logical not dst(I)=~src(I) if mask(I)!=0 In the case of floating-point GpuMats their bit representations are used for the operation. All the GpuMats must have the same type, except the mask, and the same size

public static void BitwiseNot(IInputArray src, IOutputArray dst, IInputArray mask = null, Stream stream = null)

Parameters

src IInputArray

The source GpuMat

dst IOutputArray

The destination GpuMat

mask IInputArray

Mask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

BitwiseOr(IInputArray, IInputArray, IOutputArray, IInputArray, Stream)

Calculates per-element bit-wise logical or of two GpuMats: dst(I)=src1(I) | src2(I) if mask(I)!=0 In the case of floating-point GpuMats their bit representations are used for the operation. All the GpuMats must have the same type, except the mask, and the same size

public static void BitwiseOr(IInputArray src1, IInputArray src2, IOutputArray dst, IInputArray mask = null, Stream stream = null)

Parameters

src1 IInputArray

The first source GpuMat

src2 IInputArray

The second source GpuMat

dst IOutputArray

The destination GpuMat

mask IInputArray

Mask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

BitwiseXor(IInputArray, IInputArray, IOutputArray, IInputArray, Stream)

Calculates per-element bit-wise logical conjunction of two GpuMats: dst(I)=src1(I)^src2(I) if mask(I)!=0 In the case of floating-point GpuMats their bit representations are used for the operation. All the GpuMats must have the same type, except the mask, and the same size

public static void BitwiseXor(IInputArray src1, IInputArray src2, IOutputArray dst, IInputArray mask = null, Stream stream = null)

Parameters

src1 IInputArray

The first source GpuMat

src2 IInputArray

The second source GpuMat

dst IOutputArray

The destination GpuMat

mask IInputArray

Mask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

BlendLinear(IInputArray, IInputArray, IInputArray, IInputArray, IOutputArray, Stream)

Performs linear blending of two images.

public static void BlendLinear(IInputArray img1, IInputArray img2, IInputArray weights1, IInputArray weights2, IOutputArray result, Stream stream = null)

Parameters

img1 IInputArray

First image. Supports only CV_8U and CV_32F depth.

img2 IInputArray

Second image. Must have the same size and the same type as img1 .

weights1 IInputArray

Weights for first image. Must have tha same size as img1. Supports only CV_32F type.

weights2 IInputArray

Weights for second image. Must have tha same size as img2. Supports only CV_32F type.

result IOutputArray

Destination image.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Calc(ICudaDenseOpticalFlow, IInputArray, IInputArray, IInputOutputArray, Stream)

Calculates a dense optical flow.

public static void Calc(this ICudaDenseOpticalFlow denseFlow, IInputArray i0, IInputArray i1, IInputOutputArray flow, Stream stream = null)

Parameters

denseFlow ICudaDenseOpticalFlow

The dense optical flow object

i0 IInputArray

first input image.

i1 IInputArray

second input image of the same size and the same type as i0.

flow IInputOutputArray

computed flow image that has the same size as I0 and type CV_32FC2.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Calc(ICudaSparseOpticalFlow, IInputArray, IInputArray, IInputArray, IInputOutputArray, IOutputArray, IOutputArray, Stream)

Calculates a sparse optical flow.

public static void Calc(this ICudaSparseOpticalFlow sparseFlow, IInputArray prevImg, IInputArray nextImg, IInputArray prevPts, IInputOutputArray nextPts, IOutputArray status, IOutputArray err = null, Stream stream = null)

Parameters

sparseFlow ICudaSparseOpticalFlow

The sparse optical flow

prevImg IInputArray

First input image.

nextImg IInputArray

Second input image of the same size and the same type as prevImg.

prevPts IInputArray

Vector of 2D points for which the flow needs to be found.

nextPts IInputOutputArray

Output vector of 2D points containing the calculated new positions of input features in the second image.

status IOutputArray

Output status vector. Each element of the vector is set to 1 if the flow for the corresponding features has been found. Otherwise, it is set to 0.

err IOutputArray

Optional output vector that contains error response for each point (inverse confidence).

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Calc(INvidiaOpticalFlow, IInputArray, IInputArray, IInputOutputArray, Stream, IInputArray, IOutputArray)

Calculates Optical Flow using NVIDIA Optical Flow SDK. NVIDIA GPUs starting with Turing contain a dedicated hardware accelerator for computing optical flow vectors between pairs of images. The optical flow hardware accelerator generates block-based optical flow vectors. The size of the block depends on hardware in use, and can be queried using the function getGridSize(). The block-based flow vectors generated by the hardware can be converted to dense representation(i.e.per-pixel flow vectors) using upSampler() helper function, if needed. The flow vectors are stored in CV_16SC2 format with x and y components of each flow vector in 16-bit signed fixed point representation S10.5.

public static void Calc(this INvidiaOpticalFlow nvidiaOpticalFlow, IInputArray inputImage, IInputArray referenceImage, IInputOutputArray flow, Stream stream = null, IInputArray hint = null, IOutputArray cost = null)

Parameters

nvidiaOpticalFlow INvidiaOpticalFlow

The nvidia optical flow object

inputImage IInputArray

Input image

referenceImage IInputArray

Reference image of the same size and the same type as input image.

flow IInputOutputArray

A buffer consisting of inputImage.Size() / getGridSize() flow vectors in CV_16SC2 format.

stream Stream

Stream for the asynchronous version.

hint IInputArray

Hint buffer if client provides external hints. Must have same size as flow buffer. Caller can provide flow vectors as hints for optical flow calculation.

cost IOutputArray

Cost buffer contains numbers indicating the confidence associated with each of the generated flow vectors. Higher the cost, lower the confidence. Cost buffer is of type CV_32SC1.

CalcAbsSum(IInputArray, IOutputArray, IInputArray, Stream)

Returns the sum of absolute values for matrix elements.

public static void CalcAbsSum(IInputArray src, IOutputArray dst, IInputArray mask = null, Stream stream = null)

Parameters

src IInputArray

Source image of any depth except for CV_64F.

dst IOutputArray

The GpuMat where the result will be stored.

mask IInputArray

optional operation mask; it must have the same size as src1 and CV_8UC1 type.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

CalcHist(IInputArray, IOutputArray, Stream)

Calculates histogram for one channel 8-bit image.

public static void CalcHist(IInputArray src, IOutputArray hist, Stream stream = null)

Parameters

src IInputArray

Source image with CV_8UC1 type.

hist IOutputArray

Destination histogram with one row, 256 columns, and the CV_32SC1 type.

stream Stream

tream for the asynchronous version.

CalcNorm(IInputArray, IOutputArray, NormType, IInputArray, Stream)

Returns the norm of a matrix.

public static void CalcNorm(IInputArray src, IOutputArray dst, NormType normType = NormType.L2, IInputArray mask = null, Stream stream = null)

Parameters

src IInputArray

Source matrix. Any matrices except 64F are supported.

dst IOutputArray

The GpuMat to store the result

normType NormType

Norm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.

mask IInputArray

optional operation mask; it must have the same size as src1 and CV_8UC1 type.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

CalcNormDiff(IInputArray, IInputArray, IOutputArray, NormType, Stream)

Returns the difference of two matrices.

public static void CalcNormDiff(IInputArray src1, IInputArray src2, IOutputArray dst, NormType normType = NormType.L2, Stream stream = null)

Parameters

src1 IInputArray

Source matrix. Any matrices except 64F are supported.

src2 IInputArray

Second source matrix (if any) with the same size and type as src1.

dst IOutputArray

The GpuMat where the result will be stored in

normType NormType

Norm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

CalcSqrSum(IInputArray, IOutputArray, IInputArray, Stream)

Returns the squared sum of matrix elements.

public static void CalcSqrSum(IInputArray src, IOutputArray dst, IInputArray mask = null, Stream stream = null)

Parameters

src IInputArray

Source image of any depth except for CV_64F.

dst IOutputArray

The GpuMat where the result will be stored

mask IInputArray

optional operation mask; it must have the same size as src1 and CV_8UC1 type.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

CartToPolar(IInputArray, IInputArray, IOutputArray, IOutputArray, bool, Stream)

Converts Cartesian coordinates to polar

public static void CartToPolar(IInputArray x, IInputArray y, IOutputArray magnitude, IOutputArray angle, bool angleInDegrees = false, Stream stream = null)

Parameters

x IInputArray

The source GpuMat. Supports only floating-point type

y IInputArray

The source GpuMat. Supports only floating-point type

magnitude IOutputArray

The destination GpuMat. Supports only floating-point type

angle IOutputArray

The destination GpuMat. Supports only floating-point type

angleInDegrees bool

If true, the output angle is in degrees, otherwise in radian

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Compare(IInputArray, IInputArray, IOutputArray, CmpType, Stream)

Compares elements of two GpuMats (c = a <cmpop> b). Supports CV_8UC4, CV_32FC1 types

public static void Compare(IInputArray a, IInputArray b, IOutputArray c, CmpType cmpop, Stream stream = null)

Parameters

a IInputArray

The first GpuMat

b IInputArray

The second GpuMat

c IOutputArray

The result of the comparison.

cmpop CmpType

The type of comparison

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

ConvertFp16(IInputArray, IOutputArray, Stream)

Converts an array to half precision floating number.

public static void ConvertFp16(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

Input array.

dst IOutputArray

Output array.

stream Stream

Stream for the asynchronous version.

CopyMakeBorder(IInputArray, IOutputArray, int, int, int, int, BorderType, MCvScalar, Stream)

Copies a 2D array to a larger destination array and pads borders with the given constant.

public static void CopyMakeBorder(IInputArray src, IOutputArray dst, int top, int bottom, int left, int right, BorderType borderType, MCvScalar value = default, Stream stream = null)

Parameters

src IInputArray

Source image.

dst IOutputArray

Destination image with the same type as src. The size is Size(src.cols+left+right, src.rows+top+bottom).

top int

Number of pixels in each direction from the source image rectangle to extrapolate.

bottom int

Number of pixels in each direction from the source image rectangle to extrapolate.

left int

Number of pixels in each direction from the source image rectangle to extrapolate.

right int

Number of pixels in each direction from the source image rectangle to extrapolate.

borderType BorderType

Border Type

value MCvScalar

Border value.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

CountNonZero(IInputArray)

Counts non-zero array elements

public static int CountNonZero(IInputArray src)

Parameters

src IInputArray

Single-channel source image.

Returns

int

The number of non-zero GpuMat elements

CountNonZero(IInputArray, IOutputArray, Stream)

Counts non-zero array elements

public static void CountNonZero(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

Single-channel source image.

dst IOutputArray

A Gpu mat to hold the result

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

CvtColor(IInputArray, IOutputArray, ColorConversion, int, Stream)

Converts image from one color space to another

public static void CvtColor(IInputArray src, IOutputArray dst, ColorConversion code, int dcn = 0, Stream stream = null)

Parameters

src IInputArray

The source GpuMat

dst IOutputArray

The destination GpuMat

code ColorConversion

The color conversion code

dcn int

Number of channels in the destination image. If the parameter is 0, the number of the channels is derived automatically from src and the code .

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Demosaicing(IInputArray, IOutputArray, DemosaicTypes, int, Stream)

Converts an image from Bayer pattern to RGB or grayscale.

public static void Demosaicing(IInputArray src, IOutputArray dst, DemosaicTypes code, int dcn = -1, Stream stream = null)

Parameters

src IInputArray

Source image (8-bit or 16-bit single channel).

dst IOutputArray

Destination image.

code DemosaicTypes

Color space conversion code (see the description below).

dcn int

Number of channels in the destination image. If the parameter is 0, the number of the channels is derived automatically from src and the code .

stream Stream

Stream for the asynchronous version.

Dft(IInputArray, IOutputArray, Size, DxtType, Stream)

Performs a forward or inverse discrete Fourier transform (1D or 2D) of floating point matrix. Param dft_size is the size of DFT transform.

If the source matrix is not continous, then additional copy will be done, so to avoid copying ensure the source matrix is continous one. If you want to use preallocated output ensure it is continuous too, otherwise it will be reallocated.

Being implemented via CUFFT real-to-complex transform result contains only non-redundant values in CUFFT's format. Result as full complex matrix for such kind of transform cannot be retrieved.

For complex-to-real transform it is assumed that the source matrix is packed in CUFFT's format.

public static void Dft(IInputArray src, IOutputArray dst, Size dftSize, DxtType flags = DxtType.Forward, Stream stream = null)

Parameters

src IInputArray

The source GpuMat

dst IOutputArray

The resulting GpuMat of the DST, must be pre-allocated and continious. If single channel, the result is real. If double channel, the result is complex

dftSize Size

Size of a discrete Fourier transform.

flags DxtType

DFT flags

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Divide(IInputArray, IInputArray, IOutputArray, double, DepthType, Stream)

Computes element-wise quotient of the two GpuMat (c = scale * a / b).

public static void Divide(IInputArray a, IInputArray b, IOutputArray c, double scale = 1, DepthType depthType = DepthType.Default, Stream stream = null)

Parameters

a IInputArray

The first GpuMat

b IInputArray

The second GpuMat

c IOutputArray

The element-wise quotient of the two GpuMat

scale double

The scale

depthType DepthType

Optional depth of the output array.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

DrawColorDisp(IInputArray, IOutputArray, int, Stream)

Colors a disparity image.

public static void DrawColorDisp(IInputArray srcDisp, IOutputArray dstDisp, int ndisp, Stream stream = null)

Parameters

srcDisp IInputArray

Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit floating-point disparity image. If 16-bit signed format is used, the values are assumed to have no fractional bits.

dstDisp IOutputArray

Output disparity image. It has the same size as src_disp. The type is CV_8UC4 in BGRA format (alpha = 255).

ndisp int

Number of disparities.

stream Stream

Stream for the asynchronous version.

EqualizeHist(IInputArray, IOutputArray, Stream)

Equalizes the histogram of a grayscale image.

public static void EqualizeHist(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

Source image with CV_8UC1 type.

dst IOutputArray

Destination image.

stream Stream

Stream for the asynchronous version.

Exp(IInputArray, IOutputArray, Stream)

Computes exponent of each matrix element (b = exp(a))

public static void Exp(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

The source GpuMat. Supports Byte, UInt16, Int16 and float type.

dst IOutputArray

The resulting GpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

FastNlMeansDenoising(IInputArray, IOutputArray, float, int, int, Stream)

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising with several computational optimizations. Noise expected to be a gaussian white noise.

public static void FastNlMeansDenoising(IInputArray src, IOutputArray dst, float h, int searchWindow = 21, int blockSize = 7, Stream stream = null)

Parameters

src IInputArray

Input 8-bit 1-channel, 2-channel or 3-channel image.

dst IOutputArray

Output image with the same size and type as src.

h float

Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

searchWindow int

Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater search_window - greater denoising time. Recommended value 21 pixels

blockSize int

Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

FastNlMeansDenoisingColored(IInputArray, IOutputArray, float, float, int, int, Stream)

Modification of fastNlMeansDenoising function for colored images.

public static void FastNlMeansDenoisingColored(IInputArray src, IOutputArray dst, float hLuminance, float photoRender, int searchWindow = 21, int blockSize = 7, Stream stream = null)

Parameters

src IInputArray

Input 8-bit 3-channel image.

dst IOutputArray

Output image with the same size and type as src.

hLuminance float

Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

photoRender float

The same as h but for color components. For most images value equals 10 will be enough to remove colored noise and do not distort colors

searchWindow int

Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater search_window - greater denoising time. Recommended value 21 pixels

blockSize int

Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

FindMinMaxLoc(IInputArray, IOutputArray, IOutputArray, IInputArray, Stream)

Finds global minimum and maximum matrix elements and returns their values with locations.

public static void FindMinMaxLoc(IInputArray src, IOutputArray minMaxVals, IOutputArray loc, IInputArray mask = null, Stream stream = null)

Parameters

src IInputArray

Single-channel source image.

minMaxVals IOutputArray

The output min and max values

loc IOutputArray

The ouput min and max locations

mask IInputArray

Optional mask to select a sub-matrix.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Flip(IInputArray, IOutputArray, FlipType, Stream)

Flips the GpuMat<Byte> in one of different 3 ways (row and column indices are 0-based).

public static void Flip(IInputArray src, IOutputArray dst, FlipType flipType, Stream stream = null)

Parameters

src IInputArray

The source GpuMat. supports 1, 3 and 4 channels GpuMat with Byte, UInt16, int or float depth

dst IOutputArray

Destination GpuMat. The same source and type as src

flipType FlipType

Specifies how to flip the GpuMat.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

GammaCorrection(IInputArray, IOutputArray, bool, Stream)

Routines for correcting image color gamma

public static void GammaCorrection(IInputArray src, IOutputArray dst, bool forward = true, Stream stream = null)

Parameters

src IInputArray

Source image (3- or 4-channel 8 bit).

dst IOutputArray

Destination image.

forward bool

True for forward gamma correction or false for inverse gamma correction.

stream Stream

Stream for the asynchronous version.

Gemm(IInputArray, IInputArray, double, IInputArray, double, IOutputArray, GemmType, Stream)

Performs generalized matrix multiplication: dst = alpha*op(src1)op(src2) + betaop(src3), where op(X) is X or XT

public static void Gemm(IInputArray src1, IInputArray src2, double alpha, IInputArray src3, double beta, IOutputArray dst, GemmType tABC = GemmType.Default, Stream stream = null)

Parameters

src1 IInputArray

The first source array.

src2 IInputArray

The second source array.

alpha double

The scalar

src3 IInputArray

The third source array (shift). Can be IntPtr.Zero, if there is no shift.

beta double

The scalar

dst IOutputArray

The destination array.

tABC GemmType

The gemm operation type

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

GetCudaDevicesSummary()

Get the cuda platform summary as a string

public static string GetCudaDevicesSummary()

Returns

string

A cuda platform summary

GetCudaEnabledDeviceCount()

Get the number of Cuda enabled devices

public static extern int GetCudaEnabledDeviceCount()

Returns

int

The number of Cuda enabled devices

GetDevice()

Get the current Cuda device id

public static extern int GetDevice()

Returns

int

The current Cuda device id

GetRegion(nint, ref Range, ref Range)

Create a GpuMat from the specific region of gpuMat. The data is shared between the two GpuMat.

public static extern nint GetRegion(nint gpuMat, ref Range rowRange, ref Range colRange)

Parameters

gpuMat nint

The gpuMat to extract regions from.

rowRange Range

The row range. Use MCvSlice.WholeSeq for all rows.

colRange Range

The column range. Use MCvSlice.WholeSeq for all columns.

Returns

nint

Pointer to the GpuMat

GetSubRect(nint, ref Rectangle)

Returns header, corresponding to a specified rectangle of the input GpuMat. In other words, it allows the user to treat a rectangular part of input array as a stand-alone array.

public static extern nint GetSubRect(nint mat, ref Rectangle rect)

Parameters

mat nint

Input GpuMat

rect Rectangle

Zero-based coordinates of the rectangle of interest.

Returns

nint

Pointer to the resultant sub-array header.

GpuMatReshape(nint, nint, int, int)

gpuMatReshape the src GpuMat

public static extern void GpuMatReshape(nint src, nint dst, int cn, int rows)

Parameters

src nint

The source GpuMat

dst nint

The resulting GpuMat, as input it should be an empty GpuMat.

cn int

The new number of channels

rows int

The new number of rows

HistEven(IInputArray, IOutputArray, int, int, int, Stream)

Calculates histogram with evenly distributed bins for single channel source.

public static void HistEven(IInputArray src, IOutputArray hist, int histSize, int lowerLevel, int upperLevel, Stream stream = null)

Parameters

src IInputArray

The source GpuMat. Supports CV_8UC1, CV_16UC1 and CV_16SC1 types.

hist IOutputArray

Histogram with evenly distributed bins. A GpuMat<int> type.

histSize int

The size of histogram (number of levels)

lowerLevel int

The lower level

upperLevel int

The upper level

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

HistRange(IInputArray, IOutputArray, IInputArray, Stream)

Calculates a histogram with bins determined by the levels array

public static void HistRange(IInputArray src, IOutputArray hist, IInputArray levels, Stream stream = null)

Parameters

src IInputArray

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 IOutputArray

Destination histogram with one row, (levels.cols-1) columns, and the CV_32SC1 type.

levels IInputArray

Number of levels in the histogram.

stream Stream

Stream for the asynchronous version.

InRange(IInputArray, MCvScalar, MCvScalar, IOutputArray, Stream)

Checks if array elements lie between two scalars.

public static void InRange(IInputArray src, MCvScalar lowerb, MCvScalar upperb, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

First input array.

lowerb MCvScalar

Inclusive lower boundary

upperb MCvScalar

Inclusive upper boundary

dst IOutputArray

Output array of the same size as src and CV_8U type.

stream Stream

Stream for the asynchronous version.

Integral(IInputArray, IOutputArray, Stream)

Computes the integral image and integral for the squared image

public static void Integral(IInputArray src, IOutputArray sum, Stream stream = null)

Parameters

src IInputArray

The source GpuMat, supports only CV_8UC1 source type

sum IOutputArray

The sum GpuMat, supports only CV_32S source type, but will contain unsigned int values

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

LShift(IInputArray, MCvScalar, IOutputArray, Stream)

Shifts a matrix to the left (c = a << scalar)

public static void LShift(IInputArray a, MCvScalar scalar, IOutputArray c, Stream stream = null)

Parameters

a IInputArray

The matrix to be shifted.

scalar MCvScalar

The scalar to shift by.

c IOutputArray

The result of the shift

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Log(IInputArray, IOutputArray, Stream)

Computes natural logarithm of absolute value of each matrix element: b = log(abs(a))

public static void Log(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

The source GpuMat. Supports Byte, UInt16, Int16 and float type.

dst IOutputArray

The resulting GpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Magnitude(IInputArray, IInputArray, IOutputArray, Stream)

Computes magnitude of each (x(i), y(i)) vector

public static void Magnitude(IInputArray x, IInputArray y, IOutputArray magnitude, Stream stream = null)

Parameters

x IInputArray

The source GpuMat. Supports only floating-point type

y IInputArray

The source GpuMat. Supports only floating-point type

magnitude IOutputArray

The destination GpuMat. Supports only floating-point type

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

MagnitudeSqr(IInputArray, IInputArray, IOutputArray, Stream)

Computes squared magnitude of each (x(i), y(i)) vector

public static void MagnitudeSqr(IInputArray x, IInputArray y, IOutputArray magnitude, Stream stream = null)

Parameters

x IInputArray

The source GpuMat. Supports only floating-point type

y IInputArray

The source GpuMat. Supports only floating-point type

magnitude IOutputArray

The destination GpuMat. Supports only floating-point type

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Max(IInputArray, IInputArray, IOutputArray, Stream)

Computes per-element maximum of two GpuMats (dst = max(src1, src2))

public static void Max(IInputArray src1, IInputArray src2, IOutputArray dst, Stream stream = null)

Parameters

src1 IInputArray

The first GpuMat

src2 IInputArray

The second GpuMat

dst IOutputArray

The result GpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

MeanShiftFiltering(IInputArray, IOutputArray, int, int, MCvTermCriteria, Stream)

Performs mean-shift filtering for each point of the source image. It maps each point of the source image into another point, and as the result we have new color and new position of each point.

public static void MeanShiftFiltering(IInputArray src, IOutputArray dst, int sp, int sr, MCvTermCriteria criteria, Stream stream = null)

Parameters

src IInputArray

Source CudaImage. Only CV 8UC4 images are supported for now.

dst IOutputArray

Destination CudaImage, containing color of mapped points. Will have the same size and type as src.

sp int

Spatial window radius.

sr int

Color window radius.

criteria MCvTermCriteria

Termination criteria.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

MeanShiftProc(IInputArray, IOutputArray, IOutputArray, int, int, MCvTermCriteria, Stream)

Performs mean-shift procedure and stores information about processed points (i.e. their colors and positions) into two images.

public static void MeanShiftProc(IInputArray src, IOutputArray dstr, IOutputArray dstsp, int sp, int sr, MCvTermCriteria criteria, Stream stream = null)

Parameters

src IInputArray

Source CudaImage. Only CV 8UC4 images are supported for now.

dstr IOutputArray

Destination CudaImage, containing color of mapped points. Will have the same size and type as src.

dstsp IOutputArray

Destination CudaImage, containing position of mapped points. Will have the same size as src and CV 16SC2 type.

sp int

Spatial window radius.

sr int

Color window radius.

criteria MCvTermCriteria

Termination criteria.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

MeanShiftSegmentation(IInputArray, IOutputArray, int, int, int, MCvTermCriteria, Stream)

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

public static void MeanShiftSegmentation(IInputArray src, IOutputArray dst, int sp, int sr, int minSize, MCvTermCriteria criteria, Stream stream)

Parameters

src IInputArray

Source CudaImage. Only CV 8UC4 images are supported for now.

dst IOutputArray

Segmented Image. Will have the same size and type as src. Note that this is an Image type and not CudaImage type

sp int

Spatial window radius.

sr int

Color window radius.

minSize int

Minimum segment size. Smaller segements will be merged.

criteria MCvTermCriteria

Termination criteria.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

MeanStdDev(IInputArray, ref MCvScalar, ref MCvScalar)

Computes mean value and standard deviation

public static void MeanStdDev(IInputArray mtx, ref MCvScalar mean, ref MCvScalar stddev)

Parameters

mtx IInputArray

The GpuMat. Supports only CV_8UC1 type

mean MCvScalar

The mean value

stddev MCvScalar

The standard deviation

Merge(VectorOfGpuMat, IOutputArray, Stream)

Makes multi-channel GpuMat out of several single-channel GpuMats

public static void Merge(VectorOfGpuMat srcArr, IOutputArray dst, Stream stream = null)

Parameters

srcArr VectorOfGpuMat

Pointer to an array of single channel GpuMat pointers

dst IOutputArray

The multi-channel gpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or IntPtr.Zero to call the function synchronously (blocking).

Min(IInputArray, IInputArray, IOutputArray, Stream)

Computes per-element minimum of two GpuMats (dst = min(src1, src2))

public static void Min(IInputArray src1, IInputArray src2, IOutputArray dst, Stream stream = null)

Parameters

src1 IInputArray

The first GpuMat

src2 IInputArray

The second GpuMat

dst IOutputArray

The result GpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

MinMaxLoc(IInputArray, ref double, ref double, ref Point, ref Point, IInputArray)

Finds minimum and maximum element values and their positions. The extremums are searched over the whole GpuMat or, if mask is not IntPtr.Zero, in the specified GpuMat region.

public static void MinMaxLoc(IInputArray gpuMat, ref double minVal, ref double maxVal, ref Point minLoc, ref Point maxLoc, IInputArray mask = null)

Parameters

gpuMat IInputArray

The source GpuMat, single-channel

minVal double

Pointer to returned minimum value

maxVal double

Pointer to returned maximum value

minLoc Point

Pointer to returned minimum location

maxLoc Point

Pointer to returned maximum location

mask IInputArray

The optional mask that is used to select a subarray. Use null if not needed

MulAndScaleSpectrums(IInputArray, IInputArray, IOutputArray, int, float, bool, Stream)

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

public static void MulAndScaleSpectrums(IInputArray src1, IInputArray src2, IOutputArray dst, int flags, float scale, bool conjB = false, Stream stream = null)

Parameters

src1 IInputArray

First spectrum.

src2 IInputArray

Second spectrum with the same size and type.

dst IOutputArray

Destination spectrum.

flags int

Mock parameter used for CPU/CUDA interfaces similarity, simply add a 0 value.

scale float

Scale constant.

conjB bool

Optional flag to specify if the second spectrum needs to be conjugated before the multiplication.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

MulSpectrums(IInputArray, IInputArray, IOutputArray, int, bool, Stream)

Performs a per-element multiplication of two Fourier spectrums.

public static void MulSpectrums(IInputArray src1, IInputArray src2, IOutputArray dst, int flags, bool conjB = false, Stream stream = null)

Parameters

src1 IInputArray

First spectrum.

src2 IInputArray

Second spectrum with the same size and type.

dst IOutputArray

Destination spectrum.

flags int

Mock parameter used for CPU/CUDA interfaces similarity.

conjB bool

Optional flag to specify if the second spectrum needs to be conjugated before the multiplication.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Multiply(IInputArray, IInputArray, IOutputArray, double, DepthType, Stream)

Computes element-wise product of the two GpuMat: c = scale * a * b.

public static void Multiply(IInputArray a, IInputArray b, IOutputArray c, double scale = 1, DepthType depthType = DepthType.Default, Stream stream = null)

Parameters

a IInputArray

The first GpuMat to be element-wise multiplied.

b IInputArray

The second GpuMat to be element-wise multiplied.

c IOutputArray

The element-wise multiplication of the two GpuMat

scale double

The scale

depthType DepthType

Optional depth of the output array.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

NonLocalMeans(IInputArray, IOutputArray, float, int, int, BorderType, Stream)

Performs pure non local means denoising without any simplification, and thus it is not fast.

public static void NonLocalMeans(IInputArray src, IOutputArray dst, float h, int searchWindow = 21, int blockSize = 7, BorderType borderMode = BorderType.Default, Stream stream = null)

Parameters

src IInputArray

Source image. Supports only CV_8UC1, CV_8UC2 and CV_8UC3.

dst IOutputArray

Destination image.

h float

Filter sigma regulating filter strength for color.

searchWindow int

Size of search window.

blockSize int

Size of block used for computing weights.

borderMode BorderType

Border type. REFLECT101 , REPLICATE, CONSTANT, REFLECT and WRAP are supported for now.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Norm(IInputArray, NormType, IInputArray)

Returns the norm of a matrix.

public static double Norm(IInputArray src, NormType normType, IInputArray mask = null)

Parameters

src IInputArray

Source matrix. Any matrices except 64F are supported.

normType NormType

Norm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.

mask IInputArray

optional operation mask; it must have the same size as src1 and CV_8UC1 type.

Returns

double

The norm of a matrix

Norm(IInputArray, IInputArray, NormType)

Computes norm of the difference between two GpuMats

public static double Norm(IInputArray src1, IInputArray src2, NormType normType = NormType.L2)

Parameters

src1 IInputArray

The GpuMat. Supports only CV_8UC1 type

src2 IInputArray

If IntPtr.Zero, norm operation is apply to src1 only. Otherwise, this is the GpuMat of type CV_8UC1

normType NormType

The norm type. Supports NORM_INF, NORM_L1, NORM_L2.

Returns

double

The norm of the src1 if src2 is IntPtr.Zero. Otherwise the norm of the difference between two GpuMats.

Normalize(IInputArray, IOutputArray, double, double, NormType, DepthType, IInputArray, Stream)

Normalizes the norm or value range of an array.

public static void Normalize(IInputArray src, IOutputArray dst, double alpha, double beta, NormType normType, DepthType depthType, IInputArray mask = null, Stream stream = null)

Parameters

src IInputArray

Input array.

dst IOutputArray

Output array of the same size as src .

alpha double

Norm value to normalize to or the lower range boundary in case of the range normalization.

beta double

Upper range boundary in case of the range normalization; it is not used for the norm normalization.

normType NormType

Normalization type ( NORM_MINMAX , NORM_L2 , NORM_L1 or NORM_INF ).

depthType DepthType

Optional depth of the output array.

mask IInputArray

Optional operation mask.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Phase(IInputArray, IInputArray, IOutputArray, bool, Stream)

Computes angle (angle(i)) of each (x(i), y(i)) vector

public static void Phase(IInputArray x, IInputArray y, IOutputArray angle, bool angleInDegrees = false, Stream stream = null)

Parameters

x IInputArray

The source GpuMat. Supports only floating-point type

y IInputArray

The source GpuMat. Supports only floating-point type

angle IOutputArray

The destination GpuMat. Supports only floating-point type

angleInDegrees bool

If true, the output angle is in degrees, otherwise in radian

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

PolarToCart(IInputArray, IInputArray, IOutputArray, IOutputArray, bool, Stream)

Converts polar coordinates to Cartesian

public static void PolarToCart(IInputArray magnitude, IInputArray angle, IOutputArray x, IOutputArray y, bool angleInDegrees = false, Stream stream = null)

Parameters

magnitude IInputArray

The source GpuMat. Supports only floating-point type

angle IInputArray

The source GpuMat. Supports only floating-point type

x IOutputArray

The destination GpuMat. Supports only floating-point type

y IOutputArray

The destination GpuMat. Supports only floating-point type

angleInDegrees bool

If true, the input angle is in degrees, otherwise in radian

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Pow(IInputArray, double, IOutputArray, Stream)

Computes power of each matrix element: (dst(i,j) = pow( src(i,j) , power), if src.type() is integer; (dst(i,j) = pow(fabs(src(i,j)), power), otherwise. supports all, except depth == CV_64F

public static void Pow(IInputArray src, double power, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

The source GpuMat

power double

The power

dst IOutputArray

The resulting GpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

PrintCudaDeviceInfo(int)

Print cuda device info

public static extern void PrintCudaDeviceInfo(int device)

Parameters

device int

cuda device id

PrintShortCudaDeviceInfo(int)

Print short cuda device info

public static extern void PrintShortCudaDeviceInfo(int device)

Parameters

device int

cuda device id

PyrDown(IInputArray, IOutputArray, Stream)

Performs downsampling step of Gaussian pyramid decomposition.

public static void PyrDown(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

The source CudaImage.

dst IOutputArray

The destination CudaImage, should have 2x smaller width and height than the source.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

PyrUp(IInputArray, IOutputArray, Stream)

Performs up-sampling step of Gaussian pyramid decomposition.

public static void PyrUp(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

The source CudaImage.

dst IOutputArray

The destination image, should have 2x smaller width and height than the source.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

RShift(IInputArray, MCvScalar, IOutputArray, Stream)

Shifts a matrix to the right (c = a >> scalar)

public static void RShift(IInputArray a, MCvScalar scalar, IOutputArray c, Stream stream = null)

Parameters

a IInputArray

The matrix to be shifted.

scalar MCvScalar

The scalar to shift by.

c IOutputArray

The result of the shift

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Reduce(IInputArray, IOutputArray, ReduceDimension, ReduceType, DepthType, Stream)

Reduces GpuMat to a vector by treating the GpuMat rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained.

public static void Reduce(IInputArray mtx, IOutputArray vec, ReduceDimension dim, ReduceType reduceOp, DepthType dType = DepthType.Default, Stream stream = null)

Parameters

mtx IInputArray

The input GpuMat

vec IOutputArray

Destination vector. Its size and type is defined by dim and dtype parameters

dim ReduceDimension

Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column.

reduceOp ReduceType

The reduction operation type

dType DepthType

Optional depth of the output array.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Remap(IInputArray, IOutputArray, IInputArray, IInputArray, Inter, BorderType, MCvScalar, Stream)

DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation.

public static void Remap(IInputArray src, IOutputArray dst, IInputArray xmap, IInputArray ymap, Inter interpolation, BorderType borderMode = BorderType.Constant, MCvScalar borderValue = default, Stream stream = null)

Parameters

src IInputArray

The source GpuMat. Supports CV_8UC1, CV_8UC3 source types.

dst IOutputArray

The dstination GpuMat. Supports CV_8UC1, CV_8UC3 source types.

xmap IInputArray

The xmap. Supports CV_32FC1 map type.

ymap IInputArray

The ymap. Supports CV_32FC1 map type.

interpolation Inter

Interpolation type.

borderMode BorderType

Border mode. Use BORDER_CONSTANT for default.

borderValue MCvScalar

The value of the border.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

ResetDevice()

Explicitly destroys and cleans up all resources associated with the current device in the current process. Any subsequent API call to this device will reinitialize the device.

public static extern void ResetDevice()

Resize(IInputArray, IOutputArray, Size, double, double, Inter, Stream)

Resizes the image.

public static void Resize(IInputArray src, IOutputArray dst, Size dsize, double fx = 0, double fy = 0, Inter interpolation = Inter.Linear, Stream stream = null)

Parameters

src IInputArray

The source image. Has to be GpuMat<Byte>. If stream is used, the GpuMat has to be either single channel or 4 channels.

dst IOutputArray

The destination image.

dsize Size

Destination image size. If it is zero, it is computed as: dsize = Size(round(fx* src.cols), round(fy* src.rows)). Either dsize or both fx and fy must be non-zero.

fx double

Scale factor along the horizontal axis. If it is zero, it is computed as: (double)dsize.width/src.cols

fy double

Scale factor along the vertical axis. If it is zero, it is computed as: (double)dsize.height/src.rows

interpolation Inter

The interpolation type. Supports INTER_NEAREST, INTER_LINEAR.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Rotate(IInputArray, IOutputArray, Size, double, double, double, Inter, Stream)

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

public static void Rotate(IInputArray src, IOutputArray dst, Size dSize, double angle, double xShift = 0, double yShift = 0, Inter interpolation = Inter.Linear, Stream stream = null)

Parameters

src IInputArray

Source image. Supports 1, 3 or 4 channels images with Byte, UInt16 or float depth

dst IOutputArray

Destination image with the same type as src. Must be pre-allocated

dSize Size

The size of the destination image

angle double

Angle of rotation in degrees

xShift double

Shift along the horizontal axis

yShift double

Shift along the verticle axis

interpolation Inter

Interpolation method. Only INTER_NEAREST, INTER_LINEAR, and INTER_CUBIC are supported.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

SetDevice(int)

Set the current Gpu Device

public static extern void SetDevice(int deviceId)

Parameters

deviceId int

The id of the device to be setted as current

SetGlDevice(int)

Sets a CUDA device and initializes it for the current thread with OpenGL interoperability. This function should be explicitly called after OpenGL context creation and before any CUDA calls.

public static void SetGlDevice(int device = 0)

Parameters

device int

System index of a CUDA device starting with 0.

Split(IInputArray, VectorOfGpuMat, Stream)

Copies each plane of a multi-channel GpuMat to a dedicated GpuMat

public static void Split(IInputArray src, VectorOfGpuMat dstArray, Stream stream = null)

Parameters

src IInputArray

The multi-channel gpuMat

dstArray VectorOfGpuMat

Pointer to an array of single channel GpuMat pointers

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or IntPtr.Zero to call the function synchronously (blocking).

Sqr(IInputArray, IOutputArray, Stream)

Computes square of each pixel in an image

public static void Sqr(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

The source GpuMat, support depth of byte, UInt16, Int16 and float.

dst IOutputArray

The resulting GpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

SqrIntegral(IInputArray, IOutputArray, Stream)

Computes squared integral image

public static void SqrIntegral(IInputArray src, IOutputArray sqsum, Stream stream = null)

Parameters

src IInputArray

The source GpuMat, supports only CV_8UC1 source type

sqsum IOutputArray

The sqsum GpuMat, supports only CV32F source type.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

SqrSum(IInputArray, IInputArray)

Returns the squared sum of matrix elements.

public static MCvScalar SqrSum(IInputArray src, IInputArray mask = null)

Parameters

src IInputArray

Source image of any depth except for CV_64F.

mask IInputArray

optional operation mask; it must have the same size as src1 and CV_8UC1 type.

Returns

MCvScalar

The squared sum of matrix elements.

Sqrt(IInputArray, IOutputArray, Stream)

Computes square root of each pixel in an image

public static void Sqrt(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

The source GpuMat, support depth of byte, UInt16, Int16 and float.

dst IOutputArray

The resulting GpuMat

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Subtract(IInputArray, IInputArray, IOutputArray, IInputArray, DepthType, Stream)

Subtracts one matrix from another (c = a - b).

public static void Subtract(IInputArray a, IInputArray b, IOutputArray c, IInputArray mask = null, DepthType depthType = DepthType.Default, Stream stream = null)

Parameters

a IInputArray

The matrix where subtraction take place

b IInputArray

The matrix to be substracted

c IOutputArray

The result of a - b

mask IInputArray

The optional mask that is used to select a subarray. Use null if not needed

depthType DepthType

Optional depth of the output array.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

SwapChannels(IInputOutputArray, int[], Stream)

Swap channels.

public static void SwapChannels(IInputOutputArray src, int[] dstOrder, Stream stream)

Parameters

src IInputOutputArray

The image where the channels will be swapped

dstOrder int[]

Integer array describing how channel values are permutated. The n-th entry of the array contains the number of the channel that is stored in the n-th channel of the output image. E.g. Given an RGBA image, aDstOrder = [3,2,1,0] converts this to ABGR channel order.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Threshold(IInputArray, IOutputArray, double, double, ThresholdType, Stream)

Applies fixed-level thresholding to single-channel array. The function is typically used to get bi-level (binary) image out of grayscale image or for removing a noise, i.e. filtering out pixels with too small or too large values. There are several types of thresholding the function supports that are determined by thresholdType

public static double Threshold(IInputArray src, IOutputArray dst, double threshold, double maxValue, ThresholdType thresholdType, Stream stream = null)

Parameters

src IInputArray

Source array (single-channel, 8-bit of 32-bit floating point).

dst IOutputArray

Destination array; must be either the same type as src or 8-bit.

threshold double

Threshold value

maxValue double

Maximum value to use with CV_THRESH_BINARY and CV_THRESH_BINARY_INV thresholding types

thresholdType ThresholdType

Thresholding type

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

Returns

double

The computed threshold value if Otsu's or Triangle methods used.

Transpose(IInputArray, IOutputArray, Stream)

Transposes a matrix.

public static void Transpose(IInputArray src, IOutputArray dst, Stream stream = null)

Parameters

src IInputArray

Source matrix. 1-, 4-, 8-byte element sizes are supported for now.

dst IOutputArray

Destination matrix.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

WarpAffine(IInputArray, IOutputArray, IInputArray, Size, Inter, BorderType, MCvScalar, Stream)

Warps the image using affine transformation

public static void WarpAffine(IInputArray src, IOutputArray dst, IInputArray M, Size dSize, Inter flags = Inter.Linear, BorderType borderMode = BorderType.Constant, MCvScalar borderValue = default, Stream stream = null)

Parameters

src IInputArray

The source GpuMat

dst IOutputArray

The destination GpuMat

M IInputArray

The 2x3 transformation matrix (pointer to CvArr)

dSize Size

The size of the destination image

flags Inter

Supports NN, LINEAR, CUBIC

borderMode BorderType

The border mode, use BORDER_TYPE.CONSTANT for default.

borderValue MCvScalar

The border value, use new MCvScalar() for default.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).

WarpPerspective(IInputArray, IOutputArray, IInputArray, Size, Inter, BorderType, MCvScalar, Stream)

Warps the image using perspective transformation

public static void WarpPerspective(IInputArray src, IOutputArray dst, IInputArray M, Size dSize, Inter flags = Inter.Linear, BorderType borderMode = BorderType.Constant, MCvScalar borderValue = default, Stream stream = null)

Parameters

src IInputArray

The source GpuMat

dst IOutputArray

The destination GpuMat

M IInputArray

The 2x3 transformation matrix (pointer to CvArr)

dSize Size

The size of the destination image

flags Inter

Supports NN, LINEAR, CUBIC

borderMode BorderType

The border mode, use BORDER_TYPE.CONSTANT for default.

borderValue MCvScalar

The border value, use new MCvScalar() for default.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).