Show / Hide Table of Contents

Class Cv2

OpenCV Functions of C++ I/F (cv::xxx)

Inheritance
System.Object
Cv2
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: OpenCvSharp
Assembly: OpenCvSharp.dll
Syntax
public static class Cv2

Fields

| Improve this Doc View Source

FILLED

Declaration
public const int FILLED = -1
Field Value
Type Description
System.Int32
| Improve this Doc View Source

LOG2

Declaration
public const double LOG2 = 0.69314718055994529
Field Value
Type Description
System.Double
| Improve this Doc View Source

PI

The ratio of a circle's circumference to its diameter

Declaration
public const double PI = 3.1415926535897931
Field Value
Type Description
System.Double

Methods

| Improve this Doc View Source

Abs(Mat)

Computes absolute value of each matrix element

Declaration
public static MatExpr Abs(Mat src)
Parameters
Type Name Description
Mat src

matrix

Returns
Type Description
MatExpr
| Improve this Doc View Source

Abs(MatExpr)

Computes absolute value of each matrix element

Declaration
public static MatExpr Abs(MatExpr src)
Parameters
Type Name Description
MatExpr src

matrix expression

Returns
Type Description
MatExpr
| Improve this Doc View Source

Absdiff(InputArray, InputArray, OutputArray)

Calculates the per-element absolute difference between two arrays or between an array and a scalar.

Declaration
public static void Absdiff(InputArray src1, InputArray src2, OutputArray dst)
Parameters
Type Name Description
InputArray src1

first input array or a scalar.

InputArray src2

second input array or a scalar.

OutputArray dst

output array that has the same size and type as input arrays.

| Improve this Doc View Source

Accumulate(InputArray, InputOutputArray, InputArray)

Adds an image to the accumulator.

Declaration
public static void Accumulate(InputArray src, InputOutputArray dst, InputArray mask)
Parameters
Type Name Description
InputArray src

Input image as 1- or 3-channel, 8-bit or 32-bit floating point.

InputOutputArray dst

Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.

InputArray mask

Optional operation mask.

| Improve this Doc View Source

AccumulateProduct(InputArray, InputArray, InputOutputArray, InputArray)

Adds the per-element product of two input images to the accumulator.

Declaration
public static void AccumulateProduct(InputArray src1, InputArray src2, InputOutputArray dst, InputArray mask)
Parameters
Type Name Description
InputArray src1

First input image, 1- or 3-channel, 8-bit or 32-bit floating point.

InputArray src2

Second input image of the same type and the same size as src1

InputOutputArray dst

Accumulator with the same number of channels as input images, 32-bit or 64-bit floating-point.

InputArray mask

Optional operation mask.

| Improve this Doc View Source

AccumulateSquare(InputArray, InputOutputArray, InputArray)

Adds the square of a source image to the accumulator.

Declaration
public static void AccumulateSquare(InputArray src, InputOutputArray dst, InputArray mask)
Parameters
Type Name Description
InputArray src

Input image as 1- or 3-channel, 8-bit or 32-bit floating point.

InputOutputArray dst

Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.

InputArray mask

Optional operation mask.

| Improve this Doc View Source

AccumulateWeighted(InputArray, InputOutputArray, Double, InputArray)

Updates a running average.

Declaration
public static void AccumulateWeighted(InputArray src, InputOutputArray dst, double alpha, InputArray mask)
Parameters
Type Name Description
InputArray src

Input image as 1- or 3-channel, 8-bit or 32-bit floating point.

InputOutputArray dst

Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.

System.Double alpha

Weight of the input image.

InputArray mask

Optional operation mask.

| Improve this Doc View Source

AdaptiveThreshold(InputArray, OutputArray, Double, AdaptiveThresholdTypes, ThresholdTypes, Int32, Double)

Applies an adaptive threshold to an array.

Declaration
public static void AdaptiveThreshold(InputArray src, OutputArray dst, double maxValue, AdaptiveThresholdTypes adaptiveMethod, ThresholdTypes thresholdType, int blockSize, double c)
Parameters
Type Name Description
InputArray src

Source 8-bit single-channel image.

OutputArray dst

Destination image of the same size and the same type as src .

System.Double maxValue

Non-zero value assigned to the pixels for which the condition is satisfied. See the details below.

AdaptiveThresholdTypes adaptiveMethod

Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C .

ThresholdTypes thresholdType

Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV .

System.Int32 blockSize

Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.

System.Double c

Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.

| Improve this Doc View Source

Add(InputArray, InputArray, OutputArray, InputArray, Int32)

Computes the per-element sum of two arrays or an array and a scalar.

Declaration
public static void Add(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null, int dtype = -1)
Parameters
Type Name Description
InputArray src1

The first source array

InputArray src2

The second source array. It must have the same size and same type as src1

OutputArray dst

The destination array; it will have the same size and same type as src1

InputArray mask

The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null]

System.Int32 dtype
| Improve this Doc View Source

AddWeighted(InputArray, Double, InputArray, Double, Double, OutputArray, Int32)

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

Declaration
public static void AddWeighted(InputArray src1, double alpha, InputArray src2, double beta, double gamma, OutputArray dst, int dtype = -1)
Parameters
Type Name Description
InputArray src1
System.Double alpha
InputArray src2
System.Double beta
System.Double gamma
OutputArray dst
System.Int32 dtype
| Improve this Doc View Source

AGAST(InputArray, Int32, Boolean, AgastFeatureDetector.DetectorType)

Detects corners using the AGAST algorithm

Declaration
public static KeyPoint[] AGAST(InputArray image, int threshold, bool nonmaxSuppression, AgastFeatureDetector.DetectorType type)
Parameters
Type Name Description
InputArray image

grayscale image where keypoints (corners) are detected.

System.Int32 threshold

threshold on difference between intensity of the central pixel and pixels of a circle around this pixel.

System.Boolean nonmaxSuppression

if true, non-maximum suppression is applied to detected corners (keypoints).

OpenCvSharp.AgastFeatureDetector.DetectorType type

one of the four neighborhoods as defined in the paper

Returns
Type Description
OpenCvSharp.KeyPoint[]

keypoints detected on the image.

| Improve this Doc View Source

AlignSize(Int32, Int32)

Aligns buffer size by the certain number of bytes This small inline function aligns a buffer size by the certian number of bytes by enlarging it.

Declaration
public static int AlignSize(int sz, int n)
Parameters
Type Name Description
System.Int32 sz
System.Int32 n
Returns
Type Description
System.Int32
| Improve this Doc View Source

ApplyColorMap(InputArray, OutputArray, ColormapTypes)

Applies a GNU Octave/MATLAB equivalent colormap on a given image.

Declaration
public static void ApplyColorMap(InputArray src, OutputArray dst, ColormapTypes colormap)
Parameters
Type Name Description
InputArray src

The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.

OutputArray dst

The result is the colormapped source image. Note: Mat::create is called on dst.

ColormapTypes colormap

colormap The colormap to apply

| Improve this Doc View Source

ApplyColorMap(InputArray, OutputArray, InputArray)

Applies a user colormap on a given image.

Declaration
public static void ApplyColorMap(InputArray src, OutputArray dst, InputArray userColor)
Parameters
Type Name Description
InputArray src

The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.

OutputArray dst

The result is the colormapped source image. Note: Mat::create is called on dst.

InputArray userColor

The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256

| Improve this Doc View Source

ApproxPolyDP(IEnumerable<Point>, Double, Boolean)

Approximates contour or a curve using Douglas-Peucker algorithm

Declaration
public static Point[] ApproxPolyDP(IEnumerable<Point> curve, double epsilon, bool closed)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> curve

The polygon or curve to approximate.

System.Double epsilon

Specifies the approximation accuracy. This is the maximum distance between the original curve and its approximation.

System.Boolean closed

The result of the approximation; The type should match the type of the input curve

Returns
Type Description
OpenCvSharp.Point[]

The result of the approximation; The type should match the type of the input curve

| Improve this Doc View Source

ApproxPolyDP(IEnumerable<Point2f>, Double, Boolean)

Approximates contour or a curve using Douglas-Peucker algorithm

Declaration
public static Point2f[] ApproxPolyDP(IEnumerable<Point2f> curve, double epsilon, bool closed)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> curve

The polygon or curve to approximate.

System.Double epsilon

Specifies the approximation accuracy. This is the maximum distance between the original curve and its approximation.

System.Boolean closed

If true, the approximated curve is closed (i.e. its first and last vertices are connected), otherwise it’s not

Returns
Type Description
OpenCvSharp.Point2f[]

The result of the approximation; The type should match the type of the input curve

| Improve this Doc View Source

ApproxPolyDP(InputArray, OutputArray, Double, Boolean)

Approximates contour or a curve using Douglas-Peucker algorithm

Declaration
public static void ApproxPolyDP(InputArray curve, OutputArray approxCurve, double epsilon, bool closed)
Parameters
Type Name Description
InputArray curve

The polygon or curve to approximate. Must be 1 x N or N x 1 matrix of type CV_32SC2 or CV_32FC2.

OutputArray approxCurve

The result of the approximation; The type should match the type of the input curve

System.Double epsilon

Specifies the approximation accuracy. This is the maximum distance between the original curve and its approximation.

System.Boolean closed

The result of the approximation; The type should match the type of the input curve

| Improve this Doc View Source

ArcLength(IEnumerable<Point>, Boolean)

Calculates a contour perimeter or a curve length.

Declaration
public static double ArcLength(IEnumerable<Point> curve, bool closed)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> curve

The input vector of 2D points.

System.Boolean closed

Indicates, whether the curve is closed or not.

Returns
Type Description
System.Double
| Improve this Doc View Source

ArcLength(IEnumerable<Point2f>, Boolean)

Calculates a contour perimeter or a curve length.

Declaration
public static double ArcLength(IEnumerable<Point2f> curve, bool closed)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> curve

The input vector of 2D points.

System.Boolean closed

Indicates, whether the curve is closed or not.

Returns
Type Description
System.Double
| Improve this Doc View Source

ArcLength(InputArray, Boolean)

Calculates a contour perimeter or a curve length.

Declaration
public static double ArcLength(InputArray curve, bool closed)
Parameters
Type Name Description
InputArray curve

The input vector of 2D points, represented by CV_32SC2 or CV_32FC2 matrix.

System.Boolean closed

Indicates, whether the curve is closed or not.

Returns
Type Description
System.Double
| Improve this Doc View Source

ArrowedLine(InputOutputArray, Point, Point, Scalar, Int32, LineTypes, Int32, Double)

Draws a arrow segment pointing from the first point to the second one. The function arrowedLine draws an arrow between pt1 and pt2 points in the image. See also cv::line.

Declaration
public static void ArrowedLine(InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0, double tipLength = 0.1)
Parameters
Type Name Description
InputOutputArray img

Image.

OpenCvSharp.Point pt1

The point the arrow starts from.

OpenCvSharp.Point pt2

The point the arrow points to.

OpenCvSharp.Scalar color

Line color.

System.Int32 thickness

Line thickness.

LineTypes lineType

Type of the line, see cv::LineTypes

System.Int32 shift

Number of fractional bits in the point coordinates.

System.Double tipLength

The length of the arrow tip in relation to the arrow length

| Improve this Doc View Source

BatchDistance(InputArray, InputArray, OutputArray, Int32, OutputArray, NormTypes, Int32, InputArray, Int32, Boolean)

naive nearest neighbor finder

Declaration
public static void BatchDistance(InputArray src1, InputArray src2, OutputArray dist, int dtype, OutputArray nidx, NormTypes normType = NormTypes.L2, int k = 0, InputArray mask = null, int update = 0, bool crosscheck = false)
Parameters
Type Name Description
InputArray src1
InputArray src2
OutputArray dist
System.Int32 dtype
OutputArray nidx
NormTypes normType
System.Int32 k
InputArray mask
System.Int32 update
System.Boolean crosscheck
| Improve this Doc View Source

BilateralFilter(InputArray, OutputArray, Int32, Double, Double, BorderTypes)

Applies bilateral filter to the image

Declaration
public static void BilateralFilter(InputArray src, OutputArray dst, int d, double sigmaColor, double sigmaSpace, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

The source 8-bit or floating-point, 1-channel or 3-channel image

OutputArray dst

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

System.Int32 d

The diameter of each pixel neighborhood, that is used during filtering. If it is non-positive, it's computed from sigmaSpace

System.Double sigmaColor

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

System.Double sigmaSpace

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

BorderTypes borderType
| Improve this Doc View Source

BitwiseAnd(InputArray, InputArray, OutputArray, InputArray)

computes bitwise conjunction of the two arrays (dst = src1 & src2)

Declaration
public static void BitwiseAnd(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null)
Parameters
Type Name Description
InputArray src1

first input array or a scalar.

InputArray src2

second input array or a scalar.

OutputArray dst

output array that has the same size and type as the input

InputArray mask

optional operation mask, 8-bit single channel array, that specifies elements of the output array to be changed.

| Improve this Doc View Source

BitwiseNot(InputArray, OutputArray, InputArray)

inverts each bit of array (dst = ~src)

Declaration
public static void BitwiseNot(InputArray src, OutputArray dst, InputArray mask = null)
Parameters
Type Name Description
InputArray src

input array.

OutputArray dst

output array that has the same size and type as the input

InputArray mask

optional operation mask, 8-bit single channel array, that specifies elements of the output array to be changed.

| Improve this Doc View Source

BitwiseOr(InputArray, InputArray, OutputArray, InputArray)

computes bitwise disjunction of the two arrays (dst = src1 | src2)

Declaration
public static void BitwiseOr(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null)
Parameters
Type Name Description
InputArray src1

first input array or a scalar.

InputArray src2

second input array or a scalar.

OutputArray dst

output array that has the same size and type as the input

InputArray mask

optional operation mask, 8-bit single channel array, that specifies elements of the output array to be changed.

| Improve this Doc View Source

BitwiseXor(InputArray, InputArray, OutputArray, InputArray)

computes bitwise exclusive-or of the two arrays (dst = src1 ^ src2)

Declaration
public static void BitwiseXor(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null)
Parameters
Type Name Description
InputArray src1

first input array or a scalar.

InputArray src2

second input array or a scalar.

OutputArray dst

output array that has the same size and type as the input

InputArray mask

optional operation mask, 8-bit single channel array, that specifies elements of the output array to be changed.

| Improve this Doc View Source

BlendLinear(InputArray, InputArray, InputArray, InputArray, OutputArray)

Performs linear blending of two images: dst(i,j) = weights1(i,j)*src1(i,j) + weights2(i,j)*src2(i,j)

Declaration
public static void BlendLinear(InputArray src1, InputArray src2, InputArray weights1, InputArray weights2, OutputArray dst)
Parameters
Type Name Description
InputArray src1

It has a type of CV_8UC(n) or CV_32FC(n), where n is a positive integer.

InputArray src2

It has the same type and size as src1.

InputArray weights1

It has a type of CV_32FC1 and the same size with src1.

InputArray weights2

It has a type of CV_32FC1 and the same size with src1.

OutputArray dst

It is created if it does not have the same size and type with src1.

| Improve this Doc View Source

Blur(InputArray, OutputArray, Size, Nullable<Point>, BorderTypes)

Smoothes image using normalized box filter

Declaration
public static void Blur(InputArray src, OutputArray dst, Size ksize, Point? anchor = null, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

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

OpenCvSharp.Size ksize

The smoothing kernel size

System.Nullable<OpenCvSharp.Point> anchor

The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center

BorderTypes borderType

The border mode used to extrapolate pixels outside of the image

| Improve this Doc View Source

BorderInterpolate(Int32, Int32, BorderTypes)

Computes the source location of an extrapolated pixel.

Declaration
public static int BorderInterpolate(int p, int len, BorderTypes borderType)
Parameters
Type Name Description
System.Int32 p

0-based coordinate of the extrapolated pixel along one of the axes, likely <0 or >= len

System.Int32 len

Length of the array along the corresponding axis.

BorderTypes borderType

Border type, one of the #BorderTypes, except for #BORDER_TRANSPARENT and BORDER_ISOLATED. When borderType==BORDER_CONSTANT, the function always returns -1, regardless

Returns
Type Description
System.Int32
| Improve this Doc View Source

BoundingRect(IEnumerable<Point>)

Calculates the up-right bounding rectangle of a point set.

Declaration
public static Rect BoundingRect(IEnumerable<Point> curve)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> curve

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Returns
Type Description
OpenCvSharp.Rect

Minimal up-right bounding rectangle for the specified point set.

| Improve this Doc View Source

BoundingRect(IEnumerable<Point2f>)

Calculates the up-right bounding rectangle of a point set.

Declaration
public static Rect BoundingRect(IEnumerable<Point2f> curve)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> curve

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Returns
Type Description
OpenCvSharp.Rect

Minimal up-right bounding rectangle for the specified point set.

| Improve this Doc View Source

BoundingRect(InputArray)

Calculates the up-right bounding rectangle of a point set.

Declaration
public static Rect BoundingRect(InputArray curve)
Parameters
Type Name Description
InputArray curve

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Returns
Type Description
OpenCvSharp.Rect

Minimal up-right bounding rectangle for the specified point set.

| Improve this Doc View Source

BoxFilter(InputArray, OutputArray, MatType, Size, Nullable<Point>, Boolean, BorderTypes)

Smoothes image using box filter

Declaration
public static void BoxFilter(InputArray src, OutputArray dst, MatType ddepth, Size ksize, Point? anchor = null, bool normalize = true, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

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

OpenCvSharp.MatType ddepth
OpenCvSharp.Size ksize

The smoothing kernel size

System.Nullable<OpenCvSharp.Point> anchor

The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center

System.Boolean normalize

Indicates, whether the kernel is normalized by its area or not

BorderTypes borderType

The border mode used to extrapolate pixels outside of the image

| Improve this Doc View Source

BoxPoints(RotatedRect)

Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.

The function finds the four vertices of a rotated rectangle.This function is useful to draw the rectangle.In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.

Declaration
public static Point2f[] BoxPoints(RotatedRect box)
Parameters
Type Name Description
OpenCvSharp.RotatedRect box

The input rotated rectangle. It may be the output of

Returns
Type Description
OpenCvSharp.Point2f[]

The output array of four vertices of rectangles.

| Improve this Doc View Source

BoxPoints(RotatedRect, OutputArray)

Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.

The function finds the four vertices of a rotated rectangle.This function is useful to draw the rectangle.In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.

Declaration
public static void BoxPoints(RotatedRect box, OutputArray points)
Parameters
Type Name Description
OpenCvSharp.RotatedRect box

The input rotated rectangle. It may be the output of

OutputArray points

The output array of four vertices of rectangles.

| Improve this Doc View Source

BuildOpticalFlowPyramid(InputArray, out Mat[], Size, Int32, Boolean, BorderTypes, BorderTypes, Boolean)

Constructs a pyramid which can be used as input for calcOpticalFlowPyrLK

Declaration
public static int BuildOpticalFlowPyramid(InputArray img, out Mat[] pyramid, Size winSize, int maxLevel, bool withDerivatives = true, BorderTypes pyrBorder = BorderTypes.Reflect101, BorderTypes derivBorder = BorderTypes.Constant, bool tryReuseInputImage = true)
Parameters
Type Name Description
InputArray img

8-bit input image.

Mat[] pyramid

output pyramid.

OpenCvSharp.Size winSize

window size of optical flow algorithm. Must be not less than winSize argument of calcOpticalFlowPyrLK(). It is needed to calculate required padding for pyramid levels.

System.Int32 maxLevel

0-based maximal pyramid level number.

System.Boolean withDerivatives

set to precompute gradients for the every pyramid level. If pyramid is constructed without the gradients then calcOpticalFlowPyrLK() will calculate them internally.

BorderTypes pyrBorder

the border mode for pyramid layers.

BorderTypes derivBorder

the border mode for gradients.

System.Boolean tryReuseInputImage

put ROI of input image into the pyramid if possible. You can pass false to force data copying.

Returns
Type Description
System.Int32

number of levels in constructed pyramid. Can be less than maxLevel.

| Improve this Doc View Source

BuildOpticalFlowPyramid(InputArray, OutputArray, Size, Int32, Boolean, BorderTypes, BorderTypes, Boolean)

Constructs a pyramid which can be used as input for calcOpticalFlowPyrLK

Declaration
public static int BuildOpticalFlowPyramid(InputArray img, OutputArray pyramid, Size winSize, int maxLevel, bool withDerivatives = true, BorderTypes pyrBorder = BorderTypes.Reflect101, BorderTypes derivBorder = BorderTypes.Constant, bool tryReuseInputImage = true)
Parameters
Type Name Description
InputArray img

8-bit input image.

OutputArray pyramid

output pyramid.

OpenCvSharp.Size winSize

window size of optical flow algorithm. Must be not less than winSize argument of calcOpticalFlowPyrLK(). It is needed to calculate required padding for pyramid levels.

System.Int32 maxLevel

0-based maximal pyramid level number.

System.Boolean withDerivatives

set to precompute gradients for the every pyramid level. If pyramid is constructed without the gradients then calcOpticalFlowPyrLK() will calculate them internally.

BorderTypes pyrBorder

the border mode for pyramid layers.

BorderTypes derivBorder

the border mode for gradients.

System.Boolean tryReuseInputImage

put ROI of input image into the pyramid if possible. You can pass false to force data copying.

Returns
Type Description
System.Int32

number of levels in constructed pyramid. Can be less than maxLevel.

| Improve this Doc View Source

BuildPyramid(InputArray, VectorOfMat, Int32, BorderTypes)

Declaration
public static void BuildPyramid(InputArray src, VectorOfMat dst, int maxlevel, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src
VectorOfMat dst
System.Int32 maxlevel
BorderTypes borderType
| Improve this Doc View Source

CalcBackProject(Mat[], Int32[], InputArray, OutputArray, Rangef[], Boolean)

computes the joint dense histogram for a set of images.

Declaration
public static void CalcBackProject(Mat[] images, int[] channels, InputArray hist, OutputArray backProject, Rangef[] ranges, bool uniform = true)
Parameters
Type Name Description
Mat[] images
System.Int32[] channels
InputArray hist
OutputArray backProject
OpenCvSharp.Rangef[] ranges
System.Boolean uniform
| Improve this Doc View Source

CalcCovarMatrix(InputArray, OutputArray, InputOutputArray, CovarFlags, Nullable<MatType>)

computes covariation matrix of a set of samples

Declaration
public static void CalcCovarMatrix(InputArray samples, OutputArray covar, InputOutputArray mean, CovarFlags flags, MatType? ctype = null)
Parameters
Type Name Description
InputArray samples

samples stored as rows/columns of a single matrix.

OutputArray covar

output covariance matrix of the type ctype and square size.

InputOutputArray mean

input or output (depending on the flags) array as the average value of the input vectors.

CovarFlags flags

operation flags as a combination of CovarFlags

System.Nullable<OpenCvSharp.MatType> ctype

type of the matrixl; it equals 'CV_64F' by default.

| Improve this Doc View Source

CalcCovarMatrix(Mat[], Mat, Mat, CovarFlags, Nullable<MatType>)

computes covariation matrix of a set of samples

Declaration
public static void CalcCovarMatrix(Mat[] samples, Mat covar, Mat mean, CovarFlags flags, MatType? ctype = null)
Parameters
Type Name Description
Mat[] samples

samples stored as separate matrices

Mat covar

output covariance matrix of the type ctype and square size.

Mat mean

input or output (depending on the flags) array as the average value of the input vectors.

CovarFlags flags

operation flags as a combination of CovarFlags

System.Nullable<OpenCvSharp.MatType> ctype

type of the matrixl; it equals 'CV_64F' by default.

| Improve this Doc View Source

CalcHist(Mat[], Int32[], InputArray, OutputArray, Int32, Int32[], Rangef[], Boolean, Boolean)

computes the joint dense histogram for a set of images.

Declaration
public static void CalcHist(Mat[] images, int[] channels, InputArray mask, OutputArray hist, int dims, int[] histSize, Rangef[] ranges, bool uniform = true, bool accumulate = false)
Parameters
Type Name Description
Mat[] images
System.Int32[] channels
InputArray mask
OutputArray hist
System.Int32 dims
System.Int32[] histSize
OpenCvSharp.Rangef[] ranges
System.Boolean uniform
System.Boolean accumulate
| Improve this Doc View Source

CalcHist(Mat[], Int32[], InputArray, OutputArray, Int32, Int32[], Single[][], Boolean, Boolean)

computes the joint dense histogram for a set of images.

Declaration
public static void CalcHist(Mat[] images, int[] channels, InputArray mask, OutputArray hist, int dims, int[] histSize, float[][] ranges, bool uniform = true, bool accumulate = false)
Parameters
Type Name Description
Mat[] images
System.Int32[] channels
InputArray mask
OutputArray hist
System.Int32 dims
System.Int32[] histSize
System.Single[][] ranges
System.Boolean uniform
System.Boolean accumulate
| Improve this Doc View Source

CalcOpticalFlowFarneback(InputArray, InputArray, InputOutputArray, Double, Int32, Int32, Int32, Int32, Double, OpticalFlowFlags)

Computes a dense optical flow using the Gunnar Farneback's algorithm.

Declaration
public static void CalcOpticalFlowFarneback(InputArray prev, InputArray next, InputOutputArray flow, double pyrScale, int levels, int winsize, int iterations, int polyN, double polySigma, OpticalFlowFlags flags)
Parameters
Type Name Description
InputArray prev

first 8-bit single-channel input image.

InputArray next

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

InputOutputArray flow

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

System.Double pyrScale

parameter, specifying the image scale (<1) to build pyramids for each image; pyrScale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous one.

System.Int32 levels

number of pyramid layers including the initial image; levels=1 means that no extra layers are created and only the original images are used.

System.Int32 winsize

averaging window size; larger values increase the algorithm robustness to image noise and give more chances for fast motion detection, but yield more blurred motion field.

System.Int32 iterations

number of iterations the algorithm does at each pyramid level.

System.Int32 polyN

size of the pixel neighborhood used to find polynomial expansion in each pixel; larger values mean that the image will be approximated with smoother surfaces, yielding more robust algorithm and more blurred motion field, typically poly_n =5 or 7.

System.Double polySigma

standard deviation of the Gaussian that is used to smooth derivatives used as a basis for the polynomial expansion; for polyN=5, you can set polySigma=1.1, for polyN=7, a good value would be polySigma=1.5.

OpticalFlowFlags flags

operation flags that can be a combination of OPTFLOW_USE_INITIAL_FLOW and/or OPTFLOW_FARNEBACK_GAUSSIAN

| Improve this Doc View Source

CalcOpticalFlowPyrLK(InputArray, InputArray, InputArray, InputOutputArray, OutputArray, OutputArray, Nullable<Size>, Int32, Nullable<TermCriteria>, OpticalFlowFlags, Double)

computes sparse optical flow using multi-scale Lucas-Kanade algorithm

Declaration
public static void CalcOpticalFlowPyrLK(InputArray prevImg, InputArray nextImg, InputArray prevPts, InputOutputArray nextPts, OutputArray status, OutputArray err, Size? winSize = null, int maxLevel = 3, TermCriteria? criteria = null, OpticalFlowFlags flags = OpticalFlowFlags.None, double minEigThreshold = 0.0001)
Parameters
Type Name Description
InputArray prevImg
InputArray nextImg
InputArray prevPts
InputOutputArray nextPts
OutputArray status
OutputArray err
System.Nullable<OpenCvSharp.Size> winSize
System.Int32 maxLevel
System.Nullable<OpenCvSharp.TermCriteria> criteria
OpticalFlowFlags flags
System.Double minEigThreshold
| Improve this Doc View Source

CalcOpticalFlowPyrLK(InputArray, InputArray, Point2f[], ref Point2f[], out Byte[], out Single[], Nullable<Size>, Int32, Nullable<TermCriteria>, OpticalFlowFlags, Double)

computes sparse optical flow using multi-scale Lucas-Kanade algorithm

Declaration
public static void CalcOpticalFlowPyrLK(InputArray prevImg, InputArray nextImg, Point2f[] prevPts, ref Point2f[] nextPts, out byte[] status, out float[] err, Size? winSize = null, int maxLevel = 3, TermCriteria? criteria = null, OpticalFlowFlags flags = OpticalFlowFlags.None, double minEigThreshold = 0.0001)
Parameters
Type Name Description
InputArray prevImg
InputArray nextImg
OpenCvSharp.Point2f[] prevPts
OpenCvSharp.Point2f[] nextPts
System.Byte[] status
System.Single[] err
System.Nullable<OpenCvSharp.Size> winSize
System.Int32 maxLevel
System.Nullable<OpenCvSharp.TermCriteria> criteria
OpticalFlowFlags flags
System.Double minEigThreshold
| Improve this Doc View Source

CalibrateCamera(IEnumerable<IEnumerable<Point3f>>, IEnumerable<IEnumerable<Point2f>>, Size, Double[,], Double[], out Vec3d[], out Vec3d[], CalibrationFlags, Nullable<TermCriteria>)

finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern.

Declaration
public static double CalibrateCamera(IEnumerable<IEnumerable<Point3f>> objectPoints, IEnumerable<IEnumerable<Point2f>> imagePoints, Size imageSize, double[, ] cameraMatrix, double[] distCoeffs, out Vec3d[] rvecs, out Vec3d[] tvecs, CalibrationFlags flags = CalibrationFlags.None, TermCriteria? criteria = null)
Parameters
Type Name Description
IEnumerable<IEnumerable<OpenCvSharp.Point3f>> objectPoints

In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space. The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0. In the old interface all the vectors of object points from different views are concatenated together.

IEnumerable<IEnumerable<OpenCvSharp.Point2f>> imagePoints

In the new interface it is a vector of vectors of the projections of calibration pattern points. imagePoints.Count() and objectPoints.Count() and imagePoints[i].Count() must be equal to objectPoints[i].Count() for each i.

OpenCvSharp.Size imageSize

Size of the image used only to initialize the intrinsic camera matrix.

System.Double[,] cameraMatrix

Output 3x3 floating-point camera matrix. If CV_CALIB_USE_INTRINSIC_GUESS and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.

System.Double[] distCoeffs

Output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements.

Vec3d[] rvecs

Output vector of rotation vectors (see Rodrigues() ) estimated for each pattern view. That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. M -1)

Vec3d[] tvecs

Output vector of translation vectors estimated for each pattern view.

CalibrationFlags flags

Different flags that may be zero or a combination of the CalibrationFlag values

System.Nullable<OpenCvSharp.TermCriteria> criteria

Termination criteria for the iterative optimization algorithm.

Returns
Type Description
System.Double
| Improve this Doc View Source

CalibrateCamera(IEnumerable<Mat>, IEnumerable<Mat>, Size, InputOutputArray, InputOutputArray, out Mat[], out Mat[], CalibrationFlags, Nullable<TermCriteria>)

finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern.

Declaration
public static double CalibrateCamera(IEnumerable<Mat> objectPoints, IEnumerable<Mat> imagePoints, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, out Mat[] rvecs, out Mat[] tvecs, CalibrationFlags flags = CalibrationFlags.None, TermCriteria? criteria = null)
Parameters
Type Name Description
IEnumerable<Mat> objectPoints

In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space. The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0. In the old interface all the vectors of object points from different views are concatenated together.

IEnumerable<Mat> imagePoints

In the new interface it is a vector of vectors of the projections of calibration pattern points. imagePoints.Count() and objectPoints.Count() and imagePoints[i].Count() must be equal to objectPoints[i].Count() for each i.

OpenCvSharp.Size imageSize

Size of the image used only to initialize the intrinsic camera matrix.

InputOutputArray cameraMatrix

Output 3x3 floating-point camera matrix. If CV_CALIB_USE_INTRINSIC_GUESS and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.

InputOutputArray distCoeffs

Output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements.

Mat[] rvecs

Output vector of rotation vectors (see Rodrigues() ) estimated for each pattern view. That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. M -1)

Mat[] tvecs

Output vector of translation vectors estimated for each pattern view.

CalibrationFlags flags

Different flags that may be zero or a combination of the CalibrationFlag values

System.Nullable<OpenCvSharp.TermCriteria> criteria

Termination criteria for the iterative optimization algorithm.

Returns
Type Description
System.Double
| Improve this Doc View Source

CalibrateHandEye(IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, OutputArray, OutputArray, HandEyeCalibrationMethod)

Computes Hand-Eye calibration.

The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation(separable solutions) and the following methods are implemented:

  • R.Tsai, R.Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
  • F.Park, B.Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
  • R.Horaud, F.Dornaika Hand-Eye Calibration \cite Horaud95

Another approach consists in estimating simultaneously the rotation and the translation(simultaneous solutions), with the following implemented method:

  • N.Andreff, R.Horaud, B.Espiau On-line Hand-Eye Calibration \cite Andreff99
  • K.Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98
Declaration
public static void CalibrateHandEye(IEnumerable<Mat> R_gripper2base, IEnumerable<Mat> t_gripper2base, IEnumerable<Mat> R_target2cam, IEnumerable<Mat> t_target2cam, OutputArray R_cam2gripper, OutputArray t_cam2gripper, HandEyeCalibrationMethod method = HandEyeCalibrationMethod.TSAI)
Parameters
Type Name Description
IEnumerable<Mat> R_gripper2base

Rotation part extracted from the homogeneous matrix that transforms a pointexpressed in the gripper frame to the robot base frame that contains the rotation matrices for all the transformationsfrom gripper frame to robot base frame.

IEnumerable<Mat> t_gripper2base

Translation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the robot base frame. This is a vector(vector&lt;Mat>) that contains the translation vectors for all the transformations from gripper frame to robot base frame.

IEnumerable<Mat> R_target2cam

Rotation part extracted from the homogeneous matrix that transforms a point expressed in the target frame to the camera frame. This is a vector(vector&lt;Mat>) that contains the rotation matrices for all the transformations from calibration target frame to camera frame.

IEnumerable<Mat> t_target2cam

Rotation part extracted from the homogeneous matrix that transforms a point expressed in the target frame to the camera frame. This is a vector(vector&lt;Mat>) that contains the translation vectors for all the transformations from calibration target frame to camera frame.

OutputArray R_cam2gripper

Estimated rotation part extracted from the homogeneous matrix that transforms a point expressed in the camera frame to the gripper frame.

OutputArray t_cam2gripper

Estimated translation part extracted from the homogeneous matrix that transforms a point expressed in the camera frame to the gripper frame.

HandEyeCalibrationMethod method

One of the implemented Hand-Eye calibration method

| Improve this Doc View Source

CalibrateRobotWorldHandEye(IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, OutputArray, OutputArray, OutputArray, OutputArray, RobotWorldHandEyeCalibrationMethod)

Computes Robot-World/Hand-Eye calibration. The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation(separable solutions):

  • M.Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR
Declaration
public static void CalibrateRobotWorldHandEye(IEnumerable<Mat> R_world2cam, IEnumerable<Mat> t_world2cam, IEnumerable<Mat> R_base2gripper, IEnumerable<Mat> t_base2gripper, OutputArray R_base2world, OutputArray t_base2world, OutputArray R_gripper2cam, OutputArray t_gripper2cam, RobotWorldHandEyeCalibrationMethod method = RobotWorldHandEyeCalibrationMethod.SHAH)
Parameters
Type Name Description
IEnumerable<Mat> R_world2cam

[in] R_world2cam Rotation part extracted from the homogeneous matrix that transforms a point expressed in the world frame to the camera frame. This is a vector of Mat that contains the rotation, (3x3) rotation matrices or (3x1) rotation vectors,for all the transformations from world frame to the camera frame.

IEnumerable<Mat> t_world2cam

[in] Translation part extracted from the homogeneous matrix that transforms a point expressed in the world frame to the camera frame. This is a vector (vector&lt;Mat>) that contains the (3x1) translation vectors for all the transformations from world frame to the camera frame.

IEnumerable<Mat> R_base2gripper

[in] Rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the gripper frame. This is a vector (vector&lt;Mat>) that contains the rotation, (3x3) rotation matrices or (3x1) rotation vectors, for all the transformations from robot base frame to the gripper frame.

IEnumerable<Mat> t_base2gripper

[in] Rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the gripper frame. This is a vector (vector&lt;Mat>) that contains the (3x1) translation vectors for all the transformations from robot base frame to the gripper frame.

OutputArray R_base2world

[out] R_base2world Estimated (3x3) rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the world frame.

OutputArray t_base2world

[out] t_base2world Estimated (3x1) translation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the world frame.

OutputArray R_gripper2cam

[out] R_gripper2cam Estimated (3x3) rotation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the camera frame.

OutputArray t_gripper2cam

[out] Estimated (3x1) translation part extracted from the homogeneous matrix that transforms a pointexpressed in the gripper frame to the camera frame.

RobotWorldHandEyeCalibrationMethod method

One of the implemented Robot-World/Hand-Eye calibration method

| Improve this Doc View Source

CalibrateRobotWorldHandEye(IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, out Double[,], out Double[], out Double[,], out Double[], RobotWorldHandEyeCalibrationMethod)

omputes Robot-World/Hand-Eye calibration. The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation(separable solutions):

  • M.Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR
Declaration
public static void CalibrateRobotWorldHandEye(IEnumerable<Mat> R_world2cam, IEnumerable<Mat> t_world2cam, IEnumerable<Mat> R_base2gripper, IEnumerable<Mat> t_base2gripper, out double[, ] R_base2world, out double[] t_base2world, out double[, ] R_gripper2cam, out double[] t_gripper2cam, RobotWorldHandEyeCalibrationMethod method = RobotWorldHandEyeCalibrationMethod.SHAH)
Parameters
Type Name Description
IEnumerable<Mat> R_world2cam

[in] R_world2cam Rotation part extracted from the homogeneous matrix that transforms a point expressed in the world frame to the camera frame. This is a vector of Mat that contains the rotation, (3x3) rotation matrices or (3x1) rotation vectors,for all the transformations from world frame to the camera frame.

IEnumerable<Mat> t_world2cam

[in] Translation part extracted from the homogeneous matrix that transforms a point expressed in the world frame to the camera frame. This is a vector (vector&lt;Mat>) that contains the (3x1) translation vectors for all the transformations from world frame to the camera frame.

IEnumerable<Mat> R_base2gripper

[in] Rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the gripper frame. This is a vector (vector&lt;Mat>) that contains the rotation, (3x3) rotation matrices or (3x1) rotation vectors, for all the transformations from robot base frame to the gripper frame.

IEnumerable<Mat> t_base2gripper

[in] Rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the gripper frame. This is a vector (vector&lt;Mat>) that contains the (3x1) translation vectors for all the transformations from robot base frame to the gripper frame.

System.Double[,] R_base2world

[out] R_base2world Estimated (3x3) rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the world frame.

System.Double[] t_base2world

[out] t_base2world Estimated (3x1) translation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the world frame.

System.Double[,] R_gripper2cam

[out] R_gripper2cam Estimated (3x3) rotation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the camera frame.

System.Double[] t_gripper2cam

[out] Estimated (3x1) translation part extracted from the homogeneous matrix that transforms a pointexpressed in the gripper frame to the camera frame.

RobotWorldHandEyeCalibrationMethod method

One of the implemented Robot-World/Hand-Eye calibration method

| Improve this Doc View Source

CalibrationMatrixValues(InputArray, Size, Double, Double, out Double, out Double, out Double, out Point2d, out Double)

computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size.

Declaration
public static void CalibrationMatrixValues(InputArray cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, out double fovx, out double fovy, out double focalLength, out Point2d principalPoint, out double aspectRatio)
Parameters
Type Name Description
InputArray cameraMatrix

Input camera matrix that can be estimated by calibrateCamera() or stereoCalibrate() .

OpenCvSharp.Size imageSize

Input image size in pixels.

System.Double apertureWidth

Physical width of the sensor.

System.Double apertureHeight

Physical height of the sensor.

System.Double fovx

Output field of view in degrees along the horizontal sensor axis.

System.Double fovy

Output field of view in degrees along the vertical sensor axis.

System.Double focalLength

Focal length of the lens in mm.

OpenCvSharp.Point2d principalPoint

Principal point in pixels.

System.Double aspectRatio

fy / fx

| Improve this Doc View Source

CalibrationMatrixValues(Double[,], Size, Double, Double, out Double, out Double, out Double, out Point2d, out Double)

computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size.

Declaration
public static void CalibrationMatrixValues(double[, ] cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, out double fovx, out double fovy, out double focalLength, out Point2d principalPoint, out double aspectRatio)
Parameters
Type Name Description
System.Double[,] cameraMatrix

Input camera matrix that can be estimated by calibrateCamera() or stereoCalibrate() .

OpenCvSharp.Size imageSize

Input image size in pixels.

System.Double apertureWidth

Physical width of the sensor.

System.Double apertureHeight

Physical height of the sensor.

System.Double fovx

Output field of view in degrees along the horizontal sensor axis.

System.Double fovy

Output field of view in degrees along the vertical sensor axis.

System.Double focalLength

Focal length of the lens in mm.

OpenCvSharp.Point2d principalPoint

Principal point in pixels.

System.Double aspectRatio

fy / fx

| Improve this Doc View Source

CamShift(InputArray, ref Rect, TermCriteria)

Finds an object center, size, and orientation.

Declaration
public static RotatedRect CamShift(InputArray probImage, ref Rect window, TermCriteria criteria)
Parameters
Type Name Description
InputArray probImage

Back projection of the object histogram.

OpenCvSharp.Rect window

Initial search window.

OpenCvSharp.TermCriteria criteria

Stop criteria for the underlying MeanShift() .

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

Canny(InputArray, InputArray, OutputArray, Double, Double, Boolean)

Finds edges in an image using the Canny algorithm with custom image gradient.

Declaration
public static void Canny(InputArray dx, InputArray dy, OutputArray edges, double threshold1, double threshold2, bool L2gradient = false)
Parameters
Type Name Description
InputArray dx

16-bit x derivative of input image (CV_16SC1 or CV_16SC3).

InputArray dy

16-bit y derivative of input image (same type as dx).

OutputArray edges

output edge map; single channels 8-bit image, which has the same size as image.

System.Double threshold1

first threshold for the hysteresis procedure.

System.Double threshold2

second threshold for the hysteresis procedure.

System.Boolean L2gradient

Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false]

| Improve this Doc View Source

Canny(InputArray, OutputArray, Double, Double, Int32, Boolean)

Finds edges in an image using Canny algorithm.

Declaration
public static void Canny(InputArray src, OutputArray edges, double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false)
Parameters
Type Name Description
InputArray src

Single-channel 8-bit input image

OutputArray edges

The output edge map. It will have the same size and the same type as image

System.Double threshold1

The first threshold for the hysteresis procedure

System.Double threshold2

The second threshold for the hysteresis procedure

System.Int32 apertureSize

Aperture size for the Sobel operator [By default this is ApertureSize.Size3]

System.Boolean L2gradient

Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false]

| Improve this Doc View Source

CartToPolar(InputArray, InputArray, OutputArray, OutputArray, Boolean)

Calculates the magnitude and angle of 2D vectors.

Declaration
public static void CartToPolar(InputArray x, InputArray y, OutputArray magnitude, OutputArray angle, bool angleInDegrees = false)
Parameters
Type Name Description
InputArray x

array of x-coordinates; this must be a single-precision or double-precision floating-point array.

InputArray y

array of y-coordinates, that must have the same size and same type as x.

OutputArray magnitude

output array of magnitudes of the same size and type as x.

OutputArray angle

output array of angles that has the same size and type as x; the angles are measured in radians(from 0 to 2*Pi) or in degrees(0 to 360 degrees).

System.Boolean angleInDegrees

a flag, indicating whether the angles are measured in radians(which is by default), or in degrees.

| Improve this Doc View Source

CheckChessboard(InputArray, Size)

Checks whether the image contains chessboard of the specific size or not.

Declaration
public static bool CheckChessboard(InputArray img, Size size)
Parameters
Type Name Description
InputArray img
OpenCvSharp.Size size
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CheckHardwareSupport(CpuFeatures)

Returns true if the specified feature is supported by the host hardware. The function returns true if the host hardware supports the specified feature.When user calls setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until setUseOptimized(true) is called.This way user can dynamically switch on and off the optimized code in OpenCV.

Declaration
public static bool CheckHardwareSupport(CpuFeatures feature)
Parameters
Type Name Description
CpuFeatures feature

The feature of interest, one of cv::CpuFeatures

Returns
Type Description
System.Boolean
| Improve this Doc View Source

CheckRange(InputArray, Boolean)

checks that each matrix element is within the specified range.

Declaration
public static bool CheckRange(InputArray src, bool quiet = true)
Parameters
Type Name Description
InputArray src

The array to check

System.Boolean quiet

The flag indicating whether the functions quietly return false when the array elements are out of range, or they throw an exception.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

CheckRange(InputArray, Boolean, out Point, Double, Double)

checks that each matrix element is within the specified range.

Declaration
public static bool CheckRange(InputArray src, bool quiet, out Point pos, double minVal = -1.7976931348623157E+308, double maxVal = 1.7976931348623157E+308)
Parameters
Type Name Description
InputArray src

The array to check

System.Boolean quiet

The flag indicating whether the functions quietly return false when the array elements are out of range, or they throw an exception.

OpenCvSharp.Point pos

The optional output parameter, where the position of the first outlier is stored.

System.Double minVal

The inclusive lower boundary of valid values range

System.Double maxVal

The exclusive upper boundary of valid values range

Returns
Type Description
System.Boolean
| Improve this Doc View Source

Circle(InputOutputArray, Point, Int32, Scalar, Int32, LineTypes, Int32)

Draws a circle

Declaration
public static void Circle(InputOutputArray img, Point center, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img

Image where the circle is drawn.

OpenCvSharp.Point center

Center of the circle.

System.Int32 radius

Radius of the circle.

OpenCvSharp.Scalar color

Circle color.

System.Int32 thickness

Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1]

LineTypes lineType

Type of the circle boundary. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the center coordinates and radius value. [By default this is 0]

| Improve this Doc View Source

Circle(InputOutputArray, Int32, Int32, Int32, Scalar, Int32, LineTypes, Int32)

Draws a circle

Declaration
public static void Circle(InputOutputArray img, int centerX, int centerY, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img

Image where the circle is drawn.

System.Int32 centerX

X-coordinate of the center of the circle.

System.Int32 centerY

Y-coordinate of the center of the circle.

System.Int32 radius

Radius of the circle.

OpenCvSharp.Scalar color

Circle color.

System.Int32 thickness

Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1]

LineTypes lineType

Type of the circle boundary. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the center coordinates and radius value. [By default this is 0]

| Improve this Doc View Source

ClipLine(Rect, ref Point, ref Point)

Clips the line against the image rectangle

Declaration
public static bool ClipLine(Rect imgRect, ref Point pt1, ref Point pt2)
Parameters
Type Name Description
OpenCvSharp.Rect imgRect

sThe image rectangle

OpenCvSharp.Point pt1

The first line point

OpenCvSharp.Point pt2

The second line point

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ClipLine(Size, ref Point, ref Point)

Clips the line against the image rectangle

Declaration
public static bool ClipLine(Size imgSize, ref Point pt1, ref Point pt2)
Parameters
Type Name Description
OpenCvSharp.Size imgSize

The image size

OpenCvSharp.Point pt1

The first line point

OpenCvSharp.Point pt2

The second line point

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ColorChange(InputArray, InputArray, OutputArray, Single, Single, Single)

Given an original color image, two differently colored versions of this image can be mixed seamlessly. Multiplication factor is between 0.5 to 2.5.

Declaration
public static void ColorChange(InputArray src, InputArray mask, OutputArray dst, float redMul = 1F, float greenMul = 1F, float blueMul = 1F)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

InputArray mask

Input 8-bit 1 or 3-channel image.

OutputArray dst

Output image with the same size and type as src.

System.Single redMul

R-channel multiply factor.

System.Single greenMul

G-channel multiply factor.

System.Single blueMul

B-channel multiply factor.

| Improve this Doc View Source

Compare(InputArray, InputArray, OutputArray, CmpType)

Performs the per-element comparison of two arrays or an array and scalar value.

Declaration
public static void Compare(InputArray src1, InputArray src2, OutputArray dst, CmpType cmpop)
Parameters
Type Name Description
InputArray src1

first input array or a scalar; when it is an array, it must have a single channel.

InputArray src2

second input array or a scalar; when it is an array, it must have a single channel.

OutputArray dst

output array of type ref CV_8U that has the same size and the same number of channels as the input arrays.

CmpType cmpop

a flag, that specifies correspondence between the arrays (cv::CmpTypes)

| Improve this Doc View Source

CompareHist(InputArray, InputArray, HistCompMethods)

compares two histograms stored in dense arrays

Declaration
public static double CompareHist(InputArray h1, InputArray h2, HistCompMethods method)
Parameters
Type Name Description
InputArray h1

The first compared histogram

InputArray h2

The second compared histogram of the same size as h1

HistCompMethods method

The comparison method

Returns
Type Description
System.Double
| Improve this Doc View Source

CompleteSymm(InputOutputArray, Boolean)

extends the symmetrical matrix from the lower half or from the upper half

Declaration
public static void CompleteSymm(InputOutputArray mtx, bool lowerToUpper = false)
Parameters
Type Name Description
InputOutputArray mtx

Input-output floating-point square matrix

System.Boolean lowerToUpper

If true, the lower half is copied to the upper half, otherwise the upper half is copied to the lower half

| Improve this Doc View Source

ComposeRT(InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray)

composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments

Declaration
public static void ComposeRT(InputArray rvec1, InputArray tvec1, InputArray rvec2, InputArray tvec2, OutputArray rvec3, OutputArray tvec3, OutputArray dr3dr1 = null, OutputArray dr3dt1 = null, OutputArray dr3dr2 = null, OutputArray dr3dt2 = null, OutputArray dt3dr1 = null, OutputArray dt3dt1 = null, OutputArray dt3dr2 = null, OutputArray dt3dt2 = null)
Parameters
Type Name Description
InputArray rvec1

First rotation vector.

InputArray tvec1

First translation vector.

InputArray rvec2

Second rotation vector.

InputArray tvec2

Second translation vector.

OutputArray rvec3

Output rotation vector of the superposition.

OutputArray tvec3

Output translation vector of the superposition.

OutputArray dr3dr1

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

OutputArray dr3dt1

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

OutputArray dr3dr2

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

OutputArray dr3dt2

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

OutputArray dt3dr1

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

OutputArray dt3dt1

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

OutputArray dt3dr2

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

OutputArray dt3dt2

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

| Improve this Doc View Source

ComposeRT(Double[], Double[], Double[], Double[], out Double[], out Double[])

composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments

Declaration
public static void ComposeRT(double[] rvec1, double[] tvec1, double[] rvec2, double[] tvec2, out double[] rvec3, out double[] tvec3)
Parameters
Type Name Description
System.Double[] rvec1

First rotation vector.

System.Double[] tvec1

First translation vector.

System.Double[] rvec2

Second rotation vector.

System.Double[] tvec2

Second translation vector.

System.Double[] rvec3

Output rotation vector of the superposition.

System.Double[] tvec3

Output translation vector of the superposition.

| Improve this Doc View Source

ComposeRT(Double[], Double[], Double[], Double[], out Double[], out Double[], out Double[,], out Double[,], out Double[,], out Double[,], out Double[,], out Double[,], out Double[,], out Double[,])

composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments

Declaration
public static void ComposeRT(double[] rvec1, double[] tvec1, double[] rvec2, double[] tvec2, out double[] rvec3, out double[] tvec3, out double[, ] dr3dr1, out double[, ] dr3dt1, out double[, ] dr3dr2, out double[, ] dr3dt2, out double[, ] dt3dr1, out double[, ] dt3dt1, out double[, ] dt3dr2, out double[, ] dt3dt2)
Parameters
Type Name Description
System.Double[] rvec1

First rotation vector.

System.Double[] tvec1

First translation vector.

System.Double[] rvec2

Second rotation vector.

System.Double[] tvec2

Second translation vector.

System.Double[] rvec3

Output rotation vector of the superposition.

System.Double[] tvec3

Output translation vector of the superposition.

System.Double[,] dr3dr1

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

System.Double[,] dr3dt1

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

System.Double[,] dr3dr2

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

System.Double[,] dr3dt2

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

System.Double[,] dt3dr1

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

System.Double[,] dt3dt1

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

System.Double[,] dt3dr2

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

System.Double[,] dt3dt2

Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively.

| Improve this Doc View Source

ComputeCorrespondEpilines(IEnumerable<Point2d>, Int32, Double[,])

For points in an image of a stereo pair, computes the corresponding epilines in the other image.

Declaration
public static Point3f[] ComputeCorrespondEpilines(IEnumerable<Point2d> points, int whichImage, double[, ] F)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2d> points

Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2.

System.Int32 whichImage

Index of the image (1 or 2) that contains the points .

System.Double[,] F

Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() .

Returns
Type Description
OpenCvSharp.Point3f[]

Output vector of the epipolar lines corresponding to the points in the other image. Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) .

| Improve this Doc View Source

ComputeCorrespondEpilines(IEnumerable<Point3d>, Int32, Double[,])

For points in an image of a stereo pair, computes the corresponding epilines in the other image.

Declaration
public static Point3f[] ComputeCorrespondEpilines(IEnumerable<Point3d> points, int whichImage, double[, ] F)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3d> points

Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2.

System.Int32 whichImage

Index of the image (1 or 2) that contains the points .

System.Double[,] F

Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() .

Returns
Type Description
OpenCvSharp.Point3f[]

Output vector of the epipolar lines corresponding to the points in the other image. Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) .

| Improve this Doc View Source

ComputeCorrespondEpilines(InputArray, Int32, InputArray, OutputArray)

For points in an image of a stereo pair, computes the corresponding epilines in the other image.

Declaration
public static void ComputeCorrespondEpilines(InputArray points, int whichImage, InputArray F, OutputArray lines)
Parameters
Type Name Description
InputArray points

Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2.

System.Int32 whichImage

Index of the image (1 or 2) that contains the points .

InputArray F

Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() .

OutputArray lines

Output vector of the epipolar lines corresponding to the points in the other image. Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) .

| Improve this Doc View Source

ComputeECC(InputArray, InputArray, InputArray)

Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .

Declaration
public static double ComputeECC(InputArray templateImage, InputArray inputImage, InputArray inputMask = null)
Parameters
Type Name Description
InputArray templateImage

single-channel template image; CV_8U or CV_32F array.

InputArray inputImage

single-channel input image to be warped to provide an image similar to templateImage, same type as templateImage.

InputArray inputMask

An optional mask to indicate valid values of inputImage.

Returns
Type Description
System.Double
| Improve this Doc View Source

ComputeRecallPrecisionCurve(DMatch[][], Byte[][])

Declaration
public static Point2f[] ComputeRecallPrecisionCurve(DMatch[][] matches1to2, byte[][] correctMatches1to2Mask)
Parameters
Type Name Description
OpenCvSharp.DMatch[][] matches1to2
System.Byte[][] correctMatches1to2Mask
Returns
Type Description
OpenCvSharp.Point2f[]

recallPrecisionCurve

| Improve this Doc View Source

ConnectedComponents(InputArray, OutputArray, PixelConnectivity)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public static int ConnectedComponents(InputArray image, OutputArray labels, PixelConnectivity connectivity = PixelConnectivity.Connectivity8)
Parameters
Type Name Description
InputArray image

the image to be labeled

OutputArray labels

destination labeled image

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

Returns
Type Description
System.Int32

The number of labels

| Improve this Doc View Source

ConnectedComponents(InputArray, OutputArray, PixelConnectivity, MatType)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public static int ConnectedComponents(InputArray image, OutputArray labels, PixelConnectivity connectivity, MatType ltype)
Parameters
Type Name Description
InputArray image

the image to be labeled

OutputArray labels

destination labeled image

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

OpenCvSharp.MatType ltype

output image label type. Currently CV_32S and CV_16U are supported.

Returns
Type Description
System.Int32

The number of labels

| Improve this Doc View Source

ConnectedComponents(InputArray, out Int32[,], PixelConnectivity)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public static int ConnectedComponents(InputArray image, out int[, ] labels, PixelConnectivity connectivity)
Parameters
Type Name Description
InputArray image

the image to be labeled

System.Int32[,] labels

destination labeled rectangular array

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

Returns
Type Description
System.Int32

The number of labels

| Improve this Doc View Source

ConnectedComponentsEx(InputArray, PixelConnectivity, ConnectedComponentsAlgorithmsTypes)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public static ConnectedComponents ConnectedComponentsEx(InputArray image, PixelConnectivity connectivity = PixelConnectivity.Connectivity8, ConnectedComponentsAlgorithmsTypes ccltype = ConnectedComponentsAlgorithmsTypes.Default)
Parameters
Type Name Description
InputArray image

the image to be labeled

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

ConnectedComponentsAlgorithmsTypes ccltype
Returns
Type Description
ConnectedComponents
| Improve this Doc View Source

ConnectedComponentsWithAlgorithm(InputArray, OutputArray, PixelConnectivity, MatType, ConnectedComponentsAlgorithmsTypes)

Computes the connected components labeled image of boolean image.

image with 4 or 8 way connectivity - returns N, the total number of labels[0, N - 1] where 0 represents the background label.ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.ccltype specifies the connected components labeling algorithm to use, currently Grana (BBDT) and Wu's (SAUF) algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details.Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. This function uses parallel version of both Grana and Wu's algorithms if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Declaration
public static int ConnectedComponentsWithAlgorithm(InputArray image, OutputArray labels, PixelConnectivity connectivity, MatType ltype, ConnectedComponentsAlgorithmsTypes ccltype)
Parameters
Type Name Description
InputArray image

the 8-bit single-channel image to be labeled

OutputArray labels

destination labeled image

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

OpenCvSharp.MatType ltype

output image label type. Currently CV_32S and CV_16U are supported.

ConnectedComponentsAlgorithmsTypes ccltype

connected components algorithm type.

Returns
Type Description
System.Int32
| Improve this Doc View Source

ConnectedComponentsWithStats(InputArray, OutputArray, OutputArray, OutputArray, PixelConnectivity)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public static int ConnectedComponentsWithStats(InputArray image, OutputArray labels, OutputArray stats, OutputArray centroids, PixelConnectivity connectivity = PixelConnectivity.Connectivity8)
Parameters
Type Name Description
InputArray image

the image to be labeled

OutputArray labels

destination labeled image

OutputArray stats

statistics output for each label, including the background label, see below for available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of cv::ConnectedComponentsTypes

OutputArray centroids

floating point centroid (x,y) output for each label, including the background label

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

Returns
Type Description
System.Int32
| Improve this Doc View Source

ConnectedComponentsWithStats(InputArray, OutputArray, OutputArray, OutputArray, PixelConnectivity, MatType)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public static int ConnectedComponentsWithStats(InputArray image, OutputArray labels, OutputArray stats, OutputArray centroids, PixelConnectivity connectivity, MatType ltype)
Parameters
Type Name Description
InputArray image

the image to be labeled

OutputArray labels

destination labeled image

OutputArray stats

statistics output for each label, including the background label, see below for available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of cv::ConnectedComponentsTypes

OutputArray centroids

floating point centroid (x,y) output for each label, including the background label

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

OpenCvSharp.MatType ltype

output image label type. Currently CV_32S and CV_16U are supported.

Returns
Type Description
System.Int32
| Improve this Doc View Source

ConnectedComponentsWithStatsWithAlgorithm(InputArray, OutputArray, OutputArray, OutputArray, PixelConnectivity, MatType, ConnectedComponentsAlgorithmsTypes)

computes the connected components labeled image of boolean image and also produces a statistics output for each label.

image with 4 or 8 way connectivity - returns N, the total number of labels[0, N - 1] where 0 represents the background label.ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.ccltype specifies the connected components labeling algorithm to use, currently Grana's (BBDT) and Wu's (SAUF) algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details.Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. This function uses parallel version of both Grana and Wu's algorithms (statistics included) if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Declaration
public static int ConnectedComponentsWithStatsWithAlgorithm(InputArray image, OutputArray labels, OutputArray stats, OutputArray centroids, PixelConnectivity connectivity, MatType ltype, ConnectedComponentsAlgorithmsTypes ccltype)
Parameters
Type Name Description
InputArray image

the 8-bit single-channel image to be labeled

OutputArray labels

destination labeled image

OutputArray stats

statistics output for each label, including the background label, see below for available statistics.Statistics are accessed via stats(label, COLUMN) where COLUMN is one of #ConnectedComponentsTypes. The data type is CV_32S.

OutputArray centroids

centroid output for each label, including the background label. Centroids are accessed via centroids(label, 0) for x and centroids(label, 1) for y.The data type CV_64F.

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

OpenCvSharp.MatType ltype

output image label type. Currently CV_32S and CV_16U are supported.

ConnectedComponentsAlgorithmsTypes ccltype

connected components algorithm type.

Returns
Type Description
System.Int32
| Improve this Doc View Source

ContourArea(IEnumerable<Point>, Boolean)

Calculates the contour area

Declaration
public static double ContourArea(IEnumerable<Point> contour, bool oriented = false)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> contour

The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix

System.Boolean oriented
Returns
Type Description
System.Double
| Improve this Doc View Source

ContourArea(IEnumerable<Point2f>, Boolean)

Calculates the contour area

Declaration
public static double ContourArea(IEnumerable<Point2f> contour, bool oriented = false)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> contour

The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix

System.Boolean oriented
Returns
Type Description
System.Double
| Improve this Doc View Source

ContourArea(InputArray, Boolean)

Calculates the contour area

Declaration
public static double ContourArea(InputArray contour, bool oriented = false)
Parameters
Type Name Description
InputArray contour

The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix

System.Boolean oriented
Returns
Type Description
System.Double
| Improve this Doc View Source

ConvertFp16(InputArray, OutputArray)

Converts an array to half precision floating number.

This function converts FP32(single precision floating point) from/to FP16(half precision floating point). CV_16S format is used to represent FP16 data. There are two use modes(src -> dst) : CV_32F -> CV_16S and CV_16S -> CV_32F.The input array has to have type of CV_32F or CV_16S to represent the bit depth.If the input array is neither of them, the function will raise an error. The format of half precision floating point is defined in IEEE 754-2008.

Declaration
public static void ConvertFp16(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

input array.

OutputArray dst

output array.

| Improve this Doc View Source

ConvertMaps(InputArray, InputArray, OutputArray, OutputArray, MatType, Boolean)

Converts image transformation maps from one representation to another.

Declaration
public static void ConvertMaps(InputArray map1, InputArray map2, OutputArray dstmap1, OutputArray dstmap2, MatType dstmap1Type, bool nnInterpolation = false)
Parameters
Type Name Description
InputArray map1

The first input map of type CV_16SC2 , CV_32FC1 , or CV_32FC2 .

InputArray map2

The second input map of type CV_16UC1 , CV_32FC1 , or none (empty matrix), respectively.

OutputArray dstmap1

The first output map that has the type dstmap1type and the same size as src.

OutputArray dstmap2

The second output map.

OpenCvSharp.MatType dstmap1Type

Type of the first output map that should be CV_16SC2 , CV_32FC1 , or CV_32FC2 .

System.Boolean nnInterpolation

Flag indicating whether the fixed-point maps are used for the nearest-neighbor or for a more complex interpolation.

| Improve this Doc View Source

ConvertPointsFromHomogeneous(IEnumerable<Vec3f>)

converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z))

Declaration
public static Vec2f[] ConvertPointsFromHomogeneous(IEnumerable<Vec3f> src)
Parameters
Type Name Description
IEnumerable<Vec3f> src

Input vector of N-dimensional points.

Returns
Type Description
Vec2f[]

Output vector of N-1-dimensional points.

| Improve this Doc View Source

ConvertPointsFromHomogeneous(IEnumerable<Vec4f>)

converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z))

Declaration
public static Vec3f[] ConvertPointsFromHomogeneous(IEnumerable<Vec4f> src)
Parameters
Type Name Description
IEnumerable<Vec4f> src

Input vector of N-dimensional points.

Returns
Type Description
Vec3f[]

Output vector of N-1-dimensional points.

| Improve this Doc View Source

ConvertPointsFromHomogeneous(InputArray, OutputArray)

converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z))

Declaration
public static void ConvertPointsFromHomogeneous(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

Input vector of N-dimensional points.

OutputArray dst

Output vector of N-1-dimensional points.

| Improve this Doc View Source

ConvertPointsHomogeneous(InputArray, OutputArray)

Converts points to/from homogeneous coordinates.

Declaration
public static void ConvertPointsHomogeneous(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

Input array or vector of 2D, 3D, or 4D points.

OutputArray dst

Output vector of 2D, 3D, or 4D points.

| Improve this Doc View Source

ConvertPointsToHomogeneous(IEnumerable<Vec2f>)

converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1))

Declaration
public static Vec3f[] ConvertPointsToHomogeneous(IEnumerable<Vec2f> src)
Parameters
Type Name Description
IEnumerable<Vec2f> src

Input vector of N-dimensional points.

Returns
Type Description
Vec3f[]

Output vector of N+1-dimensional points.

| Improve this Doc View Source

ConvertPointsToHomogeneous(IEnumerable<Vec3f>)

converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1))

Declaration
public static Vec4f[] ConvertPointsToHomogeneous(IEnumerable<Vec3f> src)
Parameters
Type Name Description
IEnumerable<Vec3f> src

Input vector of N-dimensional points.

Returns
Type Description
Vec4f[]

Output vector of N+1-dimensional points.

| Improve this Doc View Source

ConvertPointsToHomogeneous(InputArray, OutputArray)

converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1))

Declaration
public static void ConvertPointsToHomogeneous(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

Input vector of N-dimensional points.

OutputArray dst

Output vector of N+1-dimensional points.

| Improve this Doc View Source

ConvertScaleAbs(InputArray, OutputArray, Double, Double)

Scales, computes absolute values and converts the result to 8-bit.

Declaration
public static void ConvertScaleAbs(InputArray src, OutputArray dst, double alpha = 1, double beta = 0)
Parameters
Type Name Description
InputArray src

The source array

OutputArray dst

The destination array

System.Double alpha

The optional scale factor. [By default this is 1]

System.Double beta

The optional delta added to the scaled values. [By default this is 0]

| Improve this Doc View Source

ConvexHull(IEnumerable<Point>, Boolean)

Computes convex hull for a set of 2D points.

Declaration
public static Point[] ConvexHull(IEnumerable<Point> points, bool clockwise = false)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix

System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

Returns
Type Description
OpenCvSharp.Point[]

The output convex hull. It is a vector of points that form the hull (must have the same type as the input points).

| Improve this Doc View Source

ConvexHull(IEnumerable<Point2f>, Boolean)

Computes convex hull for a set of 2D points.

Declaration
public static Point2f[] ConvexHull(IEnumerable<Point2f> points, bool clockwise = false)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix

System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

Returns
Type Description
OpenCvSharp.Point2f[]

The output convex hull. It is a vector of points that form the hull (must have the same type as the input points).

| Improve this Doc View Source

ConvexHull(InputArray, OutputArray, Boolean, Boolean)

Computes convex hull for a set of 2D points.

Declaration
public static void ConvexHull(InputArray points, OutputArray hull, bool clockwise = false, bool returnPoints = true)
Parameters
Type Name Description
InputArray points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix

OutputArray hull

The output convex hull. It is either a vector of points that form the hull (must have the same type as the input points), or a vector of 0-based point indices of the hull points in the original array (since the set of convex hull points is a subset of the original point set).

System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

System.Boolean returnPoints
| Improve this Doc View Source

ConvexHullIndices(IEnumerable<Point>, Boolean)

Computes convex hull for a set of 2D points.

Declaration
public static int[] ConvexHullIndices(IEnumerable<Point> points, bool clockwise = false)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix

System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

Returns
Type Description
System.Int32[]

The output convex hull. It is a vector of 0-based point indices of the hull points in the original array (since the set of convex hull points is a subset of the original point set).

| Improve this Doc View Source

ConvexHullIndices(IEnumerable<Point2f>, Boolean)

Computes convex hull for a set of 2D points.

Declaration
public static int[] ConvexHullIndices(IEnumerable<Point2f> points, bool clockwise = false)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix

System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

Returns
Type Description
System.Int32[]

The output convex hull. It is a vector of 0-based point indices of the hull points in the original array (since the set of convex hull points is a subset of the original point set).

| Improve this Doc View Source

ConvexityDefects(IEnumerable<Point>, IEnumerable<Int32>)

Computes the contour convexity defects

Declaration
public static Vec4i[] ConvexityDefects(IEnumerable<Point> contour, IEnumerable<int> convexHull)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> contour

Input contour.

IEnumerable<System.Int32> convexHull

Convex hull obtained using convexHull() that should contain indices of the contour points that make the hull.

Returns
Type Description
Vec4i[]

The output vector of convexity defects. Each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.

| Improve this Doc View Source

ConvexityDefects(IEnumerable<Point2f>, IEnumerable<Int32>)

Computes the contour convexity defects

Declaration
public static Vec4i[] ConvexityDefects(IEnumerable<Point2f> contour, IEnumerable<int> convexHull)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> contour

Input contour.

IEnumerable<System.Int32> convexHull

Convex hull obtained using convexHull() that should contain indices of the contour points that make the hull.

Returns
Type Description
Vec4i[]

The output vector of convexity defects. Each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.

| Improve this Doc View Source

ConvexityDefects(InputArray, InputArray, OutputArray)

Computes the contour convexity defects

Declaration
public static void ConvexityDefects(InputArray contour, InputArray convexHull, OutputArray convexityDefects)
Parameters
Type Name Description
InputArray contour

Input contour.

InputArray convexHull

Convex hull obtained using convexHull() that should contain indices of the contour points that make the hull.

OutputArray convexityDefects

The output vector of convexity defects. Each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.

| Improve this Doc View Source

CopyMakeBorder(InputArray, OutputArray, Int32, Int32, Int32, Int32, BorderTypes, Nullable<Scalar>)

Forms a border around the image

Declaration
public static void CopyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left, int right, BorderTypes borderType, Scalar? value = null)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

The destination image; will have the same type as src and the size Size(src.cols+left+right, src.rows+top+bottom)

System.Int32 top

Specify how much pixels in each direction from the source image rectangle one needs to extrapolate

System.Int32 bottom

Specify how much pixels in each direction from the source image rectangle one needs to extrapolate

System.Int32 left

Specify how much pixels in each direction from the source image rectangle one needs to extrapolate

System.Int32 right

Specify how much pixels in each direction from the source image rectangle one needs to extrapolate

BorderTypes borderType

The border type

System.Nullable<OpenCvSharp.Scalar> value

The border value if borderType == Constant

| Improve this Doc View Source

CopyTo(InputArray, OutputArray, InputArray)

Copies the matrix to another one. When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.

Declaration
public static void CopyTo(InputArray src, OutputArray dst, InputArray mask = null)
Parameters
Type Name Description
InputArray src

Source matrix.

OutputArray dst

Destination matrix. If it does not have a proper size or type before the operation, it is reallocated.

InputArray mask

Operation mask of the same size as *this. Its non-zero elements indicate which matrix elements need to be copied.The mask has to be of type CV_8U and can have 1 or multiple channels.

| Improve this Doc View Source

CornerEigenValsAndVecs(InputArray, OutputArray, Int32, Int32, BorderTypes)

computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix.

Declaration
public static void CornerEigenValsAndVecs(InputArray src, OutputArray dst, int blockSize, int ksize, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src
OutputArray dst
System.Int32 blockSize
System.Int32 ksize
BorderTypes borderType
| Improve this Doc View Source

CornerHarris(InputArray, OutputArray, Int32, Int32, Double, BorderTypes)

Harris corner detector.

Declaration
public static void CornerHarris(InputArray src, OutputArray dst, int blockSize, int ksize, double k, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

Input single-channel 8-bit or floating-point image.

OutputArray dst

Image to store the Harris detector responses. It has the type CV_32FC1 and the same size as src.

System.Int32 blockSize

Neighborhood size (see the details on #cornerEigenValsAndVecs ).

System.Int32 ksize

Aperture parameter for the Sobel operator.

System.Double k

Harris detector free parameter. See the formula above.

BorderTypes borderType

Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.

| Improve this Doc View Source

CornerMinEigenVal(InputArray, OutputArray, Int32, Int32, BorderTypes)

Calculates the minimal eigenvalue of gradient matrices for corner detection.

Declaration
public static void CornerMinEigenVal(InputArray src, OutputArray dst, int blockSize, int ksize = 3, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

Input single-channel 8-bit or floating-point image.

OutputArray dst

Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as src .

System.Int32 blockSize

Neighborhood size (see the details on #cornerEigenValsAndVecs ).

System.Int32 ksize

Aperture parameter for the Sobel operator.

BorderTypes borderType

Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.

| Improve this Doc View Source

CornerSubPix(InputArray, IEnumerable<Point2f>, Size, Size, TermCriteria)

adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria

Declaration
public static Point2f[] CornerSubPix(InputArray image, IEnumerable<Point2f> inputCorners, Size winSize, Size zeroZone, TermCriteria criteria)
Parameters
Type Name Description
InputArray image

Input image.

IEnumerable<OpenCvSharp.Point2f> inputCorners

Initial coordinates of the input corners and refined coordinates provided for output.

OpenCvSharp.Size winSize

Half of the side length of the search window.

OpenCvSharp.Size zeroZone

Half of the size of the dead region in the middle of the search zone over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size.

OpenCvSharp.TermCriteria criteria

Criteria for termination of the iterative process of corner refinement. That is, the process of corner position refinement stops either after criteria.maxCount iterations or when the corner position moves by less than criteria.epsilon on some iteration.

Returns
Type Description
OpenCvSharp.Point2f[]
| Improve this Doc View Source

CorrectMatches(InputArray, InputArray, InputArray, OutputArray, OutputArray)

Refines coordinates of corresponding points.

Declaration
public static void CorrectMatches(InputArray F, InputArray points1, InputArray points2, OutputArray newPoints1, OutputArray newPoints2)
Parameters
Type Name Description
InputArray F

3x3 fundamental matrix.

InputArray points1

1xN array containing the first set of points.

InputArray points2

1xN array containing the second set of points.

OutputArray newPoints1

The optimized points1.

OutputArray newPoints2

The optimized points2.

| Improve this Doc View Source

CorrectMatches(Double[,], IEnumerable<Point2d>, IEnumerable<Point2d>, out Point2d[], out Point2d[])

Refines coordinates of corresponding points.

Declaration
public static void CorrectMatches(double[, ] F, IEnumerable<Point2d> points1, IEnumerable<Point2d> points2, out Point2d[] newPoints1, out Point2d[] newPoints2)
Parameters
Type Name Description
System.Double[,] F

3x3 fundamental matrix.

IEnumerable<OpenCvSharp.Point2d> points1

1xN array containing the first set of points.

IEnumerable<OpenCvSharp.Point2d> points2

1xN array containing the second set of points.

OpenCvSharp.Point2d[] newPoints1

The optimized points1.

OpenCvSharp.Point2d[] newPoints2

The optimized points2.

| Improve this Doc View Source

CountNonZero(InputArray)

computes the number of nonzero array elements

Declaration
public static int CountNonZero(InputArray mtx)
Parameters
Type Name Description
InputArray mtx

Single-channel array

Returns
Type Description
System.Int32

number of non-zero elements in mtx

| Improve this Doc View Source

CreateCLAHE(Double, Nullable<Size>)

Creates a predefined CLAHE object

Declaration
public static CLAHE CreateCLAHE(double clipLimit = 40, Size? tileGridSize = null)
Parameters
Type Name Description
System.Double clipLimit
System.Nullable<OpenCvSharp.Size> tileGridSize
Returns
Type Description
CLAHE
| Improve this Doc View Source

CreateFrameSource_Camera(Int32)

Declaration
public static FrameSource CreateFrameSource_Camera(int deviceId)
Parameters
Type Name Description
System.Int32 deviceId
Returns
Type Description
FrameSource
| Improve this Doc View Source

CreateFrameSource_Empty()

Declaration
public static FrameSource CreateFrameSource_Empty()
Returns
Type Description
FrameSource
| Improve this Doc View Source

CreateFrameSource_Video(String)

Declaration
public static FrameSource CreateFrameSource_Video(string fileName)
Parameters
Type Name Description
System.String fileName
Returns
Type Description
FrameSource
| Improve this Doc View Source

CreateFrameSource_Video_CUDA(String)

Declaration
public static FrameSource CreateFrameSource_Video_CUDA(string fileName)
Parameters
Type Name Description
System.String fileName
Returns
Type Description
FrameSource
| Improve this Doc View Source

CreateHanningWindow(InputOutputArray, Size, MatType)

Computes a Hanning window coefficients in two dimensions.

Declaration
public static void CreateHanningWindow(InputOutputArray dst, Size winSize, MatType type)
Parameters
Type Name Description
InputOutputArray dst

Destination array to place Hann coefficients in

OpenCvSharp.Size winSize

The window size specifications

OpenCvSharp.MatType type

Created array type

| Improve this Doc View Source

CreateOptFlow_Brox_GPU()

Declaration
public static DenseOpticalFlowExt CreateOptFlow_Brox_GPU()
Returns
Type Description
DenseOpticalFlowExt
| Improve this Doc View Source

CreateOptFlow_DualTVL1_GPU()

Declaration
public static DenseOpticalFlowExt CreateOptFlow_DualTVL1_GPU()
Returns
Type Description
DenseOpticalFlowExt
| Improve this Doc View Source

CreateOptFlow_Farneback()

Declaration
public static DenseOpticalFlowExt CreateOptFlow_Farneback()
Returns
Type Description
DenseOpticalFlowExt
| Improve this Doc View Source

CreateOptFlow_Farneback_GPU()

Declaration
public static DenseOpticalFlowExt CreateOptFlow_Farneback_GPU()
Returns
Type Description
DenseOpticalFlowExt
| Improve this Doc View Source

CreateOptFlow_PyrLK_GPU()

Declaration
public static DenseOpticalFlowExt CreateOptFlow_PyrLK_GPU()
Returns
Type Description
DenseOpticalFlowExt
| Improve this Doc View Source

CreateSuperResolution_BTVL1()

Create Bilateral TV-L1 Super Resolution.

Declaration
public static SuperResolution CreateSuperResolution_BTVL1()
Returns
Type Description
SuperResolution
| Improve this Doc View Source

CreateSuperResolution_BTVL1_CUDA()

Create Bilateral TV-L1 Super Resolution.

Declaration
public static SuperResolution CreateSuperResolution_BTVL1_CUDA()
Returns
Type Description
SuperResolution
| Improve this Doc View Source

CreateTrackbar(String, String, Int32, TrackbarCallbackNative, IntPtr)

Creates a trackbar and attaches it to the specified window. The function createTrackbar creates a trackbar(a slider or range control) with the specified name and range, assigns a variable value to be a position synchronized with the trackbar and specifies the callback function onChange to be called on the trackbar position change.The created trackbar is displayed in the specified window winName.

Declaration
public static int CreateTrackbar(string trackbarName, string winName, int count, TrackbarCallbackNative onChange = null, IntPtr userData = null)
Parameters
Type Name Description
System.String trackbarName

Name of the created trackbar.

System.String winName

Name of the window that will be used as a parent of the created trackbar.

System.Int32 count

Maximal position of the slider. The minimal position is always 0.

TrackbarCallbackNative onChange

Pointer to the function to be called every time the slider changes position. This function should be prototyped as void Foo(int, void*); , where the first parameter is the trackbar position and the second parameter is the user data(see the next parameter). If the callback is the NULL pointer, no callbacks are called, but only value is updated.

IntPtr userData

User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables.

Returns
Type Description
System.Int32
| Improve this Doc View Source

CreateTrackbar(String, String, ref Int32, Int32, TrackbarCallbackNative, IntPtr)

Creates a trackbar and attaches it to the specified window. The function createTrackbar creates a trackbar(a slider or range control) with the specified name and range, assigns a variable value to be a position synchronized with the trackbar and specifies the callback function onChange to be called on the trackbar position change.The created trackbar is displayed in the specified window winName.

Declaration
public static int CreateTrackbar(string trackbarName, string winName, ref int value, int count, TrackbarCallbackNative onChange = null, IntPtr userData = null)
Parameters
Type Name Description
System.String trackbarName

Name of the created trackbar.

System.String winName

Name of the window that will be used as a parent of the created trackbar.

System.Int32 value

Optional pointer to an integer variable whose value reflects the position of the slider.Upon creation, the slider position is defined by this variable.

System.Int32 count

Maximal position of the slider. The minimal position is always 0.

TrackbarCallbackNative onChange

Pointer to the function to be called every time the slider changes position. This function should be prototyped as void Foo(int, void*); , where the first parameter is the trackbar position and the second parameter is the user data(see the next parameter). If the callback is the NULL pointer, no callbacks are called, but only value is updated.

IntPtr userData

User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables.

Returns
Type Description
System.Int32
| Improve this Doc View Source

CubeRoot(Single)

computes cube root of the argument

Declaration
public static float CubeRoot(float val)
Parameters
Type Name Description
System.Single val
Returns
Type Description
System.Single
| Improve this Doc View Source

CvtColor(InputArray, OutputArray, ColorConversionCodes, Int32)

Converts image from one color space to another

Declaration
public static void CvtColor(InputArray src, OutputArray dst, ColorConversionCodes code, int dstCn = 0)
Parameters
Type Name Description
InputArray src

The source image, 8-bit unsigned, 16-bit unsigned or single-precision floating-point

OutputArray dst

The destination image; will have the same size and the same depth as src

ColorConversionCodes code

The color space conversion code

System.Int32 dstCn

The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from src and the code

| Improve this Doc View Source

CvtColorTwoPlane(InputArray, InputArray, OutputArray, ColorConversionCodes)

Converts an image from one color space to another where the source image is stored in two planes. This function only supports YUV420 to RGB conversion as of now.

Declaration
public static void CvtColorTwoPlane(InputArray src1, InputArray src2, OutputArray dst, ColorConversionCodes code)
Parameters
Type Name Description
InputArray src1

8-bit image (#CV_8U) of the Y plane.

InputArray src2

image containing interleaved U/V plane.

OutputArray dst

output image.

ColorConversionCodes code

Specifies the type of conversion. It can take any of the following values:

  • #COLOR_YUV2BGR_NV12
  • #COLOR_YUV2RGB_NV12
  • #COLOR_YUV2BGRA_NV12
  • #COLOR_YUV2RGBA_NV12
  • #COLOR_YUV2BGR_NV21
  • #COLOR_YUV2RGB_NV21
  • #COLOR_YUV2BGRA_NV21
  • #COLOR_YUV2RGBA_NV21
| Improve this Doc View Source

Dct(InputArray, OutputArray, DctFlags)

Performs forward or inverse 1D or 2D Discrete Cosine Transformation

Declaration
public static void Dct(InputArray src, OutputArray dst, DctFlags flags = DctFlags.None)
Parameters
Type Name Description
InputArray src

The source floating-point array

OutputArray dst

The destination array; will have the same size and same type as src

DctFlags flags

Transformation flags, a combination of DctFlag2 values

| Improve this Doc View Source

Decolor(InputArray, OutputArray, OutputArray)

Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized black-and-white photograph rendering, and in many single channel image processing applications @cite CL12 .

Declaration
public static void Decolor(InputArray src, OutputArray grayscale, OutputArray colorBoost)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

OutputArray grayscale

Output 8-bit 1-channel image.

OutputArray colorBoost

Output 8-bit 3-channel image.

| Improve this Doc View Source

DecomposeHomographyMat(InputArray, InputArray, out Mat[], out Mat[], out Mat[])

Decompose a homography matrix to rotation(s), translation(s) and plane normal(s).

Declaration
public static int DecomposeHomographyMat(InputArray h, InputArray k, out Mat[] rotations, out Mat[] translations, out Mat[] normals)
Parameters
Type Name Description
InputArray h

The input homography matrix between two images.

InputArray k

The input intrinsic camera calibration matrix.

Mat[] rotations

Array of rotation matrices.

Mat[] translations

Array of translation matrices.

Mat[] normals

Array of plane normal matrices.

Returns
Type Description
System.Int32
| Improve this Doc View Source

DecomposeProjectionMatrix(InputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray)

Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector

Declaration
public static void DecomposeProjectionMatrix(InputArray projMatrix, OutputArray cameraMatrix, OutputArray rotMatrix, OutputArray transVect, OutputArray rotMatrixX = null, OutputArray rotMatrixY = null, OutputArray rotMatrixZ = null, OutputArray eulerAngles = null)
Parameters
Type Name Description
InputArray projMatrix

3x4 input projection matrix P.

OutputArray cameraMatrix

Output 3x3 camera matrix K.

OutputArray rotMatrix

Output 3x3 external rotation matrix R.

OutputArray transVect

Output 4x1 translation vector T.

OutputArray rotMatrixX

Optional 3x3 rotation matrix around x-axis.

OutputArray rotMatrixY

Optional 3x3 rotation matrix around y-axis.

OutputArray rotMatrixZ

Optional 3x3 rotation matrix around z-axis.

OutputArray eulerAngles

ptional three-element vector containing three Euler angles of rotation in degrees.

| Improve this Doc View Source

DecomposeProjectionMatrix(Double[,], out Double[,], out Double[,], out Double[])

Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector

Declaration
public static void DecomposeProjectionMatrix(double[, ] projMatrix, out double[, ] cameraMatrix, out double[, ] rotMatrix, out double[] transVect)
Parameters
Type Name Description
System.Double[,] projMatrix

3x4 input projection matrix P.

System.Double[,] cameraMatrix

Output 3x3 camera matrix K.

System.Double[,] rotMatrix

Output 3x3 external rotation matrix R.

System.Double[] transVect

Output 4x1 translation vector T.

| Improve this Doc View Source

DecomposeProjectionMatrix(Double[,], out Double[,], out Double[,], out Double[], out Double[,], out Double[,], out Double[,], out Double[])

Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector

Declaration
public static void DecomposeProjectionMatrix(double[, ] projMatrix, out double[, ] cameraMatrix, out double[, ] rotMatrix, out double[] transVect, out double[, ] rotMatrixX, out double[, ] rotMatrixY, out double[, ] rotMatrixZ, out double[] eulerAngles)
Parameters
Type Name Description
System.Double[,] projMatrix

3x4 input projection matrix P.

System.Double[,] cameraMatrix

Output 3x3 camera matrix K.

System.Double[,] rotMatrix

Output 3x3 external rotation matrix R.

System.Double[] transVect

Output 4x1 translation vector T.

System.Double[,] rotMatrixX

Optional 3x3 rotation matrix around x-axis.

System.Double[,] rotMatrixY

Optional 3x3 rotation matrix around y-axis.

System.Double[,] rotMatrixZ

Optional 3x3 rotation matrix around z-axis.

System.Double[] eulerAngles

ptional three-element vector containing three Euler angles of rotation in degrees.

| Improve this Doc View Source

Demosaicing(InputArray, OutputArray, ColorConversionCodes, Int32)

main function for all demosaicing processes

Declaration
public static void Demosaicing(InputArray src, OutputArray dst, ColorConversionCodes code, int dstCn = 0)
Parameters
Type Name Description
InputArray src

input image: 8-bit unsigned or 16-bit unsigned.

OutputArray dst

output image of the same size and depth as src.

ColorConversionCodes code

Color space conversion code (see the description below).

System.Int32 dstCn

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

Remarks

The function can do the following transformations:

  • Demosaicing using bilinear interpolation

#COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR #COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY

  • Demosaicing using Variable Number of Gradients.

#COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG

  • Edge-Aware Demosaicing.

#COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA

  • Demosaicing with alpha channel

COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA

| Improve this Doc View Source

DenoiseTVL1(IEnumerable<Mat>, Mat, Double, Int32)

Primal-dual algorithm is an algorithm for solving special types of variational problems (that is, finding a function to minimize some functional). As the image denoising, in particular, may be seen as the variational problem, primal-dual algorithm then can be used to perform denoising and this is exactly what is implemented.

Declaration
public static void DenoiseTVL1(IEnumerable<Mat> observations, Mat result, double lambda = 1, int niters = 30)
Parameters
Type Name Description
IEnumerable<Mat> observations

This array should contain one or more noised versions of the image that is to be restored.

Mat result

Here the denoised image will be stored. There is no need to do pre-allocation of storage space, as it will be automatically allocated, if necessary.

System.Double lambda

Corresponds to \f$\lambda\f$ in the formulas above. As it is enlarged, the smooth (blurred) images are treated more favorably than detailed (but maybe more noised) ones. Roughly speaking, as it becomes smaller, the result will be more blur but more sever outliers will be removed.

System.Int32 niters

Number of iterations that the algorithm will run. Of course, as more iterations as better, but it is hard to quantitatively refine this statement, so just use the default and increase it if the results are poor.

| Improve this Doc View Source

DestroyAllWindows()

Destroys all of the HighGUI windows.

Declaration
public static void DestroyAllWindows()
| Improve this Doc View Source

DestroyWindow(String)

Destroys the specified window.

Declaration
public static void DestroyWindow(string winName)
Parameters
Type Name Description
System.String winName
| Improve this Doc View Source

DetailEnhance(InputArray, OutputArray, Single, Single)

This filter enhances the details of a particular image.

Declaration
public static void DetailEnhance(InputArray src, OutputArray dst, float sigmaS = 10F, float sigmaR = 0.15F)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

OutputArray dst

Output image with the same size and type as src.

System.Single sigmaS

Range between 0 to 200.

System.Single sigmaR

Range between 0 to 1.

| Improve this Doc View Source

Determinant(InputArray)

computes determinant of a square matrix

Declaration
public static double Determinant(InputArray mtx)
Parameters
Type Name Description
InputArray mtx

The input matrix; must have CV_32FC1 or CV_64FC1 type and square size

Returns
Type Description
System.Double

determinant of the specified matrix.

| Improve this Doc View Source

Dft(InputArray, OutputArray, DftFlags, Int32)

Performs a forward Discrete Fourier transform of 1D or 2D floating-point array.

Declaration
public static void Dft(InputArray src, OutputArray dst, DftFlags flags = DftFlags.None, int nonzeroRows = 0)
Parameters
Type Name Description
InputArray src

The source array, real or complex

OutputArray dst

The destination array, which size and type depends on the flags

DftFlags flags

Transformation flags, a combination of the DftFlag2 values

System.Int32 nonzeroRows

When the parameter != 0, the function assumes that only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, thus the function can handle the rest of the rows more efficiently and thus save some time. This technique is very useful for computing array cross-correlation or convolution using DFT

| Improve this Doc View Source

Dilate(InputArray, OutputArray, InputArray, Nullable<Point>, Int32, BorderTypes, Nullable<Scalar>)

Dilates an image by using a specific structuring element.

Declaration
public static void Dilate(InputArray src, OutputArray dst, InputArray element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

The destination image. It will have the same size and the same type as src

InputArray element

The structuring element used for dilation. If element=new Mat() , a 3x3 rectangular structuring element is used

System.Nullable<OpenCvSharp.Point> anchor

Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center

System.Int32 iterations

The number of times dilation is applied. [By default this is 1]

BorderTypes borderType

The pixel extrapolation method. [By default this is BorderType.Constant]

System.Nullable<OpenCvSharp.Scalar> borderValue

The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]

| Improve this Doc View Source

DistanceTransform(InputArray, OutputArray, DistanceTypes, DistanceTransformMasks, Int32)

computes the distance transform map

Declaration
public static void DistanceTransform(InputArray src, OutputArray dst, DistanceTypes distanceType, DistanceTransformMasks maskSize, int dstType = default(int))
Parameters
Type Name Description
InputArray src

8-bit, single-channel (binary) source image.

OutputArray dst

Output image with calculated distances. It is a 8-bit or 32-bit floating-point, single-channel image of the same size as src.

DistanceTypes distanceType

Type of distance

DistanceTransformMasks maskSize

Size of the distance transform mask, see #DistanceTransformMasks. In case of the #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a 3x3 mask gives the same result as 5x5 or any larger aperture.

System.Int32 dstType

Type of output image. It can be MatType.CV_8U or MatType.CV_32F. Type CV_8U can be used only for the first variant of the function and distanceType == #DIST_L1.

| Improve this Doc View Source

DistanceTransformWithLabels(InputArray, OutputArray, OutputArray, DistanceTypes, DistanceTransformMasks, DistanceTransformLabelTypes)

Calculates the distance to the closest zero pixel for each pixel of the source image.

Declaration
public static void DistanceTransformWithLabels(InputArray src, OutputArray dst, OutputArray labels, DistanceTypes distanceType, DistanceTransformMasks maskSize, DistanceTransformLabelTypes labelType = DistanceTransformLabelTypes.CComp)
Parameters
Type Name Description
InputArray src

8-bit, single-channel (binary) source image.

OutputArray dst

Output image with calculated distances. It is a 8-bit or 32-bit floating-point, single-channel image of the same size as src.

OutputArray labels

Output 2D array of labels (the discrete Voronoi diagram). It has the type CV_32SC1 and the same size as src.

DistanceTypes distanceType

Type of distance

DistanceTransformMasks maskSize

Size of the distance transform mask, see #DistanceTransformMasks. #DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a 3x3 mask gives the same result as 5x5 or any larger aperture.

DistanceTransformLabelTypes labelType

Type of the label array to build

| Improve this Doc View Source

Divide(InputArray, InputArray, OutputArray, Double, Nullable<MatType>)

Performs per-element division of two arrays or a scalar by an array.

Declaration
public static void Divide(InputArray src1, InputArray src2, OutputArray dst, double scale = 1, MatType? dtype = null)
Parameters
Type Name Description
InputArray src1

The first source array

InputArray src2

The second source array; should have the same size and same type as src1

OutputArray dst

The destination array; will have the same size and same type as src2

System.Double scale

Scale factor [By default this is 1]

System.Nullable<OpenCvSharp.MatType> dtype
| Improve this Doc View Source

Divide(Double, InputArray, OutputArray, Int32)

Performs per-element division of two arrays or a scalar by an array.

Declaration
public static void Divide(double scale, InputArray src2, OutputArray dst, int dtype = -1)
Parameters
Type Name Description
System.Double scale

Scale factor

InputArray src2

The first source array

OutputArray dst

The destination array; will have the same size and same type as src2

System.Int32 dtype
| Improve this Doc View Source

DrawChessboardCorners(InputOutputArray, Size, IEnumerable<Point2f>, Boolean)

Renders the detected chessboard corners.

Declaration
public static void DrawChessboardCorners(InputOutputArray image, Size patternSize, IEnumerable<Point2f> corners, bool patternWasFound)
Parameters
Type Name Description
InputOutputArray image

Destination image. It must be an 8-bit color image.

OpenCvSharp.Size patternSize

Number of inner corners per a chessboard row and column (patternSize = cv::Size(points_per_row,points_per_column)).

IEnumerable<OpenCvSharp.Point2f> corners

Array of detected corners, the output of findChessboardCorners.

System.Boolean patternWasFound

Parameter indicating whether the complete board was found or not. The return value of findChessboardCorners() should be passed here.

| Improve this Doc View Source

DrawChessboardCorners(InputOutputArray, Size, InputArray, Boolean)

Renders the detected chessboard corners.

Declaration
public static void DrawChessboardCorners(InputOutputArray image, Size patternSize, InputArray corners, bool patternWasFound)
Parameters
Type Name Description
InputOutputArray image

Destination image. It must be an 8-bit color image.

OpenCvSharp.Size patternSize

Number of inner corners per a chessboard row and column (patternSize = cv::Size(points_per_row,points_per_column)).

InputArray corners

Array of detected corners, the output of findChessboardCorners.

System.Boolean patternWasFound

Parameter indicating whether the complete board was found or not. The return value of findChessboardCorners() should be passed here.

| Improve this Doc View Source

DrawContours(InputOutputArray, IEnumerable<IEnumerable<Point>>, Int32, Scalar, Int32, LineTypes, Nullable<IEnumerable<HierarchyIndex>>, Int32, Nullable<Point>)

draws contours in the image

Declaration
public static void DrawContours(InputOutputArray image, IEnumerable<IEnumerable<Point>> contours, int contourIdx, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, IEnumerable<HierarchyIndex>? hierarchy = null, int maxLevel = 2147483647, Point? offset = null)
Parameters
Type Name Description
InputOutputArray image

Destination image.

IEnumerable<IEnumerable<OpenCvSharp.Point>> contours

All the input contours. Each contour is stored as a point vector.

System.Int32 contourIdx

Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

OpenCvSharp.Scalar color

Color of the contours.

System.Int32 thickness

Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), the contour interiors are drawn.

LineTypes lineType

Line connectivity.

System.Nullable<IEnumerable<HierarchyIndex>> hierarchy

Optional information about hierarchy. It is only needed if you want to draw only some of the contours

System.Int32 maxLevel

Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.

System.Nullable<OpenCvSharp.Point> offset

Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy)

| Improve this Doc View Source

DrawContours(InputOutputArray, IEnumerable<Mat>, Int32, Scalar, Int32, LineTypes, Mat, Int32, Nullable<Point>)

draws contours in the image

Declaration
public static void DrawContours(InputOutputArray image, IEnumerable<Mat> contours, int contourIdx, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, Mat hierarchy = null, int maxLevel = 2147483647, Point? offset = null)
Parameters
Type Name Description
InputOutputArray image

Destination image.

IEnumerable<Mat> contours

All the input contours. Each contour is stored as a point vector.

System.Int32 contourIdx

Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

OpenCvSharp.Scalar color

Color of the contours.

System.Int32 thickness

Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), the contour interiors are drawn.

LineTypes lineType

Line connectivity.

Mat hierarchy

Optional information about hierarchy. It is only needed if you want to draw only some of the contours

System.Int32 maxLevel

Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.

System.Nullable<OpenCvSharp.Point> offset

Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy)

| Improve this Doc View Source

DrawFrameAxes(InputOutputArray, InputArray, InputArray, InputArray, InputArray, Single, Int32)

Draw axes of the world/object coordinate system from pose estimation.

Declaration
public static void DrawFrameAxes(InputOutputArray image, InputArray cameraMatrix, InputArray distCoeffs, InputArray rvec, InputArray tvec, float length, int thickness = 3)
Parameters
Type Name Description
InputOutputArray image

Input/output image. It must have 1 or 3 channels. The number of channels is not altered.

InputArray cameraMatrix

Input 3x3 floating-point matrix of camera intrinsic parameters.

InputArray distCoeffs

Input vector of distortion coefficients \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of 4, 5, 8, 12 or 14 elements.If the vector is empty, the zero distortion coefficients are assumed.

InputArray rvec

Rotation vector (see @ref Rodrigues ) that, together with tvec , brings points from the model coordinate system to the camera coordinate system.

InputArray tvec

Translation vector.

System.Single length

Length of the painted axes in the same unit than tvec (usually in meters).

System.Int32 thickness

Line thickness of the painted axes.

Remarks

This function draws the axes of the world/object coordinate system w.r.t. to the camera frame. OX is drawn in red, OY in green and OZ in blue.

| Improve this Doc View Source

DrawKeypoints(InputArray, IEnumerable<KeyPoint>, InputOutputArray, Nullable<Scalar>, DrawMatchesFlags)

Draw keypoints.

Declaration
public static void DrawKeypoints(InputArray image, IEnumerable<KeyPoint> keypoints, InputOutputArray outImage, Scalar? color = null, DrawMatchesFlags flags = DrawMatchesFlags.Default)
Parameters
Type Name Description
InputArray image

Source image.

IEnumerable<OpenCvSharp.KeyPoint> keypoints

Keypoints from the source image.

InputOutputArray outImage

Output image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.

System.Nullable<OpenCvSharp.Scalar> color

Color of keypoints.

DrawMatchesFlags flags

Flags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags.

| Improve this Doc View Source

DrawMarker(InputOutputArray, Point, Scalar, MarkerTypes, Int32, Int32, LineTypes)

Draws a marker on a predefined position in an image.

The function cv::drawMarker draws a marker on a given position in the image.For the moment several marker types are supported, see #MarkerTypes for more information.

Declaration
public static void DrawMarker(InputOutputArray img, Point position, Scalar color, MarkerTypes markerType = MarkerTypes.Cross, int markerSize = 20, int thickness = 1, LineTypes lineType = LineTypes.Link8)
Parameters
Type Name Description
InputOutputArray img

Image.

OpenCvSharp.Point position

The point where the crosshair is positioned.

OpenCvSharp.Scalar color

Line color.

MarkerTypes markerType

The specific type of marker you want to use.

System.Int32 markerSize

The length of the marker axis [default = 20 pixels]

System.Int32 thickness

Line thickness.

LineTypes lineType

Type of the line.

| Improve this Doc View Source

DrawMatches(Mat, IEnumerable<KeyPoint>, Mat, IEnumerable<KeyPoint>, IEnumerable<DMatch>, Mat, Nullable<Scalar>, Nullable<Scalar>, Nullable<IEnumerable<Byte>>, DrawMatchesFlags)

Draws the found matches of keypoints from two images.

Declaration
public static void DrawMatches(Mat img1, IEnumerable<KeyPoint> keypoints1, Mat img2, IEnumerable<KeyPoint> keypoints2, IEnumerable<DMatch> matches1To2, Mat outImg, Scalar? matchColor = null, Scalar? singlePointColor = null, IEnumerable<byte>? matchesMask = null, DrawMatchesFlags flags = DrawMatchesFlags.Default)
Parameters
Type Name Description
Mat img1

First source image.

IEnumerable<OpenCvSharp.KeyPoint> keypoints1

Keypoints from the first source image.

Mat img2

Second source image.

IEnumerable<OpenCvSharp.KeyPoint> keypoints2

Keypoints from the second source image.

IEnumerable<OpenCvSharp.DMatch> matches1To2

Matches from the first image to the second one, which means that keypoints1[i] has a corresponding point in keypoints2[matches[i]] .

Mat outImg

Output image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.

System.Nullable<OpenCvSharp.Scalar> matchColor

Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1), the color is generated randomly.

System.Nullable<OpenCvSharp.Scalar> singlePointColor

Color of single keypoints (circles), which means that keypoints do not have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.

System.Nullable<IEnumerable<System.Byte>> matchesMask

Mask determining which matches are drawn. If the mask is empty, all matches are drawn.

DrawMatchesFlags flags

Flags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags.

| Improve this Doc View Source

DrawMatchesKnn(Mat, IEnumerable<KeyPoint>, Mat, IEnumerable<KeyPoint>, IEnumerable<IEnumerable<DMatch>>, Mat, Nullable<Scalar>, Nullable<Scalar>, Nullable<IEnumerable<IEnumerable<Byte>>>, DrawMatchesFlags)

Draws the found matches of keypoints from two images.

Declaration
public static void DrawMatchesKnn(Mat img1, IEnumerable<KeyPoint> keypoints1, Mat img2, IEnumerable<KeyPoint> keypoints2, IEnumerable<IEnumerable<DMatch>> matches1To2, Mat outImg, Scalar? matchColor = null, Scalar? singlePointColor = null, IEnumerable<IEnumerable<byte>>? matchesMask = null, DrawMatchesFlags flags = DrawMatchesFlags.Default)
Parameters
Type Name Description
Mat img1

First source image.

IEnumerable<OpenCvSharp.KeyPoint> keypoints1

Keypoints from the first source image.

Mat img2

Second source image.

IEnumerable<OpenCvSharp.KeyPoint> keypoints2

Keypoints from the second source image.

IEnumerable<IEnumerable<OpenCvSharp.DMatch>> matches1To2

Matches from the first image to the second one, which means that keypoints1[i] has a corresponding point in keypoints2[matches[i]] .

Mat outImg

Output image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.

System.Nullable<OpenCvSharp.Scalar> matchColor

Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1), the color is generated randomly.

System.Nullable<OpenCvSharp.Scalar> singlePointColor

Color of single keypoints (circles), which means that keypoints do not have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.

System.Nullable<IEnumerable<IEnumerable<System.Byte>>> matchesMask

Mask determining which matches are drawn. If the mask is empty, all matches are drawn.

DrawMatchesFlags flags

Flags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags.

| Improve this Doc View Source

EdgePreservingFilter(InputArray, OutputArray, EdgePreservingMethods, Single, Single)

Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications @cite EM11 .

Declaration
public static void EdgePreservingFilter(InputArray src, OutputArray dst, EdgePreservingMethods flags = EdgePreservingMethods.RecursFilter, float sigmaS = 60F, float sigmaR = 0.4F)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

OutputArray dst

Output 8-bit 3-channel image.

EdgePreservingMethods flags

Edge preserving filters

System.Single sigmaS

Range between 0 to 200.

System.Single sigmaR

Range between 0 to 1.

| Improve this Doc View Source

Eigen(InputArray, OutputArray, OutputArray)

Computes eigenvalues and eigenvectors of a symmetric matrix.

Declaration
public static bool Eigen(InputArray src, OutputArray eigenvalues, OutputArray eigenvectors)
Parameters
Type Name Description
InputArray src

The input matrix; must have CV_32FC1 or CV_64FC1 type, square size and be symmetric: src^T == src

OutputArray eigenvalues

The output vector of eigenvalues of the same type as src; The eigenvalues are stored in the descending order.

OutputArray eigenvectors

The output matrix of eigenvectors; It will have the same size and the same type as src; The eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding eigenvalues

Returns
Type Description
System.Boolean
| Improve this Doc View Source

EigenNonSymmetric(InputArray, OutputArray, OutputArray)

Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only).

Declaration
public static void EigenNonSymmetric(InputArray src, OutputArray eigenvalues, OutputArray eigenvectors)
Parameters
Type Name Description
InputArray src

input matrix (CV_32FC1 or CV_64FC1 type).

OutputArray eigenvalues

output vector of eigenvalues (type is the same type as src).

OutputArray eigenvectors

output matrix of eigenvectors (type is the same type as src). The eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding eigenvalues.

| Improve this Doc View Source

Ellipse(InputOutputArray, Point, Size, Double, Double, Double, Scalar, Int32, LineTypes, Int32)

Draws simple or thick elliptic arc or fills ellipse sector

Declaration
public static void Ellipse(InputOutputArray img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img

Image.

OpenCvSharp.Point center

Center of the ellipse.

OpenCvSharp.Size axes

Length of the ellipse axes.

System.Double angle

Rotation angle.

System.Double startAngle

Starting angle of the elliptic arc.

System.Double endAngle

Ending angle of the elliptic arc.

OpenCvSharp.Scalar color

Ellipse color.

System.Int32 thickness

Thickness of the ellipse arc. [By default this is 1]

LineTypes lineType

Type of the ellipse boundary. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the center coordinates and axes' values. [By default this is 0]

| Improve this Doc View Source

Ellipse(InputOutputArray, RotatedRect, Scalar, Int32, LineTypes)

Draws simple or thick elliptic arc or fills ellipse sector

Declaration
public static void Ellipse(InputOutputArray img, RotatedRect box, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8)
Parameters
Type Name Description
InputOutputArray img

Image.

OpenCvSharp.RotatedRect box

The enclosing box of the ellipse drawn

OpenCvSharp.Scalar color

Ellipse color.

System.Int32 thickness

Thickness of the ellipse boundary. [By default this is 1]

LineTypes lineType

Type of the ellipse boundary. [By default this is LineType.Link8]

| Improve this Doc View Source

Ellipse2Poly(Point, Size, Int32, Int32, Int32, Int32)

Approximates an elliptic arc with a polyline. The function ellipse2Poly computes the vertices of a polyline that approximates the specified elliptic arc. It is used by cv::ellipse.

Declaration
public static Point[] Ellipse2Poly(Point center, Size axes, int angle, int arcStart, int arcEnd, int delta)
Parameters
Type Name Description
OpenCvSharp.Point center

Center of the arc.

OpenCvSharp.Size axes

Half of the size of the ellipse main axes. See the ellipse for details.

System.Int32 angle

Rotation angle of the ellipse in degrees. See the ellipse for details.

System.Int32 arcStart

Starting angle of the elliptic arc in degrees.

System.Int32 arcEnd

Ending angle of the elliptic arc in degrees.

System.Int32 delta

Angle between the subsequent polyline vertices. It defines the approximation

Returns
Type Description
OpenCvSharp.Point[]

Output vector of polyline vertices.

| Improve this Doc View Source

Ellipse2Poly(Point2d, Size2d, Int32, Int32, Int32, Int32)

Approximates an elliptic arc with a polyline. The function ellipse2Poly computes the vertices of a polyline that approximates the specified elliptic arc. It is used by cv::ellipse.

Declaration
public static Point2d[] Ellipse2Poly(Point2d center, Size2d axes, int angle, int arcStart, int arcEnd, int delta)
Parameters
Type Name Description
OpenCvSharp.Point2d center

Center of the arc.

OpenCvSharp.Size2d axes

Half of the size of the ellipse main axes. See the ellipse for details.

System.Int32 angle

Rotation angle of the ellipse in degrees. See the ellipse for details.

System.Int32 arcStart

Starting angle of the elliptic arc in degrees.

System.Int32 arcEnd

Ending angle of the elliptic arc in degrees.

System.Int32 delta

Angle between the subsequent polyline vertices. It defines the approximation

Returns
Type Description
OpenCvSharp.Point2d[]

Output vector of polyline vertices.

| Improve this Doc View Source

EMD(InputArray, InputArray, DistanceTypes)

Computes the "minimal work" distance between two weighted point configurations.

The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations.One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval.EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster.In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.

Declaration
public static float EMD(InputArray signature1, InputArray signature2, DistanceTypes distType)
Parameters
Type Name Description
InputArray signature1

First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. Each row stores the point weight followed by the point coordinates.The matrix is allowed to have a single column(weights only) if the user-defined cost matrix is used.The weights must be non-negative and have at least one non-zero value.

InputArray signature2

Second signature of the same format as signature1 , though the number of rows may be different.The total weights may be different.In this case an extra "dummy" point is added to either signature1 or signature2. The weights must be non-negative and have at least one non-zero value.

DistanceTypes distType

Used metric.

Returns
Type Description
System.Single
| Improve this Doc View Source

EMD(InputArray, InputArray, DistanceTypes, InputArray)

Computes the "minimal work" distance between two weighted point configurations.

The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations.One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval.EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster.In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.

Declaration
public static float EMD(InputArray signature1, InputArray signature2, DistanceTypes distType, InputArray cost)
Parameters
Type Name Description
InputArray signature1

First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. Each row stores the point weight followed by the point coordinates.The matrix is allowed to have a single column(weights only) if the user-defined cost matrix is used.The weights must be non-negative and have at least one non-zero value.

InputArray signature2

Second signature of the same format as signature1 , though the number of rows may be different.The total weights may be different.In this case an extra "dummy" point is added to either signature1 or signature2. The weights must be non-negative and have at least one non-zero value.

DistanceTypes distType

Used metric.

InputArray cost

User-defined size1 x size2 cost matrix. Also, if a cost matrix is used, lower boundary lowerBound cannot be calculated because it needs a metric function.

Returns
Type Description
System.Single
| Improve this Doc View Source

EMD(InputArray, InputArray, DistanceTypes, InputArray, out Single, OutputArray)

Computes the "minimal work" distance between two weighted point configurations.

The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations.One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval.EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster.In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.

Declaration
public static float EMD(InputArray signature1, InputArray signature2, DistanceTypes distType, InputArray cost, out float lowerBound, OutputArray flow = null)
Parameters
Type Name Description
InputArray signature1

First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. Each row stores the point weight followed by the point coordinates.The matrix is allowed to have a single column(weights only) if the user-defined cost matrix is used.The weights must be non-negative and have at least one non-zero value.

InputArray signature2

Second signature of the same format as signature1 , though the number of rows may be different.The total weights may be different.In this case an extra "dummy" point is added to either signature1 or signature2. The weights must be non-negative and have at least one non-zero value.

DistanceTypes distType

Used metric.

InputArray cost

User-defined size1 x size2 cost matrix. Also, if a cost matrix is used, lower boundary lowerBound cannot be calculated because it needs a metric function.

System.Single lowerBound

Optional input/output parameter: lower boundary of a distance between the two signatures that is a distance between mass centers.The lower boundary may not be calculated if the user-defined cost matrix is used, the total weights of point configurations are not equal, or if the signatures consist of weights only(the signature matrices have a single column). You ** must** initialize *lowerBound.If the calculated distance between mass centers is greater or equal to *lowerBound(it means that the signatures are far enough), the function does not calculate EMD. In any case *lowerBound is set to the calculated distance between mass centers on return. Thus, if you want to calculate both distance between mass centers and EMD, *lowerBound should be set to 0.

OutputArray flow

Resultant size1 x size2 flow matrix: flow[i,j] is a flow from i-th point of signature1 to j-th point of signature2.

Returns
Type Description
System.Single
| Improve this Doc View Source

EqualizeHist(InputArray, OutputArray)

normalizes the grayscale image brightness and contrast by normalizing its histogram

Declaration
public static void EqualizeHist(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

The source 8-bit single channel image

OutputArray dst

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

| Improve this Doc View Source

Erode(InputArray, OutputArray, InputArray, Nullable<Point>, Int32, BorderTypes, Nullable<Scalar>)

Erodes an image by using a specific structuring element.

Declaration
public static void Erode(InputArray src, OutputArray dst, InputArray element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

The destination image. It will have the same size and the same type as src

InputArray element

The structuring element used for dilation. If element=new Mat(), a 3x3 rectangular structuring element is used

System.Nullable<OpenCvSharp.Point> anchor

Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center

System.Int32 iterations

The number of times erosion is applied

BorderTypes borderType

The pixel extrapolation method

System.Nullable<OpenCvSharp.Scalar> borderValue

The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]

| Improve this Doc View Source

EstimateAffine2D(InputArray, InputArray, OutputArray, RobustEstimationAlgorithms, Double, UInt64, Double, UInt64)

Computes an optimal affine transformation between two 2D point sets.

Declaration
public static Mat EstimateAffine2D(InputArray from, InputArray to, OutputArray inliers = null, RobustEstimationAlgorithms method = RobustEstimationAlgorithms.RANSAC, double ransacReprojThreshold = 3, ulong maxIters = 2000UL, double confidence = 0.99, ulong refineIters = 10UL)
Parameters
Type Name Description
InputArray from

First input 2D point set containing (X,Y).

InputArray to

Second input 2D point set containing (x,y).

OutputArray inliers

Output vector indicating which points are inliers (1-inlier, 0-outlier).

RobustEstimationAlgorithms method

Robust method used to compute transformation.

System.Double ransacReprojThreshold

Maximum reprojection error in the RANSAC algorithm to consider a point as an inlier.Applies only to RANSAC.

System.UInt64 maxIters

The maximum number of robust method iterations.

System.Double confidence

Confidence level, between 0 and 1, for the estimated transformation. Anything between 0.95 and 0.99 is usually good enough.Values too close to 1 can slow down the estimation significantly.Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.

System.UInt64 refineIters

Maximum number of iterations of refining algorithm (Levenberg-Marquardt). Passing 0 will disable refining, so the output matrix will be output of robust method.

Returns
Type Description
Mat

Output 2D affine transformation matrix \f$2 \times 3\f$ or empty matrix if transformation could not be estimated.

| Improve this Doc View Source

EstimateAffine3D(InputArray, InputArray, OutputArray, OutputArray, Double, Double)

Computes an optimal affine transformation between two 3D point sets.

Declaration
public static int EstimateAffine3D(InputArray src, InputArray dst, OutputArray outVal, OutputArray inliers, double ransacThreshold = 3, double confidence = 0.99)
Parameters
Type Name Description
InputArray src

First input 3D point set.

InputArray dst

Second input 3D point set.

OutputArray outVal

Output 3D affine transformation matrix 3 x 4 .

OutputArray inliers

Output vector indicating which points are inliers.

System.Double ransacThreshold

Maximum reprojection error in the RANSAC algorithm to consider a point as an inlier.

System.Double confidence

Confidence level, between 0 and 1, for the estimated transformation. Anything between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.

Returns
Type Description
System.Int32
| Improve this Doc View Source

EstimateAffinePartial2D(InputArray, InputArray, OutputArray, RobustEstimationAlgorithms, Double, UInt64, Double, UInt64)

Computes an optimal limited affine transformation with 4 degrees of freedom between two 2D point sets.

Declaration
public static Mat EstimateAffinePartial2D(InputArray from, InputArray to, OutputArray inliers = null, RobustEstimationAlgorithms method = RobustEstimationAlgorithms.RANSAC, double ransacReprojThreshold = 3, ulong maxIters = 2000UL, double confidence = 0.99, ulong refineIters = 10UL)
Parameters
Type Name Description
InputArray from

First input 2D point set.

InputArray to

Second input 2D point set.

OutputArray inliers

Output vector indicating which points are inliers.

RobustEstimationAlgorithms method

Robust method used to compute transformation.

System.Double ransacReprojThreshold

Maximum reprojection error in the RANSAC algorithm to consider a point as an inlier.Applies only to RANSAC.

System.UInt64 maxIters

The maximum number of robust method iterations.

System.Double confidence

Confidence level, between 0 and 1, for the estimated transformation. Anything between 0.95 and 0.99 is usually good enough.Values too close to 1 can slow down the estimation significantly.Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.

System.UInt64 refineIters
Returns
Type Description
Mat

Output 2D affine transformation (4 degrees of freedom) matrix 2x3 or empty matrix if transformation could not be estimated.

| Improve this Doc View Source

EvaluateFeatureDetector(Mat, Mat, Mat, ref KeyPoint[], ref KeyPoint[], out Single, out Int32)

Declaration
public static void EvaluateFeatureDetector(Mat img1, Mat img2, Mat H1to2, ref KeyPoint[] keypoints1, ref KeyPoint[] keypoints2, out float repeatability, out int correspCount)
Parameters
Type Name Description
Mat img1
Mat img2
Mat H1to2
OpenCvSharp.KeyPoint[] keypoints1
OpenCvSharp.KeyPoint[] keypoints2
System.Single repeatability
System.Int32 correspCount
| Improve this Doc View Source

Exp(InputArray, OutputArray)

computes exponent of each matrix element (dst = e**src)

Declaration
public static void Exp(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

The source array

OutputArray dst

The destination array; will have the same size and same type as src

| Improve this Doc View Source

ExtractChannel(InputArray, OutputArray, Int32)

extracts a single channel from src (coi is 0-based index)

Declaration
public static void ExtractChannel(InputArray src, OutputArray dst, int coi)
Parameters
Type Name Description
InputArray src
OutputArray dst
System.Int32 coi
| Improve this Doc View Source

FAST(InputArray, Int32, Boolean)

Detects corners using the FAST algorithm

Declaration
public static KeyPoint[] FAST(InputArray image, int threshold, bool nonmaxSupression = true)
Parameters
Type Name Description
InputArray image

grayscale image where keypoints (corners) are detected.

System.Int32 threshold

threshold on difference between intensity of the central pixel and pixels of a circle around this pixel.

System.Boolean nonmaxSupression

if true, non-maximum suppression is applied to detected corners (keypoints).

Returns
Type Description
OpenCvSharp.KeyPoint[]

keypoints detected on the image.

| Improve this Doc View Source

FAST(InputArray, Int32, Boolean, FASTType)

Detects corners using the FAST algorithm

Declaration
public static KeyPoint[] FAST(InputArray image, int threshold, bool nonmaxSupression, FASTType type)
Parameters
Type Name Description
InputArray image

grayscale image where keypoints (corners) are detected.

System.Int32 threshold

threshold on difference between intensity of the central pixel and pixels of a circle around this pixel.

System.Boolean nonmaxSupression

if true, non-maximum suppression is applied to detected corners (keypoints).

FASTType type

one of the three neighborhoods as defined in the paper

Returns
Type Description
OpenCvSharp.KeyPoint[]

keypoints detected on the image.

| Improve this Doc View Source

FastAtan2(Single, Single)

computes the angle in degrees (0..360) of the vector (x,y)

Declaration
public static float FastAtan2(float y, float x)
Parameters
Type Name Description
System.Single y
System.Single x
Returns
Type Description
System.Single
| Improve this Doc View Source

FastNlMeansDenoising(InputArray, OutputArray, Single, Int32, Int32)

Perform image denoising using Non-local Means Denoising algorithm with several computational optimizations. Noise expected to be a gaussian white noise

Declaration
public static void FastNlMeansDenoising(InputArray src, OutputArray dst, float h = 3F, int templateWindowSize = 7, int searchWindowSize = 21)
Parameters
Type Name Description
InputArray src

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

OutputArray dst

Output image with the same size and type as src .

System.Single h

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

System.Int32 templateWindowSize

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

System.Int32 searchWindowSize

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

| Improve this Doc View Source

FastNlMeansDenoisingColored(InputArray, OutputArray, Single, Single, Int32, Int32)

Modification of fastNlMeansDenoising function for colored images

Declaration
public static void FastNlMeansDenoisingColored(InputArray src, OutputArray dst, float h = 3F, float hColor = 3F, int templateWindowSize = 7, int searchWindowSize = 21)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

OutputArray dst

Output image with the same size and type as src.

System.Single h

Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

System.Single hColor

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

System.Int32 templateWindowSize

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

System.Int32 searchWindowSize

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

| Improve this Doc View Source

FastNlMeansDenoisingColoredMulti(IEnumerable<Mat>, OutputArray, Int32, Int32, Single, Single, Int32, Int32)

Modification of fastNlMeansDenoisingMulti function for colored images sequences

Declaration
public static void FastNlMeansDenoisingColoredMulti(IEnumerable<Mat> srcImgs, OutputArray dst, int imgToDenoiseIndex, int temporalWindowSize, float h = 3F, float hColor = 3F, int templateWindowSize = 7, int searchWindowSize = 21)
Parameters
Type Name Description
IEnumerable<Mat> srcImgs

Input 8-bit 3-channel images sequence. All images should have the same type and size.

OutputArray dst

Output image with the same size and type as srcImgs images.

System.Int32 imgToDenoiseIndex

Target image to denoise index in srcImgs sequence

System.Int32 temporalWindowSize

Number of surrounding images to use for target image denoising. Should be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise srcImgs[imgToDenoiseIndex] image.

System.Single h

Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.

System.Single hColor

The same as h but for color components.

System.Int32 templateWindowSize

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

System.Int32 searchWindowSize

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

| Improve this Doc View Source

FastNlMeansDenoisingMulti(IEnumerable<Mat>, OutputArray, Int32, Int32, Single, Int32, Int32)

Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces.

Declaration
public static void FastNlMeansDenoisingMulti(IEnumerable<Mat> srcImgs, OutputArray dst, int imgToDenoiseIndex, int temporalWindowSize, float h = 3F, int templateWindowSize = 7, int searchWindowSize = 21)
Parameters
Type Name Description
IEnumerable<Mat> srcImgs

Input 8-bit 1-channel, 2-channel or 3-channel images sequence. All images should have the same type and size.

OutputArray dst

Output image with the same size and type as srcImgs images.

System.Int32 imgToDenoiseIndex

Target image to denoise index in srcImgs sequence

System.Int32 temporalWindowSize

Number of surrounding images to use for target image denoising. Should be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise srcImgs[imgToDenoiseIndex] image.

System.Single h

Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

System.Int32 templateWindowSize

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

System.Int32 searchWindowSize

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

| Improve this Doc View Source

FillConvexPoly(InputOutputArray, InputArray, Scalar, LineTypes, Int32)

Fills a convex polygon.

Declaration
public static void FillConvexPoly(InputOutputArray img, InputArray pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img

Image

InputArray pts

The polygon vertices

OpenCvSharp.Scalar color

Polygon color

LineTypes lineType

Type of the polygon boundaries

System.Int32 shift

The number of fractional bits in the vertex coordinates

| Improve this Doc View Source

FillConvexPoly(Mat, IEnumerable<Point>, Scalar, LineTypes, Int32)

Fills a convex polygon.

Declaration
public static void FillConvexPoly(Mat img, IEnumerable<Point> pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
Mat img

Image

IEnumerable<OpenCvSharp.Point> pts

The polygon vertices

OpenCvSharp.Scalar color

Polygon color

LineTypes lineType

Type of the polygon boundaries

System.Int32 shift

The number of fractional bits in the vertex coordinates

| Improve this Doc View Source

FillPoly(InputOutputArray, InputArray, Scalar, LineTypes, Int32, Nullable<Point>)

Fills the area bounded by one or more polygons

Declaration
public static void FillPoly(InputOutputArray img, InputArray pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null)
Parameters
Type Name Description
InputOutputArray img

Image

InputArray pts

Array of polygons, each represented as an array of points

OpenCvSharp.Scalar color

Polygon color

LineTypes lineType

Type of the polygon boundaries

System.Int32 shift

The number of fractional bits in the vertex coordinates

System.Nullable<OpenCvSharp.Point> offset
| Improve this Doc View Source

FillPoly(Mat, IEnumerable<IEnumerable<Point>>, Scalar, LineTypes, Int32, Nullable<Point>)

Fills the area bounded by one or more polygons

Declaration
public static void FillPoly(Mat img, IEnumerable<IEnumerable<Point>> pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null)
Parameters
Type Name Description
Mat img

Image

IEnumerable<IEnumerable<OpenCvSharp.Point>> pts

Array of polygons, each represented as an array of points

OpenCvSharp.Scalar color

Polygon color

LineTypes lineType

Type of the polygon boundaries

System.Int32 shift

The number of fractional bits in the vertex coordinates

System.Nullable<OpenCvSharp.Point> offset
| Improve this Doc View Source

Filter2D(InputArray, OutputArray, MatType, InputArray, Nullable<Point>, Double, BorderTypes)

Convolves an image with the kernel

Declaration
public static void Filter2D(InputArray src, OutputArray dst, MatType ddepth, InputArray kernel, Point? anchor = null, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

The destination image. It will have the same size and the same number of channels as src

OpenCvSharp.MatType ddepth

The desired depth of the destination image. If it is negative, it will be the same as src.depth()

InputArray kernel

Convolution kernel (or rather a correlation kernel), a single-channel floating point matrix. If you want to apply different kernels to different channels, split the image into separate color planes using split() and process them individually

System.Nullable<OpenCvSharp.Point> anchor

The anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor should lie within the kernel. The special default value (-1,-1) means that the anchor is at the kernel center

System.Double delta

The optional value added to the filtered pixels before storing them in dst

BorderTypes borderType

The pixel extrapolation method

| Improve this Doc View Source

FilterHomographyDecompByVisibleRefpoints(IEnumerable<Mat>, IEnumerable<Mat>, InputArray, InputArray, OutputArray, InputArray)

Filters homography decompositions based on additional information.

Declaration
public static void FilterHomographyDecompByVisibleRefpoints(IEnumerable<Mat> rotations, IEnumerable<Mat> normals, InputArray beforePoints, InputArray afterPoints, OutputArray possibleSolutions, InputArray pointsMask = null)
Parameters
Type Name Description
IEnumerable<Mat> rotations

Vector of rotation matrices.

IEnumerable<Mat> normals

Vector of plane normal matrices.

InputArray beforePoints

Vector of (rectified) visible reference points before the homography is applied

InputArray afterPoints

Vector of (rectified) visible reference points after the homography is applied

OutputArray possibleSolutions

Vector of int indices representing the viable solution set after filtering

InputArray pointsMask

optional Mat/Vector of 8u type representing the mask for the inliers as given by the findHomography function

| Improve this Doc View Source

FilterSpeckles(InputOutputArray, Double, Int32, Double, InputOutputArray)

filters off speckles (small regions of incorrectly computed disparity)

Declaration
public static void FilterSpeckles(InputOutputArray img, double newVal, int maxSpeckleSize, double maxDiff, InputOutputArray buf = null)
Parameters
Type Name Description
InputOutputArray img

The input 16-bit signed disparity image

System.Double newVal

The disparity value used to paint-off the speckles

System.Int32 maxSpeckleSize

The maximum speckle size to consider it a speckle. Larger blobs are not affected by the algorithm

System.Double maxDiff

Maximum difference between neighbor disparity pixels to put them into the same blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point disparity map, where disparity values are multiplied by 16, this scale factor should be taken into account when specifying this parameter value.

InputOutputArray buf

The optional temporary buffer to avoid memory allocation within the function.

| Improve this Doc View Source

Find4QuadCornerSubpix(InputArray, InputOutputArray, Size)

finds subpixel-accurate positions of the chessboard corners

Declaration
public static bool Find4QuadCornerSubpix(InputArray img, InputOutputArray corners, Size regionSize)
Parameters
Type Name Description
InputArray img
InputOutputArray corners
OpenCvSharp.Size regionSize
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Find4QuadCornerSubpix(InputArray, Point2f[], Size)

finds subpixel-accurate positions of the chessboard corners

Declaration
public static bool Find4QuadCornerSubpix(InputArray img, Point2f[] corners, Size regionSize)
Parameters
Type Name Description
InputArray img
OpenCvSharp.Point2f[] corners
OpenCvSharp.Size regionSize
Returns
Type Description
System.Boolean
| Improve this Doc View Source

FindChessboardCorners(InputArray, Size, OutputArray, ChessboardFlags)

Finds the positions of internal corners of the chessboard.

Declaration
public static bool FindChessboardCorners(InputArray image, Size patternSize, OutputArray corners, ChessboardFlags flags = (ChessboardFlags)3)
Parameters
Type Name Description
InputArray image

Source chessboard view. It must be an 8-bit grayscale or color image.

OpenCvSharp.Size patternSize

Number of inner corners per a chessboard row and column ( patternSize = Size(points_per_row,points_per_colum) = Size(columns, rows) ).

OutputArray corners

Output array of detected corners.

ChessboardFlags flags

Various operation flags that can be zero or a combination of the ChessboardFlag values

Returns
Type Description
System.Boolean

The function returns true if all of the corners are found and they are placed in a certain order (row by row, left to right in every row). Otherwise, if the function fails to find all the corners or reorder them, it returns false.

| Improve this Doc View Source

FindChessboardCorners(InputArray, Size, out Point2f[], ChessboardFlags)

Finds the positions of internal corners of the chessboard.

Declaration
public static bool FindChessboardCorners(InputArray image, Size patternSize, out Point2f[] corners, ChessboardFlags flags = (ChessboardFlags)3)
Parameters
Type Name Description
InputArray image

Source chessboard view. It must be an 8-bit grayscale or color image.

OpenCvSharp.Size patternSize

Number of inner corners per a chessboard row and column ( patternSize = Size(points_per_row,points_per_colum) = Size(columns, rows) ).

OpenCvSharp.Point2f[] corners

Output array of detected corners.

ChessboardFlags flags

Various operation flags that can be zero or a combination of the ChessboardFlag values

Returns
Type Description
System.Boolean

The function returns true if all of the corners are found and they are placed in a certain order (row by row, left to right in every row). Otherwise, if the function fails to find all the corners or reorder them, it returns false.

| Improve this Doc View Source

FindChessboardCornersSB(InputArray, Size, OutputArray, ChessboardFlags)

Finds the positions of internal corners of the chessboard using a sector based approach.

Declaration
public static bool FindChessboardCornersSB(InputArray image, Size patternSize, OutputArray corners, ChessboardFlags flags = ChessboardFlags.None)
Parameters
Type Name Description
InputArray image

image Source chessboard view. It must be an 8-bit grayscale or color image.

OpenCvSharp.Size patternSize

Number of inner corners per a chessboard row and column (patternSize = Size(points_per_row, points_per_column) = Size(columns, rows) ).

OutputArray corners

Output array of detected corners.

ChessboardFlags flags

flags Various operation flags that can be zero or a combination of the ChessboardFlags values.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

FindChessboardCornersSB(InputArray, Size, out Point2f[], ChessboardFlags)

Finds the positions of internal corners of the chessboard using a sector based approach.

Declaration
public static bool FindChessboardCornersSB(InputArray image, Size patternSize, out Point2f[] corners, ChessboardFlags flags = ChessboardFlags.None)
Parameters
Type Name Description
InputArray image

image Source chessboard view. It must be an 8-bit grayscale or color image.

OpenCvSharp.Size patternSize

Number of inner corners per a chessboard row and column (patternSize = Size(points_per_row, points_per_column) = Size(columns, rows) ).

OpenCvSharp.Point2f[] corners

Output array of detected corners.

ChessboardFlags flags

flags Various operation flags that can be zero or a combination of the ChessboardFlags values.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

FindCirclesGrid(InputArray, Size, OutputArray, FindCirclesGridFlags, Feature2D)

Finds centers in the grid of circles.

Declaration
public static bool FindCirclesGrid(InputArray image, Size patternSize, OutputArray centers, FindCirclesGridFlags flags = FindCirclesGridFlags.SymmetricGrid, Feature2D blobDetector = null)
Parameters
Type Name Description
InputArray image

grid view of input circles; it must be an 8-bit grayscale or color image.

OpenCvSharp.Size patternSize

number of circles per row and column ( patternSize = Size(points_per_row, points_per_colum) ).

OutputArray centers

output array of detected centers.

FindCirclesGridFlags flags

various operation flags that can be one of the FindCirclesGridFlag values

Feature2D blobDetector

feature detector that finds blobs like dark circles on light background.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

FindCirclesGrid(InputArray, Size, out Point2f[], FindCirclesGridFlags, Feature2D)

Finds centers in the grid of circles.

Declaration
public static bool FindCirclesGrid(InputArray image, Size patternSize, out Point2f[] centers, FindCirclesGridFlags flags = FindCirclesGridFlags.SymmetricGrid, Feature2D blobDetector = null)
Parameters
Type Name Description
InputArray image

grid view of input circles; it must be an 8-bit grayscale or color image.

OpenCvSharp.Size patternSize

number of circles per row and column ( patternSize = Size(points_per_row, points_per_colum) ).

OpenCvSharp.Point2f[] centers

output array of detected centers.

FindCirclesGridFlags flags

various operation flags that can be one of the FindCirclesGridFlag values

Feature2D blobDetector

feature detector that finds blobs like dark circles on light background.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

FindContours(InputArray, out Mat[], OutputArray, RetrievalModes, ContourApproximationModes, Nullable<Point>)

Finds contours in a binary image.

Declaration
public static void FindContours(InputArray image, out Mat[] contours, OutputArray hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null)
Parameters
Type Name Description
InputArray image

Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary. The function modifies the image while extracting the contours.

Mat[] contours

Detected contours. Each contour is stored as a vector of points.

OutputArray hierarchy

Optional output vector, containing information about the image topology. It has as many elements as the number of contours. For each i-th contour contours[i], the members of the elements hierarchy[i] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.

RetrievalModes mode

Contour retrieval mode

ContourApproximationModes method

Contour approximation method

System.Nullable<OpenCvSharp.Point> offset

Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

| Improve this Doc View Source

FindContours(InputArray, out Point[][], out HierarchyIndex[], RetrievalModes, ContourApproximationModes, Nullable<Point>)

Finds contours in a binary image.

Declaration
public static void FindContours(InputArray image, out Point[][] contours, out HierarchyIndex[] hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null)
Parameters
Type Name Description
InputArray image

Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary. The function modifies the image while extracting the contours.

OpenCvSharp.Point[][] contours

Detected contours. Each contour is stored as a vector of points.

HierarchyIndex[] hierarchy

Optional output vector, containing information about the image topology. It has as many elements as the number of contours. For each i-th contour contours[i], the members of the elements hierarchy[i] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.

RetrievalModes mode

Contour retrieval mode

ContourApproximationModes method

Contour approximation method

System.Nullable<OpenCvSharp.Point> offset

Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

| Improve this Doc View Source

FindContoursAsArray(InputArray, RetrievalModes, ContourApproximationModes, Nullable<Point>)

Finds contours in a binary image.

Declaration
public static Point[][] FindContoursAsArray(InputArray image, RetrievalModes mode, ContourApproximationModes method, Point? offset = null)
Parameters
Type Name Description
InputArray image

Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary. The function modifies the image while extracting the contours.

RetrievalModes mode

Contour retrieval mode

ContourApproximationModes method

Contour approximation method

System.Nullable<OpenCvSharp.Point> offset

Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

Returns
Type Description
OpenCvSharp.Point[][]

Detected contours. Each contour is stored as a vector of points.

| Improve this Doc View Source

FindContoursAsMat(InputArray, RetrievalModes, ContourApproximationModes, Nullable<Point>)

Finds contours in a binary image.

Declaration
public static Mat<Point>[] FindContoursAsMat(InputArray image, RetrievalModes mode, ContourApproximationModes method, Point? offset = null)
Parameters
Type Name Description
InputArray image

Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary. The function modifies the image while extracting the contours.

RetrievalModes mode

Contour retrieval mode

ContourApproximationModes method

Contour approximation method

System.Nullable<OpenCvSharp.Point> offset

Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

Returns
Type Description
Mat<OpenCvSharp.Point>[]

Detected contours. Each contour is stored as a vector of points.

| Improve this Doc View Source

FindEssentialMat(InputArray, InputArray, InputArray, EssentialMatMethod, Double, Double, OutputArray)

Calculates an essential matrix from the corresponding points in two images.

Declaration
public static Mat FindEssentialMat(InputArray points1, InputArray points2, InputArray cameraMatrix, EssentialMatMethod method = EssentialMatMethod.Ransac, double prob = 0.999, double threshold = 1, OutputArray mask = null)
Parameters
Type Name Description
InputArray points1

Array of N (N >= 5) 2D points from the first image. The point coordinates should be floating-point (single or double precision).

InputArray points2

Array of the second image points of the same size and format as points1 .

InputArray cameraMatrix

Camera matrix K=⎡⎣⎢fx000fy0cxcy1⎤⎦⎥ . Note that this function assumes that points1 and points2 are feature points from cameras with the same camera matrix.

EssentialMatMethod method

Method for computing an essential matrix. RANSAC for the RANSAC algorithm. LMEDS for the LMedS algorithm.

System.Double prob

Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of confidence (probability) that the estimated matrix is correct.

System.Double threshold

Parameter used for RANSAC. It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise.

OutputArray mask

Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods.

Returns
Type Description
Mat

essential matrix

| Improve this Doc View Source

FindEssentialMat(InputArray, InputArray, Double, Point2d, EssentialMatMethod, Double, Double, OutputArray)

Calculates an essential matrix from the corresponding points in two images.

Declaration
public static Mat FindEssentialMat(InputArray points1, InputArray points2, double focal, Point2d pp, EssentialMatMethod method = EssentialMatMethod.Ransac, double prob = 0.999, double threshold = 1, OutputArray mask = null)
Parameters
Type Name Description
InputArray points1

Array of N (N >= 5) 2D points from the first image. The point coordinates should be floating-point (single or double precision).

InputArray points2

Array of the second image por LMedS methods only. It specifies a desirable level of confidence (probability) that the estimated matrix is correct.

System.Double focal

Focal length of the camera. Note that this function assumes that points1 and points2 are feature points from cameras with same focal length and principal point.

OpenCvSharp.Point2d pp

principal point of the camera.

EssentialMatMethod method

Method for computing an essential matrix. RANSAC for the RANSAC algorithm. LMEDS for the LMedS algorithm.

System.Double prob

Parameter used for the RANSAC othe accuracy of the point localization, image resolution, and the image noise.

System.Double threshold

Parameter used for RANSAC. It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. It can be set to something like 1-3, depending on ints of the same size and format as points1 .

OutputArray mask

Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods.

Returns
Type Description
Mat

essential matrix

| Improve this Doc View Source

FindFundamentalMat(IEnumerable<Point2d>, IEnumerable<Point2d>, FundamentalMatMethods, Double, Double, OutputArray)

Calculates a fundamental matrix from the corresponding points in two images.

Declaration
public static Mat FindFundamentalMat(IEnumerable<Point2d> points1, IEnumerable<Point2d> points2, FundamentalMatMethods method = FundamentalMatMethods.Ransac, double param1 = 3, double param2 = 0.99, OutputArray mask = null)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2d> points1

Array of N points from the first image. The point coordinates should be floating-point (single or double precision).

IEnumerable<OpenCvSharp.Point2d> points2

Array of the second image points of the same size and format as points1 .

FundamentalMatMethods method

Method for computing a fundamental matrix.

System.Double param1

Parameter used for RANSAC. It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise.

System.Double param2

Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of confidence (probability) that the estimated matrix is correct.

OutputArray mask

Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s.

Returns
Type Description
Mat

fundamental matrix

| Improve this Doc View Source

FindFundamentalMat(IEnumerable<Point2f>, IEnumerable<Point2f>, FundamentalMatMethods, Double, Double, OutputArray)

Calculates a fundamental matrix from the corresponding points in two images.

Declaration
public static Mat FindFundamentalMat(IEnumerable<Point2f> points1, IEnumerable<Point2f> points2, FundamentalMatMethods method = FundamentalMatMethods.Ransac, double param1 = 3, double param2 = 0.99, OutputArray mask = null)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points1

Array of N points from the first image. The point coordinates should be floating-point (single or double precision).

IEnumerable<OpenCvSharp.Point2f> points2

Array of the second image points of the same size and format as points1 .

FundamentalMatMethods method

Method for computing a fundamental matrix.

System.Double param1

Parameter used for RANSAC. It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise.

System.Double param2

Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of confidence (probability) that the estimated matrix is correct.

OutputArray mask

Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s.

Returns
Type Description
Mat

fundamental matrix

| Improve this Doc View Source

FindFundamentalMat(InputArray, InputArray, FundamentalMatMethods, Double, Double, OutputArray)

Calculates a fundamental matrix from the corresponding points in two images.

Declaration
public static Mat FindFundamentalMat(InputArray points1, InputArray points2, FundamentalMatMethods method = FundamentalMatMethods.Ransac, double param1 = 3, double param2 = 0.99, OutputArray mask = null)
Parameters
Type Name Description
InputArray points1

Array of N points from the first image. The point coordinates should be floating-point (single or double precision).

InputArray points2

Array of the second image points of the same size and format as points1 .

FundamentalMatMethods method

Method for computing a fundamental matrix.

System.Double param1

Parameter used for RANSAC. It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise.

System.Double param2

Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of confidence (probability) that the estimated matrix is correct.

OutputArray mask

Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s.

Returns
Type Description
Mat

fundamental matrix

| Improve this Doc View Source

FindHomography(IEnumerable<Point2d>, IEnumerable<Point2d>, HomographyMethods, Double, OutputArray, Int32, Double)

computes the best-fit perspective transformation mapping srcPoints to dstPoints.

Declaration
public static Mat FindHomography(IEnumerable<Point2d> srcPoints, IEnumerable<Point2d> dstPoints, HomographyMethods method = HomographyMethods.None, double ransacReprojThreshold = 3, OutputArray mask = null, int maxIters = 2000, double confidence = 0.995)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2d> srcPoints

Coordinates of the points in the original plane

IEnumerable<OpenCvSharp.Point2d> dstPoints

Coordinates of the points in the target plane

HomographyMethods method

Method used to computed a homography matrix.

System.Double ransacReprojThreshold

Maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC method only)

OutputArray mask

Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored.

System.Int32 maxIters

The maximum number of RANSAC iterations.

System.Double confidence

Confidence level, between 0 and 1.

Returns
Type Description
Mat
| Improve this Doc View Source

FindHomography(InputArray, InputArray, HomographyMethods, Double, OutputArray, Int32, Double)

computes the best-fit perspective transformation mapping srcPoints to dstPoints.

Declaration
public static Mat FindHomography(InputArray srcPoints, InputArray dstPoints, HomographyMethods method = HomographyMethods.None, double ransacReprojThreshold = 3, OutputArray mask = null, int maxIters = 2000, double confidence = 0.995)
Parameters
Type Name Description
InputArray srcPoints

Coordinates of the points in the original plane, a matrix of the type CV_32FC2

InputArray dstPoints

Coordinates of the points in the target plane, a matrix of the type CV_32FC2

HomographyMethods method

Method used to computed a homography matrix.

System.Double ransacReprojThreshold

Maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC method only)

OutputArray mask

Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored.

System.Int32 maxIters

The maximum number of RANSAC iterations.

System.Double confidence

Confidence level, between 0 and 1.

Returns
Type Description
Mat
| Improve this Doc View Source

FindHomography(InputArray, InputArray, OutputArray, UsacParams)

computes the best-fit perspective transformation mapping srcPoints to dstPoints.

Declaration
public static Mat FindHomography(InputArray srcPoints, InputArray dstPoints, OutputArray mask, UsacParams params)
Parameters
Type Name Description
InputArray srcPoints

Coordinates of the points in the original plane, a matrix of the type CV_32FC2

InputArray dstPoints

Coordinates of the points in the target plane, a matrix of the type CV_32FC2

OutputArray mask

Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored.

UsacParams params
Returns
Type Description
Mat
| Improve this Doc View Source

FindNonZero(InputArray, OutputArray)

returns the list of locations of non-zero pixels

Declaration
public static void FindNonZero(InputArray src, OutputArray idx)
Parameters
Type Name Description
InputArray src
OutputArray idx
| Improve this Doc View Source

FindTransformECC(InputArray, InputArray, InputOutputArray, MotionTypes, TermCriteria, InputArray, Int32)

Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .

Declaration
public static double FindTransformECC(InputArray templateImage, InputArray inputImage, InputOutputArray warpMatrix, MotionTypes motionType, TermCriteria criteria, InputArray inputMask = null, int gaussFiltSize = 5)
Parameters
Type Name Description
InputArray templateImage

single-channel template image; CV_8U or CV_32F array.

InputArray inputImage

single-channel input image which should be warped with the final warpMatrix in order to provide an image similar to templateImage, same type as templateImage.

InputOutputArray warpMatrix

floating-point \f$2\times 3\f$ or \f$3\times 3\f$ mapping matrix (warp).

MotionTypes motionType

parameter, specifying the type of motion

OpenCvSharp.TermCriteria criteria

parameter, specifying the termination criteria of the ECC algorithm; criteria.epsilon defines the threshold of the increment in the correlation coefficient between two iterations(a negative criteria.epsilon makes criteria.maxcount the only termination criterion). Default values are shown in the declaration above.

InputArray inputMask

An optional mask to indicate valid values of inputImage.

System.Int32 gaussFiltSize

An optional value indicating size of gaussian blur filter; (DEFAULT: 5)

Returns
Type Description
System.Double
| Improve this Doc View Source

FindTransformECC(InputArray, InputArray, InputOutputArray, MotionTypes, Nullable<TermCriteria>, InputArray)

Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .

Declaration
public static double FindTransformECC(InputArray templateImage, InputArray inputImage, InputOutputArray warpMatrix, MotionTypes motionType = MotionTypes.Affine, TermCriteria? criteria = null, InputArray inputMask = null)
Parameters
Type Name Description
InputArray templateImage

single-channel template image; CV_8U or CV_32F array.

InputArray inputImage

single-channel input image which should be warped with the final warpMatrix in order to provide an image similar to templateImage, same type as templateImage.

InputOutputArray warpMatrix

floating-point \f$2\times 3\f$ or \f$3\times 3\f$ mapping matrix (warp).

MotionTypes motionType

parameter, specifying the type of motion

System.Nullable<OpenCvSharp.TermCriteria> criteria

parameter, specifying the termination criteria of the ECC algorithm; criteria.epsilon defines the threshold of the increment in the correlation coefficient between two iterations(a negative criteria.epsilon makes criteria.maxcount the only termination criterion). Default values are shown in the declaration above.

InputArray inputMask

An optional mask to indicate valid values of inputImage.

Returns
Type Description
System.Double
| Improve this Doc View Source

FitEllipse(IEnumerable<Point>)

Fits ellipse to the set of 2D points.

Declaration
public static RotatedRect FitEllipse(IEnumerable<Point> points)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitEllipse(IEnumerable<Point2f>)

Fits ellipse to the set of 2D points.

Declaration
public static RotatedRect FitEllipse(IEnumerable<Point2f> points)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitEllipse(InputArray)

Fits ellipse to the set of 2D points.

Declaration
public static RotatedRect FitEllipse(InputArray points)
Parameters
Type Name Description
InputArray points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitEllipseAMS(IEnumerable<Point>)

Fits an ellipse around a set of 2D points.

The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Approximate Mean Square(AMS) proposed by @cite Taubin1991 is used.

Declaration
public static RotatedRect FitEllipseAMS(IEnumerable<Point> points)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitEllipseAMS(IEnumerable<Point2f>)

Fits an ellipse around a set of 2D points.

The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Approximate Mean Square(AMS) proposed by @cite Taubin1991 is used.

Declaration
public static RotatedRect FitEllipseAMS(IEnumerable<Point2f> points)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitEllipseAMS(InputArray)

Fits an ellipse around a set of 2D points.

The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Approximate Mean Square(AMS) proposed by @cite Taubin1991 is used.

Declaration
public static RotatedRect FitEllipseAMS(InputArray points)
Parameters
Type Name Description
InputArray points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitEllipseDirect(IEnumerable<Point>)

Fits an ellipse around a set of 2D points.

The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Direct least square(Direct) method by @cite Fitzgibbon1999 is used.

Declaration
public static RotatedRect FitEllipseDirect(IEnumerable<Point> points)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitEllipseDirect(IEnumerable<Point2f>)

Fits an ellipse around a set of 2D points.

The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Direct least square(Direct) method by @cite Fitzgibbon1999 is used.

Declaration
public static RotatedRect FitEllipseDirect(IEnumerable<Point2f> points)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitEllipseDirect(InputArray)

Fits an ellipse around a set of 2D points.

The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Direct least square(Direct) method by @cite Fitzgibbon1999 is used.

Declaration
public static RotatedRect FitEllipseDirect(InputArray points)
Parameters
Type Name Description
InputArray points

Input 2D point set

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitLine(IEnumerable<Point>, DistanceTypes, Double, Double, Double)

Fits line to the set of 2D points using M-estimator algorithm

Declaration
public static Line2D FitLine(IEnumerable<Point> points, DistanceTypes distType, double param, double reps, double aeps)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

Input vector of 2D or 3D points

DistanceTypes distType

Distance used by the M-estimator

System.Double param

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

System.Double reps

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

System.Double aeps

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns
Type Description
Line2D

Output line parameters.

| Improve this Doc View Source

FitLine(IEnumerable<Point2f>, DistanceTypes, Double, Double, Double)

Fits line to the set of 2D points using M-estimator algorithm

Declaration
public static Line2D FitLine(IEnumerable<Point2f> points, DistanceTypes distType, double param, double reps, double aeps)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

Input vector of 2D or 3D points

DistanceTypes distType

Distance used by the M-estimator

System.Double param

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

System.Double reps

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

System.Double aeps

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns
Type Description
Line2D

Output line parameters.

| Improve this Doc View Source

FitLine(IEnumerable<Point3f>, DistanceTypes, Double, Double, Double)

Fits line to the set of 3D points using M-estimator algorithm

Declaration
public static Line3D FitLine(IEnumerable<Point3f> points, DistanceTypes distType, double param, double reps, double aeps)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3f> points

Input vector of 2D or 3D points

DistanceTypes distType

Distance used by the M-estimator

System.Double param

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

System.Double reps

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

System.Double aeps

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns
Type Description
Line3D

Output line parameters.

| Improve this Doc View Source

FitLine(IEnumerable<Point3i>, DistanceTypes, Double, Double, Double)

Fits line to the set of 3D points using M-estimator algorithm

Declaration
public static Line3D FitLine(IEnumerable<Point3i> points, DistanceTypes distType, double param, double reps, double aeps)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3i> points

Input vector of 2D or 3D points

DistanceTypes distType

Distance used by the M-estimator

System.Double param

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

System.Double reps

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

System.Double aeps

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns
Type Description
Line3D

Output line parameters.

| Improve this Doc View Source

FitLine(InputArray, OutputArray, DistanceTypes, Double, Double, Double)

Fits line to the set of 2D points using M-estimator algorithm

Declaration
public static void FitLine(InputArray points, OutputArray line, DistanceTypes distType, double param, double reps, double aeps)
Parameters
Type Name Description
InputArray points

Input vector of 2D or 3D points

OutputArray line

Output line parameters. In case of 2D fitting, it should be a vector of 4 elements (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and (x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line and (x0, y0, z0) is a point on the line.

DistanceTypes distType

Distance used by the M-estimator

System.Double param

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

System.Double reps

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

System.Double aeps

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

| Improve this Doc View Source

Flip(InputArray, OutputArray, FlipMode)

reverses the order of the rows, columns or both in a matrix

Declaration
public static void Flip(InputArray src, OutputArray dst, FlipMode flipCode)
Parameters
Type Name Description
InputArray src

The source array

OutputArray dst

The destination array; will have the same size and same type as src

FlipMode flipCode

Specifies how to flip the array: 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, and negative (e.g., -1) means flipping around both axes. See also the discussion below for the formulas.

| Improve this Doc View Source

FloodFill(InputOutputArray, InputOutputArray, Point, Scalar)

Fills a connected component with the given color.

Declaration
public static int FloodFill(InputOutputArray image, InputOutputArray mask, Point seedPoint, Scalar newVal)
Parameters
Type Name Description
InputOutputArray image

Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.

InputOutputArray mask

(For the second function only) Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap.

OpenCvSharp.Point seedPoint

Starting point.

OpenCvSharp.Scalar newVal

New value of the repainted domain pixels.

Returns
Type Description
System.Int32
| Improve this Doc View Source

FloodFill(InputOutputArray, InputOutputArray, Point, Scalar, out Rect, Nullable<Scalar>, Nullable<Scalar>, FloodFillFlags)

Fills a connected component with the given color.

Declaration
public static int FloodFill(InputOutputArray image, InputOutputArray mask, Point seedPoint, Scalar newVal, out Rect rect, Scalar? loDiff = null, Scalar? upDiff = null, FloodFillFlags flags = FloodFillFlags.Link4)
Parameters
Type Name Description
InputOutputArray image

Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.

InputOutputArray mask

(For the second function only) Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap.

OpenCvSharp.Point seedPoint

Starting point.

OpenCvSharp.Scalar newVal

New value of the repainted domain pixels.

OpenCvSharp.Rect rect

Optional output parameter set by the function to the minimum bounding rectangle of the repainted domain.

System.Nullable<OpenCvSharp.Scalar> loDiff

Maximal lower brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.

System.Nullable<OpenCvSharp.Scalar> upDiff

Maximal upper brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.

FloodFillFlags flags

Operation flags. Lower bits contain a connectivity value, 4 (default) or 8, used within the function. Connectivity determines which neighbors of a pixel are considered. Using FloodFillFlags.MaskOnly will fill in the mask using the grey value 255 (white).

Returns
Type Description
System.Int32
| Improve this Doc View Source

FloodFill(InputOutputArray, Point, Scalar)

Fills a connected component with the given color.

Declaration
public static int FloodFill(InputOutputArray image, Point seedPoint, Scalar newVal)
Parameters
Type Name Description
InputOutputArray image

Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.

OpenCvSharp.Point seedPoint

Starting point.

OpenCvSharp.Scalar newVal

New value of the repainted domain pixels.

Returns
Type Description
System.Int32
| Improve this Doc View Source

FloodFill(InputOutputArray, Point, Scalar, out Rect, Nullable<Scalar>, Nullable<Scalar>, FloodFillFlags)

Fills a connected component with the given color.

Declaration
public static int FloodFill(InputOutputArray image, Point seedPoint, Scalar newVal, out Rect rect, Scalar? loDiff = null, Scalar? upDiff = null, FloodFillFlags flags = FloodFillFlags.Link4)
Parameters
Type Name Description
InputOutputArray image

Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.

OpenCvSharp.Point seedPoint

Starting point.

OpenCvSharp.Scalar newVal

New value of the repainted domain pixels.

OpenCvSharp.Rect rect

Optional output parameter set by the function to the minimum bounding rectangle of the repainted domain.

System.Nullable<OpenCvSharp.Scalar> loDiff

Maximal lower brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.

System.Nullable<OpenCvSharp.Scalar> upDiff

Maximal upper brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.

FloodFillFlags flags

Operation flags. Lower bits contain a connectivity value, 4 (default) or 8, used within the function. Connectivity determines which neighbors of a pixel are considered. Using FloodFillFlags.MaskOnly will fill in the mask using the grey value 255 (white).

Returns
Type Description
System.Int32
| Improve this Doc View Source

Format(InputArray, FormatType)

Declaration
public static string Format(InputArray mtx, FormatType format = FormatType.Default)
Parameters
Type Name Description
InputArray mtx
FormatType format
Returns
Type Description
System.String
| Improve this Doc View Source

GaussianBlur(InputArray, OutputArray, Size, Double, Double, BorderTypes)

Blurs an image using a Gaussian filter.

Declaration
public static void GaussianBlur(InputArray src, OutputArray dst, Size ksize, double sigmaX, double sigmaY = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

input image; the image can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.

OutputArray dst

output image of the same size and type as src.

OpenCvSharp.Size ksize

Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. Or, they can be zero’s and then they are computed from sigma* .

System.Double sigmaX

Gaussian kernel standard deviation in X direction.

System.Double sigmaY

Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height, respectively (see getGaussianKernel() for details); to fully control the result regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY.

BorderTypes borderType

pixel extrapolation method

| Improve this Doc View Source

Gemm(InputArray, InputArray, Double, InputArray, Double, OutputArray, GemmFlags)

implements generalized matrix product algorithm GEMM from BLAS

Declaration
public static void Gemm(InputArray src1, InputArray src2, double alpha, InputArray src3, double gamma, OutputArray dst, GemmFlags flags = GemmFlags.None)
Parameters
Type Name Description
InputArray src1
InputArray src2
System.Double alpha
InputArray src3
System.Double gamma
OutputArray dst
GemmFlags flags
| Improve this Doc View Source

GetAffineTransform(IEnumerable<Point2f>, IEnumerable<Point2f>)

Calculates an affine transform from three pairs of the corresponding points. The function calculates the 2×3 matrix of an affine transform.

Declaration
public static Mat GetAffineTransform(IEnumerable<Point2f> src, IEnumerable<Point2f> dst)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> src

Coordinates of triangle vertices in the source image.

IEnumerable<OpenCvSharp.Point2f> dst

Coordinates of the corresponding triangle vertices in the destination image.

Returns
Type Description
Mat
| Improve this Doc View Source

GetAffineTransform(InputArray, InputArray)

Calculates an affine transform from three pairs of the corresponding points. The function calculates the 2×3 matrix of an affine transform.

Declaration
public static Mat GetAffineTransform(InputArray src, InputArray dst)
Parameters
Type Name Description
InputArray src

Coordinates of triangle vertices in the source image.

InputArray dst

Coordinates of the corresponding triangle vertices in the destination image.

Returns
Type Description
Mat
| Improve this Doc View Source

GetBuildInformation()

Returns full configuration time cmake output.

Returned value is raw cmake output including version control system revision, compiler version, compiler flags, enabled modules and third party libraries, etc.Output format depends on target architecture.

Declaration
public static string GetBuildInformation()
Returns
Type Description
System.String
| Improve this Doc View Source

GetCpuFeaturesLine()

Returns list of CPU features enabled during compilation. Returned value is a string containing space separated list of CPU features with following markers:

  • no markers - baseline features
  • prefix * - features enabled in dispatcher
  • suffix ? - features enabled but not available in HW
Declaration
public static string GetCpuFeaturesLine()
Returns
Type Description
System.String
Examples

SSE SSE2 SSE3* SSE4.1 *SSE4.2 *FP16* AVX *AVX2* AVX512-SKX?

| Improve this Doc View Source

GetCpuTickCount()

Returns the number of CPU ticks.

The function returns the current number of CPU ticks on some architectures(such as x86, x64, PowerPC). On other platforms the function is equivalent to getTickCount.It can also be used for very accurate time measurements, as well as for RNG initialization.Note that in case of multi-CPU systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU with its own counter. So, theoretically (and practically) the subsequent calls to the function do not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU frequency depending on the load, the number of CPU clocks spent in some code cannot be directly converted to time units.Therefore, getTickCount is generally a preferable solution for measuringexecution time.

Declaration
public static long GetCpuTickCount()
Returns
Type Description
System.Int64
| Improve this Doc View Source

GetDefaultNewCameraMatrix(InputArray, Nullable<Size>, Boolean)

returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true)

Declaration
public static Mat GetDefaultNewCameraMatrix(InputArray cameraMatrix, Size? imgSize = null, bool centerPrincipalPoint = false)
Parameters
Type Name Description
InputArray cameraMatrix

Input camera matrix.

System.Nullable<OpenCvSharp.Size> imgSize

Camera view image size in pixels.

System.Boolean centerPrincipalPoint

Location of the principal point in the new camera matrix. The parameter indicates whether this location should be at the image center or not.

Returns
Type Description
Mat

the camera matrix that is either an exact copy of the input cameraMatrix (when centerPrinicipalPoint=false), or the modified one (when centerPrincipalPoint=true).

| Improve this Doc View Source

GetDerivKernels(OutputArray, OutputArray, Int32, Int32, Int32, Boolean, Nullable<MatType>)

Returns filter coefficients for computing spatial image derivatives.

Declaration
public static void GetDerivKernels(OutputArray kx, OutputArray ky, int dx, int dy, int ksize, bool normalize = false, MatType? ktype = null)
Parameters
Type Name Description
OutputArray kx

Output matrix of row filter coefficients. It has the type ktype.

OutputArray ky

Output matrix of column filter coefficients. It has the type ktype.

System.Int32 dx

Derivative order in respect of x.

System.Int32 dy

Derivative order in respect of y.

System.Int32 ksize

Aperture size. It can be CV_SCHARR, 1, 3, 5, or 7.

System.Boolean normalize

Flag indicating whether to normalize (scale down) the filter coefficients or not. Theoretically, the coefficients should have the denominator \f$=2^{ksize*2-dx-dy-2}\f$. If you are going to filter floating-point images, you are likely to use the normalized kernels. But if you compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve all the fractional bits, you may want to set normalize = false.

System.Nullable<OpenCvSharp.MatType> ktype

Type of filter coefficients. It can be CV_32f or CV_64F.

| Improve this Doc View Source

GetFontScaleFromHeight(HersheyFonts, Int32, Int32)

Calculates the font-specific size to use to achieve a given height in pixels.

Declaration
public static double GetFontScaleFromHeight(HersheyFonts fontFace, int pixelHeight, int thickness = 1)
Parameters
Type Name Description
HersheyFonts fontFace

Font to use, see cv::HersheyFonts.

System.Int32 pixelHeight

Pixel height to compute the fontScale for

System.Int32 thickness

Thickness of lines used to render the text.See putText for details.

Returns
Type Description
System.Double

The fontSize to use for cv::putText

| Improve this Doc View Source

GetGaborKernel(Size, Double, Double, Double, Double, Double, Int32)

Returns Gabor filter coefficients.

Declaration
public static Mat GetGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi, int ktype)
Parameters
Type Name Description
OpenCvSharp.Size ksize

Size of the filter returned.

System.Double sigma

Standard deviation of the gaussian envelope.

System.Double theta

Orientation of the normal to the parallel stripes of a Gabor function.

System.Double lambd

Wavelength of the sinusoidal factor.

System.Double gamma

Spatial aspect ratio.

System.Double psi

Phase offset.

System.Int32 ktype

Type of filter coefficients. It can be CV_32F or CV_64F.

Returns
Type Description
Mat
Remarks

For more details about gabor filter equations and parameters, see: https://en.wikipedia.org/wiki/Gabor_filter

| Improve this Doc View Source

GetGaussianKernel(Int32, Double, Nullable<MatType>)

Returns Gaussian filter coefficients.

Declaration
public static Mat GetGaussianKernel(int ksize, double sigma, MatType? ktype = null)
Parameters
Type Name Description
System.Int32 ksize

Aperture size. It should be odd and positive.

System.Double sigma

Gaussian standard deviation. If it is non-positive, it is computed from ksize as sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8.

System.Nullable<OpenCvSharp.MatType> ktype

Type of filter coefficients. It can be CV_32F or CV_64F.

Returns
Type Description
Mat
| Improve this Doc View Source

GetHardwareFeatureName(CpuFeatures)

Returns feature name by ID. Returns empty string if feature is not defined

Declaration
public static string GetHardwareFeatureName(CpuFeatures feature)
Parameters
Type Name Description
CpuFeatures feature
Returns
Type Description
System.String
| Improve this Doc View Source

GetLogLevel()

Get global logging level

Declaration
public static LogLevel GetLogLevel()
Returns
Type Description
LogLevel

logging level

| Improve this Doc View Source

GetMouseWheelDelta(MouseEventFlags)

Gets the mouse-wheel motion delta, when handling mouse-wheel events cv::EVENT_MOUSEWHEEL and cv::EVENT_MOUSEHWHEEL.

For regular mice with a scroll-wheel, delta will be a multiple of 120. The value 120 corresponds to a one notch rotation of the wheel or the threshold for action to be taken and one such action should occur for each delta.Some high-precision mice with higher-resolution freely-rotating wheels may generate smaller values.

For cv::EVENT_MOUSEWHEEL positive and negative values mean forward and backward scrolling, respectively.For cv::EVENT_MOUSEHWHEEL, where available, positive and negative values mean right and left scrolling, respectively.

Declaration
public static int GetMouseWheelDelta(MouseEventFlags flags)
Parameters
Type Name Description
MouseEventFlags flags

The mouse callback flags parameter.

Returns
Type Description
System.Int32
| Improve this Doc View Source

GetNearestPoint(IEnumerable<Point2f>, Single)

Declaration
public static int GetNearestPoint(IEnumerable<Point2f> recallPrecisionCurve, float lPrecision)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> recallPrecisionCurve
System.Single lPrecision
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetNumberOfCpus()

Returns the number of logical CPUs available for the process.

Declaration
public static int GetNumberOfCpus()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetNumThreads()

Returns the number of threads used by OpenCV for parallel regions.

Always returns 1 if OpenCV is built without threading support. The exact meaning of return value depends on the threading framework used by OpenCV library:

  • TBB - The number of threads, that OpenCV will try to use for parallel regions. If there is any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns default number of threads used by TBB library.
  • OpenMP - An upper bound on the number of threads that could be used to form a new team.
  • Concurrency - The number of threads, that OpenCV will try to use for parallel regions.
  • GCD - Unsupported; returns the GCD thread pool limit(512) for compatibility.
  • C= - The number of threads, that OpenCV will try to use for parallel regions, if before called setNumThreads with threads > 0, otherwise returns the number of logical CPUs, available for the process.
Declaration
public static int GetNumThreads()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetOptimalDFTSize(Int32)

Returns the optimal DFT size for a given vector size.

Declaration
public static int GetOptimalDFTSize(int vecSize)
Parameters
Type Name Description
System.Int32 vecSize

vector size.

Returns
Type Description
System.Int32
| Improve this Doc View Source

GetOptimalNewCameraMatrix(InputArray, InputArray, Size, Double, Size, out Rect, Boolean)

Returns the new camera matrix based on the free scaling parameter.

Declaration
public static Mat GetOptimalNewCameraMatrix(InputArray cameraMatrix, InputArray distCoeffs, Size imageSize, double alpha, Size newImgSize, out Rect validPixROI, bool centerPrincipalPoint = false)
Parameters
Type Name Description
InputArray cameraMatrix

Input camera matrix.

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the array is null, the zero distortion coefficients are assumed.

OpenCvSharp.Size imageSize

Original image size.

System.Double alpha

Free scaling parameter between 0 (when all the pixels in the undistorted image are valid) and 1 (when all the source image pixels are retained in the undistorted image).

OpenCvSharp.Size newImgSize

Image size after rectification. By default,it is set to imageSize .

OpenCvSharp.Rect validPixROI

Optional output rectangle that outlines all-good-pixels region in the undistorted image. See roi1, roi2 description in stereoRectify() .

System.Boolean centerPrincipalPoint

Optional flag that indicates whether in the new camera matrix the principal point should be at the image center or not. By default, the principal point is chosen to best fit a subset of the source image (determined by alpha) to the corrected image.

Returns
Type Description
Mat

optimal new camera matrix

| Improve this Doc View Source

GetOptimalNewCameraMatrix(Double[,], Double[], Size, Double, Size, out Rect, Boolean)

Returns the new camera matrix based on the free scaling parameter.

Declaration
public static double[, ] GetOptimalNewCameraMatrix(double[, ] cameraMatrix, double[] distCoeffs, Size imageSize, double alpha, Size newImgSize, out Rect validPixROI, bool centerPrincipalPoint = false)
Parameters
Type Name Description
System.Double[,] cameraMatrix

Input camera matrix.

System.Double[] distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the array is null, the zero distortion coefficients are assumed.

OpenCvSharp.Size imageSize

Original image size.

System.Double alpha

Free scaling parameter between 0 (when all the pixels in the undistorted image are valid) and 1 (when all the source image pixels are retained in the undistorted image).

OpenCvSharp.Size newImgSize

Image size after rectification. By default,it is set to imageSize .

OpenCvSharp.Rect validPixROI

Optional output rectangle that outlines all-good-pixels region in the undistorted image. See roi1, roi2 description in stereoRectify() .

System.Boolean centerPrincipalPoint

Optional flag that indicates whether in the new camera matrix the principal point should be at the image center or not. By default, the principal point is chosen to best fit a subset of the source image (determined by alpha) to the corrected image.

Returns
Type Description
System.Double[,]

optimal new camera matrix

| Improve this Doc View Source

GetPerspectiveTransform(IEnumerable<Point2f>, IEnumerable<Point2f>)

Calculates a perspective transform from four pairs of the corresponding points. The function calculates the 3×3 matrix of a perspective transform.

Declaration
public static Mat GetPerspectiveTransform(IEnumerable<Point2f> src, IEnumerable<Point2f> dst)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> src

Coordinates of quadrangle vertices in the source image.

IEnumerable<OpenCvSharp.Point2f> dst

Coordinates of the corresponding quadrangle vertices in the destination image.

Returns
Type Description
Mat
| Improve this Doc View Source

GetPerspectiveTransform(InputArray, InputArray)

Calculates a perspective transform from four pairs of the corresponding points. The function calculates the 3×3 matrix of a perspective transform.

Declaration
public static Mat GetPerspectiveTransform(InputArray src, InputArray dst)
Parameters
Type Name Description
InputArray src

Coordinates of quadrangle vertices in the source image.

InputArray dst

Coordinates of the corresponding quadrangle vertices in the destination image.

Returns
Type Description
Mat
| Improve this Doc View Source

GetRecall(IEnumerable<Point2f>, Single)

Declaration
public static float GetRecall(IEnumerable<Point2f> recallPrecisionCurve, float lPrecision)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> recallPrecisionCurve
System.Single lPrecision
Returns
Type Description
System.Single
| Improve this Doc View Source

GetRectSubPix(InputArray, Size, Point2f, OutputArray, Int32)

Retrieves a pixel rectangle from an image with sub-pixel accuracy.

Declaration
public static void GetRectSubPix(InputArray image, Size patchSize, Point2f center, OutputArray patch, int patchType = -1)
Parameters
Type Name Description
InputArray image

Source image.

OpenCvSharp.Size patchSize

Size of the extracted patch.

OpenCvSharp.Point2f center

Floating point coordinates of the center of the extracted rectangle within the source image. The center must be inside the image.

OutputArray patch

Extracted patch that has the size patchSize and the same number of channels as src .

System.Int32 patchType

Depth of the extracted pixels. By default, they have the same depth as src.

| Improve this Doc View Source

GetRotationMatrix2D(Point2f, Double, Double)

Calculates an affine matrix of 2D rotation.

Declaration
public static Mat GetRotationMatrix2D(Point2f center, double angle, double scale)
Parameters
Type Name Description
OpenCvSharp.Point2f center

Center of the rotation in the source image.

System.Double angle

Rotation angle in degrees. Positive values mean counter-clockwise rotation (the coordinate origin is assumed to be the top-left corner).

System.Double scale

Isotropic scale factor.

Returns
Type Description
Mat
| Improve this Doc View Source

GetStructuringElement(MorphShapes, Size)

Returns a structuring element of the specified size and shape for morphological operations. The function constructs and returns the structuring element that can be further passed to erode, dilate or morphologyEx.But you can also construct an arbitrary binary mask yourself and use it as the structuring element.

Declaration
public static Mat GetStructuringElement(MorphShapes shape, Size ksize)
Parameters
Type Name Description
MorphShapes shape

Element shape that could be one of MorphShapes

OpenCvSharp.Size ksize

Size of the structuring element.

Returns
Type Description
Mat
| Improve this Doc View Source

GetStructuringElement(MorphShapes, Size, Point)

Returns a structuring element of the specified size and shape for morphological operations. The function constructs and returns the structuring element that can be further passed to erode, dilate or morphologyEx.But you can also construct an arbitrary binary mask yourself and use it as the structuring element.

Declaration
public static Mat GetStructuringElement(MorphShapes shape, Size ksize, Point anchor)
Parameters
Type Name Description
MorphShapes shape

Element shape that could be one of MorphShapes

OpenCvSharp.Size ksize

Size of the structuring element.

OpenCvSharp.Point anchor

Anchor position within the element. The default value (−1,−1) means that the anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor position. In other cases the anchor just regulates how much the result of the morphological operation is shifted.

Returns
Type Description
Mat
| Improve this Doc View Source

GetTextSize(String, HersheyFonts, Double, Int32, out Int32)

returns bounding box of the text string

Declaration
public static Size GetTextSize(string text, HersheyFonts fontFace, double fontScale, int thickness, out int baseLine)
Parameters
Type Name Description
System.String text

Input text string.

HersheyFonts fontFace

Font to use, see #HersheyFonts.

System.Double fontScale

Font scale factor that is multiplied by the font-specific base size.

System.Int32 thickness

Thickness of lines used to render the text. See #putText for details.

System.Int32 baseLine

baseLine y-coordinate of the baseline relative to the bottom-most text

Returns
Type Description
OpenCvSharp.Size

The size of a box that contains the specified text.

| Improve this Doc View Source

GetTheRNG()

Returns the thread-local Random number generator

Declaration
public static RNG GetTheRNG()
Returns
Type Description
RNG
| Improve this Doc View Source

GetThreadNum()

Returns the index of the currently executed thread within the current parallel region. Always returns 0 if called outside of parallel region. @deprecated Current implementation doesn't corresponding to this documentation. The exact meaning of the return value depends on the threading framework used by OpenCV library:

  • TBB - Unsupported with current 4.1 TBB release.Maybe will be supported in future.
  • OpenMP - The thread number, within the current team, of the calling thread.
  • Concurrency - An ID for the virtual processor that the current context is executing on(0 for master thread and unique number for others, but not necessary 1,2,3,...).
  • GCD - System calling thread's ID. Never returns 0 inside parallel region.
  • C= - The index of the current parallel task.
Declaration
public static int GetThreadNum()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetTickCount()

Returns the number of ticks. The function returns the number of ticks after the certain event (for example, when the machine was turned on). It can be used to initialize RNG or to measure a function execution time by reading the tick count before and after the function call.

Declaration
public static long GetTickCount()
Returns
Type Description
System.Int64
| Improve this Doc View Source

GetTickFrequency()

Returns the number of ticks per second. The function returns the number of ticks per second.That is, the following code computes the execution time in seconds:

Declaration
public static double GetTickFrequency()
Returns
Type Description
System.Double
| Improve this Doc View Source

GetTrackbarPos(String, String)

Returns the trackbar position.

Declaration
public static int GetTrackbarPos(string trackbarName, string winName)
Parameters
Type Name Description
System.String trackbarName

Name of the trackbar.

System.String winName

Name of the window that is the parent of the trackbar.

Returns
Type Description
System.Int32

trackbar position

| Improve this Doc View Source

GetValidDisparityROI(Rect, Rect, Int32, Int32, Int32)

computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by cv::stereoRectify())

Declaration
public static Rect GetValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int SADWindowSize)
Parameters
Type Name Description
OpenCvSharp.Rect roi1
OpenCvSharp.Rect roi2
System.Int32 minDisparity
System.Int32 numberOfDisparities
System.Int32 SADWindowSize
Returns
Type Description
OpenCvSharp.Rect
| Improve this Doc View Source

GetVersionMajor()

Returns major library version

Declaration
public static int GetVersionMajor()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetVersionMinor()

Returns minor library version

Declaration
public static int GetVersionMinor()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetVersionRevision()

Returns revision field of the library version

Declaration
public static int GetVersionRevision()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetVersionString()

Returns library version string. For example "3.4.1-dev".

Declaration
public static string GetVersionString()
Returns
Type Description
System.String
| Improve this Doc View Source

GetWindowHandle(String)

get native window handle (HWND in case of Win32 and Widget in case of X Window)

Declaration
public static IntPtr GetWindowHandle(string windowName)
Parameters
Type Name Description
System.String windowName
Returns
Type Description
IntPtr
| Improve this Doc View Source

GetWindowImageRect(String)

Provides rectangle of image in the window. The function getWindowImageRect returns the client screen coordinates, width and height of the image rendering area.

Declaration
public static Rect GetWindowImageRect(string winName)
Parameters
Type Name Description
System.String winName

Name of the window.

Returns
Type Description
OpenCvSharp.Rect
| Improve this Doc View Source

GetWindowProperty(String, WindowPropertyFlags)

Provides parameters of a window.

Declaration
public static double GetWindowProperty(string winName, WindowPropertyFlags propId)
Parameters
Type Name Description
System.String winName

Name of the window.

WindowPropertyFlags propId

Window property to retrieve.

Returns
Type Description
System.Double
| Improve this Doc View Source

GoodFeaturesToTrack(InputArray, Int32, Double, Double, InputArray, Int32, Boolean, Double)

finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima

Declaration
public static Point2f[] GoodFeaturesToTrack(InputArray src, int maxCorners, double qualityLevel, double minDistance, InputArray mask, int blockSize, bool useHarrisDetector, double k)
Parameters
Type Name Description
InputArray src

Input 8-bit or floating-point 32-bit, single-channel image.

System.Int32 maxCorners

Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned.

System.Double qualityLevel

Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue or the Harris function response (see cornerHarris() ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01, then all the corners with the quality measure less than 15 are rejected.

System.Double minDistance

Minimum possible Euclidean distance between the returned corners.

InputArray mask

Optional region of interest. If the image is not empty (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.

System.Int32 blockSize

Size of an average block for computing a derivative covariation matrix over each pixel neighborhood.

System.Boolean useHarrisDetector

Parameter indicating whether to use a Harris detector

System.Double k

Free parameter of the Harris detector.

Returns
Type Description
OpenCvSharp.Point2f[]

Output vector of detected corners.

| Improve this Doc View Source

GrabCut(InputArray, InputOutputArray, Rect, InputOutputArray, InputOutputArray, Int32, GrabCutModes)

Segments the image using GrabCut algorithm

Declaration
public static void GrabCut(InputArray img, InputOutputArray mask, Rect rect, InputOutputArray bgdModel, InputOutputArray fgdModel, int iterCount, GrabCutModes mode)
Parameters
Type Name Description
InputArray img

Input 8-bit 3-channel image.

InputOutputArray mask

Input/output 8-bit single-channel mask. The mask is initialized by the function when mode is set to GC_INIT_WITH_RECT. Its elements may have Cv2.GC_BGD / Cv2.GC_FGD / Cv2.GC_PR_BGD / Cv2.GC_PR_FGD

OpenCvSharp.Rect rect

ROI containing a segmented object. The pixels outside of the ROI are marked as "obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT.

InputOutputArray bgdModel

Temporary array for the background model. Do not modify it while you are processing the same image.

InputOutputArray fgdModel

Temporary arrays for the foreground model. Do not modify it while you are processing the same image.

System.Int32 iterCount

Number of iterations the algorithm should make before returning the result. Note that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or mode==GC_EVAL .

GrabCutModes mode

Operation mode that could be one of GrabCutFlag value.

| Improve this Doc View Source

GroupRectangles(IList<Rect>, Int32, Double)

Groups the object candidate rectangles.

Declaration
public static void GroupRectangles(IList<Rect> rectList, int groupThreshold, double eps = 0.2)
Parameters
Type Name Description
IList<OpenCvSharp.Rect> rectList

Input/output vector of rectangles. Output vector includes retained and grouped rectangles.

System.Int32 groupThreshold

Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it.

System.Double eps
| Improve this Doc View Source

GroupRectangles(IList<Rect>, Int32, Double, out Int32[], out Double[])

Groups the object candidate rectangles.

Declaration
public static void GroupRectangles(IList<Rect> rectList, int groupThreshold, double eps, out int[] weights, out double[] levelWeights)
Parameters
Type Name Description
IList<OpenCvSharp.Rect> rectList
System.Int32 groupThreshold
System.Double eps
System.Int32[] weights
System.Double[] levelWeights
| Improve this Doc View Source

GroupRectangles(IList<Rect>, out Int32[], out Double[], Int32, Double)

Groups the object candidate rectangles.

Declaration
public static void GroupRectangles(IList<Rect> rectList, out int[] rejectLevels, out double[] levelWeights, int groupThreshold, double eps = 0.2)
Parameters
Type Name Description
IList<OpenCvSharp.Rect> rectList
System.Int32[] rejectLevels
System.Double[] levelWeights
System.Int32 groupThreshold
System.Double eps
| Improve this Doc View Source

GroupRectangles(IList<Rect>, out Int32[], Int32, Double)

Groups the object candidate rectangles.

Declaration
public static void GroupRectangles(IList<Rect> rectList, out int[] weights, int groupThreshold, double eps = 0.2)
Parameters
Type Name Description
IList<OpenCvSharp.Rect> rectList

Input/output vector of rectangles. Output vector includes retained and grouped rectangles.

System.Int32[] weights
System.Int32 groupThreshold

Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it.

System.Double eps

Relative difference between sides of the rectangles to merge them into a group.

| Improve this Doc View Source

GroupRectanglesMeanshift(IList<Rect>, out Double[], out Double[], Double, Nullable<Size>)

Declaration
public static void GroupRectanglesMeanshift(IList<Rect> rectList, out double[] foundWeights, out double[] foundScales, double detectThreshold = 0, Size? winDetSize = null)
Parameters
Type Name Description
IList<OpenCvSharp.Rect> rectList
System.Double[] foundWeights
System.Double[] foundScales
System.Double detectThreshold
System.Nullable<OpenCvSharp.Size> winDetSize
| Improve this Doc View Source

HaveImageReader(String)

Declaration
public static bool HaveImageReader(string fileName)
Parameters
Type Name Description
System.String fileName
Returns
Type Description
System.Boolean
| Improve this Doc View Source

HaveImageWriter(String)

Declaration
public static bool HaveImageWriter(string fileName)
Parameters
Type Name Description
System.String fileName
Returns
Type Description
System.Boolean
| Improve this Doc View Source

HConcat(IEnumerable<Mat>, OutputArray)

Applies horizontal concatenation to given matrices.

Declaration
public static void HConcat(IEnumerable<Mat> src, OutputArray dst)
Parameters
Type Name Description
IEnumerable<Mat> src

input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.

OutputArray dst

output array. It has the same number of rows and depth as the src, and the sum of cols of the src.

| Improve this Doc View Source

HConcat(InputArray, InputArray, OutputArray)

Applies horizontal concatenation to given matrices.

Declaration
public static void HConcat(InputArray src1, InputArray src2, OutputArray dst)
Parameters
Type Name Description
InputArray src1

first input array to be considered for horizontal concatenation.

InputArray src2

second input array to be considered for horizontal concatenation.

OutputArray dst

output array. It has the same number of rows and depth as the src1 and src2, and the sum of cols of the src1 and src2.

| Improve this Doc View Source

HoughCircles(InputArray, HoughModes, Double, Double, Double, Double, Int32, Int32)

Finds circles in a grayscale image using a Hough transform.

Declaration
public static CircleSegment[] HoughCircles(InputArray image, HoughModes method, double dp, double minDist, double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0)
Parameters
Type Name Description
InputArray image

The 8-bit, single-channel, grayscale input image

HoughModes method

The available methods are HoughMethods.Gradient and HoughMethods.GradientAlt

System.Double dp

The inverse ratio of the accumulator resolution to the image resolution.

System.Double minDist

Minimum distance between the centers of the detected circles.

System.Double param1

The first method-specific parameter. [By default this is 100]

System.Double param2

The second method-specific parameter. [By default this is 100]

System.Int32 minRadius

Minimum circle radius. [By default this is 0]

System.Int32 maxRadius

Maximum circle radius. [By default this is 0]

Returns
Type Description
CircleSegment[]

The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius)

| Improve this Doc View Source

HoughLines(InputArray, Double, Double, Int32, Double, Double)

Finds lines in a binary image using standard Hough transform.

Declaration
public static LineSegmentPolar[] HoughLines(InputArray image, double rho, double theta, int threshold, double srn = 0, double stn = 0)
Parameters
Type Name Description
InputArray image

The 8-bit, single-channel, binary source image. The image may be modified by the function

System.Double rho

Distance resolution of the accumulator in pixels

System.Double theta

Angle resolution of the accumulator in radians

System.Int32 threshold

The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold )

System.Double srn

For the multi-scale Hough transform it is the divisor for the distance resolution rho. [By default this is 0]

System.Double stn

For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0]

Returns
Type Description
LineSegmentPolar[]

The output vector of lines. Each line is represented by a two-element vector (rho, theta) . rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians

| Improve this Doc View Source

HoughLinesP(InputArray, Double, Double, Int32, Double, Double)

Finds lines segments in a binary image using probabilistic Hough transform.

Declaration
public static LineSegmentPoint[] HoughLinesP(InputArray image, double rho, double theta, int threshold, double minLineLength = 0, double maxLineGap = 0)
Parameters
Type Name Description
InputArray image
System.Double rho

Distance resolution of the accumulator in pixels

System.Double theta

Angle resolution of the accumulator in radians

System.Int32 threshold

The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold )

System.Double minLineLength

The minimum line length. Line segments shorter than that will be rejected. [By default this is 0]

System.Double maxLineGap

The maximum allowed gap between points on the same line to link them. [By default this is 0]

Returns
Type Description
LineSegmentPoint[]

The output lines. Each line is represented by a 4-element vector (x1, y1, x2, y2)

| Improve this Doc View Source

HoughLinesPointSet(InputArray, OutputArray, Int32, Int32, Double, Double, Double, Double, Double, Double)

Finds lines in a set of points using the standard Hough transform. The function finds lines in a set of points using a modification of the Hough transform.

Declaration
public static void HoughLinesPointSet(InputArray point, OutputArray lines, int linesMax, int threshold, double minRho, double maxRho, double rhoStep, double minTheta, double maxTheta, double thetaStep)
Parameters
Type Name Description
InputArray point

Input vector of points. Each vector must be encoded as a Point vector \f$(x,y)\f$. Type must be CV_32FC2 or CV_32SC2.

OutputArray lines

Output vector of found lines. Each vector is encoded as a vector<Vec3d>

System.Int32 linesMax

Max count of hough lines.

System.Int32 threshold

Accumulator threshold parameter. Only those lines are returned that get enough votes

System.Double minRho

Minimum Distance value of the accumulator in pixels.

System.Double maxRho

Maximum Distance value of the accumulator in pixels.

System.Double rhoStep

Distance resolution of the accumulator in pixels.

System.Double minTheta

Minimum angle value of the accumulator in radians.

System.Double maxTheta

Maximum angle value of the accumulator in radians.

System.Double thetaStep

Angle resolution of the accumulator in radians.

| Improve this Doc View Source

Idct(InputArray, OutputArray, DctFlags)

Performs inverse 1D or 2D Discrete Cosine Transformation

Declaration
public static void Idct(InputArray src, OutputArray dst, DctFlags flags = DctFlags.None)
Parameters
Type Name Description
InputArray src

The source floating-point array

OutputArray dst

The destination array; will have the same size and same type as src

DctFlags flags

Transformation flags, a combination of DctFlag2 values

| Improve this Doc View Source

Idft(InputArray, OutputArray, DftFlags, Int32)

Performs an inverse Discrete Fourier transform of 1D or 2D floating-point array.

Declaration
public static void Idft(InputArray src, OutputArray dst, DftFlags flags = DftFlags.None, int nonzeroRows = 0)
Parameters
Type Name Description
InputArray src

The source array, real or complex

OutputArray dst

The destination array, which size and type depends on the flags

DftFlags flags

Transformation flags, a combination of the DftFlag2 values

System.Int32 nonzeroRows

When the parameter != 0, the function assumes that only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, thus the function can handle the rest of the rows more efficiently and thus save some time. This technique is very useful for computing array cross-correlation or convolution using DFT

| Improve this Doc View Source

IlluminationChange(InputArray, InputArray, OutputArray, Single, Single)

Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image.

Declaration
public static void IlluminationChange(InputArray src, InputArray mask, OutputArray dst, float alpha = 0.2F, float beta = 0.4F)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

InputArray mask

Input 8-bit 1 or 3-channel image.

OutputArray dst

Output image with the same size and type as src.

System.Single alpha

Value ranges between 0-2.

System.Single beta

Value ranges between 0-2.

Remarks

This is useful to highlight under-exposed foreground objects or to reduce specular reflections.

| Improve this Doc View Source

ImDecode(InputArray, ImreadModes)

Reads image from the specified buffer in memory.

Declaration
public static Mat ImDecode(InputArray buf, ImreadModes flags)
Parameters
Type Name Description
InputArray buf

The input array of vector of bytes.

ImreadModes flags

The same flags as in imread

Returns
Type Description
Mat
| Improve this Doc View Source

ImDecode(Mat, ImreadModes)

Reads image from the specified buffer in memory.

Declaration
public static Mat ImDecode(Mat buf, ImreadModes flags)
Parameters
Type Name Description
Mat buf

The input array of vector of bytes.

ImreadModes flags

The same flags as in imread

Returns
Type Description
Mat
| Improve this Doc View Source

ImDecode(ReadOnlySpan<Byte>, ImreadModes)

Reads image from the specified buffer in memory.

Declaration
public static Mat ImDecode(ReadOnlySpan<byte> span, ImreadModes flags)
Parameters
Type Name Description
ReadOnlySpan<System.Byte> span

The input slice of bytes.

ImreadModes flags

The same flags as in imread

Returns
Type Description
Mat
| Improve this Doc View Source

ImDecode(Byte[], ImreadModes)

Reads image from the specified buffer in memory.

Declaration
public static Mat ImDecode(byte[] buf, ImreadModes flags)
Parameters
Type Name Description
System.Byte[] buf

The input array of vector of bytes.

ImreadModes flags

The same flags as in imread

Returns
Type Description
Mat
| Improve this Doc View Source

ImEncode(String, InputArray, out Byte[], ImageEncodingParam[])

Compresses the image and stores it in the memory buffer

Declaration
public static void ImEncode(string ext, InputArray img, out byte[] buf, params ImageEncodingParam[] prms)
Parameters
Type Name Description
System.String ext

The file extension that defines the output format

InputArray img

The image to be written

System.Byte[] buf

Output buffer resized to fit the compressed image.

ImageEncodingParam[] prms

Format-specific parameters.

| Improve this Doc View Source

ImEncode(String, InputArray, out Byte[], Int32[])

Compresses the image and stores it in the memory buffer

Declaration
public static bool ImEncode(string ext, InputArray img, out byte[] buf, int[] prms = null)
Parameters
Type Name Description
System.String ext

The file extension that defines the output format

InputArray img

The image to be written

System.Byte[] buf

Output buffer resized to fit the compressed image.

System.Int32[] prms

Format-specific parameters.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ImRead(String, ImreadModes)

Loads an image from a file.

Declaration
public static Mat ImRead(string fileName, ImreadModes flags = ImreadModes.Color)
Parameters
Type Name Description
System.String fileName

Name of file to be loaded.

ImreadModes flags

Specifies color type of the loaded image

Returns
Type Description
Mat
| Improve this Doc View Source

ImReadMulti(String, out Mat[], ImreadModes)

Loads a multi-page image from a file.

Declaration
public static bool ImReadMulti(string filename, out Mat[] mats, ImreadModes flags = ImreadModes.AnyColor)
Parameters
Type Name Description
System.String filename

Name of file to be loaded.

Mat[] mats

A vector of Mat objects holding each page, if more than one.

ImreadModes flags

Flag that can take values of @ref cv::ImreadModes, default with IMREAD_ANYCOLOR.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ImShow(String, Mat)

Displays the image in the specified window

Declaration
public static void ImShow(string winName, Mat mat)
Parameters
Type Name Description
System.String winName

Name of the window.

Mat mat

Image to be shown.

| Improve this Doc View Source

ImWrite(String, IEnumerable<Mat>, ImageEncodingParam[])

Saves an image to a specified file.

Declaration
public static bool ImWrite(string fileName, IEnumerable<Mat> img, params ImageEncodingParam[] prms)
Parameters
Type Name Description
System.String fileName

Name of the file.

IEnumerable<Mat> img

Image to be saved.

ImageEncodingParam[] prms

Format-specific save parameters encoded as pairs

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ImWrite(String, IEnumerable<Mat>, Int32[])

Saves an image to a specified file.

Declaration
public static bool ImWrite(string fileName, IEnumerable<Mat> img, int[] prms = null)
Parameters
Type Name Description
System.String fileName

Name of the file.

IEnumerable<Mat> img

Image to be saved.

System.Int32[] prms

Format-specific save parameters encoded as pairs

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ImWrite(String, Mat, ImageEncodingParam[])

Saves an image to a specified file.

Declaration
public static bool ImWrite(string fileName, Mat img, params ImageEncodingParam[] prms)
Parameters
Type Name Description
System.String fileName

Name of the file.

Mat img

Image to be saved.

ImageEncodingParam[] prms

Format-specific save parameters encoded as pairs

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ImWrite(String, Mat, Int32[])

Saves an image to a specified file.

Declaration
public static bool ImWrite(string fileName, Mat img, int[] prms = null)
Parameters
Type Name Description
System.String fileName

Name of the file.

Mat img

Image to be saved.

System.Int32[] prms

Format-specific save parameters encoded as pairs

Returns
Type Description
System.Boolean
| Improve this Doc View Source

InitCameraMatrix2D(IEnumerable<IEnumerable<Point3f>>, IEnumerable<IEnumerable<Point2f>>, Size, Double)

initializes camera matrix from a few 3D points and the corresponding projections.

Declaration
public static Mat InitCameraMatrix2D(IEnumerable<IEnumerable<Point3f>> objectPoints, IEnumerable<IEnumerable<Point2f>> imagePoints, Size imageSize, double aspectRatio = 1)
Parameters
Type Name Description
IEnumerable<IEnumerable<OpenCvSharp.Point3f>> objectPoints

Vector of vectors of the calibration pattern points in the calibration pattern coordinate space. In the old interface all the per-view vectors are concatenated.

IEnumerable<IEnumerable<OpenCvSharp.Point2f>> imagePoints

Vector of vectors of the projections of the calibration pattern points. In the old interface all the per-view vectors are concatenated.

OpenCvSharp.Size imageSize

Image size in pixels used to initialize the principal point.

System.Double aspectRatio

If it is zero or negative, both f_x and f_y are estimated independently. Otherwise, f_x = f_y * aspectRatio .

Returns
Type Description
Mat
| Improve this Doc View Source

InitCameraMatrix2D(IEnumerable<Mat>, IEnumerable<Mat>, Size, Double)

initializes camera matrix from a few 3D points and the corresponding projections.

Declaration
public static Mat InitCameraMatrix2D(IEnumerable<Mat> objectPoints, IEnumerable<Mat> imagePoints, Size imageSize, double aspectRatio = 1)
Parameters
Type Name Description
IEnumerable<Mat> objectPoints

Vector of vectors (vector<vector<Point3d>>) of the calibration pattern points in the calibration pattern coordinate space. In the old interface all the per-view vectors are concatenated.

IEnumerable<Mat> imagePoints

Vector of vectors (vector<vector<Point2d>>) of the projections of the calibration pattern points. In the old interface all the per-view vectors are concatenated.

OpenCvSharp.Size imageSize

Image size in pixels used to initialize the principal point.

System.Double aspectRatio

If it is zero or negative, both f_x and f_y are estimated independently. Otherwise, f_x = f_y * aspectRatio .

Returns
Type Description
Mat
| Improve this Doc View Source

InitUndistortRectifyMap(InputArray, InputArray, InputArray, InputArray, Size, MatType, OutputArray, OutputArray)

initializes maps for cv::remap() to correct lens distortion and optionally rectify the image

Declaration
public static void InitUndistortRectifyMap(InputArray cameraMatrix, InputArray distCoeffs, InputArray r, InputArray newCameraMatrix, Size size, MatType m1Type, OutputArray map1, OutputArray map2)
Parameters
Type Name Description
InputArray cameraMatrix
InputArray distCoeffs
InputArray r
InputArray newCameraMatrix
OpenCvSharp.Size size
OpenCvSharp.MatType m1Type
OutputArray map1
OutputArray map2
| Improve this Doc View Source

InitWideAngleProjMap(InputArray, InputArray, Size, Int32, MatType, OutputArray, OutputArray, ProjectionType, Double)

initializes maps for cv::remap() for wide-angle

Declaration
public static float InitWideAngleProjMap(InputArray cameraMatrix, InputArray distCoeffs, Size imageSize, int destImageWidth, MatType m1Type, OutputArray map1, OutputArray map2, ProjectionType projType, double alpha = 0)
Parameters
Type Name Description
InputArray cameraMatrix
InputArray distCoeffs
OpenCvSharp.Size imageSize
System.Int32 destImageWidth
OpenCvSharp.MatType m1Type
OutputArray map1
OutputArray map2
ProjectionType projType
System.Double alpha
Returns
Type Description
System.Single
| Improve this Doc View Source

Inpaint(InputArray, InputArray, OutputArray, Double, InpaintMethod)

Restores the selected region in an image using the region neighborhood.

Declaration
public static void Inpaint(InputArray src, InputArray inpaintMask, OutputArray dst, double inpaintRadius, InpaintMethod flags)
Parameters
Type Name Description
InputArray src

Input 8-bit, 16-bit unsigned or 32-bit float 1-channel or 8-bit 3-channel image.

InputArray inpaintMask

Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted.

OutputArray dst

Output image with the same size and type as src.

System.Double inpaintRadius

Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.

InpaintMethod flags

Inpainting method that could be cv::INPAINT_NS or cv::INPAINT_TELEA

| Improve this Doc View Source

InRange(InputArray, InputArray, InputArray, OutputArray)

Checks if array elements lie between the elements of two other arrays.

Declaration
public static void InRange(InputArray src, InputArray lowerb, InputArray upperb, OutputArray dst)
Parameters
Type Name Description
InputArray src

first input array.

InputArray lowerb

inclusive lower boundary array or a scalar.

InputArray upperb

inclusive upper boundary array or a scalar.

OutputArray dst

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

| Improve this Doc View Source

InRange(InputArray, Scalar, Scalar, OutputArray)

Checks if array elements lie between the elements of two other arrays.

Declaration
public static void InRange(InputArray src, Scalar lowerb, Scalar upperb, OutputArray dst)
Parameters
Type Name Description
InputArray src

first input array.

OpenCvSharp.Scalar lowerb

inclusive lower boundary array or a scalar.

OpenCvSharp.Scalar upperb

inclusive upper boundary array or a scalar.

OutputArray dst

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

| Improve this Doc View Source

InsertChannel(InputArray, InputOutputArray, Int32)

inserts a single channel to dst (coi is 0-based index)

Declaration
public static void InsertChannel(InputArray src, InputOutputArray dst, int coi)
Parameters
Type Name Description
InputArray src
InputOutputArray dst
System.Int32 coi
| Improve this Doc View Source

Integral(InputArray, OutputArray, OutputArray, OutputArray, Nullable<MatType>, Nullable<MatType>)

Calculates the integral of an image. The function calculates one or more integral images for the source image.

Declaration
public static void Integral(InputArray src, OutputArray sum, OutputArray sqsum, OutputArray tilted, MatType? sdepth = null, MatType? sqdepth = null)
Parameters
Type Name Description
InputArray src

input image as W×H, 8-bit or floating-point (32f or 64f).

OutputArray sum

integral image as (W+1)×(H+1) , 32-bit integer or floating-point (32f or 64f).

OutputArray sqsum

integral image for squared pixel values; it is (W+1)×(H+1), double-precision floating-point (64f) array.

OutputArray tilted

integral for the image rotated by 45 degrees; it is (W+1)×(H+1) array with the same data type as sum.

System.Nullable<OpenCvSharp.MatType> sdepth

desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or CV_64F.

System.Nullable<OpenCvSharp.MatType> sqdepth

desired depth of the integral image of squared pixel values, CV_32F or CV_64F.

| Improve this Doc View Source

Integral(InputArray, OutputArray, OutputArray, Nullable<MatType>)

Calculates the integral of an image. The function calculates one or more integral images for the source image.

Declaration
public static void Integral(InputArray src, OutputArray sum, OutputArray sqsum, MatType? sdepth = null)
Parameters
Type Name Description
InputArray src
OutputArray sum
OutputArray sqsum
System.Nullable<OpenCvSharp.MatType> sdepth
| Improve this Doc View Source

Integral(InputArray, OutputArray, Nullable<MatType>)

Calculates the integral of an image. The function calculates one or more integral images for the source image.

Declaration
public static void Integral(InputArray src, OutputArray sum, MatType? sdepth = null)
Parameters
Type Name Description
InputArray src
OutputArray sum
System.Nullable<OpenCvSharp.MatType> sdepth
| Improve this Doc View Source

IntersectConvexConvex(IEnumerable<Point>, IEnumerable<Point>, out Point[], Boolean)

finds intersection of two convex polygons

Declaration
public static float IntersectConvexConvex(IEnumerable<Point> p1, IEnumerable<Point> p2, out Point[] p12, bool handleNested = true)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> p1
IEnumerable<OpenCvSharp.Point> p2
OpenCvSharp.Point[] p12
System.Boolean handleNested
Returns
Type Description
System.Single
| Improve this Doc View Source

IntersectConvexConvex(IEnumerable<Point2f>, IEnumerable<Point2f>, out Point2f[], Boolean)

finds intersection of two convex polygons

Declaration
public static float IntersectConvexConvex(IEnumerable<Point2f> p1, IEnumerable<Point2f> p2, out Point2f[] p12, bool handleNested = true)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> p1
IEnumerable<OpenCvSharp.Point2f> p2
OpenCvSharp.Point2f[] p12
System.Boolean handleNested
Returns
Type Description
System.Single
| Improve this Doc View Source

IntersectConvexConvex(InputArray, InputArray, OutputArray, Boolean)

finds intersection of two convex polygons

Declaration
public static float IntersectConvexConvex(InputArray p1, InputArray p2, OutputArray p12, bool handleNested = true)
Parameters
Type Name Description
InputArray p1
InputArray p2
OutputArray p12
System.Boolean handleNested
Returns
Type Description
System.Single
| Improve this Doc View Source

Invert(InputArray, OutputArray, DecompTypes)

computes inverse or pseudo-inverse matrix

Declaration
public static double Invert(InputArray src, OutputArray dst, DecompTypes flags = DecompTypes.LU)
Parameters
Type Name Description
InputArray src

The source floating-point MxN matrix

OutputArray dst

The destination matrix; will have NxM size and the same type as src

DecompTypes flags

The inversion method

Returns
Type Description
System.Double
| Improve this Doc View Source

InvertAffineTransform(InputArray, OutputArray)

Inverts an affine transformation.

Declaration
public static void InvertAffineTransform(InputArray m, OutputArray im)
Parameters
Type Name Description
InputArray m

Original affine transformation.

OutputArray im

Output reverse affine transformation.

| Improve this Doc View Source

IsContourConvex(IEnumerable<Point>)

returns true if the contour is convex. Does not support contours with self-intersection

Declaration
public static bool IsContourConvex(IEnumerable<Point> contour)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> contour

Input vector of 2D points

Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsContourConvex(IEnumerable<Point2f>)

returns true if the contour is convex. D oes not support contours with self-intersection

Declaration
public static bool IsContourConvex(IEnumerable<Point2f> contour)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> contour

Input vector of 2D points

Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsContourConvex(InputArray)

returns true if the contour is convex. Does not support contours with self-intersection

Declaration
public static bool IsContourConvex(InputArray contour)
Parameters
Type Name Description
InputArray contour

Input vector of 2D points

Returns
Type Description
System.Boolean
| Improve this Doc View Source

Kmeans(InputArray, Int32, InputOutputArray, TermCriteria, Int32, KMeansFlags, OutputArray)

Finds centers of clusters and groups input samples around the clusters.

Declaration
public static double Kmeans(InputArray data, int k, InputOutputArray bestLabels, TermCriteria criteria, int attempts, KMeansFlags flags, OutputArray centers = null)
Parameters
Type Name Description
InputArray data

Data for clustering. An array of N-Dimensional points with float coordinates is needed.

System.Int32 k

Number of clusters to split the set by.

InputOutputArray bestLabels

Input/output integer array that stores the cluster indices for every sample.

OpenCvSharp.TermCriteria criteria

The algorithm termination criteria, that is, the maximum number of iterations and/or the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster centers moves by less than criteria.epsilon on some iteration, the algorithm stops.

System.Int32 attempts

Flag to specify the number of times the algorithm is executed using different initial labellings. The algorithm returns the labels that yield the best compactness (see the last function parameter).

KMeansFlags flags

Flag that can take values of cv::KmeansFlags

OutputArray centers

Output matrix of the cluster centers, one row per each cluster center.

Returns
Type Description
System.Double

The function returns the compactness measure that is computed as \f[\sum _i | \texttt{samples} _i - \texttt{centers} _{ \texttt{labels} _i} | ^2\f] after every attempt. The best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function. Basically, you can use only the core of the function, set the number of attempts to 1, initialize labels each time using a custom algorithm, pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best (most-compact) clustering.

| Improve this Doc View Source

Laplacian(InputArray, OutputArray, MatType, Int32, Double, Double, BorderTypes)

Calculates the Laplacian of an image

Declaration
public static void Laplacian(InputArray src, OutputArray dst, MatType ddepth, int ksize = 1, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

Source image

OutputArray dst

Destination image; will have the same size and the same number of channels as src

OpenCvSharp.MatType ddepth

The desired depth of the destination image

System.Int32 ksize

The aperture size used to compute the second-derivative filters

System.Double scale

The optional scale factor for the computed Laplacian values (by default, no scaling is applied

System.Double delta

The optional delta value, added to the results prior to storing them in dst

BorderTypes borderType

The pixel extrapolation method

| Improve this Doc View Source

Line(InputOutputArray, Point, Point, Scalar, Int32, LineTypes, Int32)

Draws a line segment connecting two points

Declaration
public static void Line(InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img

The image.

OpenCvSharp.Point pt1

First point of the line segment.

OpenCvSharp.Point pt2

Second point of the line segment.

OpenCvSharp.Scalar color

Line color.

System.Int32 thickness

Line thickness. [By default this is 1]

LineTypes lineType

Type of the line. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

Line(InputOutputArray, Int32, Int32, Int32, Int32, Scalar, Int32, LineTypes, Int32)

Draws a line segment connecting two points

Declaration
public static void Line(InputOutputArray img, int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img

The image.

System.Int32 pt1X

First point's x-coordinate of the line segment.

System.Int32 pt1Y

First point's y-coordinate of the line segment.

System.Int32 pt2X

Second point's x-coordinate of the line segment.

System.Int32 pt2Y

Second point's y-coordinate of the line segment.

OpenCvSharp.Scalar color

Line color.

System.Int32 thickness

Line thickness. [By default this is 1]

LineTypes lineType

Type of the line. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

LinearPolar(InputArray, OutputArray, Point2f, Double, InterpolationFlags)

Remaps an image to polar space.

Declaration
public static void LinearPolar(InputArray src, OutputArray dst, Point2f center, double maxRadius, InterpolationFlags flags)
Parameters
Type Name Description
InputArray src

Source image

OutputArray dst

Destination image

OpenCvSharp.Point2f center

The transformation center

System.Double maxRadius

Inverse magnitude scale parameter

InterpolationFlags flags

A combination of interpolation methods, see cv::InterpolationFlags

| Improve this Doc View Source

Log(InputArray, OutputArray)

computes natural logarithm of absolute value of each matrix element: dst = log(abs(src))

Declaration
public static void Log(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

The source array

OutputArray dst

The destination array; will have the same size and same type as src

| Improve this Doc View Source

LogPolar(InputArray, OutputArray, Point2f, Double, InterpolationFlags)

Remaps an image to log-polar space.

Declaration
public static void LogPolar(InputArray src, OutputArray dst, Point2f center, double m, InterpolationFlags flags)
Parameters
Type Name Description
InputArray src

Source image

OutputArray dst

Destination image

OpenCvSharp.Point2f center

The transformation center; where the output precision is maximal

System.Double m

Magnitude scale parameter.

InterpolationFlags flags

A combination of interpolation methods, see cv::InterpolationFlags

| Improve this Doc View Source

LUT(InputArray, InputArray, OutputArray)

transforms array of numbers using a lookup table: dst(i)=lut(src(i))

Declaration
public static void LUT(InputArray src, InputArray lut, OutputArray dst)
Parameters
Type Name Description
InputArray src

Source array of 8-bit elements

InputArray lut

Look-up table of 256 elements. In the case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array

OutputArray dst

Destination array; will have the same size and the same number of channels as src, and the same depth as lut

| Improve this Doc View Source

LUT(InputArray, Byte[], OutputArray)

transforms array of numbers using a lookup table: dst(i)=lut(src(i))

Declaration
public static void LUT(InputArray src, byte[] lut, OutputArray dst)
Parameters
Type Name Description
InputArray src

Source array of 8-bit elements

System.Byte[] lut

Look-up table of 256 elements. In the case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array

OutputArray dst

Destination array; will have the same size and the same number of channels as src, and the same depth as lut

| Improve this Doc View Source

Magnitude(InputArray, InputArray, OutputArray)

Calculates the magnitude of 2D vectors.

Declaration
public static void Magnitude(InputArray x, InputArray y, OutputArray magnitude)
Parameters
Type Name Description
InputArray x

floating-point array of x-coordinates of the vectors.

InputArray y

floating-point array of y-coordinates of the vectors; it must have the same size as x.

OutputArray magnitude

output array of the same size and type as x.

| Improve this Doc View Source

Mahalanobis(InputArray, InputArray, InputArray)

Calculates the Mahalanobis distance between two vectors.

Declaration
public static double Mahalanobis(InputArray v1, InputArray v2, InputArray icovar)
Parameters
Type Name Description
InputArray v1

first 1D input vector.

InputArray v2

second 1D input vector.

InputArray icovar

inverse covariance matrix.

Returns
Type Description
System.Double
| Improve this Doc View Source

MatchShapes(IEnumerable<Point>, IEnumerable<Point>, ShapeMatchModes, Double)

Compares two shapes.

Declaration
public static double MatchShapes(IEnumerable<Point> contour1, IEnumerable<Point> contour2, ShapeMatchModes method, double parameter = 0)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> contour1

First contour or grayscale image.

IEnumerable<OpenCvSharp.Point> contour2

Second contour or grayscale image.

ShapeMatchModes method

Comparison method

System.Double parameter

Method-specific parameter (not supported now)

Returns
Type Description
System.Double
| Improve this Doc View Source

MatchShapes(InputArray, InputArray, ShapeMatchModes, Double)

Compares two shapes.

Declaration
public static double MatchShapes(InputArray contour1, InputArray contour2, ShapeMatchModes method, double parameter = 0)
Parameters
Type Name Description
InputArray contour1

First contour or grayscale image.

InputArray contour2

Second contour or grayscale image.

ShapeMatchModes method

Comparison method

System.Double parameter

Method-specific parameter (not supported now)

Returns
Type Description
System.Double
| Improve this Doc View Source

MatchTemplate(InputArray, InputArray, OutputArray, TemplateMatchModes, InputArray)

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

Declaration
public static void MatchTemplate(InputArray image, InputArray templ, OutputArray result, TemplateMatchModes method, InputArray mask = null)
Parameters
Type Name Description
InputArray image

Image where the search is running; should be 8-bit or 32-bit floating-point

InputArray templ

Searched template; must be not greater than the source image and have the same data type

OutputArray result

A map of comparison results; will be single-channel 32-bit floating-point. If image is WxH and templ is wxh then result will be (W-w+1) x (H-h+1).

TemplateMatchModes method

Specifies the comparison method

InputArray mask

Mask of searched template. It must have the same datatype and size with templ. It is not set by default.

| Improve this Doc View Source

MatMulDeriv(InputArray, InputArray, OutputArray, OutputArray)

computes derivatives of the matrix product w.r.t each of the multiplied matrix coefficients

Declaration
public static void MatMulDeriv(InputArray a, InputArray b, OutputArray dABdA, OutputArray dABdB)
Parameters
Type Name Description
InputArray a

First multiplied matrix.

InputArray b

Second multiplied matrix.

OutputArray dABdA

First output derivative matrix d(AB)/dA of size A.rowsB.cols X A.rows*A.cols .

OutputArray dABdB

Second output derivative matrix d(AB)/dB of size A.rowsB.cols X B.rows*B.cols .

| Improve this Doc View Source

Max(InputArray, InputArray, OutputArray)

computes per-element maximum of two arrays (dst = max(src1, src2))

Declaration
public static void Max(InputArray src1, InputArray src2, OutputArray dst)
Parameters
Type Name Description
InputArray src1
InputArray src2
OutputArray dst
| Improve this Doc View Source

Max(Mat, Mat, Mat)

computes per-element maximum of two arrays (dst = max(src1, src2))

Declaration
public static void Max(Mat src1, Mat src2, Mat dst)
Parameters
Type Name Description
Mat src1
Mat src2
Mat dst
| Improve this Doc View Source

Max(Mat, Double, Mat)

computes per-element maximum of array and scalar (dst = max(src1, src2))

Declaration
public static void Max(Mat src1, double src2, Mat dst)
Parameters
Type Name Description
Mat src1
System.Double src2
Mat dst
| Improve this Doc View Source

Mean(InputArray, InputArray)

computes mean value of selected array elements

Declaration
public static Scalar Mean(InputArray src, InputArray mask = null)
Parameters
Type Name Description
InputArray src

The source array; it should have 1 to 4 channels (so that the result can be stored in Scalar)

InputArray mask

The optional operation mask

Returns
Type Description
OpenCvSharp.Scalar
| Improve this Doc View Source

MeanShift(InputArray, ref Rect, TermCriteria)

Finds an object on a back projection image.

Declaration
public static int MeanShift(InputArray probImage, ref Rect window, TermCriteria criteria)
Parameters
Type Name Description
InputArray probImage

Back projection of the object histogram.

OpenCvSharp.Rect window

Initial search window.

OpenCvSharp.TermCriteria criteria

Stop criteria for the iterative search algorithm.

Returns
Type Description
System.Int32

Number of iterations CAMSHIFT took to converge.

| Improve this Doc View Source

MeanStdDev(InputArray, OutputArray, OutputArray, InputArray)

computes mean value and standard deviation of all or selected array elements

Declaration
public static void MeanStdDev(InputArray src, OutputArray mean, OutputArray stddev, InputArray mask = null)
Parameters
Type Name Description
InputArray src

The source array; it should have 1 to 4 channels (so that the results can be stored in Scalar's)

OutputArray mean

The output parameter: computed mean value

OutputArray stddev

The output parameter: computed standard deviation

InputArray mask

The optional operation mask

| Improve this Doc View Source

MeanStdDev(InputArray, out Scalar, out Scalar, InputArray)

computes mean value and standard deviation of all or selected array elements

Declaration
public static void MeanStdDev(InputArray src, out Scalar mean, out Scalar stddev, InputArray mask = null)
Parameters
Type Name Description
InputArray src

The source array; it should have 1 to 4 channels (so that the results can be stored in Scalar's)

OpenCvSharp.Scalar mean

The output parameter: computed mean value

OpenCvSharp.Scalar stddev

The output parameter: computed standard deviation

InputArray mask

The optional operation mask

| Improve this Doc View Source

MedianBlur(InputArray, OutputArray, Int32)

Smoothes image using median filter

Declaration
public static void MedianBlur(InputArray src, OutputArray dst, int ksize)
Parameters
Type Name Description
InputArray src

The source 1-, 3- or 4-channel image. When ksize is 3 or 5, the image depth should be CV_8U , CV_16U or CV_32F. For larger aperture sizes it can only be CV_8U

OutputArray dst

The destination array; will have the same size and the same type as src

System.Int32 ksize

The aperture linear size. It must be odd and more than 1, i.e. 3, 5, 7 ...

| Improve this Doc View Source

Merge(Mat[], Mat)

makes multi-channel array out of several single-channel arrays

Declaration
public static void Merge(Mat[] mv, Mat dst)
Parameters
Type Name Description
Mat[] mv
Mat dst
| Improve this Doc View Source

Min(InputArray, InputArray, OutputArray)

computes per-element minimum of two arrays (dst = min(src1, src2))

Declaration
public static void Min(InputArray src1, InputArray src2, OutputArray dst)
Parameters
Type Name Description
InputArray src1
InputArray src2
OutputArray dst
| Improve this Doc View Source

Min(Mat, Mat, Mat)

computes per-element minimum of two arrays (dst = min(src1, src2))

Declaration
public static void Min(Mat src1, Mat src2, Mat dst)
Parameters
Type Name Description
Mat src1
Mat src2
Mat dst
| Improve this Doc View Source

Min(Mat, Double, Mat)

computes per-element minimum of array and scalar (dst = min(src1, src2))

Declaration
public static void Min(Mat src1, double src2, Mat dst)
Parameters
Type Name Description
Mat src1
System.Double src2
Mat dst
| Improve this Doc View Source

MinAreaRect(IEnumerable<Point>)

Finds the minimum area rotated rectangle enclosing a 2D point set.

Declaration
public static RotatedRect MinAreaRect(IEnumerable<Point> points)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

MinAreaRect(IEnumerable<Point2f>)

Finds the minimum area rotated rectangle enclosing a 2D point set.

Declaration
public static RotatedRect MinAreaRect(IEnumerable<Point2f> points)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

MinAreaRect(InputArray)

Finds the minimum area rotated rectangle enclosing a 2D point set.

Declaration
public static RotatedRect MinAreaRect(InputArray points)
Parameters
Type Name Description
InputArray points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

MinEnclosingCircle(IEnumerable<Point>, out Point2f, out Single)

Finds the minimum area circle enclosing a 2D point set.

Declaration
public static void MinEnclosingCircle(IEnumerable<Point> points, out Point2f center, out float radius)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

OpenCvSharp.Point2f center

The output center of the circle

System.Single radius

The output radius of the circle

| Improve this Doc View Source

MinEnclosingCircle(IEnumerable<Point2f>, out Point2f, out Single)

Finds the minimum area circle enclosing a 2D point set.

Declaration
public static void MinEnclosingCircle(IEnumerable<Point2f> points, out Point2f center, out float radius)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

OpenCvSharp.Point2f center

The output center of the circle

System.Single radius

The output radius of the circle

| Improve this Doc View Source

MinEnclosingCircle(InputArray, out Point2f, out Single)

Finds the minimum area circle enclosing a 2D point set.

Declaration
public static void MinEnclosingCircle(InputArray points, out Point2f center, out float radius)
Parameters
Type Name Description
InputArray points

The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

OpenCvSharp.Point2f center

The output center of the circle

System.Single radius

The output radius of the circle

| Improve this Doc View Source

MinEnclosingTriangle(IEnumerable<Point>, out Point2f[])

Finds a triangle of minimum area enclosing a 2D point set and returns its area.

Declaration
public static double MinEnclosingTriangle(IEnumerable<Point> points, out Point2f[] triangle)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> points

Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector or Mat

OpenCvSharp.Point2f[] triangle

Output vector of three 2D points defining the vertices of the triangle. The depth

Returns
Type Description
System.Double

Triangle area

| Improve this Doc View Source

MinEnclosingTriangle(IEnumerable<Point2f>, out Point2f[])

Finds a triangle of minimum area enclosing a 2D point set and returns its area.

Declaration
public static double MinEnclosingTriangle(IEnumerable<Point2f> points, out Point2f[] triangle)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> points

Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector or Mat

OpenCvSharp.Point2f[] triangle

Output vector of three 2D points defining the vertices of the triangle. The depth

Returns
Type Description
System.Double

Triangle area

| Improve this Doc View Source

MinEnclosingTriangle(InputArray, OutputArray)

Finds a triangle of minimum area enclosing a 2D point set and returns its area.

Declaration
public static double MinEnclosingTriangle(InputArray points, OutputArray triangle)
Parameters
Type Name Description
InputArray points

Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector or Mat

OutputArray triangle

Output vector of three 2D points defining the vertices of the triangle. The depth

Returns
Type Description
System.Double

Triangle area

| Improve this Doc View Source

MinMaxIdx(InputArray, out Double, out Double)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public static void MinMaxIdx(InputArray src, out double minVal, out double maxVal)
Parameters
Type Name Description
InputArray src

The source single-channel array

System.Double minVal

Pointer to returned minimum value

System.Double maxVal

Pointer to returned maximum value

| Improve this Doc View Source

MinMaxIdx(InputArray, out Double, out Double, Int32[], Int32[], InputArray)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public static void MinMaxIdx(InputArray src, out double minVal, out double maxVal, int[] minIdx, int[] maxIdx, InputArray mask = null)
Parameters
Type Name Description
InputArray src

The source single-channel array

System.Double minVal

Pointer to returned minimum value

System.Double maxVal

Pointer to returned maximum value

System.Int32[] minIdx
System.Int32[] maxIdx
InputArray mask
| Improve this Doc View Source

MinMaxIdx(InputArray, Int32[], Int32[])

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public static void MinMaxIdx(InputArray src, int[] minIdx, int[] maxIdx)
Parameters
Type Name Description
InputArray src

The source single-channel array

System.Int32[] minIdx
System.Int32[] maxIdx
| Improve this Doc View Source

MinMaxLoc(InputArray, out Point, out Point)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public static void MinMaxLoc(InputArray src, out Point minLoc, out Point maxLoc)
Parameters
Type Name Description
InputArray src

The source single-channel array

OpenCvSharp.Point minLoc

Pointer to returned minimum location

OpenCvSharp.Point maxLoc

Pointer to returned maximum location

| Improve this Doc View Source

MinMaxLoc(InputArray, out Double, out Double)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public static void MinMaxLoc(InputArray src, out double minVal, out double maxVal)
Parameters
Type Name Description
InputArray src

The source single-channel array

System.Double minVal

Pointer to returned minimum value

System.Double maxVal

Pointer to returned maximum value

| Improve this Doc View Source

MinMaxLoc(InputArray, out Double, out Double, out Point, out Point, InputArray)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public static void MinMaxLoc(InputArray src, out double minVal, out double maxVal, out Point minLoc, out Point maxLoc, InputArray mask = null)
Parameters
Type Name Description
InputArray src

The source single-channel array

System.Double minVal

Pointer to returned minimum value

System.Double maxVal

Pointer to returned maximum value

OpenCvSharp.Point minLoc

Pointer to returned minimum location

OpenCvSharp.Point maxLoc

Pointer to returned maximum location

InputArray mask

The optional mask used to select a sub-array

| Improve this Doc View Source

MixChannels(Mat[], Mat[], Int32[])

copies selected channels from the input arrays to the selected channels of the output arrays

Declaration
public static void MixChannels(Mat[] src, Mat[] dst, int[] fromTo)
Parameters
Type Name Description
Mat[] src
Mat[] dst
System.Int32[] fromTo
| Improve this Doc View Source

Moments(IEnumerable<Point>, Boolean)

Calculates all of the moments up to the third order of a polygon or rasterized shape.

Declaration
public static Moments Moments(IEnumerable<Point> array, bool binaryImage = false)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> array

Array of 2D points

System.Boolean binaryImage

If it is true, then all the non-zero image pixels are treated as 1’s

Returns
Type Description
Moments
| Improve this Doc View Source

Moments(IEnumerable<Point2f>, Boolean)

Calculates all of the moments up to the third order of a polygon or rasterized shape.

Declaration
public static Moments Moments(IEnumerable<Point2f> array, bool binaryImage = false)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> array

Array of 2D points

System.Boolean binaryImage

If it is true, then all the non-zero image pixels are treated as 1’s

Returns
Type Description
Moments
| Improve this Doc View Source

Moments(InputArray, Boolean)

Calculates all of the moments up to the third order of a polygon or rasterized shape.

Declaration
public static Moments Moments(InputArray array, bool binaryImage = false)
Parameters
Type Name Description
InputArray array

A raster image (single-channel, 8-bit or floating-point 2D array) or an array ( 1xN or Nx1 ) of 2D points ( Point or Point2f )

System.Boolean binaryImage

If it is true, then all the non-zero image pixels are treated as 1’s

Returns
Type Description
Moments
| Improve this Doc View Source

Moments(Byte[,], Boolean)

Calculates all of the moments up to the third order of a polygon or rasterized shape.

Declaration
public static Moments Moments(byte[, ] array, bool binaryImage = false)
Parameters
Type Name Description
System.Byte[,] array

A raster image (8-bit) 2D array

System.Boolean binaryImage

If it is true, then all the non-zero image pixels are treated as 1’s

Returns
Type Description
Moments
| Improve this Doc View Source

Moments(Single[,], Boolean)

Calculates all of the moments up to the third order of a polygon or rasterized shape.

Declaration
public static Moments Moments(float[, ] array, bool binaryImage = false)
Parameters
Type Name Description
System.Single[,] array

A raster image (floating-point) 2D array

System.Boolean binaryImage

If it is true, then all the non-zero image pixels are treated as 1’s

Returns
Type Description
Moments
| Improve this Doc View Source

MorphologyDefaultBorderValue()

Default borderValue for Dilate/Erode

Declaration
public static Scalar MorphologyDefaultBorderValue()
Returns
Type Description
OpenCvSharp.Scalar
| Improve this Doc View Source

MorphologyEx(InputArray, OutputArray, MorphTypes, InputArray, Nullable<Point>, Int32, BorderTypes, Nullable<Scalar>)

Performs advanced morphological transformations

Declaration
public static void MorphologyEx(InputArray src, OutputArray dst, MorphTypes op, InputArray element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray src

Source image

OutputArray dst

Destination image. It will have the same size and the same type as src

MorphTypes op

Type of morphological operation

InputArray element

Structuring element

System.Nullable<OpenCvSharp.Point> anchor

Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center

System.Int32 iterations

Number of times erosion and dilation are applied. [By default this is 1]

BorderTypes borderType

The pixel extrapolation method. [By default this is BorderType.Constant]

System.Nullable<OpenCvSharp.Scalar> borderValue

The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]

| Improve this Doc View Source

MoveWindow(String, Int32, Int32)

Moves window to the specified position

Declaration
public static void MoveWindow(string winName, int x, int y)
Parameters
Type Name Description
System.String winName

Window name

System.Int32 x

The new x-coordinate of the window

System.Int32 y

The new y-coordinate of the window

| Improve this Doc View Source

MulSpectrums(InputArray, InputArray, OutputArray, DftFlags, Boolean)

Performs the per-element multiplication of two Fourier spectrums.

Declaration
public static void MulSpectrums(InputArray a, InputArray b, OutputArray c, DftFlags flags, bool conjB = false)
Parameters
Type Name Description
InputArray a

first input array.

InputArray b

second input array of the same size and type as src1.

OutputArray c

output array of the same size and type as src1.

DftFlags flags

operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a 0 as value.

System.Boolean conjB

optional flag that conjugates the second input array before the multiplication (true) or not (false).

| Improve this Doc View Source

Multiply(InputArray, InputArray, OutputArray, Double, Int32)

Calculates the per-element scaled product of two arrays

Declaration
public static void Multiply(InputArray src1, InputArray src2, OutputArray dst, double scale = 1, int dtype = -1)
Parameters
Type Name Description
InputArray src1

The first source array

InputArray src2

The second source array of the same size and the same type as src1

OutputArray dst

The destination array; will have the same size and the same type as src1

System.Double scale

The optional scale factor. [By default this is 1]

System.Int32 dtype
| Improve this Doc View Source

MulTransposed(InputArray, OutputArray, Boolean, InputArray, Double, Int32)

multiplies matrix by its transposition from the left or from the right

Declaration
public static void MulTransposed(InputArray src, OutputArray dst, bool aTa, InputArray delta = null, double scale = 1, int dtype = -1)
Parameters
Type Name Description
InputArray src

The source matrix

OutputArray dst

The destination square matrix

System.Boolean aTa

Specifies the multiplication ordering; see the description below

InputArray delta

The optional delta matrix, subtracted from src before the multiplication. When the matrix is empty ( delta=Mat() ), it’s assumed to be zero, i.e. nothing is subtracted, otherwise if it has the same size as src, then it’s simply subtracted, otherwise it is "repeated" to cover the full src and then subtracted. Type of the delta matrix, when it's not empty, must be the same as the type of created destination matrix, see the rtype description

System.Double scale

The optional scale factor for the matrix product

System.Int32 dtype

When it’s negative, the destination matrix will have the same type as src . Otherwise, it will have type=CV_MAT_DEPTH(rtype), which should be either CV_32F or CV_64F

| Improve this Doc View Source

NamedWindow(String, WindowFlags)

Creates a window.

Declaration
public static void NamedWindow(string winName, WindowFlags flags = WindowFlags.Normal)
Parameters
Type Name Description
System.String winName

Name of the window in the window caption that may be used as a window identifier.

WindowFlags flags

Flags of the window. Currently the only supported flag is CV WINDOW AUTOSIZE. If this is set, the window size is automatically adjusted to fit the displayed image (see imshow ), and the user can not change the window size manually.

| Improve this Doc View Source

Norm(InputArray, InputArray, NormTypes, InputArray)

computes norm of selected part of the difference between two arrays

Declaration
public static double Norm(InputArray src1, InputArray src2, NormTypes normType = NormTypes.L2, InputArray mask = null)
Parameters
Type Name Description
InputArray src1

The first source array

InputArray src2

The second source array of the same size and the same type as src1

NormTypes normType

Type of the norm

InputArray mask

The optional operation mask

Returns
Type Description
System.Double
| Improve this Doc View Source

Norm(InputArray, NormTypes, InputArray)

Calculates absolute array norm, absolute difference norm, or relative difference norm.

Declaration
public static double Norm(InputArray src1, NormTypes normType = NormTypes.L2, InputArray mask = null)
Parameters
Type Name Description
InputArray src1

The first source array

NormTypes normType

Type of the norm

InputArray mask

The optional operation mask

Returns
Type Description
System.Double
| Improve this Doc View Source

Normalize(InputArray, InputOutputArray, Double, Double, NormTypes, Int32, InputArray)

scales and shifts array elements so that either the specified norm (alpha) or the minimum (alpha) and maximum (beta) array values get the specified values

Declaration
public static void Normalize(InputArray src, InputOutputArray dst, double alpha = 1, double beta = 0, NormTypes normType = NormTypes.L2, int dtype = -1, InputArray mask = null)
Parameters
Type Name Description
InputArray src

The source array

InputOutputArray dst

The destination array; will have the same size as src

System.Double alpha

The norm value to normalize to or the lower range boundary in the case of range normalization

System.Double beta

The upper range boundary in the case of range normalization; not used for norm normalization

NormTypes normType

The normalization type

System.Int32 dtype

When the parameter is negative, the destination array will have the same type as src, otherwise it will have the same number of channels as src and the depth =CV_MAT_DEPTH(rtype)

InputArray mask

The optional operation mask

| Improve this Doc View Source

Partition<T>(IEnumerable<T>, out Int32[], Cv2.PartitionPredicate<T>)

Splits an element set into equivalency classes. Consider using GroupBy of Linq instead.

Declaration
public static int Partition<T>(IEnumerable<T> vec, out int[] labels, Cv2.PartitionPredicate<T> predicate)
Parameters
Type Name Description
IEnumerable<T> vec

Set of elements stored as a vector.

System.Int32[] labels

Output vector of labels. It contains as many elements as vec. Each label labels[i] is a 0-based cluster index of vec[i] .

Cv2.PartitionPredicate<T> predicate

Equivalence predicate (a boolean function of two arguments). The predicate returns true when the elements are certainly in the same class, and returns false if they may or may not be in the same class.

Returns
Type Description
System.Int32
Type Parameters
Name Description
T
| Improve this Doc View Source

PatchNaNs(InputOutputArray, Double)

converts NaN's to the given number

Declaration
public static void PatchNaNs(InputOutputArray a, double val = 0)
Parameters
Type Name Description
InputOutputArray a
System.Double val
| Improve this Doc View Source

PCABackProject(InputArray, InputArray, InputArray, OutputArray)

Reconstructs vectors from their PC projections.

Declaration
public static void PCABackProject(InputArray data, InputArray mean, InputArray eigenvectors, OutputArray result)
Parameters
Type Name Description
InputArray data

input samples stored as the matrix rows or as the matrix columns.

InputArray mean

optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.

InputArray eigenvectors

eigenvectors of the covariation matrix

OutputArray result

output vectors

| Improve this Doc View Source

PCACompute(InputArray, InputOutputArray, OutputArray, OutputArray, Int32)

PCA of the supplied dataset.

Declaration
public static void PCACompute(InputArray data, InputOutputArray mean, OutputArray eigenvectors, OutputArray eigenvalues, int maxComponents = 0)
Parameters
Type Name Description
InputArray data

input samples stored as the matrix rows or as the matrix columns.

InputOutputArray mean

optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.

OutputArray eigenvectors

eigenvectors of the covariation matrix

OutputArray eigenvalues

eigenvalues of the covariation matrix

System.Int32 maxComponents

maximum number of components that PCA should retain; by default, all the components are retained.

| Improve this Doc View Source

PCACompute(InputArray, InputOutputArray, OutputArray, Int32)

PCA of the supplied dataset.

Declaration
public static void PCACompute(InputArray data, InputOutputArray mean, OutputArray eigenvectors, int maxComponents = 0)
Parameters
Type Name Description
InputArray data

input samples stored as the matrix rows or as the matrix columns.

InputOutputArray mean

optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.

OutputArray eigenvectors

eigenvectors of the covariation matrix

System.Int32 maxComponents

maximum number of components that PCA should retain; by default, all the components are retained.

| Improve this Doc View Source

PCAComputeVar(InputArray, InputOutputArray, OutputArray, OutputArray, Double)

PCA of the supplied dataset.

Declaration
public static void PCAComputeVar(InputArray data, InputOutputArray mean, OutputArray eigenvectors, OutputArray eigenvalues, double retainedVariance)
Parameters
Type Name Description
InputArray data

input samples stored as the matrix rows or as the matrix columns.

InputOutputArray mean

optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.

OutputArray eigenvectors

eigenvectors of the covariation matrix

OutputArray eigenvalues

eigenvalues of the covariation matrix

System.Double retainedVariance

Percentage of variance that PCA should retain. Using this parameter will let the PCA decided how many components to retain but it will always keep at least 2.

| Improve this Doc View Source

PCAComputeVar(InputArray, InputOutputArray, OutputArray, Double)

PCA of the supplied dataset.

Declaration
public static void PCAComputeVar(InputArray data, InputOutputArray mean, OutputArray eigenvectors, double retainedVariance)
Parameters
Type Name Description
InputArray data

input samples stored as the matrix rows or as the matrix columns.

InputOutputArray mean

optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.

OutputArray eigenvectors

eigenvectors of the covariation matrix

System.Double retainedVariance

Percentage of variance that PCA should retain. Using this parameter will let the PCA decided how many components to retain but it will always keep at least 2.

| Improve this Doc View Source

PCAProject(InputArray, InputArray, InputArray, OutputArray)

Projects vector(s) to the principal component subspace.

Declaration
public static void PCAProject(InputArray data, InputArray mean, InputArray eigenvectors, OutputArray result)
Parameters
Type Name Description
InputArray data

input samples stored as the matrix rows or as the matrix columns.

InputArray mean

optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.

InputArray eigenvectors

eigenvectors of the covariation matrix

OutputArray result

output vectors

| Improve this Doc View Source

PencilSketch(InputArray, OutputArray, OutputArray, Single, Single, Single)

Pencil-like non-photorealistic line drawing

Declaration
public static void PencilSketch(InputArray src, OutputArray dst1, OutputArray dst2, float sigmaS = 60F, float sigmaR = 0.07F, float shadeFactor = 0.02F)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

OutputArray dst1

Output 8-bit 1-channel image.

OutputArray dst2

Output image with the same size and type as src.

System.Single sigmaS

Range between 0 to 200.

System.Single sigmaR

Range between 0 to 1.

System.Single shadeFactor

Range between 0 to 0.1.

| Improve this Doc View Source

PerspectiveTransform(IEnumerable<Point2d>, Mat)

performs perspective transformation of each element of multi-channel input matrix

Declaration
public static Point2d[] PerspectiveTransform(IEnumerable<Point2d> src, Mat m)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2d> src

The source two-channel or three-channel floating-point array; each element is 2D/3D vector to be transformed

Mat m

3x3 or 4x4 transformation matrix

Returns
Type Description
OpenCvSharp.Point2d[]

The destination array; it will have the same size and same type as src

| Improve this Doc View Source

PerspectiveTransform(IEnumerable<Point2f>, Mat)

performs perspective transformation of each element of multi-channel input matrix

Declaration
public static Point2f[] PerspectiveTransform(IEnumerable<Point2f> src, Mat m)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> src

The source two-channel or three-channel floating-point array; each element is 2D/3D vector to be transformed

Mat m

3x3 or 4x4 transformation matrix

Returns
Type Description
OpenCvSharp.Point2f[]

The destination array; it will have the same size and same type as src

| Improve this Doc View Source

PerspectiveTransform(IEnumerable<Point3d>, Mat)

performs perspective transformation of each element of multi-channel input matrix

Declaration
public static Point3d[] PerspectiveTransform(IEnumerable<Point3d> src, Mat m)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3d> src

The source two-channel or three-channel floating-point array; each element is 2D/3D vector to be transformed

Mat m

3x3 or 4x4 transformation matrix

Returns
Type Description
OpenCvSharp.Point3d[]

The destination array; it will have the same size and same type as src

| Improve this Doc View Source

PerspectiveTransform(IEnumerable<Point3f>, Mat)

performs perspective transformation of each element of multi-channel input matrix

Declaration
public static Point3f[] PerspectiveTransform(IEnumerable<Point3f> src, Mat m)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3f> src

The source two-channel or three-channel floating-point array; each element is 2D/3D vector to be transformed

Mat m

3x3 or 4x4 transformation matrix

Returns
Type Description
OpenCvSharp.Point3f[]

The destination array; it will have the same size and same type as src

| Improve this Doc View Source

PerspectiveTransform(InputArray, OutputArray, InputArray)

performs perspective transformation of each element of multi-channel input matrix

Declaration
public static void PerspectiveTransform(InputArray src, OutputArray dst, InputArray m)
Parameters
Type Name Description
InputArray src

The source two-channel or three-channel floating-point array; each element is 2D/3D vector to be transformed

OutputArray dst

The destination array; it will have the same size and same type as src

InputArray m

3x3 or 4x4 transformation matrix

| Improve this Doc View Source

Phase(InputArray, InputArray, OutputArray, Boolean)

Calculates the rotation angle of 2D vectors.

Declaration
public static void Phase(InputArray x, InputArray y, OutputArray angle, bool angleInDegrees = false)
Parameters
Type Name Description
InputArray x

input floating-point array of x-coordinates of 2D vectors.

InputArray y

input array of y-coordinates of 2D vectors; it must have the same size and the same type as x.

OutputArray angle

output array of vector angles; it has the same size and same type as x.

System.Boolean angleInDegrees

when true, the function calculates the angle in degrees, otherwise, they are measured in radians.

| Improve this Doc View Source

PhaseCorrelate(InputArray, InputArray, InputArray, out Double)

The function is used to detect translational shifts that occur between two images.

The operation takes advantage of the Fourier shift theorem for detecting the translational shift in the frequency domain.It can be used for fast image registration as well as motion estimation. For more information please see http://en.wikipedia.org/wiki/Phase_correlation.

Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with getOptimalDFTSize.

Declaration
public static Point2d PhaseCorrelate(InputArray src1, InputArray src2, InputArray window, out double response)
Parameters
Type Name Description
InputArray src1

Source floating point array (CV_32FC1 or CV_64FC1)

InputArray src2

Source floating point array (CV_32FC1 or CV_64FC1)

InputArray window

Floating point array with windowing coefficients to reduce edge effects (optional).

System.Double response

Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional).

Returns
Type Description
OpenCvSharp.Point2d

detected phase shift(sub-pixel) between the two arrays.

| Improve this Doc View Source

PointPolygonTest(IEnumerable<Point>, Point2f, Boolean)

Checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary

Declaration
public static double PointPolygonTest(IEnumerable<Point> contour, Point2f pt, bool measureDist)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> contour
OpenCvSharp.Point2f pt
System.Boolean measureDist
Returns
Type Description
System.Double
| Improve this Doc View Source

PointPolygonTest(IEnumerable<Point2f>, Point2f, Boolean)

Checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary.

Declaration
public static double PointPolygonTest(IEnumerable<Point2f> contour, Point2f pt, bool measureDist)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> contour

Input contour.

OpenCvSharp.Point2f pt

Point tested against the contour.

System.Boolean measureDist

If true, the function estimates the signed distance from the point to the nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.

Returns
Type Description
System.Double

Positive (inside), negative (outside), or zero (on an edge) value.

| Improve this Doc View Source

PointPolygonTest(InputArray, Point2f, Boolean)

Checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary

Declaration
public static double PointPolygonTest(InputArray contour, Point2f pt, bool measureDist)
Parameters
Type Name Description
InputArray contour
OpenCvSharp.Point2f pt
System.Boolean measureDist
Returns
Type Description
System.Double
| Improve this Doc View Source

PolarToCart(InputArray, InputArray, OutputArray, OutputArray, Boolean)

Calculates x and y coordinates of 2D vectors from their magnitude and angle.

Declaration
public static void PolarToCart(InputArray magnitude, InputArray angle, OutputArray x, OutputArray y, bool angleInDegrees = false)
Parameters
Type Name Description
InputArray magnitude

input floating-point array of magnitudes of 2D vectors; it can be an empty matrix(=Mat()), in this case, the function assumes that all the magnitudes are = 1; if it is not empty, it must have the same size and type as angle.

InputArray angle

input floating-point array of angles of 2D vectors.

OutputArray x

output array of x-coordinates of 2D vectors; it has the same size and type as angle.

OutputArray y

output array of y-coordinates of 2D vectors; it has the same size and type as angle.

System.Boolean angleInDegrees

when true, the input angles are measured in degrees, otherwise, they are measured in radians.

| Improve this Doc View Source

Polylines(InputOutputArray, InputArray, Boolean, Scalar, Int32, LineTypes, Int32)

draws one or more polygonal curves

Declaration
public static void Polylines(InputOutputArray img, InputArray pts, bool isClosed, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img
InputArray pts
System.Boolean isClosed
OpenCvSharp.Scalar color
System.Int32 thickness
LineTypes lineType
System.Int32 shift
| Improve this Doc View Source

Polylines(Mat, IEnumerable<IEnumerable<Point>>, Boolean, Scalar, Int32, LineTypes, Int32)

draws one or more polygonal curves

Declaration
public static void Polylines(Mat img, IEnumerable<IEnumerable<Point>> pts, bool isClosed, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
Mat img
IEnumerable<IEnumerable<OpenCvSharp.Point>> pts
System.Boolean isClosed
OpenCvSharp.Scalar color
System.Int32 thickness
LineTypes lineType
System.Int32 shift
| Improve this Doc View Source

Pow(InputArray, Double, OutputArray)

raises the input matrix elements to the specified power (b = a**power)

Declaration
public static void Pow(InputArray src, double power, OutputArray dst)
Parameters
Type Name Description
InputArray src

The source array

System.Double power

The exponent of power

OutputArray dst

The destination array; will have the same size and the same type as src

| Improve this Doc View Source

PreCornerDetect(InputArray, OutputArray, Int32, BorderTypes)

computes another complex cornerness criteria at each pixel

Declaration
public static void PreCornerDetect(InputArray src, OutputArray dst, int ksize, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src
OutputArray dst
System.Int32 ksize
BorderTypes borderType
| Improve this Doc View Source

ProjectPoints(IEnumerable<Point3f>, Double[], Double[], Double[,], Double[], out Point2f[], out Double[,], Double)

projects points from the model coordinate space to the image coordinates. Also computes derivatives of the image coordinates w.r.t the intrinsic and extrinsic camera parameters

Declaration
public static void ProjectPoints(IEnumerable<Point3f> objectPoints, double[] rvec, double[] tvec, double[, ] cameraMatrix, double[] distCoeffs, out Point2f[] imagePoints, out double[, ] jacobian, double aspectRatio = 0)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3f> objectPoints

Array of object points, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points in the view.

System.Double[] rvec

Rotation vector (3x1).

System.Double[] tvec

Translation vector (3x1).

System.Double[,] cameraMatrix

Camera matrix (3x3)

System.Double[] distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

OpenCvSharp.Point2f[] imagePoints

Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel

System.Double[,] jacobian

Optional output 2Nx(10 + numDistCoeffs) jacobian matrix of derivatives of image points with respect to components of the rotation vector, translation vector, focal lengths, coordinates of the principal point and the distortion coefficients. In the old interface different components of the jacobian are returned via different output parameters.

System.Double aspectRatio

Optional “fixed aspect ratio” parameter. If the parameter is not 0, the function assumes that the aspect ratio (fx/fy) is fixed and correspondingly adjusts the jacobian matrix.

| Improve this Doc View Source

ProjectPoints(InputArray, InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, Double)

projects points from the model coordinate space to the image coordinates. Also computes derivatives of the image coordinates w.r.t the intrinsic and extrinsic camera parameters

Declaration
public static void ProjectPoints(InputArray objectPoints, InputArray rvec, InputArray tvec, InputArray cameraMatrix, InputArray distCoeffs, OutputArray imagePoints, OutputArray jacobian = null, double aspectRatio = 0)
Parameters
Type Name Description
InputArray objectPoints

Array of object points, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points in the view.

InputArray rvec

Rotation vector (3x1).

InputArray tvec

Translation vector (3x1).

InputArray cameraMatrix

Camera matrix (3x3)

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

OutputArray imagePoints

Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel

OutputArray jacobian

Optional output 2Nx(10 + numDistCoeffs) jacobian matrix of derivatives of image points with respect to components of the rotation vector, translation vector, focal lengths, coordinates of the principal point and the distortion coefficients. In the old interface different components of the jacobian are returned via different output parameters.

System.Double aspectRatio

Optional “fixed aspect ratio” parameter. If the parameter is not 0, the function assumes that the aspect ratio (fx/fy) is fixed and correspondingly adjusts the jacobian matrix.

| Improve this Doc View Source

PSNR(InputArray, InputArray, Double)

Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric.

This function calculates the Peak Signal-to-Noise Ratio(PSNR) image quality metric in decibels(dB), between two input arrays src1 and src2.The arrays must have the same type.

Declaration
public static double PSNR(InputArray src1, InputArray src2, double r = 255)
Parameters
Type Name Description
InputArray src1

first input array.

InputArray src2

second input array of the same size as src1.

System.Double r

the maximum pixel value (255 by default)

Returns
Type Description
System.Double
| Improve this Doc View Source

PutText(InputOutputArray, String, Point, HersheyFonts, Double, Scalar, Int32, LineTypes, Boolean)

renders text string in the image

Declaration
public static void PutText(InputOutputArray img, string text, Point org, HersheyFonts fontFace, double fontScale, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, bool bottomLeftOrigin = false)
Parameters
Type Name Description
InputOutputArray img

Image.

System.String text

Text string to be drawn.

OpenCvSharp.Point org

Bottom-left corner of the text string in the image.

HersheyFonts fontFace

Font type, see #HersheyFonts.

System.Double fontScale

Font scale factor that is multiplied by the font-specific base size.

OpenCvSharp.Scalar color

Text color.

System.Int32 thickness

Thickness of the lines used to draw a text.

LineTypes lineType

Line type. See #LineTypes

System.Boolean bottomLeftOrigin

When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.

| Improve this Doc View Source

PyrDown(InputArray, OutputArray, Nullable<Size>, BorderTypes)

Blurs an image and downsamples it.

Declaration
public static void PyrDown(InputArray src, OutputArray dst, Size? dstSize = null, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

input image.

OutputArray dst

output image; it has the specified size and the same type as src.

System.Nullable<OpenCvSharp.Size> dstSize

size of the output image; by default, it is computed as Size((src.cols+1)/2

BorderTypes borderType
| Improve this Doc View Source

PyrMeanShiftFiltering(InputArray, OutputArray, Double, Double, Int32, Nullable<TermCriteria>)

Performs initial step of meanshift segmentation of an image.

Declaration
public static void PyrMeanShiftFiltering(InputArray src, OutputArray dst, double sp, double sr, int maxLevel = 1, TermCriteria? termcrit = null)
Parameters
Type Name Description
InputArray src

The source 8-bit, 3-channel image.

OutputArray dst

The destination image of the same format and the same size as the source.

System.Double sp

The spatial window radius.

System.Double sr

The color window radius.

System.Int32 maxLevel

Maximum level of the pyramid for the segmentation.

System.Nullable<OpenCvSharp.TermCriteria> termcrit

Termination criteria: when to stop meanshift iterations.

| Improve this Doc View Source

PyrUp(InputArray, OutputArray, Nullable<Size>, BorderTypes)

Upsamples an image and then blurs it.

Declaration
public static void PyrUp(InputArray src, OutputArray dst, Size? dstSize = null, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

input image.

OutputArray dst

output image. It has the specified size and the same type as src.

System.Nullable<OpenCvSharp.Size> dstSize

size of the output image; by default, it is computed as Size(src.cols2, (src.rows2)

BorderTypes borderType
| Improve this Doc View Source

Randn(InputOutputArray, InputArray, InputArray)

fills array with normally-distributed random numbers with the specified mean and the standard deviation

Declaration
public static void Randn(InputOutputArray dst, InputArray mean, InputArray stddev)
Parameters
Type Name Description
InputOutputArray dst

The output array of random numbers. The array must be pre-allocated and have 1 to 4 channels

InputArray mean

The mean value (expectation) of the generated random numbers

InputArray stddev

The standard deviation of the generated random numbers

| Improve this Doc View Source

Randn(InputOutputArray, Scalar, Scalar)

fills array with normally-distributed random numbers with the specified mean and the standard deviation

Declaration
public static void Randn(InputOutputArray dst, Scalar mean, Scalar stddev)
Parameters
Type Name Description
InputOutputArray dst

The output array of random numbers. The array must be pre-allocated and have 1 to 4 channels

OpenCvSharp.Scalar mean

The mean value (expectation) of the generated random numbers

OpenCvSharp.Scalar stddev

The standard deviation of the generated random numbers

| Improve this Doc View Source

RandShuffle(InputOutputArray, Double)

shuffles the input array elements

Declaration
public static void RandShuffle(InputOutputArray dst, double iterFactor)
Parameters
Type Name Description
InputOutputArray dst

The input/output numerical 1D array

System.Double iterFactor

The scale factor that determines the number of random swap operations.

| Improve this Doc View Source

RandShuffle(InputOutputArray, Double, ref RNG)

shuffles the input array elements

Declaration
public static void RandShuffle(InputOutputArray dst, double iterFactor, ref RNG rng)
Parameters
Type Name Description
InputOutputArray dst

The input/output numerical 1D array

System.Double iterFactor

The scale factor that determines the number of random swap operations.

RNG rng

The optional random number generator used for shuffling. If it is null, theRng() is used instead.

| Improve this Doc View Source

Randu(InputOutputArray, InputArray, InputArray)

fills array with uniformly-distributed random numbers from the range [low, high)

Declaration
public static void Randu(InputOutputArray dst, InputArray low, InputArray high)
Parameters
Type Name Description
InputOutputArray dst

The output array of random numbers. The array must be pre-allocated and have 1 to 4 channels

InputArray low

The inclusive lower boundary of the generated random numbers

InputArray high

The exclusive upper boundary of the generated random numbers

| Improve this Doc View Source

Randu(InputOutputArray, Scalar, Scalar)

fills array with uniformly-distributed random numbers from the range [low, high)

Declaration
public static void Randu(InputOutputArray dst, Scalar low, Scalar high)
Parameters
Type Name Description
InputOutputArray dst

The output array of random numbers. The array must be pre-allocated and have 1 to 4 channels

OpenCvSharp.Scalar low

The inclusive lower boundary of the generated random numbers

OpenCvSharp.Scalar high

The exclusive upper boundary of the generated random numbers

| Improve this Doc View Source

RecoverPose(InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, InputOutputArray)

Recover relative camera rotation and translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. Returns the number of inliers which pass the check.

Declaration
public static int RecoverPose(InputArray E, InputArray points1, InputArray points2, InputArray cameraMatrix, OutputArray R, OutputArray t, InputOutputArray mask = null)
Parameters
Type Name Description
InputArray E

The input essential matrix.

InputArray points1

Array of N 2D points from the first image. The point coordinates should be floating-point (single or double precision).

InputArray points2

Array of the second image points of the same size and format as points1.

InputArray cameraMatrix

Camera matrix K=⎡⎣⎢fx000fy0cxcy1⎤⎦⎥ . Note that this function assumes that points1 and points2 are feature points from cameras with the same camera matrix.

OutputArray R

Recovered relative rotation.

OutputArray t

Recovered relative translation.

InputOutputArray mask

Input/output mask for inliers in points1 and points2. : If it is not empty, then it marks inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to recover pose. In the output mask only inliers which pass the cheirality check. This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. The cheirality check basically means that the triangulated 3D points should have positive depth.

Returns
Type Description
System.Int32
| Improve this Doc View Source

RecoverPose(InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, Double, InputOutputArray, OutputArray)

Recover relative camera rotation and translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. Returns the number of inliers which pass the check.

Declaration
public static int RecoverPose(InputArray E, InputArray points1, InputArray points2, InputArray cameraMatrix, OutputArray R, OutputArray t, double distanceTresh, InputOutputArray mask = null, OutputArray triangulatedPoints = null)
Parameters
Type Name Description
InputArray E

The input essential matrix.

InputArray points1

Array of N 2D points from the first image. The point coordinates should be floating-point (single or double precision).

InputArray points2

Array of the second image points of the same size and format as points1.

InputArray cameraMatrix

Camera matrix K=⎡⎣⎢fx000fy0cxcy1⎤⎦⎥ . Note that this function assumes that points1 and points2 are feature points from cameras with the same camera matrix.

OutputArray R

Recovered relative rotation.

OutputArray t

Recovered relative translation.

System.Double distanceTresh

threshold distance which is used to filter out far away points (i.e. infinite points).

InputOutputArray mask

Input/output mask for inliers in points1 and points2. : If it is not empty, then it marks inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to recover pose. In the output mask only inliers which pass the cheirality check. This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. The cheirality check basically means that the triangulated 3D points should have positive depth.

OutputArray triangulatedPoints

3d points which were reconstructed by triangulation.

Returns
Type Description
System.Int32
| Improve this Doc View Source

RecoverPose(InputArray, InputArray, InputArray, OutputArray, OutputArray, Double, Point2d, InputOutputArray)

Recover relative camera rotation and translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. Returns the number of inliers which pass the check.

Declaration
public static int RecoverPose(InputArray E, InputArray points1, InputArray points2, OutputArray R, OutputArray t, double focal, Point2d pp, InputOutputArray mask = null)
Parameters
Type Name Description
InputArray E

The input essential matrix.

InputArray points1

Array of N 2D points from the first image. The point coordinates should be floating-point (single or double precision).

InputArray points2

Array of the second image points of the same size and format as points1.

OutputArray R

Recovered relative rotation.

OutputArray t

Recovered relative translation.

System.Double focal

Focal length of the camera. Note that this function assumes that points1 and points2 are feature points from cameras with same focal length and principal point.

OpenCvSharp.Point2d pp

principal point of the camera.

InputOutputArray mask

Input/output mask for inliers in points1 and points2. : If it is not empty, then it marks inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to recover pose. In the output mask only inliers which pass the cheirality check. This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. The cheirality check basically means that the triangulated 3D points should have positive depth.

Returns
Type Description
System.Int32
| Improve this Doc View Source

Rectangle(InputOutputArray, Point, Point, Scalar, Int32, LineTypes, Int32)

Draws simple, thick or filled rectangle

Declaration
public static void Rectangle(InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img

Image.

OpenCvSharp.Point pt1

One of the rectangle vertices.

OpenCvSharp.Point pt2

Opposite rectangle vertex.

OpenCvSharp.Scalar color

Line color (RGB) or brightness (grayscale image).

System.Int32 thickness

Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1]

LineTypes lineType

Type of the line, see cvLine description. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

Rectangle(InputOutputArray, Rect, Scalar, Int32, LineTypes, Int32)

Draws simple, thick or filled rectangle

Declaration
public static void Rectangle(InputOutputArray img, Rect rect, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
InputOutputArray img

Image.

OpenCvSharp.Rect rect

Rectangle.

OpenCvSharp.Scalar color

Line color (RGB) or brightness (grayscale image).

System.Int32 thickness

Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1]

LineTypes lineType

Type of the line, see cvLine description. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

Rectangle(Mat, Point, Point, Scalar, Int32, LineTypes, Int32)

Draws simple, thick or filled rectangle

Declaration
public static void Rectangle(Mat img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
Mat img

Image.

OpenCvSharp.Point pt1

One of the rectangle vertices.

OpenCvSharp.Point pt2

Opposite rectangle vertex.

OpenCvSharp.Scalar color

Line color (RGB) or brightness (grayscale image).

System.Int32 thickness

Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1]

LineTypes lineType

Type of the line, see cvLine description. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

Rectangle(Mat, Rect, Scalar, Int32, LineTypes, Int32)

Draws simple, thick or filled rectangle

Declaration
public static void Rectangle(Mat img, Rect rect, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
Mat img

Image.

OpenCvSharp.Rect rect

Rectangle.

OpenCvSharp.Scalar color

Line color (RGB) or brightness (grayscale image).

System.Int32 thickness

Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1]

LineTypes lineType

Type of the line, see cvLine description. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

Rectify3Collinear(InputArray, InputArray, InputArray, InputArray, InputArray, InputArray, IEnumerable<InputArray>, IEnumerable<InputArray>, Size, InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, Double, Size, out Rect, out Rect, StereoRectificationFlags)

computes the rectification transformations for 3-head camera, where all the heads are on the same line.

Declaration
public static float Rectify3Collinear(InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2, InputArray distCoeffs2, InputArray cameraMatrix3, InputArray distCoeffs3, IEnumerable<InputArray> imgpt1, IEnumerable<InputArray> imgpt3, Size imageSize, InputArray R12, InputArray T12, InputArray R13, InputArray T13, OutputArray R1, OutputArray R2, OutputArray R3, OutputArray P1, OutputArray P2, OutputArray P3, OutputArray Q, double alpha, Size newImgSize, out Rect roi1, out Rect roi2, StereoRectificationFlags flags)
Parameters
Type Name Description
InputArray cameraMatrix1
InputArray distCoeffs1
InputArray cameraMatrix2
InputArray distCoeffs2
InputArray cameraMatrix3
InputArray distCoeffs3
IEnumerable<InputArray> imgpt1
IEnumerable<InputArray> imgpt3
OpenCvSharp.Size imageSize
InputArray R12
InputArray T12
InputArray R13
InputArray T13
OutputArray R1
OutputArray R2
OutputArray R3
OutputArray P1
OutputArray P2
OutputArray P3
OutputArray Q
System.Double alpha
OpenCvSharp.Size newImgSize
OpenCvSharp.Rect roi1
OpenCvSharp.Rect roi2
StereoRectificationFlags flags
Returns
Type Description
System.Single
| Improve this Doc View Source

Reduce(InputArray, OutputArray, ReduceDimension, ReduceTypes, Int32)

transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows

Declaration
public static void Reduce(InputArray src, OutputArray dst, ReduceDimension dim, ReduceTypes rtype, int dtype)
Parameters
Type Name Description
InputArray src

The source 2D matrix

OutputArray dst

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

ReduceDimension dim

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

ReduceTypes rtype
System.Int32 dtype

When it is negative, the destination vector will have the same type as the source matrix, otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels())

| Improve this Doc View Source

ReduceArgMax(InputArray, OutputArray, Int32, Boolean)

Finds indices of max elements along provided axis

Declaration
public static void ReduceArgMax(InputArray src, OutputArray dst, int axis, bool lastIndex = false)
Parameters
Type Name Description
InputArray src

Input single-channel array

OutputArray dst

Output array of type CV_32SC1 with the same dimensionality as src, except for axis being reduced - it should be set to 1.

System.Int32 axis

Axis to reduce along

System.Boolean lastIndex

Whether to get the index of first or last occurrence of max

| Improve this Doc View Source

ReduceArgMin(InputArray, OutputArray, Int32, Boolean)

Finds indices of min elements along provided axis

Declaration
public static void ReduceArgMin(InputArray src, OutputArray dst, int axis, bool lastIndex = false)
Parameters
Type Name Description
InputArray src

Input single-channel array

OutputArray dst

Output array of type CV_32SC1 with the same dimensionality as src, except for axis being reduced - it should be set to 1.

System.Int32 axis

Axis to reduce along

System.Boolean lastIndex

Whether to get the index of first or last occurrence of min

| Improve this Doc View Source

Remap(InputArray, OutputArray, InputArray, InputArray, InterpolationFlags, BorderTypes, Nullable<Scalar>)

Applies a generic geometrical transformation to an image.

Declaration
public static void Remap(InputArray src, OutputArray dst, InputArray map1, InputArray map2, InterpolationFlags interpolation = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray src

Source image.

OutputArray dst

Destination image. It has the same size as map1 and the same type as src

InputArray map1

The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2.

InputArray map2

The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.

InterpolationFlags interpolation

Interpolation method. The method INTER_AREA is not supported by this function.

BorderTypes borderMode

Pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image that corresponds to the "outliers" in the source image are not modified by the function.

System.Nullable<OpenCvSharp.Scalar> borderValue

Value used in case of a constant border. By default, it is 0.

| Improve this Doc View Source

Repeat(InputArray, Int32, Int32, OutputArray)

replicates the input matrix the specified number of times in the horizontal and/or vertical direction

Declaration
public static void Repeat(InputArray src, int ny, int nx, OutputArray dst)
Parameters
Type Name Description
InputArray src

The source array to replicate

System.Int32 ny

How many times the src is repeated along the vertical axis

System.Int32 nx

How many times the src is repeated along the horizontal axis

OutputArray dst

The destination array; will have the same type as src

| Improve this Doc View Source

Repeat(Mat, Int32, Int32)

replicates the input matrix the specified number of times in the horizontal and/or vertical direction

Declaration
public static Mat Repeat(Mat src, int ny, int nx)
Parameters
Type Name Description
Mat src

The source array to replicate

System.Int32 ny

How many times the src is repeated along the vertical axis

System.Int32 nx

How many times the src is repeated along the horizontal axis

Returns
Type Description
Mat
| Improve this Doc View Source

ReprojectImageTo3D(InputArray, OutputArray, InputArray, Boolean, Int32)

reprojects disparity image to 3D: (x,y,d)->(X,Y,Z) using the matrix Q returned by cv::stereoRectify

Declaration
public static void ReprojectImageTo3D(InputArray disparity, OutputArray _3dImage, InputArray Q, bool handleMissingValues = false, int ddepth = -1)
Parameters
Type Name Description
InputArray disparity

Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit floating-point disparity image.

OutputArray _3dImage

Output 3-channel floating-point image of the same size as disparity. Each element of _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map.

InputArray Q

4 x 4 perspective transformation matrix that can be obtained with stereoRectify().

System.Boolean handleMissingValues

Indicates, whether the function should handle missing values (i.e. points where the disparity was not computed). If handleMissingValues=true, then pixels with the minimal disparity that corresponds to the outliers (see StereoBM::operator() ) are transformed to 3D points with a very large Z value (currently set to 10000).

System.Int32 ddepth

he optional output array depth. If it is -1, the output image will have CV_32F depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.

| Improve this Doc View Source

Resize(InputArray, OutputArray, Size, Double, Double, InterpolationFlags)

Resizes an image.

Declaration
public static void Resize(InputArray src, OutputArray dst, Size dsize, double fx = 0, double fy = 0, InterpolationFlags interpolation = InterpolationFlags.Linear)
Parameters
Type Name Description
InputArray src

input image.

OutputArray dst

output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src.

OpenCvSharp.Size dsize

output image size; if it equals zero, it is computed as: dsize = Size(round(fxsrc.cols), round(fysrc.rows)) Either dsize or both fx and fy must be non-zero.

System.Double fx

scale factor along the horizontal axis; when it equals 0, it is computed as: (double)dsize.width/src.cols

System.Double fy

scale factor along the vertical axis; when it equals 0, it is computed as: (double)dsize.height/src.rows

InterpolationFlags interpolation

interpolation method

| Improve this Doc View Source

ResizeWindow(String, Size)

Resizes window to the specified size

Declaration
public static void ResizeWindow(string winName, Size size)
Parameters
Type Name Description
System.String winName

Window name

OpenCvSharp.Size size

The new window size

| Improve this Doc View Source

ResizeWindow(String, Int32, Int32)

Resizes window to the specified size

Declaration
public static void ResizeWindow(string winName, int width, int height)
Parameters
Type Name Description
System.String winName

Window name

System.Int32 width

The new window width

System.Int32 height

The new window height

| Improve this Doc View Source

Rodrigues(InputArray, OutputArray, OutputArray)

converts rotation vector to rotation matrix or vice versa using Rodrigues transformation

Declaration
public static void Rodrigues(InputArray src, OutputArray dst, OutputArray jacobian = null)
Parameters
Type Name Description
InputArray src

Input rotation vector (3x1 or 1x3) or rotation matrix (3x3).

OutputArray dst

Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.

OutputArray jacobian

Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial derivatives of the output array components with respect to the input array components.

| Improve this Doc View Source

Rodrigues(Double[], out Double[,], out Double[,])

converts rotation vector to rotation matrix using Rodrigues transformation

Declaration
public static void Rodrigues(double[] vector, out double[, ] matrix, out double[, ] jacobian)
Parameters
Type Name Description
System.Double[] vector

Input rotation vector (3x1).

System.Double[,] matrix

Output rotation matrix (3x3).

System.Double[,] jacobian

Optional output Jacobian matrix, 3x9, which is a matrix of partial derivatives of the output array components with respect to the input array components.

| Improve this Doc View Source

Rodrigues(Double[,], out Double[], out Double[,])

converts rotation matrix to rotation vector using Rodrigues transformation

Declaration
public static void Rodrigues(double[, ] matrix, out double[] vector, out double[, ] jacobian)
Parameters
Type Name Description
System.Double[,] matrix

Input rotation matrix (3x3).

System.Double[] vector

Output rotation vector (3x1).

System.Double[,] jacobian

Optional output Jacobian matrix, 3x9, which is a matrix of partial derivatives of the output array components with respect to the input array components.

| Improve this Doc View Source

Rotate(InputArray, OutputArray, RotateFlags)

Rotates a 2D array in multiples of 90 degrees.

Declaration
public static void Rotate(InputArray src, OutputArray dst, RotateFlags rotateCode)
Parameters
Type Name Description
InputArray src

input array.

OutputArray dst

output array of the same type as src. The size is the same with ROTATE_180, and the rows and cols are switched for ROTATE_90_CLOCKWISE and ROTATE_90_COUNTERCLOCKWISE.

RotateFlags rotateCode

an enum to specify how to rotate the array.

| Improve this Doc View Source

RotatedRectangleIntersection(RotatedRect, RotatedRect, OutputArray)

Finds out if there is any intersection between two rotated rectangles. If there is then the vertices of the interesecting region are returned as well. Below are some examples of intersection configurations. The hatched pattern indicates the intersecting region and the red vertices are returned by the function.

Declaration
public static RectanglesIntersectTypes RotatedRectangleIntersection(RotatedRect rect1, RotatedRect rect2, OutputArray intersectingRegion)
Parameters
Type Name Description
OpenCvSharp.RotatedRect rect1

First rectangle

OpenCvSharp.RotatedRect rect2

Second rectangle

OutputArray intersectingRegion

The output array of the verticies of the intersecting region. It returns at most 8 vertices. Stored as std::vector<cv::Point2f> or cv::Mat as Mx1 of type CV_32FC2.

Returns
Type Description
RectanglesIntersectTypes
| Improve this Doc View Source

RotatedRectangleIntersection(RotatedRect, RotatedRect, out Point2f[])

Finds out if there is any intersection between two rotated rectangles. If there is then the vertices of the interesecting region are returned as well. Below are some examples of intersection configurations. The hatched pattern indicates the intersecting region and the red vertices are returned by the function.

Declaration
public static RectanglesIntersectTypes RotatedRectangleIntersection(RotatedRect rect1, RotatedRect rect2, out Point2f[] intersectingRegion)
Parameters
Type Name Description
OpenCvSharp.RotatedRect rect1

First rectangle

OpenCvSharp.RotatedRect rect2

Second rectangle

OpenCvSharp.Point2f[] intersectingRegion

The output array of the verticies of the intersecting region. It returns at most 8 vertices.

Returns
Type Description
RectanglesIntersectTypes
| Improve this Doc View Source

RQDecomp3x3(InputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray)

Computes RQ decomposition of 3x3 matrix

Declaration
public static Vec3d RQDecomp3x3(InputArray src, OutputArray mtxR, OutputArray mtxQ, OutputArray qx = null, OutputArray qy = null, OutputArray qz = null)
Parameters
Type Name Description
InputArray src

3x3 input matrix.

OutputArray mtxR

Output 3x3 upper-triangular matrix.

OutputArray mtxQ

Output 3x3 orthogonal matrix.

OutputArray qx

Optional output 3x3 rotation matrix around x-axis.

OutputArray qy

Optional output 3x3 rotation matrix around y-axis.

OutputArray qz

Optional output 3x3 rotation matrix around z-axis.

Returns
Type Description
Vec3d
| Improve this Doc View Source

RQDecomp3x3(Double[,], out Double[,], out Double[,])

Computes RQ decomposition of 3x3 matrix

Declaration
public static Vec3d RQDecomp3x3(double[, ] src, out double[, ] mtxR, out double[, ] mtxQ)
Parameters
Type Name Description
System.Double[,] src

3x3 input matrix.

System.Double[,] mtxR

Output 3x3 upper-triangular matrix.

System.Double[,] mtxQ

Output 3x3 orthogonal matrix.

Returns
Type Description
Vec3d
| Improve this Doc View Source

RQDecomp3x3(Double[,], out Double[,], out Double[,], out Double[,], out Double[,], out Double[,])

Computes RQ decomposition of 3x3 matrix

Declaration
public static Vec3d RQDecomp3x3(double[, ] src, out double[, ] mtxR, out double[, ] mtxQ, out double[, ] qx, out double[, ] qy, out double[, ] qz)
Parameters
Type Name Description
System.Double[,] src

3x3 input matrix.

System.Double[,] mtxR

Output 3x3 upper-triangular matrix.

System.Double[,] mtxQ

Output 3x3 orthogonal matrix.

System.Double[,] qx

Optional output 3x3 rotation matrix around x-axis.

System.Double[,] qy

Optional output 3x3 rotation matrix around y-axis.

System.Double[,] qz

Optional output 3x3 rotation matrix around z-axis.

Returns
Type Description
Vec3d
| Improve this Doc View Source

SampsonDistance(InputArray, InputArray, InputArray)

Calculates the Sampson Distance between two points.

Declaration
public static double SampsonDistance(InputArray pt1, InputArray pt2, InputArray f)
Parameters
Type Name Description
InputArray pt1

first homogeneous 2d point

InputArray pt2

second homogeneous 2d point

InputArray f

F fundamental matrix

Returns
Type Description
System.Double

The computed Sampson distance.

Remarks

https://github.com/opencv/opencv/blob/master/modules/calib3d/src/fundam.cpp#L1109

| Improve this Doc View Source

SampsonDistance(Point3d, Point3d, Double[,])

Calculates the Sampson Distance between two points.

Declaration
public static double SampsonDistance(Point3d pt1, Point3d pt2, double[, ] f)
Parameters
Type Name Description
OpenCvSharp.Point3d pt1

first homogeneous 2d point

OpenCvSharp.Point3d pt2

second homogeneous 2d point

System.Double[,] f

F fundamental matrix

Returns
Type Description
System.Double

The computed Sampson distance.

Remarks

https://github.com/opencv/opencv/blob/master/modules/calib3d/src/fundam.cpp#L1109

| Improve this Doc View Source

ScaleAdd(InputArray, Double, InputArray, OutputArray)

adds scaled array to another one (dst = alpha*src1 + src2)

Declaration
public static void ScaleAdd(InputArray src1, double alpha, InputArray src2, OutputArray dst)
Parameters
Type Name Description
InputArray src1
System.Double alpha
InputArray src2
OutputArray dst
| Improve this Doc View Source

Scharr(InputArray, OutputArray, MatType, Int32, Int32, Double, Double, BorderTypes)

Calculates the first x- or y- image derivative using Scharr operator

Declaration
public static void Scharr(InputArray src, OutputArray dst, MatType ddepth, int xorder, int yorder, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

The destination image; will have the same size and the same number of channels as src

OpenCvSharp.MatType ddepth

The destination image depth

System.Int32 xorder

Order of the derivative x

System.Int32 yorder

Order of the derivative y

System.Double scale

The optional scale factor for the computed derivative values (by default, no scaling is applie

System.Double delta

The optional delta value, added to the results prior to storing them in dst

BorderTypes borderType

The pixel extrapolation method

| Improve this Doc View Source

SeamlessClone(InputArray, InputArray, InputArray, Point, OutputArray, SeamlessCloneMethods)

Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content @cite PM03 .

Declaration
public static void SeamlessClone(InputArray src, InputArray dst, InputArray mask, Point p, OutputArray blend, SeamlessCloneMethods flags)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

InputArray dst

Input 8-bit 3-channel image.

InputArray mask

Input 8-bit 1 or 3-channel image.

OpenCvSharp.Point p

Point in dst image where object is placed.

OutputArray blend

Output image with the same size and type as dst.

SeamlessCloneMethods flags

Cloning method

| Improve this Doc View Source

SelectROI(InputArray, Boolean, Boolean)

Selects ROI on the given image. Function creates a window and allows user to select a ROI using mouse. Controls: use space or enter to finish selection, use key c to cancel selection (function will return the zero cv::Rect).

Declaration
public static Rect SelectROI(InputArray img, bool showCrosshair = true, bool fromCenter = false)
Parameters
Type Name Description
InputArray img

image to select a ROI.

System.Boolean showCrosshair

if true crosshair of selection rectangle will be shown.

System.Boolean fromCenter

if true center of selection will match initial mouse position. In opposite case a corner of selection rectangle will correspond to the initial mouse position.

Returns
Type Description
OpenCvSharp.Rect

selected ROI or empty rect if selection canceled.

| Improve this Doc View Source

SelectROI(String, InputArray, Boolean, Boolean)

Selects ROI on the given image. Function creates a window and allows user to select a ROI using mouse. Controls: use space or enter to finish selection, use key c to cancel selection (function will return the zero cv::Rect).

Declaration
public static Rect SelectROI(string windowName, InputArray img, bool showCrosshair = true, bool fromCenter = false)
Parameters
Type Name Description
System.String windowName

name of the window where selection process will be shown.

InputArray img

image to select a ROI.

System.Boolean showCrosshair

if true crosshair of selection rectangle will be shown.

System.Boolean fromCenter

if true center of selection will match initial mouse position. In opposite case a corner of selection rectangle will correspond to the initial mouse position.

Returns
Type Description
OpenCvSharp.Rect

selected ROI or empty rect if selection canceled.

| Improve this Doc View Source

SelectROIs(String, InputArray, Boolean, Boolean)

Selects ROIs on the given image. Function creates a window and allows user to select a ROIs using mouse. Controls: use space or enter to finish current selection and start a new one, use esc to terminate multiple ROI selection process.

Declaration
public static Rect[] SelectROIs(string windowName, InputArray img, bool showCrosshair = true, bool fromCenter = false)
Parameters
Type Name Description
System.String windowName

name of the window where selection process will be shown.

InputArray img

image to select a ROI.

System.Boolean showCrosshair

if true crosshair of selection rectangle will be shown.

System.Boolean fromCenter

if true center of selection will match initial mouse position. In opposite case a corner of selection rectangle will correspond to the initial mouse position.

Returns
Type Description
OpenCvSharp.Rect[]

selected ROIs.

| Improve this Doc View Source

SepFilter2D(InputArray, OutputArray, MatType, InputArray, InputArray, Nullable<Point>, Double, BorderTypes)

Applies separable linear filter to an image

Declaration
public static void SepFilter2D(InputArray src, OutputArray dst, MatType ddepth, InputArray kernelX, InputArray kernelY, Point? anchor = null, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

The destination image; will have the same size and the same number of channels as src

OpenCvSharp.MatType ddepth

The destination image depth

InputArray kernelX

The coefficients for filtering each row

InputArray kernelY

The coefficients for filtering each column

System.Nullable<OpenCvSharp.Point> anchor

The anchor position within the kernel; The default value (-1, 1) means that the anchor is at the kernel center

System.Double delta

The value added to the filtered results before storing them

BorderTypes borderType

The pixel extrapolation method

| Improve this Doc View Source

SetBreakOnError(Boolean)

Sets/resets the break-on-error mode. When the break-on-error mode is set, the default error handler issues a hardware exception, which can make debugging more convenient.

Declaration
public static bool SetBreakOnError(bool flag)
Parameters
Type Name Description
System.Boolean flag
Returns
Type Description
System.Boolean

the previous state

| Improve this Doc View Source

SetIdentity(InputOutputArray, Nullable<Scalar>)

initializes scaled identity matrix

Declaration
public static void SetIdentity(InputOutputArray mtx, Scalar? s = null)
Parameters
Type Name Description
InputOutputArray mtx

The matrix to initialize (not necessarily square)

System.Nullable<OpenCvSharp.Scalar> s

The value to assign to the diagonal elements

| Improve this Doc View Source

SetLogLevel(LogLevel)

Set global logging level

Declaration
public static LogLevel SetLogLevel(LogLevel logLevel)
Parameters
Type Name Description
LogLevel logLevel

logging level

Returns
Type Description
LogLevel

previous logging level

| Improve this Doc View Source

SetMouseCallback(String, MouseCallback, IntPtr)

Sets the callback function for mouse events occuring within the specified window.

Declaration
public static void SetMouseCallback(string windowName, MouseCallback onMouse, IntPtr userData = null)
Parameters
Type Name Description
System.String windowName

Name of the window.

MouseCallback onMouse

Reference to the function to be called every time mouse event occurs in the specified window.

IntPtr userData
| Improve this Doc View Source

SetNumThreads(Int32)

OpenCV will try to set the number of threads for the next parallel region. If threads == 0, OpenCV will disable threading optimizations and run all it's functions sequentially.Passing threads < 0 will reset threads number to system default. This function must be called outside of parallel region. OpenCV will try to run its functions with specified threads number, but some behaviour differs from framework:

  • TBB - User-defined parallel constructions will run with the same threads number, if another is not specified.If later on user creates his own scheduler, OpenCV will use it.
  • OpenMP - No special defined behaviour.
  • Concurrency - If threads == 1, OpenCV will disable threading optimizations and run its functions sequentially.
  • GCD - Supports only values <= 0.
  • C= - No special defined behaviour.
Declaration
public static void SetNumThreads(int nThreads)
Parameters
Type Name Description
System.Int32 nThreads

Number of threads used by OpenCV.

| Improve this Doc View Source

SetTheRNG(UInt64)

Sets the thread-local Random number generator

Declaration
public static RNG SetTheRNG(ulong state)
Parameters
Type Name Description
System.UInt64 state
Returns
Type Description
RNG
| Improve this Doc View Source

SetTrackbarMax(String, String, Int32)

Sets the trackbar maximum position. The function sets the maximum position of the specified trackbar in the specified window.

Declaration
public static void SetTrackbarMax(string trackbarName, string winName, int maxVal)
Parameters
Type Name Description
System.String trackbarName

Name of the trackbar.

System.String winName

Name of the window that is the parent of trackbar.

System.Int32 maxVal

New maximum position.

| Improve this Doc View Source

SetTrackbarMin(String, String, Int32)

Sets the trackbar minimum position. The function sets the minimum position of the specified trackbar in the specified window.

Declaration
public static void SetTrackbarMin(string trackbarName, string winName, int minVal)
Parameters
Type Name Description
System.String trackbarName

Name of the trackbar.

System.String winName

Name of the window that is the parent of trackbar.

System.Int32 minVal

New minimum position.

| Improve this Doc View Source

SetTrackbarPos(String, String, Int32)

Sets the trackbar position.

Declaration
public static void SetTrackbarPos(string trackbarName, string winName, int pos)
Parameters
Type Name Description
System.String trackbarName

Name of the trackbar.

System.String winName

Name of the window that is the parent of trackbar.

System.Int32 pos

New position.

| Improve this Doc View Source

SetUseOptimized(Boolean)

Turns on/off available optimization. The function turns on or off the optimized code in OpenCV. Some optimization can not be enabled or disabled, but, for example, most of SSE code in OpenCV can be temporarily turned on or off this way.

Declaration
public static void SetUseOptimized(bool onoff)
Parameters
Type Name Description
System.Boolean onoff
| Improve this Doc View Source

SetWindowProperty(String, WindowPropertyFlags, Double)

Changes parameters of a window dynamically.

Declaration
public static void SetWindowProperty(string winName, WindowPropertyFlags propId, double propValue)
Parameters
Type Name Description
System.String winName

Name of the window.

WindowPropertyFlags propId

Window property to retrieve.

System.Double propValue

New value of the window property.

| Improve this Doc View Source

SetWindowTitle(String, String)

Updates window title

Declaration
public static void SetWindowTitle(string winName, string title)
Parameters
Type Name Description
System.String winName

Name of the window

System.String title

New title

| Improve this Doc View Source

Sobel(InputArray, OutputArray, MatType, Int32, Int32, Int32, Double, Double, BorderTypes)

Calculates the first, second, third or mixed image derivatives using an extended Sobel operator

Declaration
public static void Sobel(InputArray src, OutputArray dst, MatType ddepth, int xorder, int yorder, int ksize = 3, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

The source image

OutputArray dst

The destination image; will have the same size and the same number of channels as src

OpenCvSharp.MatType ddepth

The destination image depth

System.Int32 xorder

Order of the derivative x

System.Int32 yorder

Order of the derivative y

System.Int32 ksize

Size of the extended Sobel kernel, must be 1, 3, 5 or 7

System.Double scale

The optional scale factor for the computed derivative values (by default, no scaling is applied

System.Double delta

The optional delta value, added to the results prior to storing them in dst

BorderTypes borderType

The pixel extrapolation method

| Improve this Doc View Source

Solve(InputArray, InputArray, OutputArray, DecompTypes)

solves linear system or a least-square problem

Declaration
public static bool Solve(InputArray src1, InputArray src2, OutputArray dst, DecompTypes flags = DecompTypes.LU)
Parameters
Type Name Description
InputArray src1
InputArray src2
OutputArray dst
DecompTypes flags
Returns
Type Description
System.Boolean
| Improve this Doc View Source

SolveCubic(InputArray, OutputArray)

finds real roots of a cubic polynomial

Declaration
public static int SolveCubic(InputArray coeffs, OutputArray roots)
Parameters
Type Name Description
InputArray coeffs

The equation coefficients, an array of 3 or 4 elements

OutputArray roots

The destination array of real roots which will have 1 or 3 elements

Returns
Type Description
System.Int32
| Improve this Doc View Source

SolveLP(InputArray, InputArray, OutputArray)

Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method).

Declaration
public static SolveLPResult SolveLP(InputArray func, InputArray constr, OutputArray z)
Parameters
Type Name Description
InputArray func

This row-vector corresponds to \f$c\f$ in the LP problem formulation (see above). It should contain 32- or 64-bit floating point numbers.As a convenience, column-vector may be also submitted, in the latter case it is understood to correspond to \f$c^T\f$.

InputArray constr

m-by-n+1 matrix, whose rightmost column corresponds to \f$b\f$ in formulation above and the remaining to \f$A\f$. It should containt 32- or 64-bit floating point numbers.

OutputArray z

The solution will be returned here as a column-vector - it corresponds to \f$c\f$ in the formulation above.It will contain 64-bit floating point numbers.

Returns
Type Description
SolveLPResult
| Improve this Doc View Source

SolvePnP(IEnumerable<Point3f>, IEnumerable<Point2f>, Double[,], Nullable<IEnumerable<Double>>, ref Double[], ref Double[], Boolean, SolvePnPFlags)

Finds an object pose from 3D-2D point correspondences.

Declaration
public static void SolvePnP(IEnumerable<Point3f> objectPoints, IEnumerable<Point2f> imagePoints, double[, ] cameraMatrix, IEnumerable<double>? distCoeffs, ref double[] rvec, ref double[] tvec, bool useExtrinsicGuess = false, SolvePnPFlags flags = SolvePnPFlags.Iterative)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3f> objectPoints

Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector<Point3f> can be also passed here.

IEnumerable<OpenCvSharp.Point2f> imagePoints

Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector<Point2f> can be also passed here.

System.Double[,] cameraMatrix

Input camera matrix

System.Nullable<IEnumerable<System.Double>> distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

System.Double[] rvec

Output rotation vector that, together with tvec , brings points from the model coordinate system to the camera coordinate system.

System.Double[] tvec

Output translation vector.

System.Boolean useExtrinsicGuess

If true, the function uses the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them.

SolvePnPFlags flags

Method for solving a PnP problem

| Improve this Doc View Source

SolvePnP(InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, Boolean, SolvePnPFlags)

Finds an object pose from 3D-2D point correspondences.

Declaration
public static void SolvePnP(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, SolvePnPFlags flags = SolvePnPFlags.Iterative)
Parameters
Type Name Description
InputArray objectPoints

Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector<Point3f> can be also passed here.

InputArray imagePoints

Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector<Point2f> can be also passed here.

InputArray cameraMatrix

Input camera matrix

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

OutputArray rvec

Output rotation vector that, together with tvec , brings points from the model coordinate system to the camera coordinate system.

OutputArray tvec

Output translation vector.

System.Boolean useExtrinsicGuess

If true, the function uses the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them.

SolvePnPFlags flags

Method for solving a PnP problem:

| Improve this Doc View Source

SolvePnPRansac(IEnumerable<Point3f>, IEnumerable<Point2f>, Double[,], IEnumerable<Double>, out Double[], out Double[])

computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible.

Declaration
public static void SolvePnPRansac(IEnumerable<Point3f> objectPoints, IEnumerable<Point2f> imagePoints, double[, ] cameraMatrix, IEnumerable<double> distCoeffs, out double[] rvec, out double[] tvec)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3f> objectPoints

Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. List<Point3f> can be also passed here.

IEnumerable<OpenCvSharp.Point2f> imagePoints

Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. List<Point2f> can be also passed here.

System.Double[,] cameraMatrix

Input 3x3 camera matrix

IEnumerable<System.Double> distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

System.Double[] rvec

Output rotation vector that, together with tvec , brings points from the model coordinate system to the camera coordinate system.

System.Double[] tvec

Output translation vector.

| Improve this Doc View Source

SolvePnPRansac(IEnumerable<Point3f>, IEnumerable<Point2f>, Double[,], Nullable<IEnumerable<Double>>, out Double[], out Double[], out Int32[], Boolean, Int32, Single, Double, SolvePnPFlags)

computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible.

Declaration
public static void SolvePnPRansac(IEnumerable<Point3f> objectPoints, IEnumerable<Point2f> imagePoints, double[, ] cameraMatrix, IEnumerable<double>? distCoeffs, out double[] rvec, out double[] tvec, out int[] inliers, bool useExtrinsicGuess = false, int iterationsCount = 100, float reprojectionError = 8F, double confidence = 0.99, SolvePnPFlags flags = SolvePnPFlags.Iterative)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point3f> objectPoints

Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. List<Point3f> can be also passed here.

IEnumerable<OpenCvSharp.Point2f> imagePoints

Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. List<Point2f> can be also passed here.

System.Double[,] cameraMatrix

Input 3x3 camera matrix

System.Nullable<IEnumerable<System.Double>> distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

System.Double[] rvec

Output rotation vector that, together with tvec , brings points from the model coordinate system to the camera coordinate system.

System.Double[] tvec

Output translation vector.

System.Int32[] inliers

Output vector that contains indices of inliers in objectPoints and imagePoints .

System.Boolean useExtrinsicGuess

If true, the function uses the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them.

System.Int32 iterationsCount

Number of iterations.

System.Single reprojectionError

Inlier threshold value used by the RANSAC procedure. The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier.

System.Double confidence

The probability that the algorithm produces a useful result.

SolvePnPFlags flags

Method for solving a PnP problem

| Improve this Doc View Source

SolvePnPRansac(InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, Boolean, Int32, Single, Double, OutputArray, SolvePnPFlags)

computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible.

Declaration
public static void SolvePnPRansac(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int iterationsCount = 100, float reprojectionError = 8F, double confidence = 0.99, OutputArray inliers = null, SolvePnPFlags flags = SolvePnPFlags.Iterative)
Parameters
Type Name Description
InputArray objectPoints

Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. List<Point3f> can be also passed here.

InputArray imagePoints

Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. List<Point2f> can be also passed here.

InputArray cameraMatrix

Input 3x3 camera matrix

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

OutputArray rvec

Output rotation vector that, together with tvec , brings points from the model coordinate system to the camera coordinate system.

OutputArray tvec

Output translation vector.

System.Boolean useExtrinsicGuess

If true, the function uses the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them.

System.Int32 iterationsCount

Number of iterations.

System.Single reprojectionError

Inlier threshold value used by the RANSAC procedure. The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier.

System.Double confidence

The probability that the algorithm produces a useful result.

OutputArray inliers

Output vector that contains indices of inliers in objectPoints and imagePoints .

SolvePnPFlags flags

Method for solving a PnP problem

| Improve this Doc View Source

SolvePoly(InputArray, OutputArray, Int32)

finds real and complex roots of a polynomial

Declaration
public static double SolvePoly(InputArray coeffs, OutputArray roots, int maxIters = 300)
Parameters
Type Name Description
InputArray coeffs

The array of polynomial coefficients

OutputArray roots

The destination (complex) array of roots

System.Int32 maxIters

The maximum number of iterations the algorithm does

Returns
Type Description
System.Double
| Improve this Doc View Source

Sort(InputArray, OutputArray, SortFlags)

sorts independently each matrix row or each matrix column

Declaration
public static void Sort(InputArray src, OutputArray dst, SortFlags flags)
Parameters
Type Name Description
InputArray src

The source single-channel array

OutputArray dst

The destination array of the same size and the same type as src

SortFlags flags

The operation flags, a combination of the SortFlag values

| Improve this Doc View Source

SortIdx(InputArray, OutputArray, SortFlags)

sorts independently each matrix row or each matrix column

Declaration
public static void SortIdx(InputArray src, OutputArray dst, SortFlags flags)
Parameters
Type Name Description
InputArray src

The source single-channel array

OutputArray dst

The destination integer array of the same size as src

SortFlags flags

The operation flags, a combination of SortFlag values

| Improve this Doc View Source

SpatialGradient(InputArray, OutputArray, OutputArray, Int32, BorderTypes)

Calculates the first order image derivative in both x and y using a Sobel operator

Declaration
public static void SpatialGradient(InputArray src, OutputArray dx, OutputArray dy, int ksize = 3, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src

input image.

OutputArray dx

output image with first-order derivative in x.

OutputArray dy

output image with first-order derivative in y.

System.Int32 ksize

size of Sobel kernel. It must be 3.

BorderTypes borderType

pixel extrapolation method

| Improve this Doc View Source

Split(Mat)

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

Declaration
public static Mat[] Split(Mat src)
Parameters
Type Name Description
Mat src

The source multi-channel array

Returns
Type Description
Mat[]

The number of arrays must match mtx.channels() . The arrays themselves will be reallocated if needed

| Improve this Doc View Source

Split(Mat, out Mat[])

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

Declaration
public static void Split(Mat src, out Mat[] mv)
Parameters
Type Name Description
Mat src

The source multi-channel array

Mat[] mv

The destination array or vector of arrays; The number of arrays must match mtx.channels() . The arrays themselves will be reallocated if needed

| Improve this Doc View Source

SqrBoxFilter(InputArray, OutputArray, Int32, Size, Nullable<Point>, Boolean, BorderTypes)

Calculates the normalized sum of squares of the pixel values overlapping the filter.

For every pixel f(x, y) in the source image, the function calculates the sum of squares of those neighboring pixel values which overlap the filter placed over the pixel f(x, y).

The unnormalized square box filter can be useful in computing local image statistics such as the the local variance and standard deviation around the neighborhood of a pixel.

Declaration
public static void SqrBoxFilter(InputArray src, OutputArray dst, int ddepth, Size ksize, Point? anchor = null, bool normalize = true, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
InputArray src
OutputArray dst
System.Int32 ddepth
OpenCvSharp.Size ksize
System.Nullable<OpenCvSharp.Point> anchor
System.Boolean normalize
BorderTypes borderType
| Improve this Doc View Source

Sqrt(InputArray, OutputArray)

computes square root of each matrix element (dst = src**0.5)

Declaration
public static void Sqrt(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

The source floating-point array

OutputArray dst

The destination array; will have the same size and the same type as src

| Improve this Doc View Source

StartWindowThread()

Declaration
public static int StartWindowThread()
Returns
Type Description
System.Int32
| Improve this Doc View Source

StereoCalibrate(IEnumerable<IEnumerable<Point3f>>, IEnumerable<IEnumerable<Point2f>>, IEnumerable<IEnumerable<Point2f>>, Double[,], Double[], Double[,], Double[], Size, OutputArray, OutputArray, OutputArray, OutputArray, CalibrationFlags, Nullable<TermCriteria>)

finds intrinsic and extrinsic parameters of a stereo camera

Declaration
public static double StereoCalibrate(IEnumerable<IEnumerable<Point3f>> objectPoints, IEnumerable<IEnumerable<Point2f>> imagePoints1, IEnumerable<IEnumerable<Point2f>> imagePoints2, double[, ] cameraMatrix1, double[] distCoeffs1, double[, ] cameraMatrix2, double[] distCoeffs2, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, CalibrationFlags flags = CalibrationFlags.FixIntrinsic, TermCriteria? criteria = null)
Parameters
Type Name Description
IEnumerable<IEnumerable<OpenCvSharp.Point3f>> objectPoints

Vector of vectors of the calibration pattern points.

IEnumerable<IEnumerable<OpenCvSharp.Point2f>> imagePoints1

Vector of vectors of the projections of the calibration pattern points, observed by the first camera.

IEnumerable<IEnumerable<OpenCvSharp.Point2f>> imagePoints2

Vector of vectors of the projections of the calibration pattern points, observed by the second camera.

System.Double[,] cameraMatrix1

Input/output first camera matrix

System.Double[] distCoeffs1

Input/output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. The output vector length depends on the flags.

System.Double[,] cameraMatrix2

Input/output second camera matrix. The parameter is similar to cameraMatrix1 .

System.Double[] distCoeffs2

Input/output lens distortion coefficients for the second camera. The parameter is similar to distCoeffs1 .

OpenCvSharp.Size imageSize

Size of the image used only to initialize intrinsic camera matrix.

OutputArray R

Output rotation matrix between the 1st and the 2nd camera coordinate systems.

OutputArray T

Output translation vector between the coordinate systems of the cameras.

OutputArray E

Output essential matrix.

OutputArray F

Output fundamental matrix.

CalibrationFlags flags

Different flags that may be zero or a combination of the CalibrationFlag values

System.Nullable<OpenCvSharp.TermCriteria> criteria

Termination criteria for the iterative optimization algorithm.

Returns
Type Description
System.Double
| Improve this Doc View Source

StereoCalibrate(IEnumerable<InputArray>, IEnumerable<InputArray>, IEnumerable<InputArray>, InputOutputArray, InputOutputArray, InputOutputArray, InputOutputArray, Size, OutputArray, OutputArray, OutputArray, OutputArray, CalibrationFlags, Nullable<TermCriteria>)

finds intrinsic and extrinsic parameters of a stereo camera

Declaration
public static double StereoCalibrate(IEnumerable<InputArray> objectPoints, IEnumerable<InputArray> imagePoints1, IEnumerable<InputArray> imagePoints2, InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, CalibrationFlags flags = CalibrationFlags.FixIntrinsic, TermCriteria? criteria = null)
Parameters
Type Name Description
IEnumerable<InputArray> objectPoints

Vector of vectors of the calibration pattern points.

IEnumerable<InputArray> imagePoints1

Vector of vectors of the projections of the calibration pattern points, observed by the first camera.

IEnumerable<InputArray> imagePoints2

Vector of vectors of the projections of the calibration pattern points, observed by the second camera.

InputOutputArray cameraMatrix1

Input/output first camera matrix

InputOutputArray distCoeffs1

Input/output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. The output vector length depends on the flags.

InputOutputArray cameraMatrix2

Input/output second camera matrix. The parameter is similar to cameraMatrix1 .

InputOutputArray distCoeffs2

Input/output lens distortion coefficients for the second camera. The parameter is similar to distCoeffs1 .

OpenCvSharp.Size imageSize

Size of the image used only to initialize intrinsic camera matrix.

OutputArray R

Output rotation matrix between the 1st and the 2nd camera coordinate systems.

OutputArray T

Output translation vector between the coordinate systems of the cameras.

OutputArray E

Output essential matrix.

OutputArray F

Output fundamental matrix.

CalibrationFlags flags

Different flags that may be zero or a combination of the CalibrationFlag values

System.Nullable<OpenCvSharp.TermCriteria> criteria

Termination criteria for the iterative optimization algorithm.

Returns
Type Description
System.Double
| Improve this Doc View Source

StereoRectify(InputArray, InputArray, InputArray, InputArray, Size, InputArray, InputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, StereoRectificationFlags, Double, Size, out Rect, out Rect)

computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters

Declaration
public static void StereoRectify(InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2, InputArray distCoeffs2, Size imageSize, InputArray R, InputArray T, OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, StereoRectificationFlags flags, double alpha, Size newImageSize, out Rect validPixROI1, out Rect validPixROI2)
Parameters
Type Name Description
InputArray cameraMatrix1

First camera matrix.

InputArray distCoeffs1

First camera distortion parameters.

InputArray cameraMatrix2

Second camera matrix.

InputArray distCoeffs2

Second camera distortion parameters.

OpenCvSharp.Size imageSize

Size of the image used for stereo calibration.

InputArray R

Rotation matrix between the coordinate systems of the first and the second cameras.

InputArray T

Translation vector between coordinate systems of the cameras.

OutputArray R1

Output 3x3 rectification transform (rotation matrix) for the first camera.

OutputArray R2

Output 3x3 rectification transform (rotation matrix) for the second camera.

OutputArray P1

Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera.

OutputArray P2

Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera.

OutputArray Q

Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ).

StereoRectificationFlags flags

Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area.

System.Double alpha

Free scaling parameter. If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases.

OpenCvSharp.Size newImageSize

New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion.

OpenCvSharp.Rect validPixROI1

Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller.

OpenCvSharp.Rect validPixROI2

Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller.

| Improve this Doc View Source

StereoRectify(InputArray, InputArray, InputArray, InputArray, Size, InputArray, InputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, StereoRectificationFlags, Double, Nullable<Size>)

computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters

Declaration
public static void StereoRectify(InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2, InputArray distCoeffs2, Size imageSize, InputArray R, InputArray T, OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, StereoRectificationFlags flags = StereoRectificationFlags.ZeroDisparity, double alpha = -1, Size? newImageSize = null)
Parameters
Type Name Description
InputArray cameraMatrix1

First camera matrix.

InputArray distCoeffs1

First camera distortion parameters.

InputArray cameraMatrix2

Second camera matrix.

InputArray distCoeffs2

Second camera distortion parameters.

OpenCvSharp.Size imageSize

Size of the image used for stereo calibration.

InputArray R

Rotation matrix between the coordinate systems of the first and the second cameras.

InputArray T

Translation vector between coordinate systems of the cameras.

OutputArray R1

Output 3x3 rectification transform (rotation matrix) for the first camera.

OutputArray R2

Output 3x3 rectification transform (rotation matrix) for the second camera.

OutputArray P1

Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera.

OutputArray P2

Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera.

OutputArray Q

Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ).

StereoRectificationFlags flags

Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area.

System.Double alpha

Free scaling parameter. If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases.

System.Nullable<OpenCvSharp.Size> newImageSize

New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion.

| Improve this Doc View Source

StereoRectify(Double[,], Double[], Double[,], Double[], Size, Double[,], Double[], out Double[,], out Double[,], out Double[,], out Double[,], out Double[,], StereoRectificationFlags, Double, Size, out Rect, out Rect)

computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters

Declaration
public static void StereoRectify(double[, ] cameraMatrix1, double[] distCoeffs1, double[, ] cameraMatrix2, double[] distCoeffs2, Size imageSize, double[, ] R, double[] T, out double[, ] R1, out double[, ] R2, out double[, ] P1, out double[, ] P2, out double[, ] Q, StereoRectificationFlags flags, double alpha, Size newImageSize, out Rect validPixROI1, out Rect validPixROI2)
Parameters
Type Name Description
System.Double[,] cameraMatrix1

First camera matrix.

System.Double[] distCoeffs1

First camera distortion parameters.

System.Double[,] cameraMatrix2

Second camera matrix.

System.Double[] distCoeffs2

Second camera distortion parameters.

OpenCvSharp.Size imageSize

Size of the image used for stereo calibration.

System.Double[,] R

Rotation matrix between the coordinate systems of the first and the second cameras.

System.Double[] T

Translation vector between coordinate systems of the cameras.

System.Double[,] R1

Output 3x3 rectification transform (rotation matrix) for the first camera.

System.Double[,] R2

Output 3x3 rectification transform (rotation matrix) for the second camera.

System.Double[,] P1

Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera.

System.Double[,] P2

Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera.

System.Double[,] Q

Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ).

StereoRectificationFlags flags

Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area.

System.Double alpha

Free scaling parameter. If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases.

OpenCvSharp.Size newImageSize

New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion.

OpenCvSharp.Rect validPixROI1

Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller.

OpenCvSharp.Rect validPixROI2

Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller.

| Improve this Doc View Source

StereoRectify(Double[,], Double[], Double[,], Double[], Size, Double[,], Double[], out Double[,], out Double[,], out Double[,], out Double[,], out Double[,], StereoRectificationFlags, Double, Nullable<Size>)

computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters

Declaration
public static void StereoRectify(double[, ] cameraMatrix1, double[] distCoeffs1, double[, ] cameraMatrix2, double[] distCoeffs2, Size imageSize, double[, ] R, double[] T, out double[, ] R1, out double[, ] R2, out double[, ] P1, out double[, ] P2, out double[, ] Q, StereoRectificationFlags flags = StereoRectificationFlags.ZeroDisparity, double alpha = -1, Size? newImageSize = null)
Parameters
Type Name Description
System.Double[,] cameraMatrix1

First camera matrix.

System.Double[] distCoeffs1

First camera distortion parameters.

System.Double[,] cameraMatrix2

Second camera matrix.

System.Double[] distCoeffs2

Second camera distortion parameters.

OpenCvSharp.Size imageSize

Size of the image used for stereo calibration.

System.Double[,] R

Rotation matrix between the coordinate systems of the first and the second cameras.

System.Double[] T

Translation vector between coordinate systems of the cameras.

System.Double[,] R1

Output 3x3 rectification transform (rotation matrix) for the first camera.

System.Double[,] R2

Output 3x3 rectification transform (rotation matrix) for the second camera.

System.Double[,] P1

Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera.

System.Double[,] P2

Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera.

System.Double[,] Q

Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ).

StereoRectificationFlags flags

Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area.

System.Double alpha

Free scaling parameter. If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases.

System.Nullable<OpenCvSharp.Size> newImageSize

New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion.

| Improve this Doc View Source

StereoRectifyUncalibrated(IEnumerable<Point2d>, IEnumerable<Point2d>, Double[,], Size, out Double[,], out Double[,], Double)

computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed)

Declaration
public static bool StereoRectifyUncalibrated(IEnumerable<Point2d> points1, IEnumerable<Point2d> points2, double[, ] F, Size imgSize, out double[, ] H1, out double[, ] H2, double threshold = 5)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2d> points1

Array of feature points in the first image.

IEnumerable<OpenCvSharp.Point2d> points2

The corresponding points in the second image. The same formats as in findFundamentalMat() are supported.

System.Double[,] F

Input fundamental matrix. It can be computed from the same set of point pairs using findFundamentalMat() .

OpenCvSharp.Size imgSize

Size of the image.

System.Double[,] H1

Output rectification homography matrix for the first image.

System.Double[,] H2

Output rectification homography matrix for the second image.

System.Double threshold

Optional threshold used to filter out the outliers. If the parameter is greater than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points for which |points2[i]^T * F * points1[i]| > threshold ) are rejected prior to computing the homographies. Otherwise, all the points are considered inliers.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

StereoRectifyUncalibrated(InputArray, InputArray, InputArray, Size, OutputArray, OutputArray, Double)

computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed)

Declaration
public static bool StereoRectifyUncalibrated(InputArray points1, InputArray points2, InputArray F, Size imgSize, OutputArray H1, OutputArray H2, double threshold = 5)
Parameters
Type Name Description
InputArray points1

Array of feature points in the first image.

InputArray points2

The corresponding points in the second image. The same formats as in findFundamentalMat() are supported.

InputArray F

Input fundamental matrix. It can be computed from the same set of point pairs using findFundamentalMat() .

OpenCvSharp.Size imgSize

Size of the image.

OutputArray H1

Output rectification homography matrix for the first image.

OutputArray H2

Output rectification homography matrix for the second image.

System.Double threshold

Optional threshold used to filter out the outliers. If the parameter is greater than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points for which |points2[i]^T * F * points1[i]| > threshold ) are rejected prior to computing the homographies. Otherwise, all the points are considered inliers.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

Stylization(InputArray, OutputArray, Single, Single)

Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.

Declaration
public static void Stylization(InputArray src, OutputArray dst, float sigmaS = 60F, float sigmaR = 0.45F)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

OutputArray dst

Output image with the same size and type as src.

System.Single sigmaS

Range between 0 to 200.

System.Single sigmaR

Range between 0 to 1.

| Improve this Doc View Source

Subtract(InputArray, InputArray, OutputArray, InputArray, Int32)

Calculates per-element difference between two arrays or array and a scalar

Declaration
public static void Subtract(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null, int dtype = -1)
Parameters
Type Name Description
InputArray src1

The first source array

InputArray src2

The second source array. It must have the same size and same type as src1

OutputArray dst

The destination array; it will have the same size and same type as src1

InputArray mask

The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null]

System.Int32 dtype
| Improve this Doc View Source

Subtract(InputArray, Scalar, OutputArray, InputArray, Int32)

Calculates per-element difference between two arrays or array and a scalar

Declaration
public static void Subtract(InputArray src1, Scalar src2, OutputArray dst, InputArray mask = null, int dtype = -1)
Parameters
Type Name Description
InputArray src1

The first source array

OpenCvSharp.Scalar src2

The second source array. It must have the same size and same type as src1

OutputArray dst

The destination array; it will have the same size and same type as src1

InputArray mask

The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null]

System.Int32 dtype
| Improve this Doc View Source

Subtract(Scalar, InputArray, OutputArray, InputArray, Int32)

Calculates per-element difference between two arrays or array and a scalar

Declaration
public static void Subtract(Scalar src1, InputArray src2, OutputArray dst, InputArray mask = null, int dtype = -1)
Parameters
Type Name Description
OpenCvSharp.Scalar src1

The first source array

InputArray src2

The second source array. It must have the same size and same type as src1

OutputArray dst

The destination array; it will have the same size and same type as src1

InputArray mask

The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null]

System.Int32 dtype
| Improve this Doc View Source

Sum(InputArray)

computes sum of array elements

Declaration
public static Scalar Sum(InputArray src)
Parameters
Type Name Description
InputArray src

The source array; must have 1 to 4 channels

Returns
Type Description
OpenCvSharp.Scalar
| Improve this Doc View Source

SVBackSubst(InputArray, InputArray, InputArray, InputArray, OutputArray)

performs back substitution for the previously computed SVD

Declaration
public static void SVBackSubst(InputArray w, InputArray u, InputArray vt, InputArray rhs, OutputArray dst)
Parameters
Type Name Description
InputArray w

calculated singular values

InputArray u

calculated left singular vectors

InputArray vt

transposed matrix of right singular vectors

InputArray rhs

right-hand side of a linear system (uwv')*dst = rhs to be solved, where A has been previously decomposed.

OutputArray dst

output

| Improve this Doc View Source

SVDecomp(InputArray, OutputArray, OutputArray, OutputArray, SVD.Flags)

decomposes matrix and stores the results to user-provided matrices

Declaration
public static void SVDecomp(InputArray src, OutputArray w, OutputArray u, OutputArray vt, SVD.Flags flags = SVD.Flags.None)
Parameters
Type Name Description
InputArray src

decomposed matrix. The depth has to be CV_32F or CV_64F.

OutputArray w

calculated singular values

OutputArray u

calculated left singular vectors

OutputArray vt

transposed matrix of right singular vectors

SVD.Flags flags

peration flags - see SVD::Flags.

| Improve this Doc View Source

TextureFlattening(InputArray, InputArray, OutputArray, Single, Single, Int32)

By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge Detector is used.

Declaration
public static void TextureFlattening(InputArray src, InputArray mask, OutputArray dst, float lowThreshold = 30F, float highThreshold = 45F, int kernelSize = 3)
Parameters
Type Name Description
InputArray src

Input 8-bit 3-channel image.

InputArray mask

Input 8-bit 1 or 3-channel image.

OutputArray dst

Output image with the same size and type as src.

System.Single lowThreshold

Range from 0 to 100.

System.Single highThreshold

Value > 100.

System.Int32 kernelSize

The size of the Sobel kernel to be used.

| Improve this Doc View Source

Threshold(InputArray, OutputArray, Double, Double, ThresholdTypes)

Applies a fixed-level threshold to each array element.

Declaration
public static double Threshold(InputArray src, OutputArray dst, double thresh, double maxval, ThresholdTypes type)
Parameters
Type Name Description
InputArray src

input array (single-channel, 8-bit or 32-bit floating point).

OutputArray dst

output array of the same size and type as src.

System.Double thresh

threshold value.

System.Double maxval

maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.

ThresholdTypes type

thresholding type (see the details below).

Returns
Type Description
System.Double

the computed threshold value when type == OTSU

| Improve this Doc View Source

Trace(InputArray)

computes trace of a matrix

Declaration
public static Scalar Trace(InputArray mtx)
Parameters
Type Name Description
InputArray mtx

The source matrix

Returns
Type Description
OpenCvSharp.Scalar
| Improve this Doc View Source

Transform(InputArray, OutputArray, InputArray)

performs affine transformation of each element of multi-channel input matrix

Declaration
public static void Transform(InputArray src, OutputArray dst, InputArray m)
Parameters
Type Name Description
InputArray src

The source array; must have as many channels (1 to 4) as mtx.cols or mtx.cols-1

OutputArray dst

The destination array; will have the same size and depth as src and as many channels as mtx.rows

InputArray m

The transformation matrix

| Improve this Doc View Source

Transpose(InputArray, OutputArray)

transposes the matrix

Declaration
public static void Transpose(InputArray src, OutputArray dst)
Parameters
Type Name Description
InputArray src

The source array

OutputArray dst

The destination array of the same type as src

| Improve this Doc View Source

TriangulatePoints(InputArray, InputArray, InputArray, InputArray, OutputArray)

Reconstructs points by triangulation.

Declaration
public static void TriangulatePoints(InputArray projMatr1, InputArray projMatr2, InputArray projPoints1, InputArray projPoints2, OutputArray points4D)
Parameters
Type Name Description
InputArray projMatr1

3x4 projection matrix of the first camera.

InputArray projMatr2

3x4 projection matrix of the second camera.

InputArray projPoints1

2xN array of feature points in the first image. In case of c++ version it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.

InputArray projPoints2

2xN array of corresponding points in the second image. In case of c++ version it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.

OutputArray points4D

4xN array of reconstructed points in homogeneous coordinates.

| Improve this Doc View Source

TriangulatePoints(Double[,], Double[,], IEnumerable<Point2d>, IEnumerable<Point2d>)

Reconstructs points by triangulation.

Declaration
public static Vec4d[] TriangulatePoints(double[, ] projMatr1, double[, ] projMatr2, IEnumerable<Point2d> projPoints1, IEnumerable<Point2d> projPoints2)
Parameters
Type Name Description
System.Double[,] projMatr1

3x4 projection matrix of the first camera.

System.Double[,] projMatr2

3x4 projection matrix of the second camera.

IEnumerable<OpenCvSharp.Point2d> projPoints1

2xN array of feature points in the first image. In case of c++ version it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.

IEnumerable<OpenCvSharp.Point2d> projPoints2

2xN array of corresponding points in the second image. In case of c++ version it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.

Returns
Type Description
Vec4d[]

4xN array of reconstructed points in homogeneous coordinates.

| Improve this Doc View Source

Undistort(InputArray, OutputArray, InputArray, InputArray, InputArray)

corrects lens distortion for the given camera matrix and distortion coefficients

Declaration
public static void Undistort(InputArray src, OutputArray dst, InputArray cameraMatrix, InputArray distCoeffs, InputArray newCameraMatrix = null)
Parameters
Type Name Description
InputArray src

Input (distorted) image.

OutputArray dst

Output (corrected) image that has the same size and type as src .

InputArray cameraMatrix

Input camera matrix

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

InputArray newCameraMatrix

Camera matrix of the distorted image. By default, it is the same as cameraMatrix but you may additionally scale and shift the result by using a different matrix.

| Improve this Doc View Source

UndistortPoints(InputArray, OutputArray, InputArray, InputArray, InputArray, InputArray)

Computes the ideal point coordinates from the observed point coordinates.

Declaration
public static void UndistortPoints(InputArray src, OutputArray dst, InputArray cameraMatrix, InputArray distCoeffs, InputArray r = null, InputArray p = null)
Parameters
Type Name Description
InputArray src

Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2).

OutputArray dst

Output ideal point coordinates after undistortion and reverse perspective transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.

InputArray cameraMatrix

Camera matrix

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

InputArray r

Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by stereoRectify() can be passed here. If the matrix is empty, the identity transformation is used.

InputArray p

New camera matrix (3x3) or new projection matrix (3x4). P1 or P2 computed by stereoRectify() can be passed here. If the matrix is empty, the identity new camera matrix is used.

| Improve this Doc View Source

UndistortPointsIter(InputArray, OutputArray, InputArray, InputArray, InputArray, InputArray, Nullable<TermCriteria>)

Computes the ideal point coordinates from the observed point coordinates.

Declaration
public static void UndistortPointsIter(InputArray src, OutputArray dst, InputArray cameraMatrix, InputArray distCoeffs, InputArray r = null, InputArray p = null, TermCriteria? termCriteria = null)
Parameters
Type Name Description
InputArray src

Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2).

OutputArray dst

Output ideal point coordinates after undistortion and reverse perspective transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.

InputArray cameraMatrix

Camera matrix

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

InputArray r

Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by stereoRectify() can be passed here. If the matrix is empty, the identity transformation is used.

InputArray p

New camera matrix (3x3) or new projection matrix (3x4). P1 or P2 computed by stereoRectify() can be passed here. If the matrix is empty, the identity new camera matrix is used.

System.Nullable<OpenCvSharp.TermCriteria> termCriteria
| Improve this Doc View Source

UseOptimized()

Returns the current optimization status. The function returns the current optimization status, which is controlled by cv::setUseOptimized().

Declaration
public static bool UseOptimized()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ValidateDisparity(InputOutputArray, InputArray, Int32, Int32, Int32)

validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm

Declaration
public static void ValidateDisparity(InputOutputArray disparity, InputArray cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp = 1)
Parameters
Type Name Description
InputOutputArray disparity
InputArray cost
System.Int32 minDisparity
System.Int32 numberOfDisparities
System.Int32 disp12MaxDisp
| Improve this Doc View Source

VConcat(IEnumerable<Mat>, OutputArray)

Applies vertical concatenation to given matrices.

Declaration
public static void VConcat(IEnumerable<Mat> src, OutputArray dst)
Parameters
Type Name Description
IEnumerable<Mat> src

input array or vector of matrices. all of the matrices must have the same number of cols and the same depth.

OutputArray dst

output array. It has the same number of cols and depth as the src, and the sum of rows of the src.

| Improve this Doc View Source

VConcat(InputArray, InputArray, OutputArray)

Applies vertical concatenation to given matrices.

Declaration
public static void VConcat(InputArray src1, InputArray src2, OutputArray dst)
Parameters
Type Name Description
InputArray src1

first input array to be considered for vertical concatenation.

InputArray src2

second input array to be considered for vertical concatenation.

OutputArray dst

output array. It has the same number of cols and depth as the src1 and src2, and the sum of rows of the src1 and src2.

| Improve this Doc View Source

WaitKey(Int32)

Waits for a pressed key.

Declaration
public static int WaitKey(int delay = 0)
Parameters
Type Name Description
System.Int32 delay

Delay in milliseconds. 0 is the special value that means ”forever”

Returns
Type Description
System.Int32

Returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed.

| Improve this Doc View Source

WaitKeyEx(Int32)

Waits for a pressed key. Similar to #waitKey, but returns full key code. Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc

Declaration
public static int WaitKeyEx(int delay = 0)
Parameters
Type Name Description
System.Int32 delay

Delay in milliseconds. 0 is the special value that means ”forever”

Returns
Type Description
System.Int32

Returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed.

| Improve this Doc View Source

WarpAffine(InputArray, OutputArray, InputArray, Size, InterpolationFlags, BorderTypes, Nullable<Scalar>)

Applies an affine transformation to an image.

Declaration
public static void WarpAffine(InputArray src, OutputArray dst, InputArray m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray src

input image.

OutputArray dst

output image that has the size dsize and the same type as src.

InputArray m

2x3 transformation matrix.

OpenCvSharp.Size dsize

size of the output image.

InterpolationFlags flags

combination of interpolation methods and the optional flag WARP_INVERSE_MAP that means that M is the inverse transformation (dst -> src) .

BorderTypes borderMode

pixel extrapolation method; when borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to the "outliers" in the source image are not modified by the function.

System.Nullable<OpenCvSharp.Scalar> borderValue

value used in case of a constant border; by default, it is 0.

| Improve this Doc View Source

WarpPerspective(InputArray, OutputArray, InputArray, Size, InterpolationFlags, BorderTypes, Nullable<Scalar>)

Applies a perspective transformation to an image.

Declaration
public static void WarpPerspective(InputArray src, OutputArray dst, InputArray m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray src

input image.

OutputArray dst

output image that has the size dsize and the same type as src.

InputArray m

3x3 transformation matrix.

OpenCvSharp.Size dsize

size of the output image.

InterpolationFlags flags

combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src).

BorderTypes borderMode

pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).

System.Nullable<OpenCvSharp.Scalar> borderValue

value used in case of a constant border; by default, it equals 0.

| Improve this Doc View Source

WarpPerspective(InputArray, OutputArray, Single[,], Size, InterpolationFlags, BorderTypes, Nullable<Scalar>)

Applies a perspective transformation to an image.

Declaration
public static void WarpPerspective(InputArray src, OutputArray dst, float[, ] m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray src

input image.

OutputArray dst

output image that has the size dsize and the same type as src.

System.Single[,] m

3x3 transformation matrix.

OpenCvSharp.Size dsize

size of the output image.

InterpolationFlags flags

combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src).

BorderTypes borderMode

pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).

System.Nullable<OpenCvSharp.Scalar> borderValue

value used in case of a constant border; by default, it equals 0.

| Improve this Doc View Source

WarpPolar(InputArray, OutputArray, Size, Point2f, Double, InterpolationFlags, WarpPolarMode)

Remaps an image to polar or semilog-polar coordinates space.

Declaration
public static void WarpPolar(InputArray src, OutputArray dst, Size dsize, Point2f center, double maxRadius, InterpolationFlags interpolationFlags, WarpPolarMode warpPolarMode)
Parameters
Type Name Description
InputArray src

Source image.

OutputArray dst

Destination image. It will have same type as src.

OpenCvSharp.Size dsize

The destination image size (see description for valid options).

OpenCvSharp.Point2f center

The transformation center.

System.Double maxRadius

The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.

InterpolationFlags interpolationFlags

interpolation methods.

WarpPolarMode warpPolarMode

interpolation methods.

Remarks
  • The function can not operate in-place.
  • To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees.
  • This function uses #remap. Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
| Improve this Doc View Source

Watershed(InputArray, InputOutputArray)

Performs a marker-based image segmentation using the watershed algorithm.

Declaration
public static void Watershed(InputArray image, InputOutputArray markers)
Parameters
Type Name Description
InputArray image

Input 8-bit 3-channel image.

InputOutputArray markers

Input/output 32-bit single-channel image (map) of markers. It should have the same size as image.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX