Search Results for

    Show / Hide Table of Contents

    Class CV

    This class provides wrapper methods for the OpenCV C interface native functions.

    Inheritance
    Object
    CV
    Namespace: OpenCV.Net
    Assembly: OpenCV.Net.dll
    Syntax
    public static class CV : object

    Methods

    | Improve this Doc View Source

    Abs(Arr, Arr)

    Calculates the per-element absolute value of an array.

    Declaration
    public static void Abs(Arr src, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    AbsDiff(Arr, Arr, Arr)

    Calculates the absolute difference between two arrays.

    Declaration
    public static void AbsDiff(Arr src1, Arr src2, Arr dst)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    AbsDiffS(Arr, Arr, Scalar)

    Calculates the absolute difference between an array and a scalar.

    Declaration
    public static void AbsDiffS(Arr src, Arr dst, Scalar value)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Arr dst

    The destination array.

    Scalar value

    The scalar input value.

    | Improve this Doc View Source

    Acc(Arr, Arr, Arr)

    Adds a frame to an accumulator.

    Declaration
    public static void Acc(Arr image, Arr sum, Arr mask = null)
    Parameters
    Type Name Description
    Arr image

    Input image, 1- or 3-channel, 8-bit or 32-bit floating point. Each channel of multi-channel image is processed independently.

    Arr sum

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

    Arr mask

    Optional operation mask.

    | Improve this Doc View Source

    AdaptiveThreshold(Arr, Arr, Double, AdaptiveThresholdMethod, ThresholdTypes, Int32, Double)

    Applies an adaptive threshold to an array.

    Declaration
    public static void AdaptiveThreshold(Arr src, Arr dst, double maxValue, AdaptiveThresholdMethod adaptiveMethod = default(AdaptiveThresholdMethod), ThresholdTypes thresholdType = default(ThresholdTypes), int blockSize = 3, double C = null)
    Parameters
    Type Name Description
    Arr src

    Source 8-bit single-channel image.

    Arr dst

    Destination image; will have the same size and the same type as src.

    Double maxValue

    The non-zero value assigned to the pixels for which the condition is satisfied.

    AdaptiveThresholdMethod adaptiveMethod

    The adaptive thresholding algorithm to use.

    ThresholdTypes thresholdType

    The type of threshold to apply.

    Int32 blockSize

    The size of a pixel neighborhood that is used to calculate a threshold value for the pixel, must be an odd number greater or equal to 3.

    Double C

    The constant subtracted from the mean or weighted mean.

    | Improve this Doc View Source

    Add(Arr, Arr, Arr, Arr)

    Calculates the per-element sum of two arrays.

    Declaration
    public static void Add(Arr src1, Arr src2, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    AddS(Arr, Scalar, Arr, Arr)

    Calculates the per-element sum of an array and a scalar.

    Declaration
    public static void AddS(Arr src, Scalar value, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Scalar value

    The scalar input value.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    AddText(Arr, String, Point, Font)

    Draws text on the specified image img using the specific font.

    Declaration
    public static void AddText(Arr img, string text, Point location, Font font)
    Parameters
    Type Name Description
    Arr img

    Image where the text should be drawn.

    String text

    Text to write on the image.

    Point location

    The point where the text should start on the image.

    Font font

    Font used to draw the text.

    | Improve this Doc View Source

    AddWeighted(Arr, Double, Arr, Double, Double, Arr)

    Computes the weighted sum of two arrays.

    Declaration
    public static void AddWeighted(Arr src1, double alpha, Arr src2, double beta, double gamma, Arr dst)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Double alpha

    The weight for the first array elements.

    Arr src2

    The second input array.

    Double beta

    The weight for the second array elements.

    Double gamma

    A scalar that is added to each sum.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    Alloc(UIntPtr)

    Allocates a block of size bytes in memory, returning a pointer to the beginning of the block.

    Declaration
    public static IntPtr Alloc(UIntPtr size)
    Parameters
    Type Name Description
    UIntPtr size

    Size of the memory block, in bytes.

    Returns
    Type Description
    IntPtr

    On success, a pointer to the memory block allocated by the function. If there is not enough memory, the function raises an error.

    | Improve this Doc View Source

    And(Arr, Arr, Arr, Arr)

    Performs per-element bit-wise conjunction of two arrays.

    Declaration
    public static void And(Arr src1, Arr src2, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    AndS(Arr, Scalar, Arr, Arr)

    Performs per-element bit-wise conjunction of an array and a scalar.

    Declaration
    public static void AndS(Arr src, Scalar value, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Scalar value

    The scalar input value.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    ApproxChains(Seq, MemStorage, ContourApproximation, Double, Int32, Boolean)

    Approximates Freeman chain(s) with a polygonal curve.

    Declaration
    public static Seq ApproxChains(Seq srcSeq, MemStorage storage, ContourApproximation method, double parameter, int minimalPerimeter, bool recursive)
    Parameters
    Type Name Description
    Seq srcSeq

    The Freeman chain that can refer to other chains.

    MemStorage storage

    Storage location for the resulting polylines.

    ContourApproximation method

    Specifies the contour approximation method.

    Double parameter

    Not used.

    Int32 minimalPerimeter

    Approximates only those contours whose perimeters are greater or equal than minimalPerimeter. Other chains are removed from the resulting structure.

    Boolean recursive

    If true, the function approximates all chains that can be accessed from srcSeq by using either HNext or VPrev links; otherwise, the single chain is approximated.

    Returns
    Type Description
    Seq

    The function returns the reference to the first resultant contour.

    | Improve this Doc View Source

    ApproxPoly(Seq, Int32, MemStorage, PolygonApproximation, Double, Boolean)

    Approximates polygonal curve(s) with the specified precision.

    Declaration
    public static Seq ApproxPoly(Seq srcSeq, int headerSize, MemStorage storage, PolygonApproximation method, double parameter, bool parameter2 = false)
    Parameters
    Type Name Description
    Seq srcSeq

    The input sequence.

    Int32 headerSize

    Header size of the approximated curve(s).

    MemStorage storage

    Container for the approximated contours. If null, the input sequence storage is used.

    PolygonApproximation method

    The polygon approximation method.

    Double parameter

    Method-specific parameter. In case of DouglasPeucker it is a desired approximation accuracy.

    Boolean parameter2

    Indicates whether the single sequence should be approximated, or all the sequences on the same level and below srcSeq.

    Returns
    Type Description
    Seq

    A reference to the first approximated curve.

    | Improve this Doc View Source

    ArcLength(CVHandle)

    Calculates the contour perimeter or the curve length.

    Declaration
    public static double ArcLength(CVHandle curve)
    Parameters
    Type Name Description
    CVHandle curve

    Sequence or array of the curve points.

    Returns
    Type Description
    Double

    The length of the curve as the sum of the lengths of segments between subsequent points.

    | Improve this Doc View Source

    ArcLength(CVHandle, SeqSlice, Nullable<Boolean>)

    Calculates the contour perimeter or the curve length.

    Declaration
    public static double ArcLength(CVHandle curve, SeqSlice slice, bool? isClosed = null)
    Parameters
    Type Name Description
    CVHandle curve

    Sequence or array of the curve points.

    SeqSlice slice

    Starting and ending points of the curve. By default, the whole curve length is calculated.

    Nullable<Boolean> isClosed

    Indicates whether or not the curve is closed. If null and the input is a sequence, the sequence flags are examined to determine whether the curve is closed. Otherwise, it is assumed unclosed.

    Returns
    Type Description
    Double

    The length of the curve as the sum of the lengths of segments between subsequent points.

    | Improve this Doc View Source

    Avg(Arr, Arr)

    Calculates average (mean) of array elements.

    Declaration
    public static Scalar Avg(Arr arr, Arr mask = null)
    Parameters
    Type Name Description
    Arr arr

    The source array.

    Arr mask

    The optional operation mask.

    Returns
    Type Description
    Scalar

    The average value of array elements, independently for each channel.

    | Improve this Doc View Source

    AvgSdv(Arr, out Scalar, out Scalar, Arr)

    Calculates average (mean) and standard deviation of array elements.

    Declaration
    public static void AvgSdv(Arr arr, out Scalar mean, out Scalar stdDev, Arr mask = null)
    Parameters
    Type Name Description
    Arr arr

    The source array.

    Scalar mean

    The output average of array elements, independently for each channel.

    Scalar stdDev

    The output standard deviation, independently for each channel.

    Arr mask

    The optional operation mask.

    | Improve this Doc View Source

    AXPY(Arr, Double, Arr, Arr)

    Calculates the sum of a multiple of an array with another array.

    Declaration
    public static void AXPY(Arr A, double realScalar, Arr B, Arr C)
    Parameters
    Type Name Description
    Arr A

    The first input array.

    Double realScalar

    The scale factor for the first array.

    Arr B

    The second input array.

    Arr C

    The destination array.

    | Improve this Doc View Source

    BackProjectPCA(Arr, Arr, Arr, Arr)

    Back projects vectors from the specified subspace.

    Declaration
    public static void BackProjectPCA(Arr proj, Arr mean, Arr eigenvects, Arr result)
    Parameters
    Type Name Description
    Arr proj

    The input data array; each vector is either a single row or a single column.

    Arr mean

    The mean (average) vector. If it is a single-row vector, then inputs are stored as rows; otherwise, it should be a single-column vector and inputs will be stored as columns.

    Arr eigenvects

    The eigenvectors (principal components). One vector per row.

    Arr result

    The output matrix containing the back projected vectors.

    | Improve this Doc View Source

    BoundingRect(CVHandle, Boolean)

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

    Declaration
    public static Rect BoundingRect(CVHandle points, bool update = false)
    Parameters
    Type Name Description
    CVHandle points

    Sequence or array of points.

    Boolean update

    Indicates whether or not to update the Rect field.

    Returns
    Type Description
    Rect

    The up-right bounding rectangle for a 2d point set.

    | Improve this Doc View Source

    BoxPoints(RotatedRect, Point2f[])

    Finds the box vertices.

    Declaration
    public static void BoxPoints(RotatedRect box, Point2f[] pt)
    Parameters
    Type Name Description
    RotatedRect box

    The input rotated rectangle.

    Point2f[] pt

    The array of box vertices.

    | Improve this Doc View Source

    CalcAffineFlowPyrLK(Arr, Arr, Arr, Arr, Point2f[], Point2f[], Single[], Size, Int32, Byte[], Single[], TermCriteria, LKFlowFlags)

    Calculates the affine optical flow for a sparse feature set using a modification of the iterative Lucas-Kanade method with pyramids.

    Declaration
    public static void CalcAffineFlowPyrLK(Arr prev, Arr curr, Arr prevPyr, Arr currPyr, Point2f[] prevFeatures, Point2f[] currFeatures, float[] matrices, Size winSize, int level, byte[] status, float[] trackError, TermCriteria criteria, LKFlowFlags flags)
    Parameters
    Type Name Description
    Arr prev

    First frame.

    Arr curr

    Second frame.

    Arr prevPyr

    Buffer for the pyramid for the first frame. If it is not null, the buffer must have a sufficient size to store the pyramid from level 1 to level level; the total size of (width + 8) * height / 3 bytes is sufficient.

    Arr currPyr

    The same as prevPyr, for the second frame.

    Point2f[] prevFeatures

    Array of points for which the flow needs to be found.

    Point2f[] currFeatures

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

    Single[] matrices

    The array of affine transformation matrices for each feature point. Matrices are stored sequentially with the format m(i) = [a00, a01, a10, a11] for each feature index, i.

    Size winSize

    Size of the search window of each pyramid level.

    Int32 level

    Maximal pyramid level number. If 0 , pyramids are not used (single level), if 1, two levels are used, etc.

    Byte[] status

    Every element of the status array is set to either 1, if the flow for the corresponding feature has been found, or 0 otherwise.

    Single[] trackError

    Array of numbers containing the difference between patches around the original and moved points. Optional parameter; can be null.

    TermCriteria criteria

    Specifies when the iteration process of finding the flow for each point on each pyramid level should be stopped.

    LKFlowFlags flags

    Specifies operation flags.

    | Improve this Doc View Source

    CalcBayesianProb(Histogram[], Histogram[])

    Calculates bayesian probabilistic histograms.

    Declaration
    public static void CalcBayesianProb(Histogram[] src, Histogram[] dst)
    Parameters
    Type Name Description
    Histogram[] src

    The source histograms.

    Histogram[] dst

    The destination histograms.

    | Improve this Doc View Source

    CalcCovarMatrix(Arr[], Arr, Arr, CovarianceFlags)

    Calculates covariance matrix of a set of vectors.

    Declaration
    public static void CalcCovarMatrix(Arr[] vects, Arr covMat, Arr avg, CovarianceFlags flags)
    Parameters
    Type Name Description
    Arr[] vects

    The input vectors, all of which must have the same type and the same size. The vectors do not have to be 1D, they can be 2D (e.g., images) and so forth.

    Arr covMat

    The output covariance matrix that should be floating-point and square.

    Arr avg

    The input or output (depending on the flags) array containing the mean (average) vector of the input vectors.

    CovarianceFlags flags

    A value specifying various operation flags.

    | Improve this Doc View Source

    CalcEMD2(Arr, Arr, DistanceType, Func<Single, Single, Single>, Arr, Arr)

    Computes the earth mover distance between two weighted point sets (signatures).

    Declaration
    public static float CalcEMD2(Arr signature1, Arr signature2, DistanceType distanceType, Func<float, float, float> distanceFunc = null, Arr costMatrix = null, Arr flow = null)
    Parameters
    Type Name Description
    Arr signature1

    The first signature array. Must be floating-point and consist of rows containing the histogram bin count followed by its coordinates.

    Arr signature2

    The second signature array. Must be floating-point and consist of rows containing the histogram bin count followed by its coordinates.

    DistanceType distanceType

    The type of metric to use for computing the earth mover distance.

    Func<Single, Single, Single> distanceFunc

    The custom distance function used for computing the earth mover distance.

    Arr costMatrix

    The user-defined cost matrix.

    Arr flow

    The resultant flow matrix.

    Returns
    Type Description
    Single

    The earth mover distance between the two signatures.

    | Improve this Doc View Source

    CalcEMD2(Arr, Arr, DistanceType, Func<Single, Single, Single>, Arr, Arr, ref Single)

    Computes the earth mover distance between two weighted point sets (signatures).

    Declaration
    public static float CalcEMD2(Arr signature1, Arr signature2, DistanceType distanceType, Func<float, float, float> distanceFunc, Arr costMatrix, Arr flow, ref float lowerBound)
    Parameters
    Type Name Description
    Arr signature1

    The first signature array. Must be floating-point and consist of rows containing the histogram bin count followed by its coordinates.

    Arr signature2

    The second signature array. Must be floating-point and consist of rows containing the histogram bin count followed by its coordinates.

    DistanceType distanceType

    The type of metric to use for computing the earth mover distance.

    Func<Single, Single, Single> distanceFunc

    The custom distance function used for computing the earth mover distance.

    Arr costMatrix

    The user-defined cost matrix.

    Arr flow

    The resultant flow matrix.

    Single lowerBound

    The optional lower boundary of the distance between the two signatures that is a distance between mass centers.

    Returns
    Type Description
    Single

    The earth mover distance between the two signatures.

    | Improve this Doc View Source

    CalcGlobalOrientation(Arr, Arr, Arr, Double, Double)

    Calculates the global motion orientation of some selected region.

    Declaration
    public static double CalcGlobalOrientation(Arr orientation, Arr mask, Arr mhi, double timestamp, double duration)
    Parameters
    Type Name Description
    Arr orientation

    Motion gradient orientation image calculated by CalcMotionGradient(Arr, Arr, Arr, Double, Double, Int32).

    Arr mask

    Mask image. It may be a conjunction of a valid gradient mask, obtained with CalcMotionGradient(Arr, Arr, Arr, Double, Double, Int32) and the mask of the region, whose direction needs to be calculated.

    Arr mhi

    Motion history image.

    Double timestamp

    Current time in milliseconds or other units.

    Double duration

    Maximal duration of the motion track in the same units as timestamp.

    Returns
    Type Description
    Double

    The general motion direction angle in the selected region, between 0 degrees and 360 degrees.

    | Improve this Doc View Source

    CalcMatMulDeriv(Mat, Mat, Mat, Mat)

    Computes partial derivatives of the matrix product for each multiplied matrix.

    Declaration
    public static void CalcMatMulDeriv(Mat A, Mat B, Mat dABdA, Mat dABdB)
    Parameters
    Type Name Description
    Mat A

    First multiplied matrix.

    Mat B

    Second multiplied matrix.

    Mat dABdA

    First output derivative matrix d(AB)/dA of size (A.RowsB.Cols)x(A.Rows*A.Cols).

    Mat dABdB

    Second output derivative matrix d(AB)/dB of size (A.RowsB.Cols)x(B.Rows*B.Cols).

    | Improve this Doc View Source

    CalcMotionGradient(Arr, Arr, Arr, Double, Double, Int32)

    Calculates the gradient orientation of a motion history image.

    Declaration
    public static void CalcMotionGradient(Arr mhi, Arr mask, Arr orientation, double delta1, double delta2, int apertureSize = 3)
    Parameters
    Type Name Description
    Arr mhi

    Motion history image.

    Arr mask

    Output mask image with non-zero pixels where the motion gradient data is correct.

    Arr orientation

    Motion gradient orientation image; contains angles from 0 to 360 degrees.

    Double delta1

    The minimal or maximal gradient threshold used to determine whether a given pixel motion gradient data is correct.

    Double delta2

    The minimal or maximal gradient threshold used to determine whether a given pixel motion gradient data is correct.

    Int32 apertureSize

    Aperture size of derivative operators used by the function. See Sobel(Arr, Arr, Int32, Int32, Int32).

    | Improve this Doc View Source

    CalcOpticalFlowFarneback(Arr, Arr, Arr, Double, Int32, Int32, Int32, Int32, Double, FarnebackFlowFlags)

    Computes dense optical flow using Gunnar Farneback’s algorithm.

    Declaration
    public static void CalcOpticalFlowFarneback(Arr prev, Arr next, Arr flow, double pyrScale, int levels, int winSize, int iterations, int polyN, double polySigma, FarnebackFlowFlags flags)
    Parameters
    Type Name Description
    Arr prev

    The first 8-bit single-channel input image.

    Arr next

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

    Arr flow

    The computed flow image; will have the same size as prev and two 32-bit floating-point channels.

    Double pyrScale

    Specifies the image scale (less than 1) to build the pyramids for each image. 0.5 means the classical pyramid, where each next layer is twice smaller than the previous.

    Int32 levels

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

    Int32 winSize

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

    Int32 iterations

    The number of iterations the algorithm does at each pyramid level.

    Int32 polyN

    Size of the pixel neighborhood used to find polynomial expansion in each pixel. The larger values mean that the image will be approximated with smoother surfaces, yielding a more robust algorithm and a more blurred motion field. Typically, polyN is set to 5 or 7.

    Double polySigma

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

    FarnebackFlowFlags flags

    Specifies operation flags.

    | Improve this Doc View Source

    CalcOpticalFlowPyrLK(Arr, Arr, Arr, Arr, Point2f[], Point2f[], Size, Int32, Byte[], Single[], TermCriteria, LKFlowFlags)

    Calculates the optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.

    Declaration
    public static void CalcOpticalFlowPyrLK(Arr prev, Arr curr, Arr prevPyr, Arr currPyr, Point2f[] prevFeatures, Point2f[] currFeatures, Size winSize, int level, byte[] status, float[] trackError, TermCriteria criteria, LKFlowFlags flags)
    Parameters
    Type Name Description
    Arr prev

    First frame.

    Arr curr

    Second frame.

    Arr prevPyr

    Buffer for the pyramid for the first frame. If it is not null, the buffer must have a sufficient size to store the pyramid from level 1 to level level; the total size of (width + 8) * height / 3 bytes is sufficient.

    Arr currPyr

    The same as prevPyr, for the second frame.

    Point2f[] prevFeatures

    Array of points for which the flow needs to be found.

    Point2f[] currFeatures

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

    Size winSize

    Size of the search window of each pyramid level.

    Int32 level

    Maximal pyramid level number. If 0 , pyramids are not used (single level), if 1, two levels are used, etc.

    Byte[] status

    Every element of the status array is set to either 1, if the flow for the corresponding feature has been found, or 0 otherwise.

    Single[] trackError

    Array of numbers containing the difference between patches around the original and moved points. Optional parameter; can be null.

    TermCriteria criteria

    Specifies when the iteration process of finding the flow for each point on each pyramid level should be stopped.

    LKFlowFlags flags

    Specifies operation flags.

    | Improve this Doc View Source

    CalcPCA(Arr, Arr, Arr, Arr, PcaFlags)

    Performs PCA analysis of the vector set.

    Declaration
    public static void CalcPCA(Arr data, Arr mean, Arr eigenvals, Arr eigenvects, PcaFlags flags)
    Parameters
    Type Name Description
    Arr data

    The input data array; each vector is either a single row or a single column.

    Arr mean

    The mean (average) vector.

    Arr eigenvals

    The output eigenvalues of covariance matrix.

    Arr eigenvects

    The output eigenvectors of covariance matrix (i.e. principal components); one vector per row.

    PcaFlags flags

    A value specifying various operation flags.

    | Improve this Doc View Source

    CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags)

    Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.

    Declaration
    public static double CalibrateCamera2(Mat objectPoints, Mat imagePoints, Mat pointCounts, Size imageSize, Mat cameraMatrix, Mat distortionCoeffs, Mat rotationVectors = null, Mat translationVectors = null, CameraCalibrationFlags flags = default(CameraCalibrationFlags))
    Parameters
    Type Name Description
    Mat objectPoints

    The joint matrix of object points; calibration pattern features in the model coordinate space. A floating-point 3xN or Nx3 1-channel, or 1xN or Nx1 3-channel array, where N is the total number of points in all views.

    Mat imagePoints

    The joint matrix of object point projections in the camera views. A floating-point 2xN or Nx2 1-channel, or 1xN or Nx1 2-channel array, where N is the total number of points in all views.

    Mat pointCounts

    Integer 1xM or Mx1 vector (where M is the number of calibration pattern views) containing the number of points in each particular view. The sum of vector elements must match the size of objectPoints and imagePoints (=N).

    Size imageSize

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

    Mat cameraMatrix

    The output 3x3 floating-point camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Mat distortionCoeffs

    The output 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients (k1, k2, p1, p2[, k3]).

    Mat rotationVectors

    The output 3xM or Mx3 1-channel, or 1xM or Mx1 3-channel array of rotation vectors (see Rodrigues2(Mat, Mat, Mat)), 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, i.e. real position of the calibration pattern in the k-th pattern view (k=0..M-1)

    Mat translationVectors

    The output 3xM or Mx3 1-channel, or 1xM or Mx1 3-channel array of translation vectors, estimated for each pattern view.

    CameraCalibrationFlags flags

    Specifies various operation flags.

    Returns
    Type Description
    Double

    The final re-projection error.

    | Improve this Doc View Source

    CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags, TermCriteria)

    Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.

    Declaration
    public static double CalibrateCamera2(Mat objectPoints, Mat imagePoints, Mat pointCounts, Size imageSize, Mat cameraMatrix, Mat distortionCoeffs, Mat rotationVectors, Mat translationVectors, CameraCalibrationFlags flags, TermCriteria criteria)
    Parameters
    Type Name Description
    Mat objectPoints

    The joint matrix of object points; calibration pattern features in the model coordinate space. A floating-point 3xN or Nx3 1-channel, or 1xN or Nx1 3-channel array, where N is the total number of points in all views.

    Mat imagePoints

    The joint matrix of object point projections in the camera views. A floating-point 2xN or Nx2 1-channel, or 1xN or Nx1 2-channel array, where N is the total number of points in all views.

    Mat pointCounts

    Integer 1xM or Mx1 vector (where M is the number of calibration pattern views) containing the number of points in each particular view. The sum of vector elements must match the size of objectPoints and imagePoints (=N).

    Size imageSize

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

    Mat cameraMatrix

    The output 3x3 floating-point camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Mat distortionCoeffs

    The output 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients (k1, k2, p1, p2[, k3]).

    Mat rotationVectors

    The output 3xM or Mx3 1-channel, or 1xM or Mx1 3-channel array of rotation vectors (see Rodrigues2(Mat, Mat, Mat)), 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, i.e. real position of the calibration pattern in the k-th pattern view (k=0..M-1)

    Mat translationVectors

    The output 3xM or Mx3 1-channel, or 1xM or Mx1 3-channel array of translation vectors, estimated for each pattern view.

    CameraCalibrationFlags flags

    Specifies various operation flags.

    TermCriteria criteria

    Termination criteria for the iterative optimization algorithm.

    Returns
    Type Description
    Double

    The final re-projection error.

    | Improve this Doc View Source

    CalibrationMatrixValues(Mat, Size, Double, Double)

    Computes useful camera characteristics from the camera matrix.

    Declaration
    public static void CalibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth = null, double apertureHeight = null)
    Parameters
    Type Name Description
    Mat cameraMatrix

    Input camera matrix that can be estimated by CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags, TermCriteria) or StereoCalibrate(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, TermCriteria, StereoCalibrationFlags).

    Size imageSize

    Input image size in pixels.

    Double apertureWidth

    Physical width of the sensor.

    Double apertureHeight

    Physical height of the sensor.

    | Improve this Doc View Source

    CalibrationMatrixValues(Mat, Size, Double, Double, out Double)

    Computes useful camera characteristics from the camera matrix.

    Declaration
    public static void CalibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, out double fovx)
    Parameters
    Type Name Description
    Mat cameraMatrix

    Input camera matrix that can be estimated by CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags, TermCriteria) or StereoCalibrate(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, TermCriteria, StereoCalibrationFlags).

    Size imageSize

    Input image size in pixels.

    Double apertureWidth

    Physical width of the sensor.

    Double apertureHeight

    Physical height of the sensor.

    Double fovx

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

    | Improve this Doc View Source

    CalibrationMatrixValues(Mat, Size, Double, Double, out Double, out Double)

    Computes useful camera characteristics from the camera matrix.

    Declaration
    public static void CalibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, out double fovx, out double fovy)
    Parameters
    Type Name Description
    Mat cameraMatrix

    Input camera matrix that can be estimated by CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags, TermCriteria) or StereoCalibrate(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, TermCriteria, StereoCalibrationFlags).

    Size imageSize

    Input image size in pixels.

    Double apertureWidth

    Physical width of the sensor.

    Double apertureHeight

    Physical height of the sensor.

    Double fovx

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

    Double fovy

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

    | Improve this Doc View Source

    CalibrationMatrixValues(Mat, Size, Double, Double, out Double, out Double, out Double)

    Computes useful camera characteristics from the camera matrix.

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

    Input camera matrix that can be estimated by CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags, TermCriteria) or StereoCalibrate(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, TermCriteria, StereoCalibrationFlags).

    Size imageSize

    Input image size in pixels.

    Double apertureWidth

    Physical width of the sensor.

    Double apertureHeight

    Physical height of the sensor.

    Double fovx

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

    Double fovy

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

    Double focalLength

    Focal length of the lens in mm.

    | Improve this Doc View Source

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

    Computes useful camera characteristics from the camera matrix.

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

    Input camera matrix that can be estimated by CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags, TermCriteria) or StereoCalibrate(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, TermCriteria, StereoCalibrationFlags).

    Size imageSize

    Input image size in pixels.

    Double apertureWidth

    Physical width of the sensor.

    Double apertureHeight

    Physical height of the sensor.

    Double fovx

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

    Double fovy

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

    Double focalLength

    Focal length of the lens in mm.

    Point2d principalPoint

    Principal point in pixels.

    | Improve this Doc View Source

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

    Computes useful camera characteristics from the camera matrix.

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

    Input camera matrix that can be estimated by CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags, TermCriteria) or StereoCalibrate(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, TermCriteria, StereoCalibrationFlags).

    Size imageSize

    Input image size in pixels.

    Double apertureWidth

    Physical width of the sensor.

    Double apertureHeight

    Physical height of the sensor.

    Double fovx

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

    Double fovy

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

    Double focalLength

    Focal length of the lens in mm.

    Point2d principalPoint

    Principal point in pixels.

    Double pixelAspectRatio

    The aspect ratio of a pixel, given by fy / fx.

    | Improve this Doc View Source

    CamShift(Arr, Rect, TermCriteria, out ConnectedComp)

    Finds the object center, size, and orientation.

    Declaration
    public static bool CamShift(Arr probImage, Rect window, TermCriteria criteria, out ConnectedComp comp)
    Parameters
    Type Name Description
    Arr probImage

    Back projection of object histogram (see CalcArrBackProject(Arr[], Arr)).

    Rect window

    Initial search window.

    TermCriteria criteria

    Criteria applied to determine when the window search should be finished.

    ConnectedComp comp

    Resultant structure that contains the converged search window coordinates (Rect field) and the sum of all of the pixels inside the window (Area field).

    Returns
    Type Description
    Boolean

    true if the search was successful; false otherwise.

    | Improve this Doc View Source

    CamShift(Arr, Rect, TermCriteria, out ConnectedComp, out RotatedRect)

    Finds the object center, size, and orientation.

    Declaration
    public static bool CamShift(Arr probImage, Rect window, TermCriteria criteria, out ConnectedComp comp, out RotatedRect box)
    Parameters
    Type Name Description
    Arr probImage

    Back projection of object histogram (see CalcArrBackProject(Arr[], Arr)).

    Rect window

    Initial search window.

    TermCriteria criteria

    Criteria applied to determine when the window search should be finished.

    ConnectedComp comp

    Resultant structure that contains the converged search window coordinates (Rect field) and the sum of all of the pixels inside the window (Area field).

    RotatedRect box

    Circumscribed box for the object.

    Returns
    Type Description
    Boolean

    true if the search was successful; false otherwise.

    | Improve this Doc View Source

    Canny(Arr, Arr, Double, Double, Int32)

    Implements the Canny algorithm for edge detection.

    Declaration
    public static void Canny(Arr image, Arr edges, double threshold1, double threshold2, int apertureSize = 3)
    Parameters
    Type Name Description
    Arr image

    Input image.

    Arr edges

    Single-channel image to store the edges found by the function.

    Double threshold1

    The first threshold. The smallest value between threshold1 and threshold2 is used for edge linking, the largest value is used to find the initial segments of strong edges.

    Double threshold2

    The second threshold. The smallest value between threshold1 and threshold2 is used for edge linking, the largest value is used to find the initial segments of strong edges.

    Int32 apertureSize

    Aperture parameter for the Sobel operator (see Sobel(Arr, Arr, Int32, Int32, Int32)).

    | Improve this Doc View Source

    CartToPolar(Arr, Arr, Arr, Arr, Boolean)

    Calculates the magnitude and/or angle of 2d vectors.

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

    The array of x-coordinates.

    Arr y

    The array of y-coordinates.

    Arr magnitude

    The destination array of magnitudes, may be set to null if it is not needed.

    Arr angle

    The destination array of angles, may be set to null if it is not needed. The angles are measured in radians (0 to 2pi) or in degrees (0 to 360 degrees).

    Boolean angleInDegrees

    A value indicating whether the angles are measured in radians, which is the default mode, or in degrees.

    | Improve this Doc View Source

    Cbrt(Single)

    Calculates the cubic root.

    Declaration
    public static float Cbrt(float value)
    Parameters
    Type Name Description
    Single value

    The input floating-point value.

    Returns
    Type Description
    Single

    The cubic root of value.

    | Improve this Doc View Source

    CheckChessboard(IplImage, Size)

    Does a fast check if a chessboard is in the input image.

    Declaration
    public static bool CheckChessboard(IplImage src, Size size)
    Parameters
    Type Name Description
    IplImage src

    The input image.

    Size size

    The size of the chessboard.

    Returns
    Type Description
    Boolean

    true if a chessboard may be in the input image; false otherwise.

    | Improve this Doc View Source

    CheckContourConvexity(CVHandle)

    Tests contour convexity. The contour must be simple, without self-intersections.

    Declaration
    public static bool CheckContourConvexity(CVHandle contour)
    Parameters
    Type Name Description
    CVHandle contour

    Sequence or array of points.

    Returns
    Type Description
    Boolean

    A value indicating whether or not the contour is convex.

    | Improve this Doc View Source

    Circle(Arr, Point, Int32, Scalar, Int32, LineFlags, Int32)

    Draws a circle with the specified center and radius.

    Declaration
    public static void Circle(Arr img, Point center, int radius, Scalar color, int thickness = 1, LineFlags lineType = default(LineFlags), int shift = 0)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    Point center

    The center of the circle.

    Int32 radius

    The radius of the circle.

    Scalar color

    The color of the circle.

    Int32 thickness

    The thickness of the circle outline if positive, otherwise this indicates that a filled circle is to be drawn.

    LineFlags lineType

    The algorithm used to draw the circle boundary.

    Int32 shift

    The number of fractional bits in the center coordinates and radius value.

    | 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
    Size imgSize

    The size of the image.

    Point pt1

    The first ending point of the line segment.

    Point pt2

    The second ending point of the line segment.

    Returns
    Type Description
    Boolean

    true if some portion of the line segment is inside the image, otherwise false.

    | Improve this Doc View Source

    Cmp(Arr, Arr, Arr, ComparisonOperation)

    Performs per-element comparison of two arrays.

    Declaration
    public static void Cmp(Arr src1, Arr src2, Arr dst, ComparisonOperation cmpOp)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array. Both input arrays must have a single channel.

    Arr dst

    The destination array. It must have U8 or S8 type.

    ComparisonOperation cmpOp

    The comparison operation used to test the relation between the elements to be checked.

    | Improve this Doc View Source

    CmpS(Arr, Double, Arr, ComparisonOperation)

    Performs per-element comparison of an array and a scalar.

    Declaration
    public static void CmpS(Arr src, double value, Arr dst, ComparisonOperation cmpOp)
    Parameters
    Type Name Description
    Arr src

    The input array, must have a single channel.

    Double value

    The scalar value with which to compare each array element.

    Arr dst

    The destination array. It must have U8 or S8 type.

    ComparisonOperation cmpOp

    The comparison operation used to test the relation between the elements to be checked.

    | Improve this Doc View Source

    CompleteSymm(Mat, Boolean)

    Copies the lower or the upper half of a square matrix to another half.

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

    The input-output floating point square matrix.

    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(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat)

    Combines two rotation-and-shift transformations.

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

    First rotation vector.

    Mat tvec1

    First translation vector.

    Mat rvec2

    Second rotation vector.

    Mat tvec2

    Second translation vector.

    Mat rvec3

    Output rotation vector of the superposition.

    Mat tvec3

    Output translation vector of the superposition.

    Mat dr3dr1

    Optional output derivatives of rvec3 with regard to rvec1.

    Mat dr3dt1

    Optional output derivatives of rvec3 with regard to tvec1.

    Mat dr3dr2

    Optional output derivatives of rvec3 with regard to rvec2.

    Mat dr3dt2

    Optional output derivatives of rvec3 with regard to tvec2.

    Mat dt3dr1

    Optional output derivatives of tvec3 with regard to rvec1.

    Mat dt3dt1

    Optional output derivatives of tvec3 with regard to tvec1.

    Mat dt3dr2

    Optional output derivatives of tvec3 with regard to rvec2.

    Mat dt3dt2

    Optional output derivatives of tvec3 with regard to tvec2.

    | Improve this Doc View Source

    ComputeCorrespondEpilines(Mat, Int32, Mat, Mat)

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

    Declaration
    public static void ComputeCorrespondEpilines(Mat points, int whichImage, Mat fundamentalMatrix, Mat correspondentLines)
    Parameters
    Type Name Description
    Mat points

    The input points. 2xN, Nx2, 3xN or Nx3 array (where N number of points). Multi-channel 1xN or Nx1 array is also acceptable.

    Int32 whichImage

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

    Mat fundamentalMatrix

    The fundamental matrix that can be estimated using FindFundamentalMat(Mat, Mat, Mat, FundamentalMatrixMethod, Double, Double, Mat) or StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double, Size).

    Mat correspondentLines

    The output epilines, a 3xN or Nx3 array. Each line ax + by + c = 0 is encoded by 3 numbers (a, b, c).

    | Improve this Doc View Source

    ContourArea(CVHandle)

    Calculates the area of a whole contour or contour section.

    Declaration
    public static double ContourArea(CVHandle contour)
    Parameters
    Type Name Description
    CVHandle contour

    Sequence or array of vertices.

    Returns
    Type Description
    Double

    The area of the whole contour or contour section.

    | Improve this Doc View Source

    ContourArea(CVHandle, SeqSlice, Boolean)

    Calculates the area of a whole contour or contour section.

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

    Sequence or array of vertices.

    SeqSlice slice

    Starting and ending points of the contour section of interest. By default, the area of the whole contour is calculated.

    Boolean oriented

    If false, the absolute area will be returned; otherwise the returned value might be negative.

    Returns
    Type Description
    Double

    The area of the whole contour or contour section.

    | Improve this Doc View Source

    ContourPerimeter(CVHandle)

    Calculates the contour perimeter.

    Declaration
    public static double ContourPerimeter(CVHandle contour)
    Parameters
    Type Name Description
    CVHandle contour

    Sequence or array of the contour points.

    Returns
    Type Description
    Double

    The perimeter of the closed contour as the sum of the lengths of segments between subsequent points.

    | Improve this Doc View Source

    Convert(Arr, Arr)

    Converts one array to another.

    Declaration
    public static void Convert(Arr src, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    ConvertImage(Arr, Arr, ConvertImageFlags)

    Converts one image to another with an optional vertical flip.

    Declaration
    public static void ConvertImage(Arr src, Arr dst, ConvertImageFlags flags = default(ConvertImageFlags))
    Parameters
    Type Name Description
    Arr src

    Source image.

    Arr dst

    Destination image.

    ConvertImageFlags flags

    The operation flags.

    | Improve this Doc View Source

    ConvertMaps(Arr, Arr, Arr, Arr)

    Converts image transformation maps from floating-point to integer fixed-point for fast remapping operation.

    Declaration
    public static void ConvertMaps(Arr mapx, Arr mapy, Arr mapxy, Arr mapalpha)
    Parameters
    Type Name Description
    Arr mapx

    The map of x-coordinates, 32-bit single-channel floating-point image.

    Arr mapy

    The map of y-coordinates, 32-bit single-channel floating-point image.

    Arr mapxy

    The output map of xy-coordinates, 16-bit 2-channel signed integer image.

    Arr mapalpha

    The output alpha map, 16-bit single-channel unsigned integer image.

    | Improve this Doc View Source

    ConvertPointsHomogeneous(Mat, Mat)

    Convert points to/from homogeneous coordinates.

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

    The input point array, 2xN, Nx2, 3xN, Nx3, 4xN or Nx4 (where N is the number of points). Multi-channel 1xN or Nx1 array is also acceptable.

    Mat dst

    The output point array, must contain the same number of points as the input. The dimensionality must be the same, 1 less or 1 more than the input.

    | Improve this Doc View Source

    ConvertScale(Arr, Arr, Double, Double)

    Converts one array to another with optional linear transformation.

    Declaration
    public static void ConvertScale(Arr src, Arr dst, double scale = null, double shift = null)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array.

    Double scale

    The optional scale factor applied independently to all element channels.

    Double shift

    The optional value added to scaled array elements.

    | Improve this Doc View Source

    ConvertScaleAbs(Arr, Arr, Double, Double)

    Converts input array elements to an 8-bit unsigned integer array with optional linear transformation.

    Declaration
    public static void ConvertScaleAbs(Arr src, Arr dst, double scale = null, double shift = null)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array (must have U8 depth).

    Double scale

    The optional scale factor applied independently to all element channels.

    Double shift

    The optional value added to scaled array elements.

    Remarks

    This function is similar to ConvertScale(Arr, Arr, Double, Double), but stores absolute values after the conversion results.

    | Improve this Doc View Source

    ConvexHull2(CVHandle, CVHandle, ShapeOrientation, Boolean)

    Finds the convex hull of a point set.

    Declaration
    public static Seq ConvexHull2(CVHandle input, CVHandle hullStorage = null, ShapeOrientation orientation = default(ShapeOrientation), bool returnPoints = false)
    Parameters
    Type Name Description
    CVHandle input

    Sequence or array of points.

    CVHandle hullStorage

    The array or memory storage that will store the convex hull.

    ShapeOrientation orientation

    Desired orientation of the convex hull.

    Boolean returnPoints

    If true, the points themselves will be stored in the hull instead of the indices.

    Returns
    Type Description
    Seq

    A sequence containing the points in the convex hull.

    | Improve this Doc View Source

    ConvexityDefects(CVHandle, Seq, MemStorage)

    Finds the convexity defects of a contour.

    Declaration
    public static Seq ConvexityDefects(CVHandle contour, Seq convexhull, MemStorage storage = null)
    Parameters
    Type Name Description
    CVHandle contour

    Input contour.

    Seq convexhull

    Convex hull obtained using ConvexHull2(CVHandle, CVHandle, ShapeOrientation, Boolean) that should contain pointers or indices to the contour points, not the hull points themselves (i.e. the returnPoints of ConvexHull2(CVHandle, CVHandle, ShapeOrientation, Boolean) parameter should be false).

    MemStorage storage

    Container for the output sequence of convexity defects.

    Returns
    Type Description
    Seq

    A sequence of ConvexityDefect structures.

    | Improve this Doc View Source

    Copy(Arr, Arr, Arr)

    Copies elements of one array to another.

    Declaration
    public static void Copy(Arr src, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    CopyMakeBorder(Arr, Arr, Point, IplBorder)

    Copies an image and makes a border around it.

    Declaration
    public static void CopyMakeBorder(Arr src, Arr dst, Point offset, IplBorder borderType)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Point offset

    Coordinates of the top-left corner (or bottom-left in the case of images with bottom-left origin) of the destination image rectangle where the source image (or its ROI) is copied.

    IplBorder borderType

    Type of the border to create around the copied source image rectangle.

    | Improve this Doc View Source

    CopyMakeBorder(Arr, Arr, Point, IplBorder, Scalar)

    Copies an image and makes a border around it.

    Declaration
    public static void CopyMakeBorder(Arr src, Arr dst, Point offset, IplBorder borderType, Scalar value)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Point offset

    Coordinates of the top-left corner (or bottom-left in the case of images with bottom-left origin) of the destination image rectangle where the source image (or its ROI) is copied.

    IplBorder borderType

    Type of the border to create around the copied source image rectangle.

    Scalar value

    Value of the border pixels if borderType is Constant.

    | Improve this Doc View Source

    CornerEigenValsAndVecs(Arr, Arr, Int32, Int32)

    Calculates eigenvalues and eigenvectors of image blocks for corner detection.

    Declaration
    public static void CornerEigenValsAndVecs(Arr image, Arr eigenvv, int blockSize, int apertureSize = 3)
    Parameters
    Type Name Description
    Arr image

    Input image.

    Arr eigenvv

    Image to store the results. It must be 6 times wider than the input image.

    Int32 blockSize

    The pixel neighborhood size. The method calculates the covariance matrix of derivatives over the neighborhood and finds its eigenvectors and eigenvalues.

    Int32 apertureSize

    Aperture parameter for the Sobel operator (see Sobel(Arr, Arr, Int32, Int32, Int32)).

    | Improve this Doc View Source

    CornerHarris(Arr, Arr, Int32, Int32, Double)

    Implements the Harris edge detector.

    Declaration
    public static void CornerHarris(Arr image, Arr harrisResponse, int blockSize, int apertureSize = 3, double k = 0.04)
    Parameters
    Type Name Description
    Arr image

    Input image.

    Arr harrisResponse

    Image to store the Harris detector responses. Should have the same size as image.

    Int32 blockSize

    The pixel neighborhood size (see CornerEigenValsAndVecs(Arr, Arr, Int32, Int32)).

    Int32 apertureSize

    Aperture parameter for the Sobel operator (see Sobel(Arr, Arr, Int32, Int32, Int32)).

    Double k

    Harris detector free parameter.

    | Improve this Doc View Source

    CornerMinEigenVal(Arr, Arr, Int32, Int32)

    Calculates the minimal eigenvalue of gradient matrices for corner detection.

    Declaration
    public static void CornerMinEigenVal(Arr image, Arr eigenval, int blockSize, int apertureSize = 3)
    Parameters
    Type Name Description
    Arr image

    Input image.

    Arr eigenval

    Image to store the minimal eigenvalues. Should have the same size as image.

    Int32 blockSize

    The pixel neighborhood size (see CornerEigenValsAndVecs(Arr, Arr, Int32, Int32)).

    Int32 apertureSize

    Aperture parameter for the Sobel operator (see Sobel(Arr, Arr, Int32, Int32, Int32)).

    | Improve this Doc View Source

    CorrectMatches(Mat, Mat, Mat, Mat, Mat)

    Refines coordinates of corresponding points.

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

    3x3 fundamental matrix.

    Mat points1

    1xN array containing the first set of points.

    Mat points2

    1xN array containing the second set of points.

    Mat newPoints1

    The optimized points1.

    Mat newPoints2

    The optimized points2

    | Improve this Doc View Source

    CountNonZero(Arr)

    Counts non-zero array elements.

    Declaration
    public static int CountNonZero(Arr arr)
    Parameters
    Type Name Description
    Arr arr

    The source array. Must be a single-channel array or a multi-channel image with COI set.

    Returns
    Type Description
    Int32

    The number of non-zero elements in arr.

    | Improve this Doc View Source

    CreateButton(String, ButtonCallback, ButtonType, Boolean)

    Creates and attaches a button to the shared control panel.

    Declaration
    public static bool CreateButton(string buttonName = null, ButtonCallback onChange = null, ButtonType buttonType = default(ButtonType), bool initialButtonState = false)
    Parameters
    Type Name Description
    String buttonName

    The name of the button.

    ButtonCallback onChange

    The callback method that will be called every time the button changes state.

    ButtonType buttonType

    The type of button to create.

    Boolean initialButtonState

    The initial state of the button.

    Returns
    Type Description
    Boolean

    true if the button was created successfully; otherwise, false.

    | Improve this Doc View Source

    CreatePyramid(Arr, Int32, Double, Size[], Arr, Boolean, PyramidDecompositionFilter)

    Builds pyramid representation of an image.

    Declaration
    public static Mat[] CreatePyramid(Arr img, int extraLayers, double rate, Size[] layerSizes = null, Arr buffer = null, bool calc = true, PyramidDecompositionFilter filter = default(PyramidDecompositionFilter))
    Parameters
    Type Name Description
    Arr img

    The source image.

    Int32 extraLayers

    The number of extra pyramid layers.

    Double rate

    The size scale factor between each pyramid layer. Used if layerSizes is null.

    Size[] layerSizes

    The size of each pyramid layer.

    Arr buffer

    An image buffer on which the pyramids will be stored.

    Boolean calc

    A value indicating whether to compute the actual pyramids. If it is false, only the memory for the pyramids is allocated.

    PyramidDecompositionFilter filter

    The type of filter used for convolution.

    Returns
    Type Description
    Mat[]

    A set of matrix handles representing the pyramid of img.

    | Improve this Doc View Source

    CrossProduct(Arr, Arr, Arr)

    Calculates the cross product of two 3D vectors.

    Declaration
    public static void CrossProduct(Arr src1, Arr src2, Arr dst)
    Parameters
    Type Name Description
    Arr src1

    The first source vector.

    Arr src2

    The second source vector.

    Arr dst

    The destination vector.

    | Improve this Doc View Source

    CvtColor(Arr, Arr, ColorConversion)

    Converts an image from one color space to another.

    Declaration
    public static void CvtColor(Arr src, Arr dst, ColorConversion code)
    Parameters
    Type Name Description
    Arr src

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

    Arr dst

    The output image of the same size and depth as src.

    ColorConversion code

    The color space conversion to apply.

    | Improve this Doc View Source

    DCT(Arr, Arr, DiscreteTransformFlags)

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

    Declaration
    public static void DCT(Arr src, Arr dst, DiscreteTransformFlags flags)
    Parameters
    Type Name Description
    Arr src

    The source array, real 1D or 2D array.

    Arr dst

    Destination array of the same size and type as src.

    DiscreteTransformFlags flags

    The transformation flags specifying the operation of the DCT.

    | Improve this Doc View Source

    DecodeImage(Mat, LoadImageFlags)

    Reads an image from a buffer in memory as an IplImage.

    Declaration
    public static IplImage DecodeImage(Mat buf, LoadImageFlags colorType)
    Parameters
    Type Name Description
    Mat buf

    Input array of bytes.

    LoadImageFlags colorType

    Specific color type of the loaded image.

    Returns
    Type Description
    IplImage

    The newly loaded image.

    | Improve this Doc View Source

    DecodeImageM(Mat, LoadImageFlags)

    Reads an image from a buffer in memory as a Mat.

    Declaration
    public static Mat DecodeImageM(Mat buf, LoadImageFlags colorType)
    Parameters
    Type Name Description
    Mat buf

    Input array of bytes.

    LoadImageFlags colorType

    Specific color type of the loaded image.

    Returns
    Type Description
    Mat

    The newly loaded image.

    | Improve this Doc View Source

    DecomposeProjectionMatrix(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Point3d[])

    Decomposes the projection matrix into a rotation matrix and a camera matrix.

    Declaration
    public static void DecomposeProjectionMatrix(Mat projMatr, Mat calibMatr, Mat rotMatr, Mat posVect, Mat rotMatrX = null, Mat rotMatrY = null, Mat rotMatrZ = null, Point3d[] eulerAngles = null)
    Parameters
    Type Name Description
    Mat projMatr

    The 3x4 input projection matrix P.

    Mat calibMatr

    The output 3x3 camera matrix K.

    Mat rotMatr

    The output 3x3 external rotation matrix R.

    Mat posVect

    The output 4x1 translation vector T.

    Mat rotMatrX

    Optional output 3x3 rotation matrix around x-axis.

    Mat rotMatrY

    Optional output 3x3 rotation matrix around y-axis.

    Mat rotMatrZ

    Optional output 3x3 rotation matrix around z-axis.

    Point3d[] eulerAngles

    Optional output array containing the three Euler angles of rotation.

    | Improve this Doc View Source

    Det(Arr)

    Returns the determinant of a matrix.

    Declaration
    public static double Det(Arr mat)
    Parameters
    Type Name Description
    Arr mat

    The source matrix.

    Returns
    Type Description
    Double

    The determinant of the square matrix mat.

    | Improve this Doc View Source

    DFT(Arr, Arr, DiscreteTransformFlags, Int32)

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

    Declaration
    public static void DFT(Arr src, Arr dst, DiscreteTransformFlags flags, int nonzeroRows)
    Parameters
    Type Name Description
    Arr src

    The source array, containing real or complex values.

    Arr dst

    The destination array of the same size and type as src.

    DiscreteTransformFlags flags

    The transformation flags specifying the operation of the DFT.

    Int32 nonzeroRows

    The number of nonzero rows in the source array (in the case of a forward 2d transform), or a number of rows of interest in the destination array (in the case of an inverse 2d transform).

    | Improve this Doc View Source

    Dilate(Arr, Arr, IplConvKernel, Int32)

    Dilates an image by using a specific structuring element.

    Declaration
    public static void Dilate(Arr src, Arr dst, IplConvKernel element = null, int iterations = 1)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    IplConvKernel element

    The structuring element used for dilation. If it is null, a 3x3 rectangular structuring element is used.

    Int32 iterations

    The number of times dilation is applied.

    | Improve this Doc View Source

    DistTransform(Arr, Arr, DistanceType, Int32, Single[], Arr, DistanceLabel)

    Calculates the distance to the closest zero pixel for all non-zero pixels of the source image.

    Declaration
    public static void DistTransform(Arr src, Arr dst, DistanceType distanceType = default(DistanceType), int maskSize = 3, float[] mask = null, Arr labels = null, DistanceLabel labelType = default(DistanceLabel))
    Parameters
    Type Name Description
    Arr src

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

    Arr dst

    Output image with calculated distances (32-bit floating-point, single-channel).

    DistanceType distanceType

    The type of distance to use.

    Int32 maskSize

    Size of the distance transform mask; can be 3 or 5.

    Single[] mask

    User-defined mask in the case of a user-defined distance. It consists of 2 numbers (horizontal/vertical shift cost, diagonal shift cost) in the case of a 3x3 mask and 3 numbers (horizontal/vertical shift cost, diagonal shift cost, knight’s move cost) in the case of a 5x5 mask.

    Arr labels

    The optional output 2d array of integer type labels, the same size as src and dst.

    DistanceLabel labelType

    Specifies the content of the output label array.

    | Improve this Doc View Source

    Div(Arr, Arr, Arr, Double)

    Calculates the per-element division of two arrays.

    Declaration
    public static void Div(Arr src1, Arr src2, Arr dst, double scale = null)
    Parameters
    Type Name Description
    Arr src1

    The first input array. If the reference is null, the array is assumed to be all ones.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    Double scale

    An optional scale factor.

    | Improve this Doc View Source

    DotProduct(Arr, Arr)

    Calculates the dot product of two arrays in Euclidian metrics.

    Declaration
    public static double DotProduct(Arr src1, Arr src2)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Returns
    Type Description
    Double

    The Euclidean dot product of the two arrays. In the case of multiple channel arrays, the results for all channels are accumulated.

    | Improve this Doc View Source

    DrawChessboardCorners(Arr, Size, Point2f[], Boolean)

    Renders the detected chessboard corners.

    Declaration
    public static void DrawChessboardCorners(Arr image, Size patternSize, Point2f[] corners, bool patternWasFound)
    Parameters
    Type Name Description
    Arr image

    The destination image; it must be an 8-bit color image.

    Size patternSize

    The number of inner corners per chessboard row and column (pointsPerRow, pointsPerColumn).

    Point2f[] corners

    The array of detected corners.

    Boolean patternWasFound

    A value indicating whether the complete board was found.

    | Improve this Doc View Source

    DrawContours(Arr, Seq, Scalar, Scalar, Int32, Int32, LineFlags)

    Draws contour outlines or filled interiors in an image.

    Declaration
    public static void DrawContours(Arr img, Seq contour, Scalar externalColor, Scalar holeColor, int maxLevel, int thickness = 1, LineFlags lineType = default(LineFlags))
    Parameters
    Type Name Description
    Arr img

    The image where the contours are to be drawn.

    Seq contour

    The first contour to draw.

    Scalar externalColor

    The color of the external contours.

    Scalar holeColor

    The color of the internal holes.

    Int32 maxLevel

    The maximal level for drawn contours. If 0, only contour is drawn. If 1, the contour and all contours following it on the same level are drawn. If 2, all contours following contour and all contours one level below the contours are drawn, and so forth. If the value is negative, the function does not draw the contours following contour contour but draws the child contours of contour up to the max level minus one.

    Int32 thickness

    The thickness of the lines the contours are drawn with. If negative, the contour interiors are drawn.

    LineFlags lineType

    The algorithm used to draw the contour boundaries.

    | Improve this Doc View Source

    DrawContours(Arr, Seq, Scalar, Scalar, Int32, Int32, LineFlags, Point)

    Draws contour outlines or filled interiors in an image.

    Declaration
    public static void DrawContours(Arr img, Seq contour, Scalar externalColor, Scalar holeColor, int maxLevel, int thickness, LineFlags lineType, Point offset)
    Parameters
    Type Name Description
    Arr img

    The image where the contours are to be drawn.

    Seq contour

    The first contour to draw.

    Scalar externalColor

    The color of the external contours.

    Scalar holeColor

    The color of the internal holes.

    Int32 maxLevel

    The maximal level for drawn contours. If 0, only contour is drawn. If 1, the contour and all contours following it on the same level are drawn. If 2, all contours following contour and all contours one level below the contours are drawn, and so forth. If the value is negative, the function does not draw the contours following contour contour but draws the child contours of contour up to the max level minus one.

    Int32 thickness

    The thickness of the lines the contours are drawn with. If negative, the contour interiors are drawn.

    LineFlags lineType

    The algorithm used to draw the contour boundaries.

    Point offset

    An offset to apply to all contour vertices.

    | Improve this Doc View Source

    EigenVV(Arr, Arr, Arr, Double, Int32, Int32)

    Computes eigenvalues and eigenvectors of a symmetric matrix.

    Declaration
    public static void EigenVV(Arr mat, Arr evects, Arr evals, double eps = null, int lowindex = null, int highindex = null)
    Parameters
    Type Name Description
    Arr mat

    The input symmetric square matrix, modified during the processing.

    Arr evects

    The output matrix of eigenvectors, stored as subsequent rows.

    Arr evals

    The output vector of eigenvalues, stored in the descending order.

    Double eps

    Accuracy of diagonalization.

    Int32 lowindex

    Optional index of largest eigenvalue/-vector to calculate.

    Int32 highindex

    Optional index of smallest eigenvalue/-vector to calculate.

    | Improve this Doc View Source

    Ellipse(Arr, Point, Size, Double, Double, Double, Scalar, Int32, LineFlags, Int32)

    Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector, depending on thickness, startAngle and endAngle parameters. The resultant figure is rotated by angle. All the angles are in degrees.

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

    The image on which to draw.

    Point center

    The center of the ellipse.

    Size axes

    The length of the ellipse axes.

    Double angle

    The rotation angle.

    Double startAngle

    The starting angle of the elliptic arc.

    Double endAngle

    The ending angle of the elliptic arc.

    Scalar color

    The color of the ellipse.

    Int32 thickness

    The thickness of the ellipse boundary if positive, otherwise this indicates that a filled ellipse sector is to be drawn.

    LineFlags lineType

    The algorithm used to draw the ellipse boundary.

    Int32 shift

    The number of fractional bits in the center coordinates and axes' values.

    | Improve this Doc View Source

    EllipseBox(Arr, RotatedRect, Scalar, Int32, LineFlags, Int32)

    Draws a simple or thick ellipse from the specified enclosing box.

    Declaration
    public static void EllipseBox(Arr img, RotatedRect box, Scalar color, int thickness = 1, LineFlags lineType = default(LineFlags), int shift = 0)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    RotatedRect box

    The enclosing box of the ellipse.

    Scalar color

    The color of the ellipse.

    Int32 thickness

    The thickness of the ellipse boundary if positive, otherwise this indicates that a filled ellipse is to be drawn.

    LineFlags lineType

    The algorithm used to draw the ellipse boundary.

    Int32 shift

    The number of fractional bits in the center coordinates and axes' values.

    | Improve this Doc View Source

    EllipseToPoly(Point, Size, Int32, Int32, Int32, Point[], Int32)

    Returns the polygon points which make up the given ellipse.

    Declaration
    public static int EllipseToPoly(Point center, Size axes, int angle, int startAngle, int endAngle, Point[] pts, int delta)
    Parameters
    Type Name Description
    Point center

    The center of the ellipse.

    Size axes

    The length of the ellipse axes.

    Int32 angle

    The rotation angle.

    Int32 startAngle

    The starting angle of the elliptic arc.

    Int32 endAngle

    The ending angle of the elliptic arc.

    Point[] pts

    The array of points that define the polygon. The array must be large enough to hold the result.

    Int32 delta

    The angle between the subsequent polyline vertices. It defines the approximation accuracy.

    Returns
    Type Description
    Int32

    The total number of points stored into pts.

    | Improve this Doc View Source

    EncodeImage(String, Arr, Int32[])

    Encodes an image into a memory buffer.

    Declaration
    public static Mat EncodeImage(string ext, Arr image, params int[] parameters)
    Parameters
    Type Name Description
    String ext

    File extension that defines the output format.

    Arr image

    Image to be written.

    Int32[] parameters

    Optional image compression parameters.

    Returns
    Type Description
    Mat

    A newly created Mat containing the encoded image bytes.

    | Improve this Doc View Source

    EqualizeHist(Arr, Arr)

    Equalizes the histogram of a grayscale image.

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

    Source 8-bit single channel image.

    Arr dst

    Destination image of the same size and type as src.

    | Improve this Doc View Source

    Erode(Arr, Arr, IplConvKernel, Int32)

    Erodes an image by using a specific structuring element.

    Declaration
    public static void Erode(Arr src, Arr dst, IplConvKernel element = null, int iterations = 1)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    IplConvKernel element

    The structuring element used for erosion. If it is null, a 3x3 rectangular structuring element is used.

    Int32 iterations

    The number of times erosion is applied.

    | Improve this Doc View Source

    EstimateRigidTransform(Arr, Arr, Mat, Boolean)

    Estimates the optimal affine transformation between two images or two point sets.

    Declaration
    public static bool EstimateRigidTransform(Arr A, Arr B, Mat M, bool fullAffine)
    Parameters
    Type Name Description
    Arr A

    First input 2D point set stored as a Mat, or an image.

    Arr B

    Second input 2D point set of the same size and the same type as A, or another image.

    Mat M

    The output optimal 2x3 affine transformation matrix.

    Boolean fullAffine

    If true, the function finds an optimal affine transformation with no additional restrictions (6 degrees of freedom). Otherwise, the class of transformations to choose from is limited to combinations of translation, rotation, and uniform scaling (5 degrees of freedom).

    Returns
    Type Description
    Boolean

    true if the optimal affine transformation was successfully found; false otherwise.

    | Improve this Doc View Source

    Exp(Arr, Arr)

    Calculates the exponent of every array element.

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

    The source array.

    Arr dst

    The destination array, it should have double type or the same type as src.

    | Improve this Doc View Source

    FastArctan(Single, Single)

    Calculates the angle of a 2D vector.

    Declaration
    public static float FastArctan(float y, float x)
    Parameters
    Type Name Description
    Single y

    The y-coordinate of the 2D vector.

    Single x

    The x-coordinate of the 2D vector.

    Returns
    Type Description
    Single

    The full-range angle of an input 2D vector. The angle is measured in degrees and varies from 0 degrees to 360 degrees. The accuracy is about 0.1 degrees.

    | Improve this Doc View Source

    FillConvexPoly(Arr, Point[], Scalar, LineFlags, Int32)

    Fills a convex polygon.

    Declaration
    public static void FillConvexPoly(Arr img, Point[] pts, Scalar color, LineFlags lineType = default(LineFlags), int shift = 0)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    Point[] pts

    The array of points specifying a single convex polygon.

    Scalar color

    The color of the polygon.

    LineFlags lineType

    The algorithm used to draw the polygon boundaries.

    Int32 shift

    The number of fractional bits in the vertex coordinates.

    | Improve this Doc View Source

    FillPoly(Arr, Point[][], Scalar, LineFlags, Int32)

    Fills an area bounded by several polygonal contours.

    Declaration
    public static void FillPoly(Arr img, Point[][] pts, Scalar color, LineFlags lineType = default(LineFlags), int shift = 0)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    Point[][] pts

    The array of polygons bounding the area to fill.

    Scalar color

    The color of the filled area.

    LineFlags lineType

    The algorithm used to draw the polygon boundaries.

    Int32 shift

    The number of fractional bits in the vertex coordinates.

    | Improve this Doc View Source

    Filter2D(Arr, Arr, Mat)

    Convolves an image with the kernel.

    Declaration
    public static void Filter2D(Arr src, Arr dst, Mat kernel)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image of the same size and number of channels as src.

    Mat kernel

    The convolution kernel (or rather a correlation kernel), a single-channel floating point matrix.

    | Improve this Doc View Source

    Filter2D(Arr, Arr, Mat, Point)

    Convolves an image with the kernel.

    Declaration
    public static void Filter2D(Arr src, Arr dst, Mat kernel, Point anchor)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image of the same size and number of channels as src.

    Mat kernel

    The convolution kernel (or rather a correlation kernel), a single-channel floating point matrix.

    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; default value (-1,-1) means that the anchor is at the kernel center.

    | Improve this Doc View Source

    FindChessboardCorners(Arr, Size, Point2f[])

    Finds the positions of the internal corners of the chessboard.

    Declaration
    public static bool FindChessboardCorners(Arr image, Size patternSize, Point2f[] corners)
    Parameters
    Type Name Description
    Arr image

    Source chessboard view; it must be an 8-bit grayscale or color image.

    Size patternSize

    The number of inner corners per chessboard row and column (pointsPerRow,pointsPerColumn).

    Point2f[] corners

    The output array of detected corners.

    Returns
    Type Description
    Boolean

    true if all of the corners have been found and correctly reordered; false otherwise.

    | Improve this Doc View Source

    FindChessboardCorners(Arr, Size, Point2f[], out Int32, ChessboardCalibrationFlags)

    Finds the positions of the internal corners of the chessboard.

    Declaration
    public static bool FindChessboardCorners(Arr image, Size patternSize, Point2f[] corners, out int cornerCount, ChessboardCalibrationFlags flags = default(ChessboardCalibrationFlags))
    Parameters
    Type Name Description
    Arr image

    Source chessboard view; it must be an 8-bit grayscale or color image.

    Size patternSize

    The number of inner corners per chessboard row and column (pointsPerRow, pointsPerColumn).

    Point2f[] corners

    The output array of detected corners.

    Int32 cornerCount

    The output number of corners found.

    ChessboardCalibrationFlags flags

    Specifies operation flags.

    Returns
    Type Description
    Boolean

    true if all of the corners have been found and correctly reordered; false otherwise.

    | Improve this Doc View Source

    FindContours(Arr, MemStorage, out Seq)

    Finds the contours in a binary image.

    Declaration
    public static int FindContours(Arr image, MemStorage storage, out Seq firstContour)
    Parameters
    Type Name Description
    Arr image

    The source image, 8-bit single channel. Non-zero pixels are treated as ones, zero pixels remain zero, i.e. the image is treated as binary.

    MemStorage storage

    Container of the retrieved contours.

    Seq firstContour

    The reference to the first outer contour.

    Returns
    Type Description
    Int32

    The number of retrieved contours.

    | Improve this Doc View Source

    FindContours(Arr, MemStorage, out Seq, Int32, ContourRetrieval, ContourApproximation)

    Finds the contours in a binary image.

    Declaration
    public static int FindContours(Arr image, MemStorage storage, out Seq firstContour, int headerSize, ContourRetrieval mode = default(ContourRetrieval), ContourApproximation method = default(ContourApproximation))
    Parameters
    Type Name Description
    Arr image

    The source image, 8-bit single channel. Non-zero pixels are treated as ones, zero pixels remain zero, i.e. the image is treated as binary.

    MemStorage storage

    Container of the retrieved contours.

    Seq firstContour

    The reference to the first outer contour.

    Int32 headerSize

    Size of the sequence header.

    ContourRetrieval mode

    Specifies the contour retrieval mode.

    ContourApproximation method

    Specifies the contour approximation method.

    Returns
    Type Description
    Int32

    The number of retrieved contours.

    | Improve this Doc View Source

    FindContours(Arr, MemStorage, out Seq, Int32, ContourRetrieval, ContourApproximation, Point)

    Finds the contours in a binary image.

    Declaration
    public static int FindContours(Arr image, MemStorage storage, out Seq firstContour, int headerSize, ContourRetrieval mode, ContourApproximation method, Point offset)
    Parameters
    Type Name Description
    Arr image

    The 8-bit, single channel, binary source image.

    MemStorage storage

    Container of the retrieved contours.

    Seq firstContour

    The reference to the first outer contour.

    Int32 headerSize

    Size of the sequence header.

    ContourRetrieval mode

    Specifies the contour retrieval mode.

    ContourApproximation method

    Specifies the contour approximation method.

    Point offset

    An offset, by which every contour point is shifted. This is useful if the contours are extracted from an image ROI but should then be analyzed in the whole image context.

    Returns
    Type Description
    Int32

    The number of retrieved contours.

    | Improve this Doc View Source

    FindCornerSubPix(Arr, Point2f[], Size, Size, TermCriteria)

    Refines the corner locations.

    Declaration
    public static void FindCornerSubPix(Arr image, Point2f[] corners, Size win, Size zeroZone, TermCriteria criteria)
    Parameters
    Type Name Description
    Arr image

    Input image.

    Point2f[] corners

    Initial coordinates of the input corners; refined coordinates on output.

    Size win

    Half of the side length of the search window.

    Size zeroZone

    Half of the size of the dead region in the middle of the search zone over which the summation 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 size.

    TermCriteria criteria

    Criteria for termination of the iterative process of corner refinement.

    | Improve this Doc View Source

    FindExtrinsicCameraParams2(Mat, Mat, Mat, Mat, Mat, Mat, Boolean)

    Finds the object pose from the 3D-2D point correspondences.

    Declaration
    public static void FindExtrinsicCameraParams2(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distortionCoeffs, Mat rotationVector, Mat translationVector, bool useExtrinsicGuess = false)
    Parameters
    Type Name Description
    Mat objectPoints

    The array of object points in the object coordinate space, 3xN or Nx3 1-channel, or 1xN or Nx1 3-channel, where N is the number of points.

    Mat imagePoints

    The array of corresponding image points, 2xN or Nx2 1-channel or 1xN or Nx1 2-channel, where N is the number of points.

    Mat cameraMatrix

    The camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Mat distortionCoeffs

    The input vector of distortion coefficients of 4,5 or 8 elements. If it is null, the zero distortion coefficients are assumed.

    Mat rotationVector

    The output rotation vector (see Rodrigues2(Mat, Mat, Mat)) that (together with translationVector) brings points from the model coordinate system to the camera coordinate system.

    Mat translationVector

    The output translation vector.

    Boolean useExtrinsicGuess

    If true, the function will use the provided rotationVector and translationVector as the initial approximations of the rotation and translation vectors, respectively, and will further optimize them.

    | Improve this Doc View Source

    FindFundamentalMat(Mat, Mat, Mat, FundamentalMatrixMethod, Double, Double, Mat)

    Calculates the fundamental matrix from the corresponding points in two images.

    Declaration
    public static int FindFundamentalMat(Mat points1, Mat points2, Mat fundamentalMatrix, FundamentalMatrixMethod method = default(FundamentalMatrixMethod), double param1 = null, double param2 = 0.99, Mat status = null)
    Parameters
    Type Name Description
    Mat points1

    Array of N points from the first image. It can be 2xN, Nx2, 3xN or Nx3 1-channel array or 1xN or Nx1 2- or 3-channel array. The point coordinates should be floating-point (single or double precision).

    Mat points2

    Array of the second image points of the same size and format as points1.

    Mat fundamentalMatrix

    The output fundamental matrix or matrices. The size should be 3x3 or 9x3 (7-point method may return up to 3 matrices).

    FundamentalMatrixMethod method

    Method for computing the fundamental matrix.

    Double param1

    The parameter is used for RANSAC. It is the maximum distance from the point to the 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 image noise.

    Double param2

    The parameter is used for RANSAC or LMedS methods only. It specifies the desirable level of confidence (probability) that the estimated matrix is correct.

    Mat status

    The optional 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 RANSAC and LMedS methods. For other methods it is set to all 1's.

    Returns
    Type Description
    Int32

    The number of fundamental matrices found (1 or 3) or 0, if no matrix is found. Normally just one matrix is found, but in the case of 7-point algorithm the function may return up to 3 solutions (9x3 matrix that stores all 3 matrices sequentially).

    | Improve this Doc View Source

    FindHomography(Mat, Mat, Mat, FindHomographyMethod, Double, Mat)

    Finds the perspective transformation between two planes.

    Declaration
    public static bool FindHomography(Mat srcPoints, Mat dstPoints, Mat homography, FindHomographyMethod method = default(FindHomographyMethod), double ransacReprojThreshold = null, Mat mask = null)
    Parameters
    Type Name Description
    Mat srcPoints

    Coordinates of the points in the original plane, 2xN, Nx2, 3xN or Nx3 1-channel array (the latter two are for representation in homogeneous coordinates), where N is the number of points. 1xN or Nx1 2- or 3-channel array can also be passed.

    Mat dstPoints

    Point coordinates in the destination plane, 2xN, Nx2, 3xN or Nx3 1-channel, or 1xN or Nx1 2- or 3-channel array.

    Mat homography

    The output 3x3 homography matrix.

    FindHomographyMethod method

    The method used to compute the homography matrix.

    Double ransacReprojThreshold

    The maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC method only).

    Mat mask

    The optional output mask set by a robust method (Ransac or LMedS).

    Returns
    Type Description
    Boolean

    A value indicating whether the homography matrix calculation was successful.

    | Improve this Doc View Source

    FitEllipse2(CVHandle)

    Fits an ellipse around a set of 2D points.

    Declaration
    public static RotatedRect FitEllipse2(CVHandle points)
    Parameters
    Type Name Description
    CVHandle points

    Sequence or array of points.

    Returns
    Type Description
    RotatedRect

    The rotated rectangle representing the ellipse best fit around the point set. The size of the box represents the full lengths of the ellipse axes.

    | Improve this Doc View Source

    FitLine(Arr, DistanceType, Double, Double, Double, Single[])

    Fits line to 2D or 3D point set.

    Declaration
    public static void FitLine(Arr points, DistanceType distType, double param, double reps, double aeps, float[] line)
    Parameters
    Type Name Description
    Arr points

    Sequence or array of 2D or 3D points with 32-bit integer or floating-point coordinates.

    DistanceType distType

    The distance used for fitting.

    Double param

    Numerical parameter (C) for some types of distances, if 0 then some optimal value is chosen.

    Double reps

    Sufficient accuracy for radius (distance between the coordinate origin and the line); 0.01 would be a good default.

    Double aeps

    Sufficient accuracy for angle; 0.01 would be a good default.

    Single[] line

    The output line parameters. In case of 2D fitting it is an array of 4 floats (vx, vy, x0, y0) where (vx, vy) is a normalized vector collinear to the line and (x0, y0) is some point on the line. In case of 3D fitting it is an array of 6 floats (vx, vy, vz, x0, y0, z0) where (vx, vy, vz) is a normalized vector collinear to the line and (x0, y0, z0) is some point on the line.

    | Improve this Doc View Source

    Flip(Arr, Arr, FlipMode)

    Flips a 2D array around vertical, horizontal or both axes.

    Declaration
    public static void Flip(Arr src, Arr dst = null, FlipMode flipMode = default(FlipMode))
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array. If it is null, the flipping is done in place.

    FlipMode flipMode

    A value that specifies how to flip the array.

    | Improve this Doc View Source

    FloodFill(Arr, Point, Scalar)

    Fills a connected component with the given color.

    Declaration
    public static void FloodFill(Arr image, Point seedPoint, Scalar newVal)
    Parameters
    Type Name Description
    Arr image

    Input/output 1- or 3-channel, 8-bit or floating-point image. It is modified by the function unless MaskOnly is set.

    Point seedPoint

    The starting point.

    Scalar newVal

    New value of the repainted domain pixels.

    | Improve this Doc View Source

    FloodFill(Arr, Point, Scalar, Scalar)

    Fills a connected component with the given color.

    Declaration
    public static void FloodFill(Arr image, Point seedPoint, Scalar newVal, Scalar lowerDiff)
    Parameters
    Type Name Description
    Arr image

    Input/output 1- or 3-channel, 8-bit or floating-point image. It is modified by the function unless MaskOnly is set.

    Point seedPoint

    The starting point.

    Scalar newVal

    New value of the repainted domain pixels.

    Scalar lowerDiff

    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.

    | Improve this Doc View Source

    FloodFill(Arr, Point, Scalar, Scalar, Scalar)

    Fills a connected component with the given color.

    Declaration
    public static void FloodFill(Arr image, Point seedPoint, Scalar newVal, Scalar lowerDiff, Scalar upperDiff)
    Parameters
    Type Name Description
    Arr image

    Input/output 1- or 3-channel, 8-bit or floating-point image. It is modified by the function unless MaskOnly is set.

    Point seedPoint

    The starting point.

    Scalar newVal

    New value of the repainted domain pixels.

    Scalar lowerDiff

    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.

    Scalar upperDiff

    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.

    | Improve this Doc View Source

    FloodFill(Arr, Point, Scalar, Scalar, Scalar, out ConnectedComp, FloodFillFlags, Arr)

    Fills a connected component with the given color.

    Declaration
    public static void FloodFill(Arr image, Point seedPoint, Scalar newVal, Scalar lowerDiff, Scalar upperDiff, out ConnectedComp comp, FloodFillFlags flags = default(FloodFillFlags), Arr mask = null)
    Parameters
    Type Name Description
    Arr image

    Input/output 1- or 3-channel, 8-bit or floating-point image. It is modified by the function unless MaskOnly is set.

    Point seedPoint

    The starting point.

    Scalar newVal

    New value of the repainted domain pixels.

    Scalar lowerDiff

    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.

    Scalar upperDiff

    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.

    ConnectedComp comp

    Output parameter that will be initialized with information about the repainted domain.

    FloodFillFlags flags

    The operation flags.

    Arr mask

    Operation mask, should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller than image.

    | Improve this Doc View Source

    Free(ref IntPtr)

    Deallocates a block of memory previously allocated by a call to Alloc(UIntPtr).

    Declaration
    public static void Free(ref IntPtr ptr)
    Parameters
    Type Name Description
    IntPtr ptr

    Pointer to a memory block previously allocated with Alloc(UIntPtr).

    | Improve this Doc View Source

    GEMM(Arr, Arr, Double, Arr, Double, Arr, GemmFlags)

    Performs generalized matrix multiplication.

    Declaration
    public static void GEMM(Arr src1, Arr src2, double alpha, Arr src3, double beta, Arr dst, GemmFlags tABC = default(GemmFlags))
    Parameters
    Type Name Description
    Arr src1

    The first source array.

    Arr src2

    The second source array.

    Double alpha

    A scale factor for the multiplication.

    Arr src3

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

    Double beta

    A scale factor for the shift.

    Arr dst

    The destination array.

    GemmFlags tABC

    The operation flags, used to indicate whether any of the inputs should be transposed.

    | Improve this Doc View Source

    GetAffineTransform(Point2f[], Point2f[], Mat)

    Calculates the affine transform from three corresponding points.

    Declaration
    public static Mat GetAffineTransform(Point2f[] src, Point2f[] dst, Mat mapMatrix)
    Parameters
    Type Name Description
    Point2f[] src

    Coordinates of three triangle vertices in the source image.

    Point2f[] dst

    Coordinates of the three corresponding triangle vertices in the destination image.

    Mat mapMatrix

    The destination 2 x 3 transformation matrix.

    Returns
    Type Description
    Mat

    The destination 2 x 3 transformation matrix.

    | Improve this Doc View Source

    GetOptimalDFTSize(Int32)

    Returns optimal DFT size for a given vector size.

    Declaration
    public static int GetOptimalDFTSize(int size0)
    Parameters
    Type Name Description
    Int32 size0

    The vector size.

    Returns
    Type Description
    Int32

    The minimum number N that is greater than or equal to size0, such that the DFT of a vector of size N can be computed fast.

    | Improve this Doc View Source

    GetOptimalNewCameraMatrix(Mat, Mat, Size, Double, Mat)

    Returns the new camera matrix based on the free scaling parameter.

    Declaration
    public static void GetOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Mat newCameraMatrix)
    Parameters
    Type Name Description
    Mat cameraMatrix

    The input camera matrix.

    Mat distCoeffs

    The input 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients (k1, k2, p1, p2[, k3]). If the vector is null, the zero distortion coefficients are assumed.

    Size imageSize

    The original image size.

    Double alpha

    The free scaling parameter between 0 (when all the pixels in the undistorted image will be valid) and 1 (when all the source image pixels will be retained in the undistorted image); see StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double, Size).

    Mat newCameraMatrix

    The output new camera matrix.

    | Improve this Doc View Source

    GetOptimalNewCameraMatrix(Mat, Mat, Size, Double, Mat, Size)

    Returns the new camera matrix based on the free scaling parameter.

    Declaration
    public static void GetOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Mat newCameraMatrix, Size newImageSize)
    Parameters
    Type Name Description
    Mat cameraMatrix

    The input camera matrix.

    Mat distCoeffs

    The input 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients (k1, k2, p1, p2[, k3]). If the vector is null, the zero distortion coefficients are assumed.

    Size imageSize

    The original image size.

    Double alpha

    The free scaling parameter between 0 (when all the pixels in the undistorted image will be valid) and 1 (when all the source image pixels will be retained in the undistorted image); see StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double, Size).

    Mat newCameraMatrix

    The output new camera matrix.

    Size newImageSize

    The image size after rectification. By default it will be set to imageSize.

    | Improve this Doc View Source

    GetOptimalNewCameraMatrix(Mat, Mat, Size, Double, Mat, Size, out Rect, Boolean)

    Returns the new camera matrix based on the free scaling parameter.

    Declaration
    public static void GetOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Mat newCameraMatrix, Size newImageSize, out Rect validPixelROI, bool centerPrincipalPoint = false)
    Parameters
    Type Name Description
    Mat cameraMatrix

    The input camera matrix.

    Mat distCoeffs

    The input 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients (k1, k2, p1, p2[, k3]). If the vector is null, the zero distortion coefficients are assumed.

    Size imageSize

    The original image size.

    Double alpha

    The free scaling parameter between 0 (when all the pixels in the undistorted image will be valid) and 1 (when all the source image pixels will be retained in the undistorted image); see StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double, Size).

    Mat newCameraMatrix

    The output new camera matrix.

    Size newImageSize

    The image size after rectification. By default it will be set to imageSize.

    Rect validPixelROI

    The optional output rectangle that will outline all-good-pixels region in the undistorted image.

    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.

    | Improve this Doc View Source

    GetPerspectiveTransform(Point2f[], Point2f[], Mat)

    Calculates the perspective transform from four corresponding points.

    Declaration
    public static Mat GetPerspectiveTransform(Point2f[] src, Point2f[] dst, Mat mapMatrix)
    Parameters
    Type Name Description
    Point2f[] src

    Coordinates of four quadrangle vertices in the source image.

    Point2f[] dst

    Coordinates of the four corresponding quadrangle vertices in the destination image.

    Mat mapMatrix

    The destination 3 x 3 transformation matrix.

    Returns
    Type Description
    Mat

    The destination 3 x 3 transformation matrix.

    | Improve this Doc View Source

    GetQuadrangleSubPix(Arr, Arr, Mat)

    Retrieves the pixel quadrangle from an image with sub-pixel accuracy.

    Declaration
    public static void GetQuadrangleSubPix(Arr src, Arr dst, Mat mapMatrix)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image containing the extracted quadrangle.

    Mat mapMatrix

    The 2 x 3 transformation matrix.

    | Improve this Doc View Source

    GetRectSubPix(Arr, Arr, Point2f)

    Retrieves the pixel rectangle from an image with sub-pixel accuracy.

    Declaration
    public static void GetRectSubPix(Arr src, Arr dst, Point2f center)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image containing the extracted rectangle.

    Point2f center

    Floating point coordinates of the extracted rectangle center within the source image. The center must be inside the image.

    | Improve this Doc View Source

    GetRotationMatrix2D(Point2f, Double, Double, Mat)

    Calculates the affine matrix of 2d rotation.

    Declaration
    public static Mat GetRotationMatrix2D(Point2f center, double angle, double scale, Mat mapMatrix)
    Parameters
    Type Name Description
    Point2f center

    Center of the rotation in the source image.

    Double angle

    The rotation angle in degrees. Positive values mean counter-clockwise rotation (the coordinate origin is assumed to be the top-left corner).

    Double scale

    Isotropic scale factor.

    Mat mapMatrix

    The destination 2 x 3 transformation matrix.

    Returns
    Type Description
    Mat

    The destination 2 x 3 transformation matrix.

    | Improve this Doc View Source

    GetTextSize(String, Font, out Size, out Int32)

    Retrieves the width and height of a text string.

    Declaration
    public static void GetTextSize(string text, Font font, out Size textSize, out int baseline)
    Parameters
    Type Name Description
    String text

    The input string that is to be measured.

    Font font

    The font style used to render the text strokes.

    Size textSize

    The resultant size of the text string. Height of the text does not include the height of character parts that are below the baseline.

    Int32 baseline

    The y-coordinate of the baseline relative to the bottom-most text point.

    | Improve this Doc View Source

    GoodFeaturesToTrack(Arr, Arr, Arr, Point2f[], out Int32, Double, Double, Arr, Int32, Boolean, Double)

    Determines strong corners on an image.

    Declaration
    public static void GoodFeaturesToTrack(Arr image, Arr eigImage, Arr tempImage, Point2f[] corners, out int cornerCount, double qualityLevel, double minDistance, Arr mask = null, int blockSize = 3, bool useHarris = false, double k = 0.04)
    Parameters
    Type Name Description
    Arr image

    The source 8-bit or floating-point 32-bit, single-channel image.

    Arr eigImage

    Temporary floating-point 32-bit image, the same size as image.

    Arr tempImage

    Another temporary image, the same size and format as eigImage.

    Point2f[] corners

    Output parameter; detected corners.

    Int32 cornerCount

    Output parameter; number of detected corners.

    Double qualityLevel

    Multiplier for the max/min eigenvalue; specifies the minimal accepted quality of image corners.

    Double minDistance

    Limit, specifying the minimum possible distance between the returned corners; Euclidian distance is used.

    Arr mask

    Region of interest. The function selects points either in the specified region or in the whole image if the mask is null.

    Int32 blockSize

    Size of the averaging block, passed to the underlying corner detection method.

    Boolean useHarris

    If true, Harris operator (CornerHarris(Arr, Arr, Int32, Int32, Double)) is used instead of default (CornerMinEigenVal(Arr, Arr, Int32, Int32)).

    Double k

    Free parameter of Harris detector; used only if useHarris is true.

    | Improve this Doc View Source

    HoughCircles(Arr, CVHandle, HoughCirclesMethod, Double, Double, Double, Double, Int32, Int32)

    Finds circles in a grayscale image using a Hough transform.

    Declaration
    public static Seq HoughCircles(Arr image, CVHandle circleStorage, HoughCirclesMethod method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius)
    Parameters
    Type Name Description
    Arr image

    The 8-bit, single-channel, grayscale input image.

    CVHandle circleStorage

    The storage for the circles that are detected. It can be a memory storage (in this case a sequence of circles is created in the storage and returned by the function) or single row/single column matrix (Mat) of a particular type.

    HoughCirclesMethod method

    The Hough transform method. Currently, only Gradient is implemented.

    Double dp

    The inverse ratio of the accumulator resolution to the image resolution. For example, if dp = 1, the accumulator will have the same resolution as the input image, if dp = 2 the accumulator will have half as big width and height, etc.

    Double minDist

    Minimum distance between the centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed.

    Double param1

    The first method-specific parameter. in the case of Gradient it is the higher threshold of the two passed to the canny edge detector (the lower one will be twice smaller).

    Double param2

    The second method-specific parameter. in the case of Gradient it is the accumulator threshold at the center detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first.

    Int32 minRadius

    Minimum circle radius.

    Int32 maxRadius

    Maximum circle radius.

    Returns
    Type Description
    Seq

    A sequence of lines in case circleStorage is a memory storage.

    | Improve this Doc View Source

    HoughLines2(Arr, CVHandle, HoughLinesMethod, Double, Double, Int32, Double, Double)

    Finds lines in a binary image using a Hough transform.

    Declaration
    public static Seq HoughLines2(Arr image, CVHandle lineStorage, HoughLinesMethod method, double rho, double theta, int threshold, double param1, double param2)
    Parameters
    Type Name Description
    Arr image

    The 8-bit, single-channel, binary source image. In the case of a probabilistic method, the image is modified by the function.

    CVHandle lineStorage

    The storage for the lines that are detected. It can be a memory storage (in this case a sequence of lines is created in the storage and returned by the function) or single row/single column matrix (Mat) of a particular type.

    HoughLinesMethod method

    The Hough transform variant.

    Double rho

    Distance resolution in pixel-related units.

    Double theta

    Angle resolution measured in radians.

    Int32 threshold

    Threshold parameter. A line is returned by the function if the corresponding accumulator value is greater than threshold.

    Double param1

    The first method-dependent parameter. For the classical Hough transform it is not used. For the probabilistic Hough transform it is the minimum line length. For the multi-scale Hough transform it is the divisor for the distance resolution rho.

    Double param2

    The second method-dependent parameter. For the classical Hough transform it is not used. For the probabilistic Hough transform it is the maximum gap between line segments lying on the same line to treat them as a single line segment (i.e. to join them). For the multi-scale Hough transform it is the divisor for the angle resolution theta.

    Returns
    Type Description
    Seq

    A sequence of lines in case lineStorage is a memory storage.

    | Improve this Doc View Source

    InitIntrinsicParams2D(Mat, Mat, Mat, Size, Mat, Double)

    Finds the initial camera matrix from the 3D-2D point correspondences.

    Declaration
    public static void InitIntrinsicParams2D(Mat objectPoints, Mat imagePoints, Mat npoints, Size imageSize, Mat cameraMatrix, double aspectRatio = null)
    Parameters
    Type Name Description
    Mat objectPoints

    The joint array of object points; see CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags).

    Mat imagePoints

    The joint array of object point projections; see CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags).

    Mat npoints

    The array of point counts; see CalibrateCamera2(Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, CameraCalibrationFlags).

    Size imageSize

    The image size in pixels; used to initialize the principal point.

    Mat cameraMatrix

    The output camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Double aspectRatio

    If it is zero or negative, both fx and fy are estimated independently. Otherwise fx = fy * aspectRatio.

    | Improve this Doc View Source

    InitUndistortMap(Mat, Mat, Arr, Arr)

    Computes an undistortion map.

    Declaration
    public static void InitUndistortMap(Mat cameraMatrix, Mat distortionCoeffs, Arr mapx, Arr mapy)
    Parameters
    Type Name Description
    Mat cameraMatrix

    The input camera matrix.

    Mat distortionCoeffs

    The 4 or 5 element vector of distortion coefficients.

    Arr mapx

    The output map of x-coordinates, 32-bit single-channel floating-point image or 16-bit 2-channel signed integer image. Fixed-point version is faster.

    Arr mapy

    The output map of y-coordinates, 32-bit single-channel floating-point image or 16-bit single-channel unsigned integer image. Fixed-point version is faster.

    | Improve this Doc View Source

    InitUndistortRectifyMap(Mat, Mat, Mat, Mat, Arr, Arr)

    Computes the undistortion and rectification transformation map.

    Declaration
    public static void InitUndistortRectifyMap(Mat cameraMatrix, Mat distortionCoeffs, Mat R, Mat newCameraMatrix, Arr mapx, Arr mapy)
    Parameters
    Type Name Description
    Mat cameraMatrix

    The input camera matrix.

    Mat distortionCoeffs

    The 4 or 5 element vector of distortion coefficients.

    Mat R

    The optional rectification transformation in object space (3x3 matrix). If it is null the identity transform is used.

    Mat newCameraMatrix

    The new camera matrix.

    Arr mapx

    The output map of x-coordinates, 32-bit single-channel floating-point image or 16-bit 2-channel signed integer image. Fixed-point version is faster.

    Arr mapy

    The output map of y-coordinates, 32-bit single-channel floating-point image or 16-bit single-channel unsigned integer image. Fixed-point version is faster.

    | Improve this Doc View Source

    Inpaint(Arr, Arr, Arr, Double, InpaintMethod)

    Restores the selected region in an image using the region neighborhood.

    Declaration
    public static void Inpaint(Arr src, Arr inpaintMask, Arr dst, double inpaintRange, InpaintMethod flags)
    Parameters
    Type Name Description
    Arr src

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

    Arr inpaintMask

    Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted.

    Arr dst

    Output image with the same size and type as src.

    Double inpaintRange

    Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.

    InpaintMethod flags

    Specifies the inpainting method.

    | Improve this Doc View Source

    InRange(Arr, Arr, Arr, Arr)

    Checks that array elements lie between the elements of two other arrays.

    Declaration
    public static void InRange(Arr src, Arr lower, Arr upper, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Arr lower

    The inclusive lower boundary array.

    Arr upper

    The exclusive upper boundary array.

    Arr dst

    The destination array. It must have U8 or S8 type.

    | Improve this Doc View Source

    InRangeS(Arr, Scalar, Scalar, Arr)

    Checks that array elements lie between two scalars.

    Declaration
    public static void InRangeS(Arr src, Scalar lower, Scalar upper, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Scalar lower

    The inclusive lower boundary.

    Scalar upper

    The exclusive upper boundary.

    Arr dst

    The destination array. It must have U8 or S8 type.

    | Improve this Doc View Source

    Integral(Arr, Arr, Arr, Arr)

    Calculates the integral of an image.

    Declaration
    public static void Integral(Arr image, Arr sum, Arr sqsum = null, Arr tiltedSum = null)
    Parameters
    Type Name Description
    Arr image

    The source image, W x H, 8-bit or floating-point (32f or 64f).

    Arr sum

    The integral image, (W + 1) x (H + 1), 32-bit integer or double precision floating-point (64f).

    Arr sqsum

    The optional integral image for squared pixel values, (W + 1) x (H + 1), double precision floating-point (64f).

    Arr tiltedSum

    The integral for the image rotated by 45 degrees, the same data type as sum.

    | Improve this Doc View Source

    Invert(Arr, Arr, InversionMethod)

    Finds the inverse or pseudo-inverse of a matrix.

    Declaration
    public static double Invert(Arr src, Arr dst, InversionMethod method = default(InversionMethod))
    Parameters
    Type Name Description
    Arr src

    The source matrix.

    Arr dst

    The destination matrix.

    InversionMethod method

    The inversion method.

    Returns
    Type Description
    Double

    The inversed condition of src (ratio of the smallest singular value to the largest singular value) or 0 if src is all zeros.

    | Improve this Doc View Source

    KMeans2(Arr, Int32, Arr, TermCriteria, Int32)

    Finds centers of clusters and groups input samples around the clusters.

    Declaration
    public static int KMeans2(Arr samples, int clusterCount, Arr labels, TermCriteria criteria, int attempts = 1)
    Parameters
    Type Name Description
    Arr samples

    The floating-point matrix of input samples, one row per sample.

    Int32 clusterCount

    The number of clusters to split the set by.

    Arr labels

    The input/output integer array that stores the cluster indices for every sample.

    TermCriteria criteria

    The algorithm termination criteria, that is, the maximum number of iterations and/or the desired accuracy.

    Int32 attempts

    Specifies the number of times the algorithm is executed using different initial labelings. The algorithm returns the labels that yield the best compactness (see the last parameter).

    Returns
    Type Description
    Int32

    The compactness measure for the best clustering attempt.

    | Improve this Doc View Source

    KMeans2(Arr, Int32, Arr, TermCriteria, Int32, ref UInt64, KMeansFlags, Arr)

    Finds centers of clusters and groups input samples around the clusters.

    Declaration
    public static int KMeans2(Arr samples, int clusterCount, Arr labels, TermCriteria criteria, int attempts, ref ulong rng, KMeansFlags flags = default(KMeansFlags), Arr centers = null)
    Parameters
    Type Name Description
    Arr samples

    The floating-point matrix of input samples, one row per sample.

    Int32 clusterCount

    The number of clusters to split the set by.

    Arr labels

    The input/output integer array that stores the cluster indices for every sample.

    TermCriteria criteria

    The algorithm termination criteria, that is, the maximum number of iterations and/or the desired accuracy.

    Int32 attempts

    Specifies the number of times the algorithm is executed using different initial labelings. The algorithm returns the labels that yield the best compactness (see the last parameter).

    UInt64 rng

    The random number generator state initialized by Rng(Int64).

    KMeansFlags flags

    The operation flags for the k-means algorithm.

    Arr centers

    The output matrix of the cluster centers, one row per each cluster center.

    Returns
    Type Description
    Int32

    The compactness measure for the best clustering attempt.

    | Improve this Doc View Source

    KMeans2(Arr, Int32, Arr, TermCriteria, Int32, ref UInt64, KMeansFlags, Arr, out Double)

    Finds centers of clusters and groups input samples around the clusters.

    Declaration
    public static int KMeans2(Arr samples, int clusterCount, Arr labels, TermCriteria criteria, int attempts, ref ulong rng, KMeansFlags flags, Arr centers, out double compactness)
    Parameters
    Type Name Description
    Arr samples

    The floating-point matrix of input samples, one row per sample.

    Int32 clusterCount

    The number of clusters to split the set by.

    Arr labels

    The input/output integer array that stores the cluster indices for every sample.

    TermCriteria criteria

    The algorithm termination criteria, that is, the maximum number of iterations and/or the desired accuracy.

    Int32 attempts

    Specifies the number of times the algorithm is executed using different initial labelings. The algorithm returns the labels that yield the best compactness (see the last parameter).

    UInt64 rng

    The random number generator state initialized by Rng(Int64).

    KMeansFlags flags

    The operation flags for the k-means algorithm.

    Arr centers

    The output matrix of the cluster centers, one row per each cluster center.

    Double compactness

    When this method returns, contains the compactness measure for the best clustering attempt.

    Returns
    Type Description
    Int32

    The compactness measure for the best clustering attempt.

    | Improve this Doc View Source

    Laplace(Arr, Arr, Int32)

    Calculates the Laplacian of an image.

    Declaration
    public static void Laplace(Arr src, Arr dst, int apertureSize = 3)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Int32 apertureSize

    Size of the extended Sobel kernel used to compute derivatives, must be 1, 3, 5 or 7.

    | Improve this Doc View Source

    Line(Arr, Point, Point, Scalar, Int32, LineFlags, Int32)

    Draws a line segment connecting two points.

    Declaration
    public static void Line(Arr img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineFlags lineType = default(LineFlags), int shift = 0)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    Point pt1

    The first point of the line segment.

    Point pt2

    The second point of the line segment.

    Scalar color

    The color of the line.

    Int32 thickness

    The thickness of the line.

    LineFlags lineType

    The algorithm used to draw the line.

    Int32 shift

    The number of fractional bits in the point coordinates.

    | Improve this Doc View Source

    LinearPolar(Arr, Arr, Point2f, Double, WarpFlags)

    Performs forward or inverse linear-polar image transform. The function emulates human "foveal" vision. In-place operation is not supported.

    Declaration
    public static void LinearPolar(Arr src, Arr dst, Point2f center, double maxRadius, WarpFlags flags = default(WarpFlags))
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Point2f center

    The transformation center; where the output precision is maximal.

    Double maxRadius

    The maximum radius of polar transformation.

    WarpFlags flags

    A combination of interpolation methods and operational flags.

    | Improve this Doc View Source

    LineIterator(Arr, Point, Point, LineType, Boolean)

    Steps through all image points on the raster line between pt1 and pt2.

    Declaration
    public static IEnumerable<Scalar> LineIterator(Arr image, Point pt1, Point pt2, LineType connectivity = default(LineType), bool leftToRight = false)
    Parameters
    Type Name Description
    Arr image

    The image to sample the line from.

    Point pt1

    The first ending point of the line segment.

    Point pt2

    The second ending point of the line segment.

    LineType connectivity

    The scanned line connectivity for Bresenham's algorithm, either 4 or 8.

    Boolean leftToRight

    If true the line is scanned from the leftmost point to the rightmost point, otherwise it will be scanned in the specified order, from pt1 to pt2.

    Returns
    Type Description
    IEnumerable<Scalar>

    An whose elements are the result of scanning the image points along the raster line between pt1 and pt2.

    | Improve this Doc View Source

    Load<TElement>(String, MemStorage, String)

    Loads an object from a file.

    Declaration
    public static TElement Load<TElement>(string fileName, MemStorage storage = null, string name = null)
        where TElement : CVHandle
    Parameters
    Type Name Description
    String fileName

    The file path to be loaded.

    MemStorage storage

    Memory storage for dynamic structures, such as Seq or Graph. It is not used for matrices or images.

    String name

    Optional object name. If it is null, the first top-level object in the storage will be loaded.

    Returns
    Type Description
    TElement

    The loaded object instance.

    Type Parameters
    Name Description
    TElement

    The type of object to load.

    | Improve this Doc View Source

    Load<TElement>(String, MemStorage, String, out String)

    Loads an object from a file.

    Declaration
    public static TElement Load<TElement>(string fileName, MemStorage storage, string name, out string realName)
        where TElement : CVHandle
    Parameters
    Type Name Description
    String fileName

    The file path to be loaded.

    MemStorage storage

    Memory storage for dynamic structures, such as Seq or Graph. It is not used for matrices or images.

    String name

    Optional object name. If it is null, the first top-level object in the storage will be loaded.

    String realName

    Optional output parameter that will contain the name of the loaded object.

    Returns
    Type Description
    TElement

    The loaded object instance.

    Type Parameters
    Name Description
    TElement

    The type of object to load.

    | Improve this Doc View Source

    LoadImage(String, LoadImageFlags)

    Loads an image from a file as an IplImage.

    Declaration
    public static IplImage LoadImage(string fileName, LoadImageFlags colorType)
    Parameters
    Type Name Description
    String fileName

    Name of file to be loaded.

    LoadImageFlags colorType

    Specific color type of the loaded image.

    Returns
    Type Description
    IplImage

    The newly loaded image.

    | Improve this Doc View Source

    LoadImageM(String, LoadImageFlags)

    Loads an image from a file as a Mat.

    Declaration
    public static Mat LoadImageM(string fileName, LoadImageFlags colorType)
    Parameters
    Type Name Description
    String fileName

    Name of file to be loaded.

    LoadImageFlags colorType

    Specific color type of the loaded image.

    Returns
    Type Description
    Mat

    The newly loaded image.

    | Improve this Doc View Source

    Log(Arr, Arr)

    Calculates the natural logarithm of every array element’s absolute value.

    Declaration
    public static void Log(Arr src, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array, it should have double type or the same type as src.

    | Improve this Doc View Source

    LogPolar(Arr, Arr, Point2f, Double, WarpFlags)

    Performs forward or inverse log-polar image transform. The function emulates human "foveal" vision. In-place operation is not supported.

    Declaration
    public static void LogPolar(Arr src, Arr dst, Point2f center, double M, WarpFlags flags = default(WarpFlags))
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Point2f center

    The transformation center; where the output precision is maximal.

    Double M

    Magnitude scale parameter for polar transformation.

    WarpFlags flags

    A combination of interpolation methods and operational flags.

    | Improve this Doc View Source

    LUT(Arr, Arr, Arr)

    Performs a look-up transformation of the source array.

    Declaration
    public static void LUT(Arr src, Arr dst, Arr lut)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Arr dst

    The destination array.

    Arr lut

    The look-up table array. Elements of src are used as indices in this 256-element table.

    | Improve this Doc View Source

    Mahalanobis(Arr, Arr, Arr)

    Calculates the Mahalonobis distance between two vectors.

    Declaration
    public static double Mahalanobis(Arr vec1, Arr vec2, Arr mat)
    Parameters
    Type Name Description
    Arr vec1

    The first 1D source vector.

    Arr vec2

    The second 1D source vector.

    Arr mat

    The inverse covariance matrix.

    Returns
    Type Description
    Double

    The weighted Mahalanobis distance between two vectors.

    | Improve this Doc View Source

    MatchShapes(CVHandle, CVHandle, ShapeMatchingMethod, Double)

    Compares two shapes using their Hu moments.

    Declaration
    public static double MatchShapes(CVHandle object1, CVHandle object2, ShapeMatchingMethod method, double parameter = null)
    Parameters
    Type Name Description
    CVHandle object1

    First contour or grayscale image.

    CVHandle object2

    Second contour or grayscale image.

    ShapeMatchingMethod method

    The shape comparison method.

    Double parameter

    Method-specific parameter (not used).

    Returns
    Type Description
    Double

    The distance between the two shapes.

    | Improve this Doc View Source

    MatchTemplate(Arr, Arr, Arr, TemplateMatchingMethod)

    Compares a template against overlapped image regions.

    Declaration
    public static void MatchTemplate(Arr image, Arr templ, Arr result, TemplateMatchingMethod method)
    Parameters
    Type Name Description
    Arr image

    The image where the search is running; should be 8-bit or 32-bit floating-point.

    Arr templ

    Searched template; must not be greater than image and have the same data type.

    Arr result

    A map of comparison results; single-channel 32-bit floating-point.

    TemplateMatchingMethod method

    Specifies the way the template must be compared with the image regions.

    | Improve this Doc View Source

    MatMul(Arr, Arr, Arr)

    Performs generalized matrix multiplication.

    Declaration
    public static void MatMul(Arr src1, Arr src2, Arr dst)
    Parameters
    Type Name Description
    Arr src1

    The first source array.

    Arr src2

    The second source array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    MatMulAdd(Arr, Arr, Arr, Arr)

    Performs generalized matrix multiplication.

    Declaration
    public static void MatMulAdd(Arr src1, Arr src2, Arr src3, Arr dst)
    Parameters
    Type Name Description
    Arr src1

    The first source array.

    Arr src2

    The second source array.

    Arr src3

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

    Arr dst

    The destination array.

    | Improve this Doc View Source

    Max(Arr, Arr, Arr)

    Finds per-element maximum of two arrays.

    Declaration
    public static void Max(Arr src1, Arr src2, Arr dst)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    MaxRect(Rect, Rect)

    Finds minimum rectangle containing two given rectangles.

    Declaration
    public static Rect MaxRect(Rect rect1, Rect rect2)
    Parameters
    Type Name Description
    Rect rect1

    The first rectangle.

    Rect rect2

    The second rectangle.

    Returns
    Type Description
    Rect

    The minimum rectangle containing rect1 and rect2.

    | Improve this Doc View Source

    MaxS(Arr, Double, Arr)

    Finds per-element maximum of array and scalar.

    Declaration
    public static void MaxS(Arr src, double value, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Double value

    The scalar input value.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    MeanShift(Arr, Rect, TermCriteria, out ConnectedComp)

    Finds the object center on back projection.

    Declaration
    public static bool MeanShift(Arr probImage, Rect window, TermCriteria criteria, out ConnectedComp comp)
    Parameters
    Type Name Description
    Arr probImage

    Back projection of object histogram (see CalcArrBackProject(Arr[], Arr)).

    Rect window

    Initial search window.

    TermCriteria criteria

    Criteria applied to determine when the window search should be finished.

    ConnectedComp comp

    Resultant structure that contains the converged search window coordinates (Rect field) and the sum of all of the pixels inside the window (Area field).

    Returns
    Type Description
    Boolean

    true if the search was successful; false otherwise.

    | Improve this Doc View Source

    Merge(Arr, Arr, Arr, Arr, Arr)

    Composes a multi-channel array from several single-channel arrays or inserts a single channel into the array.

    Declaration
    public static void Merge(Arr src0, Arr src1, Arr src2, Arr src3, Arr dst)
    Parameters
    Type Name Description
    Arr src0

    The first input channel array.

    Arr src1

    The second input channel array.

    Arr src2

    The third input channel array.

    Arr src3

    The fourth input channel array.

    Arr dst

    The destination array.

    Remarks

    The function is the opposite to Split(Arr, Arr, Arr, Arr, Arr). If the destination array has N channels then if the first N input channels are not null, they all are copied to the destination array; if only a single source channel of the first N is not null, this particular channel is copied into the destination array; otherwise an exception is raised. The rest of the source channels (beyond the first N) must always be null. For an IplImage instance, Copy(Arr, Arr, Arr) with COI set can also be used to insert a single channel into the image.

    | Improve this Doc View Source

    Min(Arr, Arr, Arr)

    Finds per-element minimum of two arrays.

    Declaration
    public static void Min(Arr src1, Arr src2, Arr dst)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    MinAreaRect2(CVHandle, MemStorage)

    Finds the circumscribed rectangle of minimal area for a given 2D point set.

    Declaration
    public static RotatedRect MinAreaRect2(CVHandle points, MemStorage storage = null)
    Parameters
    Type Name Description
    CVHandle points

    Sequence or array of points.

    MemStorage storage

    Optional temporary memory storage.

    Returns
    Type Description
    RotatedRect

    The oriented rectangle with minimal area for the specified points.

    | Improve this Doc View Source

    MinEnclosingCircle(CVHandle, out Point2f, out Single)

    Finds the circumscribed circle of minimal area for a given 2D point set.

    Declaration
    public static bool MinEnclosingCircle(CVHandle points, out Point2f center, out float radius)
    Parameters
    Type Name Description
    CVHandle points

    Sequence or array of points.

    Point2f center

    Output parameter; the center of the enclosing circle.

    Single radius

    Output parameter; the radius of the enclosing circle.

    Returns
    Type Description
    Boolean

    true if the resulting circle contains all the input points and false otherwise.

    | Improve this Doc View Source

    MinMaxLoc(Arr, out Double, out Double)

    Finds global minimum and maximum in array or subarray.

    Declaration
    public static void MinMaxLoc(Arr arr, out double minValue, out double maxValue)
    Parameters
    Type Name Description
    Arr arr

    The source array, single-channel or multi-channel with COI set.

    Double minValue

    The returned minimum value.

    Double maxValue

    The returned maximum value.

    | Improve this Doc View Source

    MinMaxLoc(Arr, out Double, out Double, out Point)

    Finds global minimum and maximum in array or subarray.

    Declaration
    public static void MinMaxLoc(Arr arr, out double minValue, out double maxValue, out Point minLocation)
    Parameters
    Type Name Description
    Arr arr

    The source array, single-channel or multi-channel with COI set.

    Double minValue

    The returned minimum value.

    Double maxValue

    The returned maximum value.

    Point minLocation

    The returned minimum location.

    | Improve this Doc View Source

    MinMaxLoc(Arr, out Double, out Double, out Point, out Point, Arr)

    Finds global minimum and maximum in array or subarray.

    Declaration
    public static void MinMaxLoc(Arr arr, out double minValue, out double maxValue, out Point minLocation, out Point maxLocation, Arr mask = null)
    Parameters
    Type Name Description
    Arr arr

    The source array, single-channel or multi-channel with COI set.

    Double minValue

    The returned minimum value.

    Double maxValue

    The returned maximum value.

    Point minLocation

    The returned minimum location.

    Point maxLocation

    The returned maximum location.

    Arr mask

    The optional mask used to select a subarray.

    | Improve this Doc View Source

    MinS(Arr, Double, Arr)

    Finds per-element minimum of an array and a scalar.

    Declaration
    public static void MinS(Arr src, double value, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Double value

    The scalar input value.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    MixChannels(Arr[], Arr[], Int32[])

    Copies specified channels from the input arrays to the specified channels of the output arrays. All matrices must have the same size and depth.

    Declaration
    public static void MixChannels(Arr[] src, Arr[] dst, int[] fromTo)
    Parameters
    Type Name Description
    Arr[] src

    The input arrays.

    Arr[] dst

    The output arrays.

    Int32[] fromTo

    The array of index pairs, specifying which channels are copied and where. fromTo[k2] is the 0-based index of the input channel in src and fromTo[k2+1] is the index of the output channel in dst. Continuous channel numbering is used, i.e. the first input channels in src are indexed from

    0
    to
    src[0].Channels-1
    , and the second input channels are indexed from
    src[0].Channels
    to

    src[0].Channels + src[1].Channels-1
    . The same scheme is used

    for the output image channels. As a special case, negative output channel indices mean that the corresponding output channel is filled with zeros.

    Remarks

    This function is a generalized form of Split(Arr, Arr, Arr, Arr, Arr) and Merge(Arr, Arr, Arr, Arr, Arr). It can be used to change the order of the planes, add/remove alpha channel, extract or insert a single plane or multiple planes, etc.

    | Improve this Doc View Source

    MorphologyEx(Arr, Arr, Arr, IplConvKernel, MorphologicalOperation, Int32)

    Performs advanced morphological transformations.

    Declaration
    public static void MorphologyEx(Arr src, Arr dst, Arr temp, IplConvKernel element, MorphologicalOperation operation, int iterations = 1)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Arr temp

    Temporary image, required for Gradient and in-place operation of TopHat and BlackHat.

    IplConvKernel element

    The structuring element used for morphological transformation.

    MorphologicalOperation operation

    The type of morphological transformation applied.

    Int32 iterations

    The number of times erosion and dilation are applied.

    | Improve this Doc View Source

    Mul(Arr, Arr, Arr, Double)

    Calculates the per-element product of two arrays.

    Declaration
    public static void Mul(Arr src1, Arr src2, Arr dst, double scale = null)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    Double scale

    An optional scale factor.

    | Improve this Doc View Source

    MulSpectrums(Arr, Arr, Arr, DiscreteTransformFlags)

    Performs per-element multiplication of two Fourier spectrums.

    Declaration
    public static void MulSpectrums(Arr src1, Arr src2, Arr dst, DiscreteTransformFlags flags)
    Parameters
    Type Name Description
    Arr src1

    The first source array.

    Arr src2

    The second source array.

    Arr dst

    The destination array of the same type and size as the source arrays.

    DiscreteTransformFlags flags

    A combination of Rows and MultiplyConjugate.

    | Improve this Doc View Source

    MultiplyAcc(Arr, Arr, Arr, Arr)

    Adds the product of two input images to the accumulator.

    Declaration
    public static void MultiplyAcc(Arr image1, Arr image2, Arr acc, Arr mask = null)
    Parameters
    Type Name Description
    Arr image1

    First input image, 1- or 3-channel, 8-bit or 32-bit floating point. Each channel of multi-channel image is processed independently.

    Arr image2

    Second input image, the same format as the first one.

    Arr acc

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

    Arr mask

    Optional operation mask.

    | Improve this Doc View Source

    MulTransposed(Arr, Arr, Int32, Arr, Double)

    Calculates the product of an array and a transposed array.

    Declaration
    public static void MulTransposed(Arr src, Arr dst, int order, Arr delta = null, double scale = null)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array. Must be of type F32 or F64.

    Int32 order

    The order of multipliers.

    Arr delta

    An optional array, subtracted from src before multiplication.

    Double scale

    An optional scale factor.

    | Improve this Doc View Source

    Norm(Arr, Arr, NormTypes, Arr)

    Calculates absolute array norm, absolute difference norm, or relative difference norm.

    Declaration
    public static double Norm(Arr arr1, Arr arr2 = null, NormTypes normType = default(NormTypes), Arr mask = null)
    Parameters
    Type Name Description
    Arr arr1

    The first source image.

    Arr arr2

    The second source image. If it is null, the absolute norm of arr1 is calculated, otherwise the absolute or relative norm of arr1-arr2 is calculated.

    NormTypes normType

    The type of array norm.

    Arr mask

    The optional operation mask.

    Returns
    Type Description
    Double

    The absolute or relative array norm.

    | Improve this Doc View Source

    Normalize(Arr, Arr, Double, Double, NormTypes, Arr)

    Normalizes the array norm or the range.

    Declaration
    public static void Normalize(Arr src, Arr dst, double a = null, double b = null, NormTypes normType = default(NormTypes), Arr mask = null)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array. Must have the same size as src.

    Double a

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

    Double b

    The upper range boundary in the case of range normalization; not used for norm normalization.

    NormTypes normType

    The normalization type.

    Arr mask

    The optional operation mask.

    | Improve this Doc View Source

    Not(Arr, Arr)

    Performs per-element bit-wise inversion of array elements.

    Declaration
    public static void Not(Arr src, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    Or(Arr, Arr, Arr, Arr)

    Performs per-element bit-wise disjunction of two arrays.

    Declaration
    public static void Or(Arr src1, Arr src2, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    OrS(Arr, Scalar, Arr, Arr)

    Performs per-element bit-wise disjunction of an array and a scalar.

    Declaration
    public static void OrS(Arr src, Scalar value, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Scalar value

    The scalar input value.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    PerspectiveTransform(Arr, Arr, Mat)

    Performs perspective matrix transformation of a vector array.

    Declaration
    public static void PerspectiveTransform(Arr src, Arr dst, Mat mat)
    Parameters
    Type Name Description
    Arr src

    The source three-channel floating-point array.

    Arr dst

    The destination three-channel floating-point array.

    Mat mat

    The 3x3 or 4x4 transformation matrix.

    | Improve this Doc View Source

    PointPolygonTest(CVHandle, Point2f, Boolean)

    Point in contour test.

    Declaration
    public static double PointPolygonTest(CVHandle contour, Point2f pt, bool measureDist)
    Parameters
    Type Name Description
    CVHandle contour

    Input contour.

    Point2f pt

    The point to be tested against the contour.

    Boolean measureDist

    If true the method estimates the distance from the point to the nearest contour edge. Otherwise, only the test result itself is stored.

    Returns
    Type Description
    Double

    If measureDist is true, the return value is a signed distance between the point and the nearest contour edge. Otherwise, +1, -1 and 0 are returned, respectively, when the point is inside the contour, outside or lies on an edge.

    | Improve this Doc View Source

    PolarToCart(Arr, Arr, Arr, Arr, Boolean)

    Calculates Cartesian coordinates of 2d vectors represented in polar form.

    Declaration
    public static void PolarToCart(Arr magnitude, Arr angle, Arr x, Arr y, bool angleInDegrees = false)
    Parameters
    Type Name Description
    Arr magnitude

    The array of magnitudes. If it is null, the magnitudes are assumed to be all ones.

    Arr angle

    The array of angles, whether in radians or degrees.

    Arr x

    The destination array of x-coordinates, may be set to null if it is not needed.

    Arr y

    The destination array of y-coordinates, may be set to null if it is not needed.

    Boolean angleInDegrees

    A value indicating whether the angles are measured in radians, which is the default mode, or in degrees.

    | Improve this Doc View Source

    PolyLine(Arr, Point[][], Boolean, Scalar, Int32, LineFlags, Int32)

    Draws one or more polygonal curves.

    Declaration
    public static void PolyLine(Arr img, Point[][] pts, bool isClosed, Scalar color, int thickness = 1, LineFlags lineType = default(LineFlags), int shift = 0)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    Point[][] pts

    The array of polygons to draw.

    Boolean isClosed

    A value indicating whether the polylines must be drawn closed. If closed, the function draws the line from the last vertex of every contour to the first vertex.

    Scalar color

    The color of the polygons.

    Int32 thickness

    The thickness of the polyline edges.

    LineFlags lineType

    The algorithm used to draw the polygon boundaries.

    Int32 shift

    The number of fractional bits in the vertex coordinates.

    | Improve this Doc View Source

    Pow(Arr, Arr, Double)

    Raises every array element to a power.

    Declaration
    public static void Pow(Arr src, Arr dst, double power)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array, should be the same type as the source.

    Double power

    The exponent of power.

    | Improve this Doc View Source

    PreCornerDetect(Arr, Arr, Int32)

    Calculates the feature map for corner detection.

    Declaration
    public static void PreCornerDetect(Arr image, Arr corners, int apertureSize = 3)
    Parameters
    Type Name Description
    Arr image

    Input image.

    Arr corners

    Image to store the corner candidates.

    Int32 apertureSize

    Aperture parameter for the Sobel operator (see Sobel(Arr, Arr, Int32, Int32, Int32)).

    | Improve this Doc View Source

    ProjectPCA(Arr, Arr, Arr, Arr)

    Projects vectors to the specified subspace.

    Declaration
    public static void ProjectPCA(Arr data, Arr mean, Arr eigenvects, Arr result)
    Parameters
    Type Name Description
    Arr data

    The input data array; each vector is either a single row or a single column.

    Arr mean

    The mean (average) vector. If it is a single-row vector, then inputs are stored as rows; otherwise, it should be a single-column vector and inputs will be stored as columns.

    Arr eigenvects

    The eigenvectors (principal components). One vector per row.

    Arr result

    The output matrix containing the projected vectors.

    | Improve this Doc View Source

    ProjectPoints2(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Double)

    Projects 3D points to an image plane.

    Declaration
    public static void ProjectPoints2(Mat objectPoints, Mat rotationVector, Mat translationVector, Mat cameraMatrix, Mat distortionCoeffs, Mat imagePoints, Mat dpdrot = null, Mat dpdt = null, Mat dpdf = null, Mat dpdc = null, Mat dpddist = null, double aspectRatio = null)
    Parameters
    Type Name Description
    Mat objectPoints

    The array of object points, 3xN or Nx3 1-channel or 1xN or Nx1 3-channel, where N is the number of points in the view.

    Mat rotationVector

    The rotation vector of the points; see Rodrigues2(Mat, Mat, Mat).

    Mat translationVector

    The translation vector of the points; see Rodrigues2(Mat, Mat, Mat).

    Mat cameraMatrix

    The camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Mat distortionCoeffs

    The input vector of distortion coefficients of 4,5 or 8 elements. If it is null, the zero distortion coefficients are assumed.

    Mat imagePoints

    The output array of image points, 2xN or Nx2 1-channel or 1xN or Nx1 2-channel.

    Mat dpdrot

    Optional 2Nx3 matrix of derivatives of image points with respect to components of the rotation vector.

    Mat dpdt

    Optional 2Nx3 matrix of derivatives of image points with respect to components of the translation vector.

    Mat dpdf

    Optional 2Nx2 matrix of derivatives of image points with respect to fx and fy.

    Mat dpdc

    Optional 2Nx2 matrix of derivatives of image points with respect to cx and cy.

    Mat dpddist

    Optional 2Nx4 matrix of derivatives of image points with respect to the distortion coefficients.

    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

    PutText(Arr, String, Point, Font, Scalar)

    Renders text strokes with the specified font and color at the specified location.

    Declaration
    public static void PutText(Arr img, string text, Point origin, Font font, Scalar color)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    String text

    The text string to print.

    Point origin

    The coordinates of the bottom-left corner of the first letter.

    Font font

    The font style used to render the text strokes.

    Scalar color

    The color of the text.

    | Improve this Doc View Source

    PyrDown(Arr, Arr, PyramidDecompositionFilter)

    Blurs an image and downsamples it.

    Declaration
    public static void PyrDown(Arr src, Arr dst, PyramidDecompositionFilter filter = default(PyramidDecompositionFilter))
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image, with the same type as src.

    PyramidDecompositionFilter filter

    The type of filter used for convolution.

    | Improve this Doc View Source

    PyrMeanShiftFiltering(Arr, Arr, Double, Double, Int32)

    Performs initial step of meanshift segmentation of an image.

    Declaration
    public static void PyrMeanShiftFiltering(Arr src, Arr dst, double sp, double sr, int maxLevel = 1)
    Parameters
    Type Name Description
    Arr src

    The source 8-bit, 3-channel image.

    Arr dst

    The destination image of the same format and the same size as src.

    Double sp

    The spatial window radius.

    Double sr

    The color window radius.

    Int32 maxLevel

    Maximum level of the pyramid for the segmentation.

    | Improve this Doc View Source

    PyrMeanShiftFiltering(Arr, Arr, Double, Double, Int32, TermCriteria)

    Performs initial step of meanshift segmentation of an image.

    Declaration
    public static void PyrMeanShiftFiltering(Arr src, Arr dst, double sp, double sr, int maxLevel, TermCriteria termcrit)
    Parameters
    Type Name Description
    Arr src

    The source 8-bit, 3-channel image.

    Arr dst

    The destination image of the same format and the same size as src.

    Double sp

    The spatial window radius.

    Double sr

    The color window radius.

    Int32 maxLevel

    Maximum level of the pyramid for the segmentation.

    TermCriteria termcrit

    Termination criteria: when to stop meanshift iterations.

    | Improve this Doc View Source

    PyrUp(Arr, Arr, PyramidDecompositionFilter)

    Upsamples an image and then blurs it.

    Declaration
    public static void PyrUp(Arr src, Arr dst, PyramidDecompositionFilter filter = default(PyramidDecompositionFilter))
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image, with the same type as src.

    PyramidDecompositionFilter filter

    The type of filter used for convolution.

    | Improve this Doc View Source

    RandArr(ref UInt64, Arr, RandDistribution, Scalar, Scalar)

    Fills an array with random numbers and updates the generator state.

    Declaration
    public static void RandArr(ref ulong rng, Arr arr, RandDistribution distType, Scalar param1, Scalar param2)
    Parameters
    Type Name Description
    UInt64 rng

    The random number generator state initialized by Rng(Int64).

    Arr arr

    The destination array.

    RandDistribution distType

    The type of distribution used to generate random numbers.

    Scalar param1

    The first parameter of the distribution. In the case of a uniform distribution it is the inclusive lower boundary of the random numbers range. In the case of a normal distribution it is the mean value of the random numbers.

    Scalar param2

    The second parameter of the distribution. In the case of a uniform distribution it is the exclusive upper boundary of the random numbers range. In the case of a normal distribution it is the standard deviation of the random numbers.

    | Improve this Doc View Source

    RandInt(ref UInt64)

    Returns a random 32-bit unsigned integer and updates the generator state.

    Declaration
    public static uint RandInt(ref ulong rng)
    Parameters
    Type Name Description
    UInt64 rng

    The random number generator state initialized by Rng(Int64).

    Returns
    Type Description
    UInt32

    A uniformly-distributed random 32-bit unsigned integer.

    | Improve this Doc View Source

    RandReal(ref UInt64)

    Returns a floating-point random number and updates the generator state.

    Declaration
    public static double RandReal(ref ulong rng)
    Parameters
    Type Name Description
    UInt64 rng

    The random number generator state initialized by Rng(Int64).

    Returns
    Type Description
    Double

    A uniformly-distributed random floating-point number between 0 inclusive and 1 exclusive.

    | Improve this Doc View Source

    RandShuffle(Arr, ref UInt64, Double)

    Shuffles the array elements randomly and updates the generator state.

    Declaration
    public static void RandShuffle(Arr mat, ref ulong rng, double iterFactor = null)
    Parameters
    Type Name Description
    Arr mat

    The source and destination array. The array is shuffled in place.

    UInt64 rng

    The random number generator state initialized by Rng(Int64).

    Double iterFactor

    The scale factor that determines the number of random swap operations.

    | Improve this Doc View Source

    Range(Arr, Double, Double)

    Fills a matrix with the given range of numbers.

    Declaration
    public static Arr Range(Arr mat, double start, double end)
    Parameters
    Type Name Description
    Arr mat

    The matrix to initialize. It should be single-channel, 32-bit integer or floating-point.

    Double start

    The lower inclusive boundary of the range.

    Double end

    The upper exclusive boundary of the range.

    Returns
    Type Description
    Arr

    The source matrix if the operation was successful, null otherwise.

    | Improve this Doc View Source

    Rectangle(Arr, Point, Point, Scalar, Int32, LineFlags, Int32)

    Draws a simple, thick, or filled rectangle with the two opposite corners pt1 and pt2.

    Declaration
    public static void Rectangle(Arr img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineFlags lineType = default(LineFlags), int shift = 0)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    Point pt1

    The first point of the line segment.

    Point pt2

    The second point of the line segment.

    Scalar color

    The color of the rectangle.

    Int32 thickness

    The thickness of the lines that make up the rectangle if positive, otherwise this indicates that a filled rectangle is to be drawn.

    LineFlags lineType

    The algorithm used to draw the rectangle outline.

    Int32 shift

    The number of fractional bits in the point coordinates.

    | Improve this Doc View Source

    Rectangle(Arr, Rect, Scalar, Int32, LineFlags, Int32)

    Draws a simple, thick, or filled rectangle specified by a Rect structure.

    Declaration
    public static void Rectangle(Arr img, Rect rectangle, Scalar color, int thickness = 1, LineFlags lineType = default(LineFlags), int shift = 0)
    Parameters
    Type Name Description
    Arr img

    The image on which to draw.

    Rect rectangle

    The rectangle to draw.

    Scalar color

    The color of the rectangle.

    Int32 thickness

    The thickness of the lines that make up the rectangle if positive, otherwise this indicates that a filled rectangle is to be drawn.

    LineFlags lineType

    The algorithm used to draw the rectangle outline.

    Int32 shift

    The number of fractional bits in the rectangle coordinates.

    | Improve this Doc View Source

    Reduce(Arr, Arr, Int32, ReduceOperation)

    Reduces a matrix to a vector.

    Declaration
    public static void Reduce(Arr src, Arr dst, int dim = null, ReduceOperation op = ReduceOperation.Sum)
    Parameters
    Type Name Description
    Arr src

    The input matrix.

    Arr dst

    The output single-row/single-column vector that accumulates all the matrix rows/columns.

    Int32 dim

    The dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row, 1 means that the matrix is reduced to a single column and -1 means that the dimension is chosen automatically by analysing the dst size.

    ReduceOperation op

    The reduction operation.

    | Improve this Doc View Source

    Remap(Arr, Arr, Arr, Arr, WarpFlags)

    Applies a generic geometrical transformation to the image. The method transforms the source image using the specified map for each individual pixel coordinates.

    Declaration
    public static void Remap(Arr src, Arr dst, Arr mapx, Arr mapy, WarpFlags flags = default(WarpFlags))
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Arr mapx

    The map of x-coordinates, 32-bit single-channel floating-point image or 16-bit 2-channel signed integer image. Fixed-point version is faster.

    Arr mapy

    The map of y-coordinates, 32-bit single-channel floating-point image or 16-bit single-channel unsigned integer image. Fixed-point version is faster.

    WarpFlags flags

    A combination of interpolation methods and operational flags.

    | Improve this Doc View Source

    Remap(Arr, Arr, Arr, Arr, WarpFlags, Scalar)

    Applies a generic geometrical transformation to the image. The method transforms the source image using the specified map for each individual pixel coordinates.

    Declaration
    public static void Remap(Arr src, Arr dst, Arr mapx, Arr mapy, WarpFlags flags, Scalar fillval)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Arr mapx

    The map of x-coordinates, 32-bit single-channel floating-point image or 16-bit 2-channel signed integer image.

    Arr mapy

    The map of y-coordinates, 32-bit single-channel floating-point image or 16-bit single-channel unsigned integer image.

    WarpFlags flags

    A combination of interpolation methods and operational flags.

    Scalar fillval

    A value used to fill outliers.

    | Improve this Doc View Source

    Repeat(Arr, Arr)

    Repeats the 2D source array in both horizontal and vertical directions to fill the destination array.

    Declaration
    public static void Repeat(Arr src, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    ReprojectImageTo3D(Arr, Arr, Mat, Boolean)

    Reprojects disparity image to 3D space.

    Declaration
    public static void ReprojectImageTo3D(Arr disparityImage, Arr image3d, Mat Q, bool handleMissingValues)
    Parameters
    Type Name Description
    Arr disparityImage

    The input single-channel 16-bit signed or 32-bit floating-point disparity image.

    Arr image3d

    The output 3-channel floating-point image of the same size as disparity . Each element of image3d(x,y) will contain the 3D coordinates of the point (x,y), computed from the disparity map.

    Mat Q

    The 4x4 perspective transformation matrix that can be obtained with StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double).

    Boolean handleMissingValues

    If true, the pixels with the minimal disparity (which correspond to the outliers; see FindStereoCorrespondence(Arr, Arr, Arr)) will be transformed to 3D points with some very large Z value (currently set to 10000).

    | Improve this Doc View Source

    Resize(Arr, Arr, SubPixelInterpolation)

    Resizes an image.

    Declaration
    public static void Resize(Arr src, Arr dst, SubPixelInterpolation interpolation = default(SubPixelInterpolation))
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    SubPixelInterpolation interpolation

    The interpolation method.

    | Improve this Doc View Source

    Rng(Int64)

    Initializes a random number generator state.

    Declaration
    public static ulong Rng(long seed)
    Parameters
    Type Name Description
    Int64 seed

    A 64-bit value used to initiate a random sequence.

    Returns
    Type Description
    UInt64

    The initialized random number generator state.

    | Improve this Doc View Source

    Rodrigues2(Mat, Mat, Mat)

    Converts a rotation matrix to a rotation vector or vice versa.

    Declaration
    public static bool Rodrigues2(Mat src, Mat dst, Mat jacobian = null)
    Parameters
    Type Name Description
    Mat src

    The input rotation vector (3x1 or 1x3) or rotation matrix (3x3).

    Mat dst

    The output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.

    Mat jacobian

    Optional output Jacobian matrix, 3x9 or 9x3; partial derivatives of the output array components with respect to the input array components.

    Returns
    Type Description
    Boolean

    A value indicating whether the conversion was successful.

    | Improve this Doc View Source

    RQDecomp3x3(Mat, Mat, Mat, Mat, Mat, Mat, Point3d[])

    Computes the ‘RQ’ decomposition of 3x3 matrices.

    Declaration
    public static void RQDecomp3x3(Mat matrixM, Mat matrixR, Mat matrixQ, Mat matrixQx = null, Mat matrixQy = null, Mat matrixQz = null, Point3d[] eulerAngles = null)
    Parameters
    Type Name Description
    Mat matrixM

    The 3x3 input matrix.

    Mat matrixR

    The output 3x3 upper-triangular matrix.

    Mat matrixQ

    The output 3x3 orthogonal matrix.

    Mat matrixQx

    Optional output 3x3 rotation matrix around x-axis.

    Mat matrixQy

    Optional output 3x3 rotation matrix around y-axis.

    Mat matrixQz

    Optional output 3x3 rotation matrix around z-axis.

    Point3d[] eulerAngles

    Optional output array containing the three Euler angles of rotation.

    | Improve this Doc View Source

    RunningAvg(Arr, Arr, Double, Arr)

    Calculates the weighted sum of the input image image and the accumulator acc so that acc becomes a running average of frame sequence.

    Declaration
    public static void RunningAvg(Arr image, Arr acc, double alpha, Arr mask = null)
    Parameters
    Type Name Description
    Arr image

    Input image, 1- or 3-channel, 8-bit or 32-bit floating point. Each channel of multi-channel image is processed independently.

    Arr acc

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

    Double alpha

    Weight of the input image. This parameter regulates how fast the accumulator forgets about previous frames.

    Arr mask

    Optional operation mask.

    | Improve this Doc View Source

    SampleLine<TElement>(Arr, Point, Point, LineType)

    Samples the raster line elements.

    Declaration
    public static TElement[] SampleLine<TElement>(Arr image, Point pt1, Point pt2, LineType connectivity = default(LineType))
        where TElement : struct
    Parameters
    Type Name Description
    Arr image

    The image to sample the line from.

    Point pt1

    Starting line point.

    Point pt2

    Ending line point.

    LineType connectivity

    The scanned line connectivity for Bresenham's algorithm, either 4 or 8.

    Returns
    Type Description
    TElement[]

    The buffer containing the sampled line elements.

    Type Parameters
    Name Description
    TElement

    The type of the elements in the image.

    | Improve this Doc View Source

    Save<TElement>(String, TElement, String, String, AttrList)

    Saves an object to a file.

    Declaration
    public static void Save<TElement>(string fileName, TElement element, string name = null, string comment = null, AttrList attributes = default(AttrList))
        where TElement : CVHandle
    Parameters
    Type Name Description
    String fileName

    The file path to be saved.

    TElement element

    The object to save.

    String name

    Optional object name. If it is null, the name will be formed from fileName.

    String comment

    Optional comment to put in the beginning of the file.

    AttrList attributes

    A list of attributes used to customize the writing procedure.

    Type Parameters
    Name Description
    TElement

    The type of object to save.

    | Improve this Doc View Source

    SaveImage(String, Arr, Int32[])

    Saves an image to a specified file.

    Declaration
    public static bool SaveImage(string fileName, Arr image, params int[] parameters)
    Parameters
    Type Name Description
    String fileName

    Name of the file.

    Arr image

    Image to be saved.

    Int32[] parameters

    Optional image compression parameters.

    Returns
    Type Description
    Boolean

    true if the image was saved successfully; otherwise, false.

    | Improve this Doc View Source

    ScaleAdd(Arr, Scalar, Arr, Arr)

    Calculates the sum of a scaled array and another array.

    Declaration
    public static void ScaleAdd(Arr src1, Scalar scale, Arr src2, Arr dst)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Scalar scale

    The scale factor for the first array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    | Improve this Doc View Source

    SegmentMotion(Arr, Arr, MemStorage, Double, Double)

    Segments a whole motion into separate moving parts.

    Declaration
    public static Seq SegmentMotion(Arr mhi, Arr segMask, MemStorage storage, double timestamp, double segThresh)
    Parameters
    Type Name Description
    Arr mhi

    Motion history image.

    Arr segMask

    Output image where the segmentation mask should be stored, single-channel, 32-bit floating-point. Different motion segments are marked with individual values (1,2,...).

    MemStorage storage

    Memory storage that will contain a sequence of motion connected components.

    Double timestamp

    Current time in milliseconds or other units.

    Double segThresh

    Segmentation threshold; recommended to be equal to the interval between motion history “steps” or greater.

    Returns
    Type Description
    Seq

    A sequence of ConnectedComp structures, one for each motion component. The motion direction for every component can be calculated with CalcGlobalOrientation(Arr, Arr, Arr, Double, Double) using the extracted mask of the particular component.

    | Improve this Doc View Source

    SetIdentity(Arr)

    Initializes a scaled identity matrix.

    Declaration
    public static void SetIdentity(Arr mat)
    Parameters
    Type Name Description
    Arr mat

    The matrix to initialize (not necessarily square).

    | Improve this Doc View Source

    SetIdentity(Arr, Scalar)

    Initializes a scaled identity matrix.

    Declaration
    public static void SetIdentity(Arr mat, Scalar value)
    Parameters
    Type Name Description
    Arr mat

    The matrix to initialize (not necessarily square).

    Scalar value

    The value to assign to the diagonal elements.

    | Improve this Doc View Source

    Smooth(Arr, Arr, SmoothMethod, Int32, Int32, Double, Double)

    Smooths the image in one of several ways.

    Declaration
    public static void Smooth(Arr src, Arr dst, SmoothMethod smoothType = default(SmoothMethod), int size1 = 3, int size2 = 0, double sigma1 = null, double sigma2 = null)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    SmoothMethod smoothType

    Type of the smoothing.

    Int32 size1

    The first parameter of the smoothing operation, the aperture width. Must be a positive odd number (e.g. 1, 3, 5, ...).

    Int32 size2

    The second parameter of the smoothing operation, the aperture height. Ignored by Median and Bilateral methods. In the case of simple scaled/non-scaled and Gaussian blur, if size2 is zero, it is set to size1. Otherwise it must be a positive odd number.

    Double sigma1

    In the case of a Gaussian smoothing, this parameter may specify the standard deviation. If it is zero, it is calculated from the kernel size. If sigma1 is not zero but size1 and size2 are zeros, the kernel size is calculated from sigma1.

    Double sigma2

    Optionally specifies the standard deviation for the second dimension.

    | Improve this Doc View Source

    Sobel(Arr, Arr, Int32, Int32, Int32)

    Calculates the first, second, third or mixed image derivatives using an extended Sobel operator.

    Declaration
    public static void Sobel(Arr src, Arr dst, int xorder, int yorder, int apertureSize = 3)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Int32 xorder

    The order of the derivative x.

    Int32 yorder

    The order of the derivative y.

    Int32 apertureSize

    Size of the extended Sobel kernel, must be 1, 3, 5 or 7.

    | Improve this Doc View Source

    Solve(Arr, Arr, Arr, InversionMethod)

    Solves a linear system or least-squares problem.

    Declaration
    public static bool Solve(Arr src1, Arr src2, Arr dst, InversionMethod method = default(InversionMethod))
    Parameters
    Type Name Description
    Arr src1

    The source matrix.

    Arr src2

    The right-hand part of the linear system.

    Arr dst

    The output solution.

    InversionMethod method

    The matrix inversion method.

    Returns
    Type Description
    Boolean

    If LU method is used, returns true if src1 is non-singular and false otherwise; in the latter case, dst is not valid.

    | Improve this Doc View Source

    SolveCubic(Mat, Mat)

    Finds the real roots of a cubic equation.

    Declaration
    public static int SolveCubic(Mat coeffs, Mat roots)
    Parameters
    Type Name Description
    Mat coeffs

    The equation coefficients, an array of 3 or 4 elements.

    Mat roots

    The output array of real roots which should have 3 elements.

    Returns
    Type Description
    Int32

    The number of real roots found.

    | Improve this Doc View Source

    SolvePoly(Mat, Mat, Int32, Int32)

    Finds the real or complex roots of a polynomial equation.

    Declaration
    public static void SolvePoly(Mat coeffs, Mat roots2, int maxIter = 20, int fig = 100)
    Parameters
    Type Name Description
    Mat coeffs

    The array of polynomial coefficients.

    Mat roots2

    The destination (complex) array of roots.

    Int32 maxIter

    The maximum number of iterations to perform.

    Int32 fig

    The required figures of precision.

    | Improve this Doc View Source

    Sort(Arr, Arr, Arr, SortFlags)

    Sorts each row or each column of a matrix.

    Declaration
    public static void Sort(Arr src, Arr dst = null, Arr indices = null, SortFlags flags = default(SortFlags))
    Parameters
    Type Name Description
    Arr src

    The source single-channel array.

    Arr dst

    The destination array of the same size and the same type as src.

    Arr indices

    The array on which to store the sorted indices.

    SortFlags flags

    The operation flags indicating whether to sort rows or columns and whether to use ascending or descending order.

    | Improve this Doc View Source

    Split(Arr, Arr, Arr, Arr, Arr)

    Divides a multi-channel array into several single-channel arrays or extracts a single channel from the array.

    Declaration
    public static void Split(Arr src, Arr dst0, Arr dst1, Arr dst2, Arr dst3)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst0

    The first destination channel array.

    Arr dst1

    The second destination channel array.

    Arr dst2

    The third destination channel array.

    Arr dst3

    The fourth destination channel array.

    Remarks

    The function divides a multi-channel array into separate single-channel arrays. Two modes are available for the operation. If the source array has N channels and the first N destination channels are not null, they all are extracted from the source array; if only a single destination channel of the first N is not null, this particular channel is extracted; otherwise an exception is raised. The rest of the destination channels (beyond the first N) must always be null. For an IplImage instance, Copy(Arr, Arr, Arr) with COI set can also be used to extract a single channel from the image.

    | Improve this Doc View Source

    SquareAcc(Arr, Arr, Arr)

    Adds the square of the source image to the accumulator.

    Declaration
    public static void SquareAcc(Arr image, Arr sqsum, Arr mask = null)
    Parameters
    Type Name Description
    Arr image

    Input image, 1- or 3-channel, 8-bit or 32-bit floating point. Each channel of multi-channel image is processed independently.

    Arr sqsum

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

    Arr mask

    Optional operation mask.

    | Improve this Doc View Source

    StartFindContours(Arr, MemStorage, Int32, ContourRetrieval, ContourApproximation, Point)

    Initializes the contour scanning process.

    Declaration
    public static ContourScanner StartFindContours(Arr image, MemStorage storage, int headerSize, ContourRetrieval mode, ContourApproximation method, Point offset)
    Parameters
    Type Name Description
    Arr image

    The 8-bit, single channel, binary source image.

    MemStorage storage

    Container of the retrieved contours.

    Int32 headerSize

    Size of the sequence header.

    ContourRetrieval mode

    Specifies the contour retrieval mode.

    ContourApproximation method

    Specifies the contour approximation method.

    Point offset

    An offset, by which every contour point is shifted. This is useful if the contours are extracted from an image ROI but should then be analyzed in the whole image context.

    Returns
    Type Description
    ContourScanner

    A reference to the ContourScanner instance that can be used to iterate over the retrieved contours.

    | Improve this Doc View Source

    StereoCalibrate(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat)

    Calibrates stereo camera.

    Declaration
    public static double StereoCalibrate(Mat objectPoints, Mat imagePoints1, Mat imagePoints2, Mat npoints, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E = null, Mat F = null)
    Parameters
    Type Name Description
    Mat objectPoints

    The joint matrix of object points; calibration pattern features in the model coordinate space. A floating-point 3xN or Nx3 1-channel, or 1xN or Nx1 3-channel array, where N is the total number of points in all views.

    Mat imagePoints1

    The joint matrix of object point projections in the first camera views. A floating-point 2xN or Nx2 1-channel, or 1xN or Nx1 2-channel array, where N is the total number of points in all views.

    Mat imagePoints2

    The joint matrix of object point projections in the second camera views. A floating-point 2xN or Nx2 1-channel, or 1xN or Nx1 2-channel array, where N is the total number of points in all views.

    Mat npoints

    Integer 1xM or Mx1 vector (where M is the number of calibration pattern views) containing the number of points in each particular view. The sum of vector elements must match the size of objectPoints, imagePoints1 and imagePoints2 (=N).

    Mat cameraMatrix1

    The output 3x3 floating-point first camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Mat distCoeffs1

    The output 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients for the first camera (k1, k2, p1, p2[, k3]).

    Mat cameraMatrix2

    The output 3x3 floating-point second camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Mat distCoeffs2

    The output 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients for the second camera (k1, k2, p1, p2[, k3]).

    Size imageSize

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

    Mat R

    The output rotation matrix between the 1st and the 2nd cameras’ coordinate systems.

    Mat T

    The output translation vector between the cameras’ coordinate systems.

    Mat E

    The optional output essential matrix.

    Mat F

    The optional output fundamental matrix.

    Returns
    Type Description
    Double

    The final re-projection error.

    | Improve this Doc View Source

    StereoCalibrate(Mat, Mat, Mat, Mat, Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, TermCriteria, StereoCalibrationFlags)

    Calibrates stereo camera.

    Declaration
    public static double StereoCalibrate(Mat objectPoints, Mat imagePoints1, Mat imagePoints2, Mat npoints, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, TermCriteria criteria, StereoCalibrationFlags flags = default(StereoCalibrationFlags))
    Parameters
    Type Name Description
    Mat objectPoints

    The joint matrix of object points; calibration pattern features in the model coordinate space. A floating-point 3xN or Nx3 1-channel, or 1xN or Nx1 3-channel array, where N is the total number of points in all views.

    Mat imagePoints1

    The joint matrix of object point projections in the first camera views. A floating-point 2xN or Nx2 1-channel, or 1xN or Nx1 2-channel array, where N is the total number of points in all views.

    Mat imagePoints2

    The joint matrix of object point projections in the second camera views. A floating-point 2xN or Nx2 1-channel, or 1xN or Nx1 2-channel array, where N is the total number of points in all views.

    Mat npoints

    Integer 1xM or Mx1 vector (where M is the number of calibration pattern views) containing the number of points in each particular view. The sum of vector elements must match the size of objectPoints, imagePoints1 and imagePoints2 (=N).

    Mat cameraMatrix1

    The output 3x3 floating-point first camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Mat distCoeffs1

    The output 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients for the first camera (k1, k2, p1, p2[, k3]).

    Mat cameraMatrix2

    The output 3x3 floating-point second camera matrix A = [fx 0 cx; 0 fy cy; 0 0 1].

    Mat distCoeffs2

    The output 4x1, 1x4, 5x1 or 1x5 vector of distortion coefficients for the second camera (k1, k2, p1, p2[, k3]).

    Size imageSize

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

    Mat R

    The output rotation matrix between the 1st and the 2nd cameras’ coordinate systems.

    Mat T

    The output translation vector between the cameras’ coordinate systems.

    Mat E

    The optional output essential matrix.

    Mat F

    The optional output fundamental matrix.

    TermCriteria criteria

    The termination criteria for the iterative optimization algorithm.

    StereoCalibrationFlags flags

    Specifies various operation flags.

    Returns
    Type Description
    Double

    The final re-projection error.

    | Improve this Doc View Source

    StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double)

    Computes rectification transforms for each head of a calibrated stereo camera.

    Declaration
    public static void StereoRectify(Mat cameraMatrix1, Mat cameraMatrix2, Mat distCoeffs1, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q = null, StereoRectificationFlags flags = default(StereoRectificationFlags), double alpha = null)
    Parameters
    Type Name Description
    Mat cameraMatrix1

    The first camera matrix.

    Mat cameraMatrix2

    The second camera matrix.

    Mat distCoeffs1

    The input distortion coefficients for the first camera.

    Mat distCoeffs2

    The input distortion coefficients for the second camera.

    Size imageSize

    Size of the image used for stereo calibration.

    Mat R

    The rotation matrix between the 1st and the 2nd cameras’ coordinate systems.

    Mat T

    The translation vector between the cameras’ coordinate systems.

    Mat R1

    The output 3x3 rectification transform (rotation matrix) for the first camera.

    Mat R2

    The output 3x3 rectification transform (rotation matrix) for the second camera.

    Mat P1

    The output 3x4 projection matrix for the first camera in the new (rectified) coordinate system.

    Mat P2

    The output 3x4 projection matrix for the second camera in the new (rectified) coordinate system.

    Mat Q

    The output 4x4 disparity-to-depth mapping matrix, see ReprojectImageTo3D(Arr, Arr, Mat, Boolean).

    StereoRectificationFlags flags

    The operation flags.

    Double alpha

    The free scaling parameter. If it is -1, the function performs some default scaling. Otherwise the parameter should be between 0 and 1. 0 means that the rectified images will be zoomed and shifted so that only valid pixels are visible (i.e. there will be no black areas after rectification). 1 means that the rectified image will be decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images, i.e. no source image pixels are lost.

    | Improve this Doc View Source

    StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double, Size)

    Computes rectification transforms for each head of a calibrated stereo camera.

    Declaration
    public static void StereoRectify(Mat cameraMatrix1, Mat cameraMatrix2, Mat distCoeffs1, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, StereoRectificationFlags flags, double alpha, Size newImageSize)
    Parameters
    Type Name Description
    Mat cameraMatrix1

    The first camera matrix.

    Mat cameraMatrix2

    The second camera matrix.

    Mat distCoeffs1

    The input distortion coefficients for the first camera.

    Mat distCoeffs2

    The input distortion coefficients for the second camera.

    Size imageSize

    Size of the image used for stereo calibration.

    Mat R

    The rotation matrix between the 1st and the 2nd cameras’ coordinate systems.

    Mat T

    The translation vector between the cameras’ coordinate systems.

    Mat R1

    The output 3x3 rectification transform (rotation matrix) for the first camera.

    Mat R2

    The output 3x3 rectification transform (rotation matrix) for the second camera.

    Mat P1

    The output 3x4 projection matrix for the first camera in the new (rectified) coordinate system.

    Mat P2

    The output 3x4 projection matrix for the second camera in the new (rectified) coordinate system.

    Mat Q

    The output 4x4 disparity-to-depth mapping matrix, see ReprojectImageTo3D(Arr, Arr, Mat, Boolean).

    StereoRectificationFlags flags

    The operation flags.

    Double alpha

    The free scaling parameter. If it is -1, the function performs some default scaling. Otherwise the parameter should be between 0 and 1. 0 means that the rectified images will be zoomed and shifted so that only valid pixels are visible (i.e. there will be no black areas after rectification). 1 means that the rectified image will be decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images, i.e. no source image pixels are lost.

    Size newImageSize

    The new image resolution after rectification. By default, i.e. when (0,0) is passed, it is set to the original imageSize. Setting it to larger value can help you to preserve details in the original image, especially when there is big radial distortion.

    | Improve this Doc View Source

    StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double, Size, out Rect)

    Computes rectification transforms for each head of a calibrated stereo camera.

    Declaration
    public static void StereoRectify(Mat cameraMatrix1, Mat cameraMatrix2, Mat distCoeffs1, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, StereoRectificationFlags flags, double alpha, Size newImageSize, out Rect validPixelROI1)
    Parameters
    Type Name Description
    Mat cameraMatrix1

    The first camera matrix.

    Mat cameraMatrix2

    The second camera matrix.

    Mat distCoeffs1

    The input distortion coefficients for the first camera.

    Mat distCoeffs2

    The input distortion coefficients for the second camera.

    Size imageSize

    Size of the image used for stereo calibration.

    Mat R

    The rotation matrix between the 1st and the 2nd cameras’ coordinate systems.

    Mat T

    The translation vector between the cameras’ coordinate systems.

    Mat R1

    The output 3x3 rectification transform (rotation matrix) for the first camera.

    Mat R2

    The output 3x3 rectification transform (rotation matrix) for the second camera.

    Mat P1

    The output 3x4 projection matrix for the first camera in the new (rectified) coordinate system.

    Mat P2

    The output 3x4 projection matrix for the second camera in the new (rectified) coordinate system.

    Mat Q

    The output 4x4 disparity-to-depth mapping matrix, see ReprojectImageTo3D(Arr, Arr, Mat, Boolean).

    StereoRectificationFlags flags

    The operation flags.

    Double alpha

    The free scaling parameter. If it is -1, the function performs some default scaling. Otherwise the parameter should be between 0 and 1. 0 means that the rectified images will be zoomed and shifted so that only valid pixels are visible (i.e. there will be no black areas after rectification). 1 means that the rectified image will be decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images, i.e. no source image pixels are lost.

    Size newImageSize

    The new image resolution after rectification. By default, i.e. when (0,0) is passed, it is set to the original imageSize. Setting it to larger value can help you to preserve details in the original image, especially when there is big radial distortion.

    Rect validPixelROI1

    The optional output rectangle inside the rectified first camera image where all the pixels are valid.

    | Improve this Doc View Source

    StereoRectify(Mat, Mat, Mat, Mat, Size, Mat, Mat, Mat, Mat, Mat, Mat, Mat, StereoRectificationFlags, Double, Size, out Rect, out Rect)

    Computes rectification transforms for each head of a calibrated stereo camera.

    Declaration
    public static void StereoRectify(Mat cameraMatrix1, Mat cameraMatrix2, Mat distCoeffs1, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, StereoRectificationFlags flags, double alpha, Size newImageSize, out Rect validPixelROI1, out Rect validPixelROI2)
    Parameters
    Type Name Description
    Mat cameraMatrix1

    The first camera matrix.

    Mat cameraMatrix2

    The second camera matrix.

    Mat distCoeffs1

    The input distortion coefficients for the first camera.

    Mat distCoeffs2

    The input distortion coefficients for the second camera.

    Size imageSize

    Size of the image used for stereo calibration.

    Mat R

    The rotation matrix between the 1st and the 2nd cameras’ coordinate systems.

    Mat T

    The translation vector between the cameras’ coordinate systems.

    Mat R1

    The output 3x3 rectification transform (rotation matrix) for the first camera.

    Mat R2

    The output 3x3 rectification transform (rotation matrix) for the second camera.

    Mat P1

    The output 3x4 projection matrix for the first camera in the new (rectified) coordinate system.

    Mat P2

    The output 3x4 projection matrix for the second camera in the new (rectified) coordinate system.

    Mat Q

    The output 4x4 disparity-to-depth mapping matrix, see ReprojectImageTo3D(Arr, Arr, Mat, Boolean).

    StereoRectificationFlags flags

    The operation flags.

    Double alpha

    The free scaling parameter. If it is -1, the function performs some default scaling. Otherwise the parameter should be between 0 and 1. 0 means that the rectified images will be zoomed and shifted so that only valid pixels are visible (i.e. there will be no black areas after rectification). 1 means that the rectified image will be decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images, i.e. no source image pixels are lost.

    Size newImageSize

    The new image resolution after rectification. By default, i.e. when (0,0) is passed, it is set to the original imageSize. Setting it to larger value can help you to preserve details in the original image, especially when there is big radial distortion.

    Rect validPixelROI1

    The optional output rectangle inside the rectified first camera image where all the pixels are valid.

    Rect validPixelROI2

    The optional output rectangle inside the rectified second camera image where all the pixels are valid.

    | Improve this Doc View Source

    StereoRectifyUncalibrated(Mat, Mat, Mat, Size, Mat, Mat, Double)

    Computes rectification transform for uncalibrated stereo camera.

    Declaration
    public static bool StereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imageSize, Mat H1, Mat H2, double threshold = null)
    Parameters
    Type Name Description
    Mat points1

    Array of N points from the first image.It can be 2xN, Nx2, 3xN or Nx3 1-channel array or 1xN or Nx1 2- or 3-channel array. The point coordinates should be floating-point (single or double precision).

    Mat points2

    Array of the second image points of the same size and format as points1.

    Mat F

    The input fundamental matrix. It can be computed from the same set of point pairs using FindFundamentalMat(Mat, Mat, Mat, FundamentalMatrixMethod, Double, Double, Mat).

    Size imageSize

    Size of the image.

    Mat H1

    The output rectification homography matrix for the first camera.

    Mat H2

    The output rectification homography matrix for the second camera.

    Double threshold

    The optional threshold used to filter out the outliers. If the parameter is greater than zero, then all the point pairs that do not comply the epipolar geometry well enough are rejected prior to computing the homographies. Otherwise, all the points are considered inliers.

    Returns
    Type Description
    Boolean

    A value indicating whether the rectification transform was computed successfully.

    | Improve this Doc View Source

    Sub(Arr, Arr, Arr, Arr)

    Calculates the per-element difference between two arrays.

    Declaration
    public static void Sub(Arr src1, Arr src2, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    SubRS(Arr, Scalar, Arr, Arr)

    Subtracts every element of a source array from a scalar.

    Declaration
    public static void SubRS(Arr src, Scalar value, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Scalar value

    The scalar input value.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    SubS(Arr, Scalar, Arr, Arr)

    Calculates the per-element difference between an array and a scalar.

    Declaration
    public static void SubS(Arr src, Scalar value, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Scalar value

    The scalar input value.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    Sum(Arr)

    Adds up array elements.

    Declaration
    public static Scalar Sum(Arr arr)
    Parameters
    Type Name Description
    Arr arr

    The source array.

    Returns
    Type Description
    Scalar

    The sum of array elements, independently for each channel.

    | Improve this Doc View Source

    SVBkSb(Arr, Arr, Arr, Arr, Arr, SvdFlags)

    Performs singular value back substitution.

    Declaration
    public static void SVBkSb(Arr W, Arr U, Arr V, Arr B, Arr X, SvdFlags flags)
    Parameters
    Type Name Description
    Arr W

    The matrix or vector of singular values.

    Arr U

    The left orthogonal matrix (may be transposed).

    Arr V

    The right orthogonal matrix (may be transposed).

    Arr B

    The matrix to multiply the pseudo-inverse of the original matrix A by. If it is null it will be assumed to be an identity matrix of an appropriate size.

    Arr X

    The destination matrix for the result of back substitution.

    SvdFlags flags

    The operation flags that were used to compute the singular values.

    | Improve this Doc View Source

    SVD(Arr, Arr, Arr, Arr, SvdFlags)

    Performs singular value decomposition of a real floating-point matrix.

    Declaration
    public static void SVD(Arr A, Arr W, Arr U = null, Arr V = null, SvdFlags flags = default(SvdFlags))
    Parameters
    Type Name Description
    Arr A

    The source MxN matrix.

    Arr W

    The resulting singular value diagonal matrix or vector of singular values.

    Arr U

    The optional left orthogonal matrix.

    Arr V

    The optional right orthogonal matrix.

    SvdFlags flags

    The operation flags that can be used to speed up the processing.

    | Improve this Doc View Source

    Threshold(Arr, Arr, Double, Double, ThresholdTypes)

    Applies a fixed-level threshold to array elements.

    Declaration
    public static double Threshold(Arr src, Arr dst, double threshold, double maxValue, ThresholdTypes thresholdType)
    Parameters
    Type Name Description
    Arr src

    Source array.

    Arr dst

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

    Double threshold

    Threshold value.

    Double maxValue

    Maximum value to use with Binary and BinaryInv.

    ThresholdTypes thresholdType

    The type of threshold to apply.

    Returns
    Type Description
    Double

    The computed threshold value in case Otsu is used.

    | Improve this Doc View Source

    Trace(Arr)

    Returns the trace of a matrix.

    Declaration
    public static Scalar Trace(Arr mat)
    Parameters
    Type Name Description
    Arr mat

    The source matrix.

    Returns
    Type Description
    Scalar

    The sum of the diagonal elements of the matrix mat.

    | Improve this Doc View Source

    Transform(Arr, Arr, Mat, Mat)

    Transforms each element of source array and stores resultant vectors in destination array.

    Declaration
    public static void Transform(Arr src, Arr dst, Mat transmat, Mat shiftvec = null)
    Parameters
    Type Name Description
    Arr src

    The source array.

    Arr dst

    The destination array.

    Mat transmat

    The transformation matrix to apply to elements of the source array.

    Mat shiftvec

    The optional shift vector.

    | Improve this Doc View Source

    Transpose(Arr, Arr)

    Transposes a matrix.

    Declaration
    public static void Transpose(Arr src, Arr dst)
    Parameters
    Type Name Description
    Arr src

    The source matrix.

    Arr dst

    The destination matrix.

    | Improve this Doc View Source

    TriangulatePoints(Mat, Mat, Mat, Mat, Mat)

    Reconstructs points by triangulation.

    Declaration
    public static void TriangulatePoints(Mat projMatr1, Mat projMatr2, Mat projPoints1, Mat projPoints2, Mat points4D)
    Parameters
    Type Name Description
    Mat projMatr1

    3x4 projection matrix of the first camera.

    Mat projMatr2

    3x4 projection matrix of the second camera.

    Mat projPoints1

    2xN array of feature points in the first image.

    Mat projPoints2

    2xN array of corresponding points in the second image.

    Mat points4D

    4xN array of reconstructed points in homogeneous coordinates.

    | Improve this Doc View Source

    Undistort2(Arr, Arr, Mat, Mat, Mat)

    Transforms an image to compensate for lens distortion.

    Declaration
    public static void Undistort2(Arr src, Arr dst, Mat cameraMatrix, Mat distortionCoeffs, Mat newCameraMatrix = null)
    Parameters
    Type Name Description
    Arr src

    The input (distorted) image.

    Arr dst

    The output (corrected) image with same size and type as src.

    Mat cameraMatrix

    The input camera matrix.

    Mat distortionCoeffs

    The vector of distortion coefficients.

    Mat newCameraMatrix

    Regulates the particular subset of the source image that will be visible in the corrected image.

    | Improve this Doc View Source

    UndistortPoints(Mat, Mat, Mat, Mat, Mat, Mat)

    Computes the ideal point coordinates from the observed point coordinates.

    Declaration
    public static void UndistortPoints(Mat src, Mat dst, Mat cameraMatrix, Mat distortionCoeffs, Mat R = null, Mat P = null)
    Parameters
    Type Name Description
    Mat src

    The observed point coordinates, 2xN or Nx2 single-channel or 1xN or Nx1 2-channel.

    Mat dst

    The output ideal point coordinates, after undistortion and reverse perspective transformation, same format as src.

    Mat cameraMatrix

    The input camera matrix.

    Mat distortionCoeffs

    The 4 or 5 element vector of distortion coefficients.

    Mat R

    The optional rectification transformation in object space (3x3 matrix). If it is null the identity transform is used.

    Mat P

    The optional new camera matrix (3x3) or the new projection matrix (3x4). If it is null the identity new camera matrix is used.

    | Improve this Doc View Source

    UpdateMotionHistory(Arr, Arr, Double, Double)

    Updates the motion history image by a moving silhouette.

    Declaration
    public static void UpdateMotionHistory(Arr silhouette, Arr mhi, double timestamp, double duration)
    Parameters
    Type Name Description
    Arr silhouette

    Silhouette mask that has non-zero pixels where the motion occurs.

    Arr mhi

    Motion history image, that is updated by the function (single-channel, 32-bit floating-point).

    Double timestamp

    Current time in milliseconds or other units.

    Double duration

    Maximal duration of the motion track in the same units as timestamp.

    | Improve this Doc View Source

    WaitKey(Int32)

    Waits for a pressed key.

    Declaration
    public static int WaitKey(int delay = 0)
    Parameters
    Type Name Description
    Int32 delay

    Maximum delay in milliseconds for which to wait for a key press.

    Returns
    Type Description
    Int32

    The pressed key code or -1 if no key was pressed before the specified time had elapsed.

    | Improve this Doc View Source

    WarpAffine(Arr, Arr, Mat, WarpFlags)

    Applies an affine transformation to an image.

    Declaration
    public static void WarpAffine(Arr src, Arr dst, Mat mapMatrix, WarpFlags flags = default(WarpFlags))
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Mat mapMatrix

    The 2 x 3 transformation matrix.

    WarpFlags flags

    A combination of interpolation methods and operational flags.

    | Improve this Doc View Source

    WarpAffine(Arr, Arr, Mat, WarpFlags, Scalar)

    Applies an affine transformation to an image.

    Declaration
    public static void WarpAffine(Arr src, Arr dst, Mat mapMatrix, WarpFlags flags, Scalar fillval)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Mat mapMatrix

    The 2 x 3 transformation matrix.

    WarpFlags flags

    A combination of interpolation methods and operational flags.

    Scalar fillval

    A value used to fill outliers.

    | Improve this Doc View Source

    WarpPerspective(Arr, Arr, Mat, WarpFlags)

    Applies a perspective transformation to an image.

    Declaration
    public static void WarpPerspective(Arr src, Arr dst, Mat mapMatrix, WarpFlags flags = default(WarpFlags))
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Mat mapMatrix

    The 3 x 3 transformation matrix.

    WarpFlags flags

    A combination of interpolation methods and operational flags.

    | Improve this Doc View Source

    WarpPerspective(Arr, Arr, Mat, WarpFlags, Scalar)

    Applies a perspective transformation to an image.

    Declaration
    public static void WarpPerspective(Arr src, Arr dst, Mat mapMatrix, WarpFlags flags, Scalar fillval)
    Parameters
    Type Name Description
    Arr src

    The source image.

    Arr dst

    The destination image.

    Mat mapMatrix

    The 3 x 3 transformation matrix.

    WarpFlags flags

    A combination of interpolation methods and operational flags.

    Scalar fillval

    A value used to fill outliers.

    | Improve this Doc View Source

    Watershed(Arr, Arr)

    Performs marker-based image segmentation using the watershed algorithm.

    Declaration
    public static void Watershed(Arr image, Arr markers)
    Parameters
    Type Name Description
    Arr image

    The input 8-bit 3-channel image.

    Arr markers

    The input/output 32-bit single-channel image (map) of markers. It should have the same size as image.

    | Improve this Doc View Source

    Xor(Arr, Arr, Arr, Arr)

    Performs per-element bit-wise "exclusive or" operation on two arrays.

    Declaration
    public static void Xor(Arr src1, Arr src2, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src1

    The first input array.

    Arr src2

    The second input array.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    | Improve this Doc View Source

    XorS(Arr, Scalar, Arr, Arr)

    Performs per-element bit-wise “exclusive or” operation on an array and a scalar.

    Declaration
    public static void XorS(Arr src, Scalar value, Arr dst, Arr mask = null)
    Parameters
    Type Name Description
    Arr src

    The input array.

    Scalar value

    The scalar input value.

    Arr dst

    The destination array.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed on dst.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX