Class CudaInvoke
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
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
IInputArrayThe source GpuMat, support depth of Int16 and float.
dst
IOutputArrayThe resulting GpuMat
stream
StreamUse 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
IInputArraySource image of any depth except for CV_64F.
mask
IInputArrayoptional 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
IInputArrayThe first GpuMat
b
IInputArrayThe second GpuMat
c
IOutputArrayThe result of the element-wise absolute difference.
stream
StreamUse 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
IInputArrayThe first matrix to be added.
b
IInputArrayThe second matrix to be added.
c
IOutputArrayThe sum of the two matrix
mask
IInputArrayThe optional mask that is used to select a subarray. Use null if not needed
depthType
DepthTypeOptional depth of the output array.
stream
StreamUse 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
IInputArrayThe first source GpuMat
alpha
doubleThe weight for
src1
src2
IInputArrayThe second source GpuMat
beta
doubleThe weight for
src2
gamma
doubleThe constant to be added
dst
IOutputArrayThe result
depthType
DepthTypeOptional depth of the output array.
stream
StreamUse 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
IInputArrayFirst image. Supports CV_8UC4 , CV_16UC4 , CV_32SC4 and CV_32FC4 types.
img2
IInputArraySecond image. Must have the same size and the same type as img1 .
dst
IOutputArrayDestination image
alphaOp
AlphaCompTypesFlag specifying the alpha-blending operation
stream
StreamStream 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
IInputArrayThe source image
dst
IOutputArrayThe destination image; should have the same size and the same type as src
kernelSize
intThe diameter of each pixel neighborhood, that is used during filtering.
sigmaColor
floatFilter 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
floatFilter 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
BorderTypePixel extrapolation method, use DEFAULT for default
stream
StreamUse 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
IInputArrayThe first source GpuMat
src2
IInputArrayThe second source GpuMat
dst
IOutputArrayThe destination GpuMat
mask
IInputArrayMask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.
stream
StreamUse 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
IInputArrayThe source GpuMat
dst
IOutputArrayThe destination GpuMat
mask
IInputArrayMask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.
stream
StreamUse 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
IInputArrayThe first source GpuMat
src2
IInputArrayThe second source GpuMat
dst
IOutputArrayThe destination GpuMat
mask
IInputArrayMask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.
stream
StreamUse 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
IInputArrayThe first source GpuMat
src2
IInputArrayThe second source GpuMat
dst
IOutputArrayThe destination GpuMat
mask
IInputArrayMask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.
stream
StreamUse 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
IInputArrayFirst image. Supports only CV_8U and CV_32F depth.
img2
IInputArraySecond image. Must have the same size and the same type as img1 .
weights1
IInputArrayWeights for first image. Must have tha same size as img1. Supports only CV_32F type.
weights2
IInputArrayWeights for second image. Must have tha same size as img2. Supports only CV_32F type.
result
IOutputArrayDestination image.
stream
StreamUse 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
ICudaDenseOpticalFlowThe dense optical flow object
i0
IInputArrayfirst input image.
i1
IInputArraysecond input image of the same size and the same type as
i0
.flow
IInputOutputArraycomputed flow image that has the same size as I0 and type CV_32FC2.
stream
StreamUse 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
ICudaSparseOpticalFlowThe sparse optical flow
prevImg
IInputArrayFirst input image.
nextImg
IInputArraySecond input image of the same size and the same type as
prevImg
.prevPts
IInputArrayVector of 2D points for which the flow needs to be found.
nextPts
IInputOutputArrayOutput vector of 2D points containing the calculated new positions of input features in the second image.
status
IOutputArrayOutput 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
IOutputArrayOptional output vector that contains error response for each point (inverse confidence).
stream
StreamUse 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
INvidiaOpticalFlowThe nvidia optical flow object
inputImage
IInputArrayInput image
referenceImage
IInputArrayReference image of the same size and the same type as input image.
flow
IInputOutputArrayA buffer consisting of inputImage.Size() / getGridSize() flow vectors in CV_16SC2 format.
stream
StreamStream for the asynchronous version.
hint
IInputArrayHint 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
IOutputArrayCost 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
IInputArraySource image of any depth except for CV_64F.
dst
IOutputArrayThe GpuMat where the result will be stored.
mask
IInputArrayoptional operation mask; it must have the same size as src1 and CV_8UC1 type.
stream
StreamUse 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
IInputArraySource image with CV_8UC1 type.
hist
IOutputArrayDestination histogram with one row, 256 columns, and the CV_32SC1 type.
stream
Streamtream 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
IInputArraySource matrix. Any matrices except 64F are supported.
dst
IOutputArrayThe GpuMat to store the result
normType
NormTypeNorm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.
mask
IInputArrayoptional operation mask; it must have the same size as src1 and CV_8UC1 type.
stream
StreamUse 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
IInputArraySource matrix. Any matrices except 64F are supported.
src2
IInputArraySecond source matrix (if any) with the same size and type as src1.
dst
IOutputArrayThe GpuMat where the result will be stored in
normType
NormTypeNorm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.
stream
StreamUse 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
IInputArraySource image of any depth except for CV_64F.
dst
IOutputArrayThe GpuMat where the result will be stored
mask
IInputArrayoptional operation mask; it must have the same size as src1 and CV_8UC1 type.
stream
StreamUse 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
IInputArrayThe source GpuMat. Supports only floating-point type
y
IInputArrayThe source GpuMat. Supports only floating-point type
magnitude
IOutputArrayThe destination GpuMat. Supports only floating-point type
angle
IOutputArrayThe destination GpuMat. Supports only floating-point type
angleInDegrees
boolIf true, the output angle is in degrees, otherwise in radian
stream
StreamUse 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
IInputArrayThe first GpuMat
b
IInputArrayThe second GpuMat
c
IOutputArrayThe result of the comparison.
cmpop
CmpTypeThe type of comparison
stream
StreamUse 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
IInputArrayInput array.
dst
IOutputArrayOutput array.
stream
StreamStream 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
IInputArraySource image.
dst
IOutputArrayDestination image with the same type as src. The size is Size(src.cols+left+right, src.rows+top+bottom).
top
intNumber of pixels in each direction from the source image rectangle to extrapolate.
bottom
intNumber of pixels in each direction from the source image rectangle to extrapolate.
left
intNumber of pixels in each direction from the source image rectangle to extrapolate.
right
intNumber of pixels in each direction from the source image rectangle to extrapolate.
borderType
BorderTypeBorder Type
value
MCvScalarBorder value.
stream
StreamUse 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
IInputArraySingle-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
IInputArraySingle-channel source image.
dst
IOutputArrayA Gpu mat to hold the result
stream
StreamUse 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
IInputArrayThe source GpuMat
dst
IOutputArrayThe destination GpuMat
code
ColorConversionThe color conversion code
dcn
intNumber 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
StreamUse 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
IInputArraySource image (8-bit or 16-bit single channel).
dst
IOutputArrayDestination image.
code
DemosaicTypesColor space conversion code (see the description below).
dcn
intNumber 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
StreamStream 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
IInputArrayThe source GpuMat
dst
IOutputArrayThe 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
SizeSize of a discrete Fourier transform.
flags
DxtTypeDFT flags
stream
StreamUse 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
IInputArrayThe first GpuMat
b
IInputArrayThe second GpuMat
c
IOutputArrayThe element-wise quotient of the two GpuMat
scale
doubleThe scale
depthType
DepthTypeOptional depth of the output array.
stream
StreamUse 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
IInputArrayInput 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
IOutputArrayOutput disparity image. It has the same size as src_disp. The type is CV_8UC4 in BGRA format (alpha = 255).
ndisp
intNumber of disparities.
stream
StreamStream 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
IInputArraySource image with CV_8UC1 type.
dst
IOutputArrayDestination image.
stream
StreamStream 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
IInputArrayThe source GpuMat. Supports Byte, UInt16, Int16 and float type.
dst
IOutputArrayThe resulting GpuMat
stream
StreamUse 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
IInputArrayInput 8-bit 1-channel, 2-channel or 3-channel image.
dst
IOutputArrayOutput image with the same size and type as src.
h
floatParameter 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
intSize 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
intSize in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels
stream
StreamUse 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
IInputArrayInput 8-bit 3-channel image.
dst
IOutputArrayOutput image with the same size and type as src.
hLuminance
floatParameter 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
floatThe 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
intSize 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
intSize in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels
stream
StreamUse 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
IInputArraySingle-channel source image.
minMaxVals
IOutputArrayThe output min and max values
loc
IOutputArrayThe ouput min and max locations
mask
IInputArrayOptional mask to select a sub-matrix.
stream
StreamUse 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
IInputArrayThe source GpuMat. supports 1, 3 and 4 channels GpuMat with Byte, UInt16, int or float depth
dst
IOutputArrayDestination GpuMat. The same source and type as
src
flipType
FlipTypeSpecifies how to flip the GpuMat.
stream
StreamUse 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
IInputArraySource image (3- or 4-channel 8 bit).
dst
IOutputArrayDestination image.
forward
boolTrue for forward gamma correction or false for inverse gamma correction.
stream
StreamStream 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
IInputArrayThe first source array.
src2
IInputArrayThe second source array.
alpha
doubleThe scalar
src3
IInputArrayThe third source array (shift). Can be IntPtr.Zero, if there is no shift.
beta
doubleThe scalar
dst
IOutputArrayThe destination array.
tABC
GemmTypeThe gemm operation type
stream
StreamUse 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
nintThe gpuMat to extract regions from.
rowRange
RangeThe row range. Use MCvSlice.WholeSeq for all rows.
colRange
RangeThe 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
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
nintThe source GpuMat
dst
nintThe resulting GpuMat, as input it should be an empty GpuMat.
cn
intThe new number of channels
rows
intThe 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
IInputArrayThe source GpuMat. Supports CV_8UC1, CV_16UC1 and CV_16SC1 types.
hist
IOutputArrayHistogram with evenly distributed bins. A GpuMat<int> type.
histSize
intThe size of histogram (number of levels)
lowerLevel
intThe lower level
upperLevel
intThe upper level
stream
StreamUse 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
IInputArraySource 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
IOutputArrayDestination histogram with one row, (levels.cols-1) columns, and the CV_32SC1 type.
levels
IInputArrayNumber of levels in the histogram.
stream
StreamStream 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
IInputArrayFirst input array.
lowerb
MCvScalarInclusive lower boundary
upperb
MCvScalarInclusive upper boundary
dst
IOutputArrayOutput array of the same size as src and CV_8U type.
stream
StreamStream 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
IInputArrayThe source GpuMat, supports only CV_8UC1 source type
sum
IOutputArrayThe sum GpuMat, supports only CV_32S source type, but will contain unsigned int values
stream
StreamUse 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
IInputArrayThe matrix to be shifted.
scalar
MCvScalarThe scalar to shift by.
c
IOutputArrayThe result of the shift
stream
StreamUse 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
IInputArrayThe source GpuMat. Supports Byte, UInt16, Int16 and float type.
dst
IOutputArrayThe resulting GpuMat
stream
StreamUse 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
IInputArrayThe source GpuMat. Supports only floating-point type
y
IInputArrayThe source GpuMat. Supports only floating-point type
magnitude
IOutputArrayThe destination GpuMat. Supports only floating-point type
stream
StreamUse 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
IInputArrayThe source GpuMat. Supports only floating-point type
y
IInputArrayThe source GpuMat. Supports only floating-point type
magnitude
IOutputArrayThe destination GpuMat. Supports only floating-point type
stream
StreamUse 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
IInputArrayThe first GpuMat
src2
IInputArrayThe second GpuMat
dst
IOutputArrayThe result GpuMat
stream
StreamUse 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
IInputArraySource CudaImage. Only CV 8UC4 images are supported for now.
dst
IOutputArrayDestination CudaImage, containing color of mapped points. Will have the same size and type as src.
sp
intSpatial window radius.
sr
intColor window radius.
criteria
MCvTermCriteriaTermination criteria.
stream
StreamUse 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
IInputArraySource CudaImage. Only CV 8UC4 images are supported for now.
dstr
IOutputArrayDestination CudaImage, containing color of mapped points. Will have the same size and type as src.
dstsp
IOutputArrayDestination CudaImage, containing position of mapped points. Will have the same size as src and CV 16SC2 type.
sp
intSpatial window radius.
sr
intColor window radius.
criteria
MCvTermCriteriaTermination criteria.
stream
StreamUse 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
IInputArraySource CudaImage. Only CV 8UC4 images are supported for now.
dst
IOutputArraySegmented Image. Will have the same size and type as src. Note that this is an Image type and not CudaImage type
sp
intSpatial window radius.
sr
intColor window radius.
minSize
intMinimum segment size. Smaller segements will be merged.
criteria
MCvTermCriteriaTermination criteria.
stream
StreamUse 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
IInputArrayThe GpuMat. Supports only CV_8UC1 type
mean
MCvScalarThe mean value
stddev
MCvScalarThe 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
VectorOfGpuMatPointer to an array of single channel GpuMat pointers
dst
IOutputArrayThe multi-channel gpuMat
stream
StreamUse 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
IInputArrayThe first GpuMat
src2
IInputArrayThe second GpuMat
dst
IOutputArrayThe result GpuMat
stream
StreamUse 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
IInputArrayThe source GpuMat, single-channel
minVal
doublePointer to returned minimum value
maxVal
doublePointer to returned maximum value
minLoc
PointPointer to returned minimum location
maxLoc
PointPointer to returned maximum location
mask
IInputArrayThe 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
IInputArrayFirst spectrum.
src2
IInputArraySecond spectrum with the same size and type.
dst
IOutputArrayDestination spectrum.
flags
intMock parameter used for CPU/CUDA interfaces similarity, simply add a 0 value.
scale
floatScale constant.
conjB
boolOptional flag to specify if the second spectrum needs to be conjugated before the multiplication.
stream
StreamUse 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
IInputArrayFirst spectrum.
src2
IInputArraySecond spectrum with the same size and type.
dst
IOutputArrayDestination spectrum.
flags
intMock parameter used for CPU/CUDA interfaces similarity.
conjB
boolOptional flag to specify if the second spectrum needs to be conjugated before the multiplication.
stream
StreamUse 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
IInputArrayThe first GpuMat to be element-wise multiplied.
b
IInputArrayThe second GpuMat to be element-wise multiplied.
c
IOutputArrayThe element-wise multiplication of the two GpuMat
scale
doubleThe scale
depthType
DepthTypeOptional depth of the output array.
stream
StreamUse 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
IInputArraySource image. Supports only CV_8UC1, CV_8UC2 and CV_8UC3.
dst
IOutputArrayDestination image.
h
floatFilter sigma regulating filter strength for color.
searchWindow
intSize of search window.
blockSize
intSize of block used for computing weights.
borderMode
BorderTypeBorder type. REFLECT101 , REPLICATE, CONSTANT, REFLECT and WRAP are supported for now.
stream
StreamUse 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
IInputArraySource matrix. Any matrices except 64F are supported.
normType
NormTypeNorm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.
mask
IInputArrayoptional 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
IInputArrayThe GpuMat. Supports only CV_8UC1 type
src2
IInputArrayIf IntPtr.Zero, norm operation is apply to
src1
only. Otherwise, this is the GpuMat of type CV_8UC1normType
NormTypeThe norm type. Supports NORM_INF, NORM_L1, NORM_L2.
Returns
- double
The norm of the
src1
ifsrc2
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
IInputArrayInput array.
dst
IOutputArrayOutput array of the same size as src .
alpha
doubleNorm value to normalize to or the lower range boundary in case of the range normalization.
beta
doubleUpper range boundary in case of the range normalization; it is not used for the norm normalization.
normType
NormTypeNormalization type ( NORM_MINMAX , NORM_L2 , NORM_L1 or NORM_INF ).
depthType
DepthTypeOptional depth of the output array.
mask
IInputArrayOptional operation mask.
stream
StreamUse 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
IInputArrayThe source GpuMat. Supports only floating-point type
y
IInputArrayThe source GpuMat. Supports only floating-point type
angle
IOutputArrayThe destination GpuMat. Supports only floating-point type
angleInDegrees
boolIf true, the output angle is in degrees, otherwise in radian
stream
StreamUse 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
IInputArrayThe source GpuMat. Supports only floating-point type
angle
IInputArrayThe source GpuMat. Supports only floating-point type
x
IOutputArrayThe destination GpuMat. Supports only floating-point type
y
IOutputArrayThe destination GpuMat. Supports only floating-point type
angleInDegrees
boolIf true, the input angle is in degrees, otherwise in radian
stream
StreamUse 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
IInputArrayThe source GpuMat
power
doubleThe power
dst
IOutputArrayThe resulting GpuMat
stream
StreamUse 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
intcuda device id
PrintShortCudaDeviceInfo(int)
Print short cuda device info
public static extern void PrintShortCudaDeviceInfo(int device)
Parameters
device
intcuda 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
IInputArrayThe source CudaImage.
dst
IOutputArrayThe destination CudaImage, should have 2x smaller width and height than the source.
stream
StreamUse 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
IInputArrayThe source CudaImage.
dst
IOutputArrayThe destination image, should have 2x smaller width and height than the source.
stream
StreamUse 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
IInputArrayThe matrix to be shifted.
scalar
MCvScalarThe scalar to shift by.
c
IOutputArrayThe result of the shift
stream
StreamUse 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
IInputArrayThe input GpuMat
vec
IOutputArrayDestination vector. Its size and type is defined by dim and dtype parameters
dim
ReduceDimensionDimension 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
ReduceTypeThe reduction operation type
dType
DepthTypeOptional depth of the output array.
stream
StreamUse 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
IInputArrayThe source GpuMat. Supports CV_8UC1, CV_8UC3 source types.
dst
IOutputArrayThe dstination GpuMat. Supports CV_8UC1, CV_8UC3 source types.
xmap
IInputArrayThe xmap. Supports CV_32FC1 map type.
ymap
IInputArrayThe ymap. Supports CV_32FC1 map type.
interpolation
InterInterpolation type.
borderMode
BorderTypeBorder mode. Use BORDER_CONSTANT for default.
borderValue
MCvScalarThe value of the border.
stream
StreamUse 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
IInputArrayThe source image. Has to be GpuMat<Byte>. If stream is used, the GpuMat has to be either single channel or 4 channels.
dst
IOutputArrayThe destination image.
dsize
SizeDestination 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
doubleScale factor along the horizontal axis. If it is zero, it is computed as: (double)dsize.width/src.cols
fy
doubleScale factor along the vertical axis. If it is zero, it is computed as: (double)dsize.height/src.rows
interpolation
InterThe interpolation type. Supports INTER_NEAREST, INTER_LINEAR.
stream
StreamUse 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
IInputArraySource image. Supports 1, 3 or 4 channels images with Byte, UInt16 or float depth
dst
IOutputArrayDestination image with the same type as src. Must be pre-allocated
dSize
SizeThe size of the destination image
angle
doubleAngle of rotation in degrees
xShift
doubleShift along the horizontal axis
yShift
doubleShift along the verticle axis
interpolation
InterInterpolation method. Only INTER_NEAREST, INTER_LINEAR, and INTER_CUBIC are supported.
stream
StreamUse 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
intThe 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
intSystem 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
IInputArrayThe multi-channel gpuMat
dstArray
VectorOfGpuMatPointer to an array of single channel GpuMat pointers
stream
StreamUse 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
IInputArrayThe source GpuMat, support depth of byte, UInt16, Int16 and float.
dst
IOutputArrayThe resulting GpuMat
stream
StreamUse 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
IInputArrayThe source GpuMat, supports only CV_8UC1 source type
sqsum
IOutputArrayThe sqsum GpuMat, supports only CV32F source type.
stream
StreamUse 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
IInputArraySource image of any depth except for CV_64F.
mask
IInputArrayoptional 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
IInputArrayThe source GpuMat, support depth of byte, UInt16, Int16 and float.
dst
IOutputArrayThe resulting GpuMat
stream
StreamUse 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
IInputArrayThe matrix where subtraction take place
b
IInputArrayThe matrix to be substracted
c
IOutputArrayThe result of a - b
mask
IInputArrayThe optional mask that is used to select a subarray. Use null if not needed
depthType
DepthTypeOptional depth of the output array.
stream
StreamUse 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
IInputOutputArrayThe 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
StreamUse 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
IInputArraySource array (single-channel, 8-bit of 32-bit floating point).
dst
IOutputArrayDestination array; must be either the same type as src or 8-bit.
threshold
doubleThreshold value
maxValue
doubleMaximum value to use with CV_THRESH_BINARY and CV_THRESH_BINARY_INV thresholding types
thresholdType
ThresholdTypeThresholding type
stream
StreamUse 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
IInputArraySource matrix. 1-, 4-, 8-byte element sizes are supported for now.
dst
IOutputArrayDestination matrix.
stream
StreamUse 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
IInputArrayThe source GpuMat
dst
IOutputArrayThe destination GpuMat
M
IInputArrayThe 2x3 transformation matrix (pointer to CvArr)
dSize
SizeThe size of the destination image
flags
InterSupports NN, LINEAR, CUBIC
borderMode
BorderTypeThe border mode, use BORDER_TYPE.CONSTANT for default.
borderValue
MCvScalarThe border value, use new MCvScalar() for default.
stream
StreamUse 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
IInputArrayThe source GpuMat
dst
IOutputArrayThe destination GpuMat
M
IInputArrayThe 2x3 transformation matrix (pointer to CvArr)
dSize
SizeThe size of the destination image
flags
InterSupports NN, LINEAR, CUBIC
borderMode
BorderTypeThe border mode, use BORDER_TYPE.CONSTANT for default.
borderValue
MCvScalarThe border value, use new MCvScalar() for default.
stream
StreamUse a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).