Constructors

Properties

Methods

abs absdiff accumulate accumulateAsync accumulateProduct accumulateProductAsync accumulateSquare accumulateSquareAsync accumulateWeighted accumulateWeightedAsync adaptiveThreshold adaptiveThresholdAsync add addWeighted addWeightedAsync and at atRaw bgrToGray bgrToGrayAsync bilateralFilter bilateralFilterAsync bitwiseAnd bitwiseNot bitwiseOr bitwiseXor blur blurAsync boxFilter boxFilterAsync buildPyramid buildPyramidAsync calibrationMatrixValues calibrationMatrixValuesAsync canny cannyAsync compareHist compareHistAsync connectedComponents connectedComponentsAsync connectedComponentsWithStats connectedComponentsWithStatsAsync convertScaleAbs convertScaleAbsAsync convertTo convertToAsync copy copyAsync copyMakeBorder copyMakeBorderAsync copyTo copyToAsync cornerEigenValsAndVecs cornerEigenValsAndVecsAsync cornerHarris cornerHarrisAsync cornerMinEigenVal cornerMinEigenValAsync cornerSubPix cornerSubPixAsync correctMatches correctMatchesAsync countNonZero countNonZeroAsync cvtColor cvtColorAsync dct dctAsync decomposeEssentialMat decomposeEssentialMatAsync decomposeHomographyMat decomposeHomographyMatAsync decomposeProjectionMatrix decomposeProjectionMatrixAsync determinant dft dftAsync dilate dilateAsync distanceTransform distanceTransformAsync distanceTransformWithLabels distanceTransformWithLabelsAsync div dot drawArrowedLine drawChessboardCorners drawChessboardCornersAsync drawCircle drawContours drawEllipse drawFillConvexPoly drawFillPoly drawLine drawPolylines drawRectangle eigen eigenAsync equalizeHist equalizeHistAsync erode erodeAsync exp filter2D filter2DAsync filterSpeckles filterSpecklesAsync find4QuadCornerSubpix find4QuadCornerSubpixAsync findChessboardCorners findChessboardCornersAsync findContours findContoursAsync findEssentialMat findEssentialMatAsync findNonZero findNonZeroAsync flattenFloat flip flipAsync floodFill floodFillAsync gaussianBlur gaussianBlurAsync getData getDataAsArray getDataAsync getOptimalNewCameraMatrix getOptimalNewCameraMatrixAsync getRegion goodFeaturesToTrack goodFeaturesToTrackAsync grabCut grabCutAsync guidedFilter guidedFilterAsync hDiv hMul houghCircles houghCirclesAsync houghLines houghLinesAsync houghLinesP houghLinesPAsync idct idctAsync idft idftAsync inRange inRangeAsync integral integralAsync inv laplacian laplacianAsync log matMul matMulDeriv matMulDerivAsync matchTemplate matchTemplateAsync mean meanAsync meanStdDev meanStdDevAsync medianBlur medianBlurAsync minMaxLoc minMaxLocAsync moments momentsAsync morphologyEx morphologyExAsync mul mulSpectrums mulSpectrumsAsync norm normalize normalizeAsync or padToSquare perspectiveTransform perspectiveTransformAsync popBack popBackAsync pop_back pop_backAsync pushBack pushBackAsync push_back push_backAsync putText putTextAsync pyrDown pyrDownAsync pyrUp pyrUpAsync recoverPose recoverPoseAsync rectify3Collinear rectify3CollinearAsync reduce reduceAsync release reprojectImageTo3D reprojectImageTo3DAsync rescale rescaleAsync resize resizeAsync resizeToMax resizeToMaxAsync rodrigues rodriguesAsync rotate rotateAsync rqDecomp3x3 rqDecomp3x3Async scharr scharrAsync seamlessClone seamlessCloneAsync sepFilter2D sepFilter2DAsync set setData setTo setToAsync sobel sobelAsync solve solveAsync split splitAsync splitChannels splitChannelsAsync sqrBoxFilter sqrBoxFilterAsync sqrt stereoRectify stereoRectifyAsync sub sum sumAsync threshold thresholdAsync transform transformAsync transpose triangulatePoints triangulatePointsAsync undistort undistortAsync validateDisparity validateDisparityAsync warpAffine warpAffineAsync warpPerspective warpPerspectiveAsync watershed watershedAsync eye ones zeros

Constructors

  • Returns Mat

  • Parameters

    • channels: Mat[]

    Returns Mat

  • Parameters

    • rows: number
    • cols: number
    • type: number

      CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F ...

    • Optional fillValue: number | number[]

    Returns Mat

  • Parameters

    • rows: number
    • cols: number
    • type: number

      CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F ...

    • data: Buffer
    • Optional step: number

    Returns Mat

  • Parameters

    • dataArray: number[][] | number[][][] | number[][][][]
    • type: number

      CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F ...

    Returns Mat

  • Create a Mat having the given size. The constructor build n-Dimmentional Mat

    added in opencv4node 6.2.0

    Parameters

    • sizes: number[]
    • type: number

    Returns Mat

  • Parameters

    • data: Buffer
    • rows: number
    • cols: number
    • Optional type: number

      CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F ...

    Returns Mat

Properties

channels: number

Mat channels like python .shape[2]

cols: number

Mat width like python .shape[1]

depth: number
dims: number
elemSize: number
empty: boolean
rows: number

Mat height like python .shape[0]

sizes: number[]
step: number
type: number

Methods

  • Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    • src: Mat
    • alpha: number
    • Optional mask: Mat

    Returns Mat

  • Parameters

    • src: Mat
    • alpha: number
    • Optional mask: Mat

    Returns Promise<Mat>

  • Parameters

    • maxVal: number
    • adaptiveMethod: number
    • thresholdType: number
    • blockSize: number
    • C: number

    Returns Mat

  • Parameters

    • maxVal: number
    • adaptiveMethod: number
    • thresholdType: number
    • blockSize: number
    • C: number

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    • alpha: number
    • mat2: Mat
    • beta: number
    • gamma: number
    • Optional dtype: number

    Returns Mat

  • Parameters

    • alpha: number
    • mat2: Mat
    • beta: number
    • gamma: number
    • Optional dtype: number

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    • row: number
    • col: number

    Returns number

  • Parameters

    • row: number
    • col: number

    Returns Vec2

  • Parameters

    • row: number
    • col: number

    Returns Vec3

  • Parameters

    • row: number
    • col: number

    Returns Vec4

  • Parameters

    • idx: number[]

    Returns number

  • Parameters

    • idx: number[]

    Returns Vec2

  • Parameters

    • idx: number[]

    Returns Vec3

  • Parameters

    • idx: number[]

    Returns Vec4

  • Parameters

    • row: number
    • col: number

    Returns number

  • Parameters

    • row: number
    • col: number

    Returns number[]

  • Returns Mat

  • Returns Promise<Mat>

  • Parameters

    • d: number
    • sigmaColor: number
    • sigmaSpace: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • d: number
    • sigmaColor: number
    • sigmaSpace: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    • kSize: Size
    • Optional anchor: Point2
    • Optional borderType: number

    Returns Mat

  • Parameters

    • kSize: Size
    • Optional anchor: Point2
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • ddepth: number
    • ksize: Size
    • Optional anchor: Point2
    • Optional normalize: boolean
    • Optional borderType: number

    Returns Mat

  • Parameters

    • ddepth: number
    • ksize: Size
    • Optional anchor: Point2
    • Optional normalize: boolean
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • maxLevel: number
    • Optional borderType: number

    Returns Mat[]

  • Parameters

    • maxLevel: number
    • Optional borderType: number

    Returns Promise<Mat[]>

  • Parameters

    • imageSize: Size
    • apertureWidth: number
    • apertureHeight: number

    Returns Promise<CalibrationMatrixValues>

  • Parameters

    • threshold1: number
    • threshold2: number
    • Optional apertureSize: number
    • Optional L2gradient: boolean

    Returns Mat

  • Parameters

    • threshold1: number
    • threshold2: number
    • Optional apertureSize: number
    • Optional L2gradient: boolean

    Returns Promise<Mat>

  • Parameters

    • H2: Mat
    • method: number

    Returns number

  • Parameters

    • H2: Mat
    • method: number

    Returns Promise<number>

  • Parameters

    • Optional connectivity: number
    • Optional ltype: number

    Returns Mat

  • Parameters

    • opts: {
          connectivity?: number;
          ltype?: number;
      }
      • Optional connectivity?: number
      • Optional ltype?: number

    Returns Mat

  • Parameters

    • Optional connectivity: number
    • Optional ltype: number

    Returns Promise<Mat>

  • Parameters

    • opts: {
          connectivity?: number;
          ltype?: number;
      }
      • Optional connectivity?: number
      • Optional ltype?: number

    Returns Promise<Mat>

  • Parameters

    • alpha: number
    • beta: number

    Returns Mat

  • Parameters

    • alpha: number
    • beta: number

    Returns Promise<Mat>

  • Parameters

    • type: number
    • Optional alpha: number
    • Optional beta: number

    Returns Mat

  • Parameters

    • type: number
    • Optional alpha: number
    • Optional beta: number

    Returns Promise<Mat>

  • Parameters

    • Optional mask: Mat

    Returns Mat

  • Parameters

    • Optional mask: Mat

    Returns Promise<Mat>

  • Parameters

    • top: number
    • bottom: number
    • left: number
    • right: number
    • Optional borderType: number
    • Optional value: number | Vec3 | Vec4 | Vec2

    Returns Mat

  • Parameters

    • top: number
    • bottom: number
    • left: number
    • right: number
    • args: {
          borderType?: number;
          value?: number | Vec3 | Vec4 | Vec2;
      }
      • Optional borderType?: number
      • Optional value?: number | Vec3 | Vec4 | Vec2

    Returns Mat

  • Parameters

    • top: number
    • bottom: number
    • left: number
    • right: number
    • Optional borderType: number
    • Optional value: number | Vec3 | Vec4 | Vec2

    Returns Promise<Mat>

  • Parameters

    • top: number
    • bottom: number
    • left: number
    • right: number
    • args: {
          borderType?: number;
          value?: number | Vec3 | Vec4 | Vec2;
      }
      • Optional borderType?: number
      • Optional value?: number | Vec3 | Vec4 | Vec2

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    • blockSize: number
    • Optional ksize: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • blockSize: number
    • Optional ksize: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • blockSize: number
    • ksize: number
    • k: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • blockSize: number
    • ksize: number
    • k: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • blockSize: number
    • Optional ksize: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • blockSize: number
    • Optional ksize: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    Returns Point2[]

  • Parameters

    Returns Promise<Point2[]>

  • Returns number

  • Returns Promise<number>

  • Parameters

    • code: number
    • Optional dstCn: number

    Returns Mat

  • Parameters

    • code: number
    • Optional dstCn: number

    Returns Promise<Mat>

  • Parameters

    • Optional flags: number

    Returns Mat

  • Parameters

    • Optional flags: number

    Returns Promise<Mat>

  • Returns number

  • Parameters

    • Optional flags: number
    • Optional nonzeroRows: number

    Returns Mat

  • Parameters

    • Optional flags: number
    • Optional nonzeroRows: number

    Returns Promise<Mat>

  • Parameters

    • kernel: Mat
    • Optional anchor: Point2
    • Optional iterations: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • kernel: Mat
    • Optional anchor: Point2
    • Optional iterations: number
    • Optional borderType: number

    Returns Promise<Mat>

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

    https://docs.opencv.org/4.x/d7/d1b/group__imgproc__misc.html#ga8a0b7fdfcb7a13dde018988ba3a43042

    Parameters

    • distanceType: number

      Type of distance, see DistanceTypes

    • maskSize: number

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

    • Optional dstType: number

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

    Returns Mat

  • Parameters

    • distanceType: number
    • maskSize: number
    • Optional dstType: number

    Returns Promise<Mat>

  • Parameters

    • distanceType: number
    • maskSize: number
    • Optional labelType: number

    Returns {
        dst: Mat;
        labels: Mat;
    }

  • Parameters

    • distanceType: number
    • maskSize: number
    • Optional labelType: number

    Returns Promise<{
        dst: Mat;
        labels: Mat;
    }>

  • Parameters

    • s: number

    Returns Mat

  • Parameters

    • Optional m: Mat

    Returns Mat

  • Parameters

    • pt0: Point2
    • pt1: Point2
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional shift: number
    • Optional tipLength: number

    Returns void

  • Parameters

    • patternSize: Size
    • corners: Point2[]
    • patternWasFound: boolean

    Returns void

  • Parameters

    • patternSize: Size
    • corners: Point2[]
    • patternWasFound: boolean

    Returns Promise<void>

  • Parameters

    • center: Point2
    • radius: number
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional shift: number

    Returns void

  • Draws contours outlines or filled contours.

    The function draws contour outlines in the image if thickness≥0 or fills the area bounded by the contours if thickness<0 . The example below shows how to retrieve connected components from the binary image and label them: :

    https://docs.opencv.org/4.5.4/d6/d6e/group__imgproc__draw.html#ga746c0625f1781f1ffc9056259103edbc

    MatImgprocBindings.h

    Parameters

    Returns void

  • Parameters

    • contours: Point2[][]
    • contourIdx: number
    • color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional hierarchy: Vec4[]
    • Optional maxLevel: number
    • Optional offset: Point2

    Returns void

  • Parameters

    • box: RotatedRect
    • opts: {
          color?: Vec3;
          lineType?: number;
          thickness?: number;
      }
      • Optional color?: Vec3
      • Optional lineType?: number
      • Optional thickness?: number

    Returns void

  • Parameters

    • box: RotatedRect
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number

    Returns void

  • Parameters

    • center: Point2
    • axes: Size
    • angle: number
    • startAngle: number
    • endAngle: number
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional shift: number

    Returns void

  • Parameters

    • pts: Point2[]
    • Optional color: Vec3
    • Optional lineType: number
    • Optional shift: number

    Returns void

  • Parameters

    • pts: Point2[][]
    • Optional color: Vec3
    • Optional lineType: number
    • Optional shift: number
    • Optional offset: Point2

    Returns void

  • Parameters

    • pt0: Point2
    • pt1: Point2
    • opts: {
          color?: Vec3;
          lineType?: number;
          shift?: number;
          thickness?: number;
      }
      • Optional color?: Vec3
      • Optional lineType?: number
      • Optional shift?: number
      • Optional thickness?: number

    Returns void

  • Parameters

    • pt0: Point2
    • pt1: Point2
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional shift: number

    Returns void

  • Parameters

    • pts: Point2[][]
    • isClosed: boolean
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional shift: number

    Returns void

  • Parameters

    • pt0: Point2
    • pt1: Point2
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional shift: number

    Returns void

  • Parameters

    Returns void

  • Parameters

    • rect: Rect
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional shift: number

    Returns void

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    • kernel: Mat
    • Optional anchor: Point2
    • Optional iterations: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • kernel: Mat
    • Optional anchor: Point2
    • Optional iterations: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Returns Mat

  • Parameters

    • ddepth: number
    • kernel: Mat
    • Optional anchor: Point2
    • Optional delta: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • ddepth: number
    • kernel: Mat
    • Optional anchor: Point2
    • Optional delta: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • newVal: number
    • maxSpeckleSize: number
    • maxDiff: number

    Returns {
        newPoints1: Point2[];
        newPoints2: Point2[];
    }

  • Parameters

    • newVal: number
    • maxSpeckleSize: number
    • maxDiff: number

    Returns Promise<{
        newPoints1: Point2[];
        newPoints2: Point2[];
    }>

  • Parameters

    Returns boolean

  • Parameters

    Returns Promise<boolean>

  • Parameters

    • patternSize: Size
    • Optional flags: number

    Returns {
        corners: Point2[];
        returnValue: boolean;
    }

    • corners: Point2[]
    • returnValue: boolean
  • Parameters

    • patternSize: Size
    • Optional flags: number

    Returns Promise<{
        corners: Point2[];
        returnValue: boolean;
    }>

  • Parameters

    • mode: number
    • method: number
    • Optional offset: Point2

    Returns Contour[]

  • Parameters

    • mode: number
    • method: number
    • Optional offset: Point2

    Returns Promise<Contour[]>

  • Parameters

    • points1: Point2[]
    • points2: Point2[]
    • Optional method: number
    • Optional prob: number
    • Optional threshold: number

    Returns {
        E: Mat;
        mask: Mat;
    }

  • Parameters

    • points1: Point2[]
    • points2: Point2[]
    • Optional method: number
    • Optional prob: number
    • Optional threshold: number

    Returns Promise<{
        E: Mat;
        mask: Mat;
    }>

  • Returns Point2[]

  • Returns Promise<Point2[]>

  • Parameters

    • rows: number
    • cols: number

    Returns Mat

  • Parameters

    • flipCode: number

    Returns Mat

  • Parameters

    • flipCode: number

    Returns Promise<Mat>

  • Fills a connected component with the given color.

    The function cv::floodFill fills a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at (x,y) is considered to belong to the repainted domain if:

    https://docs.opencv.org/4.x/d7/d1b/group__imgproc__misc.html#ga366aae45a6c1289b341d140839f18717

    Type Parameters

    • T extends number | Vec3

    Parameters

    • seedPoint: Point2

      Starting point.

    • newVal: T

      New value of the repainted domain pixels.

    • Optional mask: Mat

      Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller than image. Since this is both an input and output parameter, you must take responsibility of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example, an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags as described below. Additionally, the function fills the border of the mask with ones to simplify internal processing. It is therefore possible to use the same mask in multiple calls to the function to make sure the filled areas do not overlap.

    • Optional loDiff: T

      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.

    • Optional upDiff: T

      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.

    • Optional flags: T

      Operation flags. The first 8 bits contain a connectivity value. The default value of 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner) will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill the mask (the default value is 1). For example, 4 | ( 255 << 8 ) will consider 4 nearest neighbours and fill the mask with a value of 255. The following additional options occupy higher bits and therefore may be further combined with the connectivity and mask fill values using bit-wise or (|), see FloodFillFlags.

    Returns {
        rect: Rect;
        returnValue: number;
    }

    • rect: Rect
    • returnValue: number
  • Type Parameters

    • T extends number | Vec3

    Parameters

    • seedPoint: Point2
    • newVal: T
    • opts: {
          flags?: T;
          loDiff?: T;
          mask?: Mat;
          upDiff?: T;
      }
      • Optional flags?: T
      • Optional loDiff?: T
      • Optional mask?: Mat
      • Optional upDiff?: T

    Returns {
        rect: Rect;
        returnValue: number;
    }

    • rect: Rect
    • returnValue: number
  • Type Parameters

    • T extends number | Vec3

    Parameters

    • seedPoint: Point2
    • newVal: T
    • Optional mask: Mat
    • Optional loDiff: T
    • Optional upDiff: T
    • Optional flags: number

    Returns Promise<{
        rect: Rect;
        returnValue: number;
    }>

  • Type Parameters

    • T extends number | Vec3

    Parameters

    • seedPoint: Point2
    • newVal: T
    • opts: {
          flags?: number;
          loDiff?: T;
          mask?: Mat;
          upDiff?: T;
      }
      • Optional flags?: number
      • Optional loDiff?: T
      • Optional mask?: Mat
      • Optional upDiff?: T

    Returns Promise<{
        rect: Rect;
        returnValue: number;
    }>

  • Parameters

    • kSize: Size
    • sigmaX: number
    • Optional sigmaY: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • kSize: Size
    • sigmaX: number
    • Optional sigmaY: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Returns Buffer

  • if Mat.dims <= 2

    Returns number[][]

    See

    https://github.com/justadudewhohacks/opencv4nodejs/issues/329

    Note this method offer low performances, use getData instead.

  • if Mat.dims > 2 (3D)

    Returns number[][][]

  • Returns Promise<Buffer>

  • The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter. By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original image pixels if there is valuable information in the corners alpha=1 , or get something in between. When alpha>0 , the undistorted result is likely to have some black pixels corresponding to "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to initUndistortRectifyMap to produce the maps for remap.

    https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#ga7a6c4e032c97f03ba747966e6ad862b1

    Parameters

    • distCoeffs: number[]

      Input vector of distortion coefficients (k1,k2,p1,p2[,k3[,k4,k5,k6[,s1,s2,s3,s4[,Ï„x,Ï„y]]]]) of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.

    • imageSize: Size

      Original image size.

    • alpha: number

      Free scaling parameter between 0 (when all the pixels in the undistorted image are valid) and 1 (when all the source image pixels are retained in the undistorted image). See stereoRectify for details.

    • Optional newImageSize: Size

      Image size after rectification. By default, it is set to imageSize .

    • Optional centerPrincipalPoint: boolean

      Optional flag that indicates whether in the new camera intrinsic matrix the principal point should be at the image center or not. By default, the principal point is chosen to best fit a subset of the source image (determined by alpha) to the corrected image.

    Returns OptimalNewCameraMatrix

  • Parameters

    • distCoeffs: number[]
    • imageSize: Size
    • alpha: number
    • Optional newImageSize: Size
    • Optional centerPrincipalPoint: boolean

    Returns Promise<OptimalNewCameraMatrix>

  • crop a region from the image like python Mat[x1,y1,x2,y2]

    Parameters

    Returns Mat

  • Parameters

    • maxCorners: number
    • qualityLevel: number
    • minDistance: number
    • Optional mask: Mat
    • Optional blockSize: number
    • Optional gradientSize: number
    • Optional useHarrisDetector: boolean
    • Optional harrisK: number

    Returns Point2[]

  • Parameters

    • maxCorners: number
    • qualityLevel: number
    • minDistance: number
    • Optional mask: Mat
    • Optional blockSize: number
    • Optional gradientSize: number
    • Optional useHarrisDetector: boolean
    • Optional harrisK: number

    Returns Promise<Point2[]>

  • Parameters

    • mask: Mat
    • rect: Rect
    • bgdModel: Mat
    • fgdModel: Mat
    • iterCount: number
    • mode: number

    Returns void

  • Parameters

    • mask: Mat
    • rect: Rect
    • bgdModel: Mat
    • fgdModel: Mat
    • iterCount: number
    • mode: number

    Returns Promise<void>

  • Parameters

    • guide: Mat
    • radius: number
    • eps: number
    • Optional ddepth: number

    Returns Mat

  • Parameters

    • guide: Mat
    • radius: number
    • eps: number
    • Optional ddepth: number

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    • method: number
    • dp: number
    • minDist: number
    • Optional param1: number
    • Optional param2: number
    • Optional minRadius: number
    • Optional maxRadius: number

    Returns Vec3[]

  • Parameters

    • method: number
    • dp: number
    • minDist: number
    • Optional param1: number
    • Optional param2: number
    • Optional minRadius: number
    • Optional maxRadius: number

    Returns Promise<Vec3[]>

  • Parameters

    • rho: number
    • theta: number
    • threshold: number
    • Optional srn: number
    • Optional stn: number
    • Optional min_theta: number
    • Optional max_theta: number

    Returns Vec2[]

  • Parameters

    • rho: number
    • theta: number
    • threshold: number
    • Optional srn: number
    • Optional stn: number
    • Optional min_theta: number
    • Optional max_theta: number

    Returns Promise<Vec2[]>

  • Parameters

    • rho: number
    • theta: number
    • threshold: number
    • Optional minLineLength: number
    • Optional maxLineGap: number

    Returns Vec4[]

  • Parameters

    • rho: number
    • theta: number
    • threshold: number
    • Optional minLineLength: number
    • Optional maxLineGap: number

    Returns Promise<Vec4[]>

  • Parameters

    • Optional flags: number

    Returns Mat

  • Parameters

    • Optional flags: number

    Returns Promise<Mat>

  • Parameters

    • Optional flags: number
    • Optional nonzeroRows: number

    Returns Mat

  • Parameters

    • Optional flags: number
    • Optional nonzeroRows: number

    Returns Promise<Mat>

  • Parameters

    • lower: number
    • upper: number

    Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    • lower: number
    • upper: number

    Returns Promise<Mat>

  • Parameters

    Returns Promise<Mat>

  • Parameters

    • Optional sdepth: number

      desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or CV_64F.

    • Optional sqdepth: number

      desired depth of the integral image of squared pixel values, CV_32F or CV_64F.

    Returns {
        sqsum: Mat;
        sum: Mat;
        tilted: Mat;
    }

  • Parameters

    • opts: {
          sdepth?: number;
          sqdepth?: number;
      }
      • Optional sdepth?: number
      • Optional sqdepth?: number

    Returns {
        sqsum: Mat;
        sum: Mat;
        tilted: Mat;
    }

  • Parameters

    • Optional sdepth: number
    • Optional sqdepth: number

    Returns Promise<{
        sqsum: Mat;
        sum: Mat;
        tilted: Mat;
    }>

  • Parameters

    • opts: {
          sdepth?: number;
          sqdepth?: number;
      }
      • Optional sdepth?: number
      • Optional sqdepth?: number

    Returns Promise<{
        sqsum: Mat;
        sum: Mat;
        tilted: Mat;
    }>

  • Returns Mat

  • Parameters

    • ddepth: number
    • Optional ksize: number
    • Optional scale: number
    • Optional delta: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • ddepth: number
    • Optional ksize: number
    • Optional scale: number
    • Optional delta: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    Returns {
        dABdA: Mat;
        dABdB: Mat;
    }

  • Parameters

    Returns Promise<{
        dABdA: Mat;
        dABdB: Mat;
    }>

  • Compares a template against overlapped image regions.

    The function slides through image , compares the overlapped patches of size w×h against templ using the specified method and stores the comparison results in result . TemplateMatchModes describes the formulae for the available comparison methods ( I denotes image, T template, R result, M the optional mask ). The summation is done over template and/or the image patch: x′=0...w−1,y′=0...h−1 After the function finishes the comparison, the best matches can be found as global minimums (when TM_SQDIFF was used) or maximums (when TM_CCORR or TM_CCOEFF was used) using the minMaxLoc function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.

    https://docs.opencv.org/4.x/df/dfb/group__imgproc__object.html#ga586ebfb0a7fb604b35a23d85391329be

    Parameters

    • template: Mat

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

    • method: number

      Parameter specifying the comparison method, can be one of TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED.

    • Optional mask: Mat

      Optional mask. It must have the same size as templ. It must either have the same number of channels as template or only one channel, which is then used for all template and image channels. If the data type is CV_8U, the mask is interpreted as a binary mask, meaning only elements where mask is nonzero are used and are kept unchanged independent of the actual mask value (weight equals 1). For data tpye CV_32F, the mask values are used as weights. The exact formulas are documented in TemplateMatchModes.

    Returns Mat

    Map of comparison results. It must be single-channel 32-bit floating-point. If image is W×H and templ is w×h , then result is (W−w+1)×(H−h+1) .

  • Parameters

    • template: Mat
    • method: number
    • Optional mask: Mat

    Returns Promise<Mat>

  • Parameters

    • template: Mat
    • method: number
    • Optional callback: ((err, res) => void)
        • (err, res): void
        • Parameters

          • err: unknown
          • res: Mat

          Returns void

    Returns void

  • Parameters

    • template: Mat
    • method: number
    • Optional mask: Mat
    • Optional callback: ((err, res) => void)
        • (err, res): void
        • Parameters

          • err: unknown
          • res: Mat

          Returns void

    Returns void

  • Returns Vec4

  • Returns Promise<Vec4>

  • Parameters

    • Optional mask: Mat

    Returns {
        mean: Mat;
        stddev: Mat;
    }

  • Parameters

    • Optional mask: Mat

    Returns Promise<{
        mean: Mat;
        stddev: Mat;
    }>

  • Parameters

    • kSize: number

    Returns Mat

  • Parameters

    • kSize: number

    Returns Promise<Mat>

  • Finds the global minimum and maximum in an array.

    The function cv::minMaxLoc finds the minimum and maximum element values and their positions. The extremums are searched across the whole array or, if mask is not an empty array, in the specified array region.

    The function do not work with multi-channel arrays. If you need to find minimum or maximum elements across all the channels, use Mat::reshape first to reinterpret the array as single-channel. Or you may extract the particular channel using either extractImageCOI , or mixChannels , or split .

    https://docs.opencv.org/4.x/d2/de8/group__core__array.html#gab473bf2eb6d14ff97e89b355dac20707

    Parameters

    • Optional mask: Mat

      optional mask used to select a sub-array.

    Returns {
        maxLoc: Point2;
        maxVal: number;
        minLoc: Point2;
        minVal: number;
    }

  • Parameters

    • Optional mask: Mat

    Returns Promise<{
        maxLoc: Point2;
        maxVal: number;
        minLoc: Point2;
        minVal: number;
    }>

  • Returns Moments

  • Returns Promise<Moments>

  • Parameters

    • kernel: Mat
    • morphType: number
    • Optional anchor: Point2
    • Optional iterations: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • kernel: Mat
    • morphType: number
    • Optional anchor: Point2
    • Optional iterations: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • s: number

    Returns Mat

  • Parameters

    • mat2: Mat
    • Optional dftRows: boolean
    • Optional conjB: boolean

    Returns Mat

  • Parameters

    • mat2: Mat
    • Optional dftRows: boolean
    • Optional conjB: boolean

    Returns Promise<Mat>

  • Parameters

    • src2: Mat
    • Optional normType: number
    • Optional mask: Mat

    Returns number

  • Parameters

    • Optional normType: number
    • Optional mask: Mat

    Returns number

  • Parameters

    • this: Mat
    • Optional alpha: number
    • Optional beta: number
    • Optional normType: number
    • Optional dtype: number
    • Optional mask: Mat

    Returns Mat

  • Parameters

    • this: Mat
    • opt: {
          alpha?: number;
          beta?: number;
          dtype?: number;
          mask?: Mat;
          normType?: number;
      }
      • Optional alpha?: number
      • Optional beta?: number
      • Optional dtype?: number
      • Optional mask?: Mat
      • Optional normType?: number

    Returns Mat

  • Parameters

    • this: Mat
    • Optional alpha: number
    • Optional beta: number
    • Optional normType: number
    • Optional dtype: number
    • Optional mask: Mat

    Returns Promise<Mat>

  • Parameters

    • this: Mat
    • opt: {
          alpha?: number;
          beta?: number;
          dtype?: number;
          mask?: Mat;
          normType?: number;
      }
      • Optional alpha?: number
      • Optional beta?: number
      • Optional dtype?: number
      • Optional mask?: Mat
      • Optional normType?: number

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    • Optional numRows: number

    Returns Mat

  • Parameters

    • Optional numRows: number

    Returns Promise<Mat>

  • Parameters

    • Optional numRows: number

    Returns Mat

  • Parameters

    • Optional numRows: number

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    • text: string
    • origin: Point2
    • fontFace: number
    • fontScale: number
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional bottomLeftOrigin: boolean | 0

    Returns void

  • Parameters

    • text: string
    • origin: Point2
    • fontFace: number
    • fontScale: number
    • Optional opts: {
          bottomLeftOrigin?: boolean | 0;
          color?: Vec3;
          lineType?: number;
          thickness?: number;
      }
      • Optional bottomLeftOrigin?: boolean | 0
      • Optional color?: Vec3
      • Optional lineType?: number
      • Optional thickness?: number

    Returns void

  • Parameters

    • text: string
    • origin: Point2
    • fontFace: number
    • fontScale: number
    • Optional color: Vec3
    • Optional thickness: number
    • Optional lineType: number
    • Optional bottomLeftOrigin: boolean | 0

    Returns Promise<void>

  • Parameters

    • text: string
    • origin: Point2
    • fontFace: number
    • fontScale: number
    • Optional opts: {
          bottomLeftOrigin?: boolean | 0;
          color?: Vec3;
          lineType?: number;
          thickness?: number;
      }
      • Optional bottomLeftOrigin?: boolean | 0
      • Optional color?: Vec3
      • Optional lineType?: number
      • Optional thickness?: number

    Returns Promise<void>

  • Parameters

    • Optional size: Size
    • Optional borderType: number

    Returns Mat

  • Parameters

    • Optional size: Size
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • Optional size: Size
    • Optional borderType: number

    Returns Mat

  • Parameters

    • Optional size: Size
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    Returns {
        R: Mat;
        T: Vec3;
        returnValue: number;
    }

  • Parameters

    Returns Promise<{
        R: Mat;
        T: Vec3;
        returnValue: number;
    }>

  • Parameters

    • distCoeffs1: number[]
    • cameraMatrix2: Mat
    • distCoeffs2: number[]
    • cameraMatrix3: Mat
    • distCoeffs3: number[]
    • imageSize: Size
    • R12: Mat
    • T12: Vec3
    • R13: Mat
    • T13: Vec3
    • alpha: number
    • newImageSize: Size
    • flags: number

    Returns {
        P1: Mat;
        P2: Mat;
        P3: Mat;
        Q: Mat;
        R1: Mat;
        R2: Mat;
        R3: Mat;
        returnValue: number;
        roi1: Rect;
        roi2: Rect;
    }

  • Parameters

    • distCoeffs1: number[]
    • cameraMatrix2: Mat
    • distCoeffs2: number[]
    • cameraMatrix3: Mat
    • distCoeffs3: number[]
    • imageSize: Size
    • R12: Mat
    • T12: Vec3
    • R13: Mat
    • T13: Vec3
    • alpha: number
    • newImageSize: Size
    • flags: number

    Returns Promise<{
        P1: Mat;
        P2: Mat;
        P3: Mat;
        Q: Mat;
        R1: Mat;
        R2: Mat;
        R3: Mat;
        returnValue: number;
        roi1: Rect;
        roi2: Rect;
    }>

  • Parameters

    • dim: number
    • rtype: number
    • Optional dtype: number

    Returns Mat

  • Parameters

    • dim: number
    • rtype: number
    • Optional dtype: number

    Returns Promise<Mat>

  • Decrements the reference counter and deallocates the matrix if needed.

    The method decrements the reference counter associated with the matrix data. When the reference counter reaches 0, the matrix data is deallocated and the data and the reference counter pointers are set to NULL's. If the matrix header points to an external data set (see Mat::Mat ), the reference counter is NULL, and the method has no effect in this case.

    This method can be called manually to force the matrix data deallocation. But since this method is automatically called in the destructor, or by any other method that changes the data pointer, it is usually not needed. The reference counter decrement and check for 0 is an atomic operation on the platforms that support it. Thus, it is safe to operate on the same matrices asynchronously in different threads. https://docs.opencv.org/4.6.0/d3/d63/classcv_1_1Mat.html#ae48d4913285518e2c21a3457017e716e

    Returns void

  • Parameters

    • Q: Mat
    • Optional handleMissingValues: boolean
    • Optional ddepth: number

    Returns Mat

  • Parameters

    • Q: Mat
    • Optional handleMissingValues: boolean
    • Optional ddepth: number

    Returns Promise<Mat>

  • Parameters

    • factor: number

    Returns Mat

  • Parameters

    • factor: number

    Returns Promise<Mat>

  • Parameters

    • rows: number
    • cols: number
    • Optional fx: number
    • Optional fy: number
    • Optional interpolation: number

    Returns Mat

  • Parameters

    • dsize: Size
    • Optional fx: number
    • Optional fy: number
    • Optional interpolation: number

    Returns Mat

  • Parameters

    • rows: number
    • cols: number
    • Optional fx: number
    • Optional fy: number
    • Optional interpolation: number

    Returns Promise<Mat>

  • Parameters

    • dsize: Size
    • Optional fx: number
    • Optional fy: number
    • Optional interpolation: number

    Returns Promise<Mat>

  • Parameters

    • maxRowsOrCols: number

    Returns Mat

  • Parameters

    • maxRowsOrCols: number

    Returns Promise<Mat>

  • Returns {
        dst: Mat;
        jacobian: Mat;
    }

  • Returns Promise<{
        dst: Mat;
        jacobian: Mat;
    }>

  • Parameters

    • rotateCode: number

    Returns Mat

  • Parameters

    • rotateCode: number

    Returns Promise<Mat>

  • Parameters

    • ddepth: number
    • dx: number
    • dy: number
    • Optional scale: number
    • Optional delta: number
    • Optional borderType: number

    Returns Mat

  • Parameters

    • ddepth: number
    • dx: number
    • dy: number
    • Optional scale: number
    • Optional delta: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Applies a separable linear filter to an image.

    The function applies a separable linear filter to the image. That is, first, every row of src is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result shifted by delta is stored in dst .

    https://docs.opencv.org/4.x/d4/d86/group__imgproc__filter.html#ga910e29ff7d7b105057d1625a4bf6318d

    Parameters

    • ddepth: number

      Destination image depth, see combinations

    • kernelX: Mat

      Coefficients for filtering each row.

    • kernelY: Mat

      Coefficients for filtering each column.

    • Optional anchor: Point2

      Anchor position within the kernel. The default value (−1,−1) means that the anchor is at the kernel center.

    • Optional delta: number

      Value added to the filtered results before storing them.

    • Optional borderType: number

      Pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.

    Returns Mat

  • Parameters

    • ddepth: number
    • kernelX: Mat
    • kernelY: Mat
    • opts: {
          anchor?: Point2;
          borderType?: number;
          delta?: number;
      }
      • Optional anchor?: Point2
      • Optional borderType?: number
      • Optional delta?: number

    Returns Mat

  • Parameters

    • ddepth: number
    • kernelX: Mat
    • kernelY: Mat
    • Optional anchor: Point2
    • Optional delta: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • ddepth: number
    • kernelX: Mat
    • kernelY: Mat
    • opts: {
          anchor?: Point2;
          borderType?: number;
          delta?: number;
      }
      • Optional anchor?: Point2
      • Optional borderType?: number
      • Optional delta?: number

    Returns Promise<Mat>

  • Parameters

    • row: number
    • col: number
    • value: number | number[] | Vec3 | Vec4 | Vec2

    Returns void

  • Copy a Buffer into an existing Mat object. The actual size written is defined by the target Mat size (mat.rows * mat.cols * mat.elemSize())

    Parameters

    • buffer: Buffer

    Returns Mat

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Parameters

    • ddepth: number

      output image depth, see combinations; in the case of 8-bit input images it will result in truncated derivatives.

    • dx: number

      order of the derivative x.

    • dy: number

      order of the derivative y.

    • Optional ksize: 1 | 3 | 5 | 7

      size of the extended Sobel kernel; it must be 1, 3, 5, or 7.

    • Optional scale: number

      optional scale factor for the computed derivative values; by default, no scaling is applied (see getDerivKernels for details).

    • Optional delta: number

      optional delta value that is added to the results prior to storing them in dst.

    • Optional borderType: number

      pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.

    Returns Mat

  • Parameters

    • ddepth: number
    • dx: number
    • dy: number
    • opts: {
          borderType?: number;
          delta?: number;
          ksize?: 1 | 3 | 5 | 7;
          scale?: number;
      }
      • Optional borderType?: number
      • Optional delta?: number
      • Optional ksize?: 1 | 3 | 5 | 7
      • Optional scale?: number

    Returns Mat

  • Parameters

    • ddepth: number
    • dx: number
    • dy: number
    • Optional ksize: 1 | 3 | 5 | 7
    • Optional scale: number
    • Optional delta: number
    • Optional borderType: number

    Returns Promise<Mat>

  • Parameters

    • ddepth: number
    • dx: number
    • dy: number
    • opts: {
          borderType?: number;
          delta?: number;
          ksize?: 1 | 3 | 5 | 7;
          scale?: number;
      }
      • Optional borderType?: number
      • Optional delta?: number
      • Optional ksize?: 1 | 3 | 5 | 7
      • Optional scale?: number

    Returns Promise<Mat>

  • Parameters

    • this: Mat
    • mat2: Mat
    • Optional flags: number

    Returns Mat

  • Parameters

    • this: Mat
    • mat2: Mat
    • Optional flags: number

    Returns Promise<Mat>

  • Returns Mat[]

  • Returns Promise<Mat[]>

  • Returns Mat[]

  • Returns Promise<Mat[]>

  • Parameters

    • ddepth: number
    • ksize: Size
    • Optional anchor: Point2
    • Optional normalize: boolean
    • Optional borderType: number

    Returns Mat

  • Parameters

    • ddepth: number
    • ksize: Size
    • Optional anchor: Point2
    • Optional normalize: boolean
    • Optional borderType: number

    Returns Promise<Mat>

  • Returns Mat

  • Computes rectification transforms for each head of a calibrated stereo camera.

    https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#ga617b1685d4059c6040827800e72ad2b6

    Parameters

    • distCoeffs1: number[]

      First camera distortion parameters.

    • cameraMatrix2: Mat

      Second camera intrinsic matrix.

    • distCoeffs2: number[]

      Second camera distortion parameters.

    • imageSize: Size

      Size of the image used for stereo calibration.

    • R: Mat

      Rotation matrix from the coordinate system of the first camera to the second camera, see stereoCalibrate.

    • T: Vec3

      Translation vector from the coordinate system of the first camera to the second camera, see stereoCalibrate.

    • Optional flags: number

      Operation flags that may be zero or CALIB_ZERO_DISPARITY . If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area.

    • Optional alpha: number

      Free scaling parameter. If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images (no source image pixels are lost). Any intermediate value yields an intermediate result between those two extreme cases.

    • Optional newImageSize: Size

      New image resolution after rectification. The same size should be passed to initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0) is passed (default), it is set to the original imageSize . Setting it to a larger value can help you preserve details in the original image, especially when there is a big radial distortion.

    Returns StereoRectify

  • Parameters

    • distCoeffs1: number[]
    • cameraMatrix2: Mat
    • distCoeffs2: number[]
    • imageSize: Size
    • R: Mat
    • T: Vec3
    • Optional flags: number
    • Optional alpha: number
    • Optional newImageSize: Size

    Returns Promise<StereoRectify>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<number | Vec3 | Vec4 | Vec2>

  • Applies a fixed-level threshold to each array element.

    The function applies fixed-level thresholding to a multiple-channel array. The function is typically used to get a bi-level (binary) image out of a grayscale image ( compare could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large values. There are several types of thresholding supported by the function. They are determined by type parameter.

    Also, the special values THRESH_OTSU or THRESH_TRIANGLE may be combined with one of the above values. In these cases, the function determines the optimal threshold value using the Otsu's or Triangle algorithm and uses it instead of the specified thresh.

    Note: Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images. https://docs.opencv.org/4.x/d7/d1b/group__imgproc__misc.html#gae8a4a146d1ca78c626a53577199e9c57

    Parameters

    • thresh: number

      threshold value.

    • maxVal: number

      maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types

    • type: number

      thresholding type (see ThresholdTypes).

    Returns Mat

  • Parameters

    • thresh: number
    • maxVal: number
    • type: number

    Returns Promise<Mat>

  • Parameters

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Returns Mat

  • This function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera.

    https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#gad3fc9a0c82b08df034234979960b778c

    Parameters

    • projPoints1: Point2[]

      2xN array of feature points in the first image. In the case of the c++ version, it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.

    • projPoints2: Point2[]

      2xN array of corresponding points in the second image. In the case of the c++ version, it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Transforms an image to compensate for lens distortion.

    The function transforms an image to compensate radial and tangential lens distortion.

    The function is simply a combination of initUndistortRectifyMap (with unity R ) and remap (with bilinear interpolation). See the former function for details of the transformation being performed.

    Those pixels in the destination image, for which there is no correspondent pixels in the source image, are filled with zeros (black color).

    A particular subset of the source image that will be visible in the corrected image can be regulated by newCameraMatrix. You can use getOptimalNewCameraMatrix to compute the appropriate newCameraMatrix depending on your requirements.

    The camera matrix and the distortion parameters can be determined using calibrateCamera. If the resolution of images is different from the resolution used at the calibration stage, fx,fy,cx and cy need to be scaled accordingly, while the distortion coefficients remain the same.

    https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#ga69f2545a8b62a6b0fc2ee060dc30559d

    Parameters

    • cameraMatrix: Mat

      Input camera matrix

    • distCoeffs: Mat

      Input vector of distortion coefficients (k1,k2,p1,p2[,k3[,k4,k5,k6[,s1,s2,s3,s4[,Ï„x,Ï„y]]]]) of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.

    Returns Mat

  • Parameters

    • cameraMatrix: Mat
    • distCoeffs: Mat

    Returns Promise<Mat>

  • Parameters

    • cost: Mat
    • minDisparity: number
    • numberOfDisparities: number
    • Optional disp12MaxDisp: number

    Returns void

  • Parameters

    • cost: Mat
    • minDisparity: number
    • numberOfDisparities: number
    • Optional disp12MaxDisp: number

    Returns Promise<void>

  • Parameters

    • transforMationMatrix: Mat
    • Optional size: Size
    • Optional flags: number
    • Optional borderMode: number
    • Optional borderValue: Vec3

    Returns Mat

  • Parameters

    • transforMationMatrix: Mat
    • Optional size: Size
    • Optional flags: number
    • Optional borderMode: number
    • Optional borderValue: Vec3

    Returns Promise<Mat>

  • Parameters

    • transforMationMatrix: Mat
    • Optional size: Size
    • Optional flags: number
    • Optional borderMode: number
    • Optional borderValue: Vec3

    Returns Mat

  • Parameters

    • transforMationMatrix: Mat
    • Optional size: Size
    • Optional flags: number
    • Optional borderMode: number
    • Optional borderValue: Vec3

    Returns Promise<Mat>

  • Performs a marker-based image segmentation using the watershed algorithm.

    The function implements one of the variants of watershed, non-parametric marker-based segmentation algorithm, described in [173] .

    Before passing the image to the function, you have to roughly outline the desired regions in the image markers with positive (>0) indices. So, every region is represented as one or more connected components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary mask using findContours and drawContours (see the watershed.cpp demo). The markers are "seeds" of the future image regions. All the other pixels in markers , whose relation to the outlined regions is not known and should be defined by the algorithm, should be set to 0's. In the function output, each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the regions.

    Note Any two neighbor connected components are not necessarily separated by a watershed boundary (-1's pixels); for example, they can touch each other in the initial marker image passed to the function. https://docs.opencv.org/4.6.0/d3/d47/group__imgproc__segmentation.html#ga3267243e4d3f95165d55a618c65ac6e1

    Parameters

    • markers: Mat

      Input/output 32-bit single-channel image (map) of markers. It should have the same size as image.

    Returns Mat

  • Parameters

    Returns Promise<Mat>

  • Returns an identity matrix of the specified size and type.

    The method returns a Matlab-style identity matrix initializer, similarly to Mat::zeros. Similarly to Mat::ones, you can use a scale operation to create a scaled identity matrix efficiently:

    // make a 4x4 diagonal matrix with 0.1's on the diagonal. Mat A = Mat::eye(4, 4, CV_32F)*0.1;

    Note: In case of multi-channels type, identity matrix will be initialized only for the first channel, the others will be set to 0's https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#a458874f0ab8946136254da37ba06b78b

    Parameters

    • rows: number

      Number of rows.

    • cols: number

      Number of columns.

    • type: number

      Created matrix type.

    Returns Mat

  • Returns an array of all 1's of the specified size and type.

    The method returns a Matlab-style 1's array initializer, similarly to Mat::zeros. Note that using this method you can initialize an array with an arbitrary value, using the following Matlab idiom:

    Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3. The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it just remembers the scale factor (3 in this case) and use it when actually invoking the matrix initializer.

    Note In case of multi-channels type, only the first channel will be initialized with 1's, the others will be set to 0's. https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#a5e10227b777425407986727e2d26fcdc

    Parameters

    • rows: number
    • cols: number
    • type: number

    Returns Mat

  • Returns a zero array of the specified size and type.

    The method returns a Matlab-style zero array initializer. It can be used to quickly form a constant array as a function parameter, part of a matrix expression, or as a matrix initializer:

    Mat A; A = Mat::zeros(3, 3, CV_32F);

    In the example above, a new matrix is allocated only if A is not a 3x3 floating-point matrix. Otherwise, the existing matrix A is filled with zeros. https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#a56daa006391a670e9cb0cd08e3168c99

    Parameters

    • rows: number

      Number of rows.

    • cols: number

      Number of columns.

    • type: number

      Created matrix type.

    Returns Mat