View Source Evision (Evision v0.2.9)
Summary
Functions
Calculates the per-element absolute difference between two arrays or between an array and a scalar.
Calculates the per-element absolute difference between two arrays or between an array and a scalar.
Adds an image to the accumulator image.
Adds an image to the accumulator image.
Adds the per-element product of two input images to the accumulator image.
Adds the per-element product of two input images to the accumulator image.
Adds the square of a source image to the accumulator image.
Adds the square of a source image to the accumulator image.
Updates a running average.
Updates a running average.
Applies an adaptive threshold to an array.
Applies an adaptive threshold to an array.
Calculates the per-element sum of two arrays or an array and a scalar.
Calculates the per-element sum of two arrays or an array and a scalar.
Draws a text on the image.
Draws a text on the image.
Calculates the weighted sum of two arrays.
Calculates the weighted sum of two arrays.
Variant 1:
Applies a user colormap on a given image.
Variant 1:
Applies a user colormap on a given image.
Approximates a polygonal curve(s) with the specified precision.
Approximates a polygonal curve(s) with the specified precision.
Calculates a contour perimeter or a curve length.
Draws an arrow segment pointing from the first point to the second one.
Draws an arrow segment pointing from the first point to the second one.
naive nearest neighbor finder
naive nearest neighbor finder
Applies the bilateral filter to an image.
Applies the bilateral filter to an image.
blendLinear
Blurs an image using the normalized box filter.
Blurs an image using the normalized box filter.
Computes the source location of an extrapolated pixel.
Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image.
Blurs an image using the box filter.
Blurs an image using the box filter.
Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.
Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.
Broadcast the given Mat to the given shape.
Broadcast the given Mat to the given shape.
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.
calcBackProject
calcBackProject
calcCovarMatrix
calcCovarMatrix
Computes a dense optical flow using the Gunnar Farneback's algorithm.
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.
calibrateCamera
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
calibrateCameraRO
calibrateCameraRO
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
Computes Hand-Eye calibration: \f$\_{}^{g}\textrm{T}\_c\f$
Computes Hand-Eye calibration: \f$\_{}^{g}\textrm{T}\_c\f$
Computes Robot-World/Hand-Eye calibration: \f$\_{}^{w}\textrm{T}\_b\f$ and \f$\_{}^{c}\textrm{T}\_g\f$
Computes Robot-World/Hand-Eye calibration: \f$\_{}^{w}\textrm{T}\_b\f$ and \f$\_{}^{c}\textrm{T}\_g\f$
Computes useful camera characteristics from the camera intrinsic matrix.
Finds an object center, size, and orientation.
Finds edges in an image using the Canny algorithm @cite Canny86 .
Variant 1:
Canny
Calculates the magnitude and angle of 2D vectors.
Calculates the magnitude and angle of 2D vectors.
checkChessboard
Returns true if the specified feature is supported by the host hardware.
Checks every element of an input array for invalid values.
Checks every element of an input array for invalid values.
Draws a circle.
Draws a circle.
clipLine
Given an original color image, two differently colored versions of this image can be mixed seamlessly.
Given an original color image, two differently colored versions of this image can be mixed seamlessly.
Performs the per-element comparison of two arrays or an array and scalar value.
Performs the per-element comparison of two arrays or an array and scalar value.
Compares two histograms.
Copies the lower or the upper half of a square matrix to its another half.
Copies the lower or the upper half of a square matrix to its another half.
Combines two rotation-and-shift transformations.
Combines two rotation-and-shift transformations.
For points in an image of a stereo pair, computes the corresponding epilines in the other image.
For points in an image of a stereo pair, computes the corresponding epilines in the other image.
Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .
Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .
connectedComponents
connectedComponents
computes the connected components labeled image of boolean image
computes the connected components labeled image of boolean image
connectedComponentsWithStats
connectedComponentsWithStats
computes the connected components labeled image of boolean image and also produces a statistics output for each label
computes the connected components labeled image of boolean image and also produces a statistics output for each label
Calculates a contour area.
Calculates a contour area.
Converts an array to half precision floating number.
Converts an array to half precision floating number.
Converts image transformation maps from one representation to another.
Converts image transformation maps from one representation to another.
Converts points from homogeneous to Euclidean space.
Converts points from homogeneous to Euclidean space.
Converts points from Euclidean to homogeneous space.
Converts points from Euclidean to homogeneous space.
Scales, calculates absolute values, and converts the result to 8-bit.
Scales, calculates absolute values, and converts the result to 8-bit.
Finds the convex hull of a point set.
Finds the convex hull of a point set.
Finds the convexity defects of a contour.
Finds the convexity defects of a contour.
Forms a border around an image.
Forms a border around an image.
This is an overloaded member function, provided for convenience (python) Copies the matrix to another one. When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.
This is an overloaded member function, provided for convenience (python) Copies the matrix to another one. When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.
Calculates eigenvalues and eigenvectors of image blocks for corner detection.
Calculates eigenvalues and eigenvectors of image blocks for corner detection.
Harris corner detector.
Harris corner detector.
Calculates the minimal eigenvalue of gradient matrices for corner detection.
Calculates the minimal eigenvalue of gradient matrices for corner detection.
Refines the corner locations.
Refines coordinates of corresponding points.
Refines coordinates of corresponding points.
Counts non-zero array elements.
createAffineTransformer
Creates AlignMTB object
Creates AlignMTB object
Creates KNN Background Subtractor
Creates KNN Background Subtractor
Creates MOG2 Background Subtractor
Creates MOG2 Background Subtractor
Creates CalibrateDebevec object
Creates CalibrateDebevec object
Creates CalibrateRobertson object
Creates CalibrateRobertson object
createChiHistogramCostExtractor
createChiHistogramCostExtractor
Creates a smart pointer to a cv::CLAHE class and initializes it.
Creates a smart pointer to a cv::CLAHE class and initializes it.
createEMDHistogramCostExtractor
createEMDHistogramCostExtractor
createEMDL1HistogramCostExtractor
createEMDL1HistogramCostExtractor
Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it.
Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it.
This function computes a Hanning window coefficients in two dimensions.
This function computes a Hanning window coefficients in two dimensions.
createHausdorffDistanceExtractor
createHausdorffDistanceExtractor
Creates a smart pointer to a LineSegmentDetector object and initializes it.
Creates a smart pointer to a LineSegmentDetector object and initializes it.
Creates MergeDebevec object
Creates MergeMertens object
Creates MergeMertens object
Creates MergeRobertson object
createNormHistogramCostExtractor
createNormHistogramCostExtractor
createShapeContextDistanceExtractor
createShapeContextDistanceExtractor
createThinPlateSplineShapeTransformer
createThinPlateSplineShapeTransformer
Creates simple linear mapper with gamma correction
Creates simple linear mapper with gamma correction
Creates TonemapDrago object
Creates TonemapDrago object
Creates TonemapMantiuk object
Creates TonemapMantiuk object
Creates TonemapReinhard object
Creates TonemapReinhard object
Computes the cube root of an argument.
HighGUI backend used.
Converts an image from one color space to another.
Converts an image from one color space to another.
Converts an image from one color space to another where the source image is stored in two planes.
Converts an image from one color space to another where the source image is stored in two planes.
Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized black-and-white photograph rendering, and in many single channel image processing applications
Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized black-and-white photograph rendering, and in many single channel image processing applications
Decompose an essential matrix to possible rotations and translation.
Decompose an essential matrix to possible rotations and translation.
Decompose a homography matrix to rotation(s), translation(s) and plane normal(s).
Decompose a homography matrix to rotation(s), translation(s) and plane normal(s).
Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
main function for all demosaicing processes
main function for all demosaicing processes
This filter enhances the details of a particular image.
This filter enhances the details of a particular image.
Returns the determinant of a square floating-point matrix.
Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
Dilates an image by using a specific structuring element.
Dilates an image by using a specific structuring element.
Displays a text on a window image as an overlay for a specified duration.
Displays a text on a window image as an overlay for a specified duration.
Displays a text on the window statusbar during the specified period of time.
Displays a text on the window statusbar during the specified period of time.
distanceTransform
distanceTransform
Calculates the distance to the closest zero pixel for each pixel of the source image.
Calculates the distance to the closest zero pixel for each pixel of the source image.
Variant 1:
divide
Variant 1:
divide
Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum.
Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum.
Renders the detected chessboard corners.
Draws contours outlines or filled contours.
Draws contours outlines or filled contours.
Draw axes of the world/object coordinate system from pose estimation. @sa solvePnP
Draw axes of the world/object coordinate system from pose estimation. @sa solvePnP
Draws keypoints.
Draws keypoints.
Draws a marker on a predefined position in an image.
Draws a marker on a predefined position in an image.
Draws the found matches of keypoints from two images.
Variant 1:
drawMatches
drawMatches
Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications @cite EM11 .
Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications @cite EM11 .
Calculates eigenvalues and eigenvectors of a symmetric matrix.
Calculates eigenvalues and eigenvectors of a symmetric matrix.
Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only).
Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only).
Approximates an elliptic arc with a polyline.
ellipse
ellipse
Draws a simple or thick elliptic arc or fills an ellipse sector.
Draws a simple or thick elliptic arc or fills an ellipse sector.
Computes the "minimal work" distance between two weighted point configurations.
Computes the "minimal work" distance between two weighted point configurations.
return a list of enabled modules in this build
Equalizes the histogram of a grayscale image.
Equalizes the histogram of a grayscale image.
Erodes an image by using a specific structuring element.
Erodes an image by using a specific structuring element.
Computes an optimal affine transformation between two 2D point sets.
Variant 1:
estimateAffine2D
estimateAffine2D
Computes an optimal affine transformation between two 3D point sets.
Computes an optimal affine transformation between two 3D point sets.
Computes an optimal limited affine transformation with 4 degrees of freedom between two 2D point sets.
Computes an optimal limited affine transformation with 4 degrees of freedom between two 2D point sets.
Estimates the sharpness of a detected chessboard.
Estimates the sharpness of a detected chessboard.
Computes an optimal translation between two 3D point sets.
Computes an optimal translation between two 3D point sets.
Calculates the exponent of every array element.
Calculates the exponent of every array element.
Extracts a single channel from src (coi is 0-based index)
Extracts a single channel from src (coi is 0-based index)
Calculates the angle of a 2D vector in degrees.
Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise
Variant 1:
Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise
Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise
Modification of fastNlMeansDenoising function for colored images
Modification of fastNlMeansDenoising function for colored images
Modification of fastNlMeansDenoisingMulti function for colored images sequences
Modification of fastNlMeansDenoisingMulti function for colored images sequences
Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. See @cite Buades2005DenoisingIS for more details (open access here).
Variant 1:
Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. See @cite Buades2005DenoisingIS for more details (open access here).
Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. See @cite Buades2005DenoisingIS for more details (open access here).
Fills a convex polygon.
Fills a convex polygon.
Fills the area bounded by one or more polygons.
Fills the area bounded by one or more polygons.
Convolves an image with the kernel.
Convolves an image with the kernel.
Filters homography decompositions based on additional information.
Filters homography decompositions based on additional information.
Filters off small noise blobs (speckles) in the disparity map
Filters off small noise blobs (speckles) in the disparity map
find4QuadCornerSubpix
Finds the positions of internal corners of the chessboard.
Finds the positions of internal corners of the chessboard.
findChessboardCornersSB
findChessboardCornersSB
Finds the positions of internal corners of the chessboard using a sector based approach.
Finds the positions of internal corners of the chessboard using a sector based approach.
findCirclesGrid
findCirclesGrid
Finds centers in the grid of circles.
Finds centers in the grid of circles.
Finds contours in a binary image.
Finds contours in a binary image.
findContoursLinkRuns
findContoursLinkRuns
findEssentialMat
Variant 1:
Calculates an essential matrix from the corresponding points in two images.
Calculates an essential matrix from the corresponding points in two images.
Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.
Variant 1:
findEssentialMat
findEssentialMat
findFundamentalMat
Variant 1:
findFundamentalMat
findFundamentalMat
Calculates a fundamental matrix from the corresponding points in two images.
Calculates a fundamental matrix from the corresponding points in two images.
Finds a perspective transformation between two planes.
Variant 1:
findHomography
findHomography
Returns the list of locations of non-zero pixels
Returns the list of locations of non-zero pixels
findTransformECC
findTransformECC
Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .
Fits an ellipse around a set of 2D points.
Fits an ellipse around a set of 2D points.
Fits an ellipse around a set of 2D points.
Fits a line to a 2D or 3D point set.
Fits a line to a 2D or 3D point set.
Flips a 2D array around vertical, horizontal, or both axes.
Flips a 2D array around vertical, horizontal, or both axes.
Flips a n-dimensional at given axis
Flips a n-dimensional at given axis
Fills a connected component with the given color.
Fills a connected component with the given color.
Blurs an image using a Gaussian filter.
Blurs an image using a Gaussian filter.
Performs generalized matrix multiplication.
Performs generalized matrix multiplication.
getAffineTransform
Returns full configuration time cmake output.
Returns list of CPU features enabled during compilation.
Returns the number of CPU ticks.
Returns the default new camera matrix.
Returns the default new camera matrix.
Returns filter coefficients for computing spatial image derivatives.
Returns filter coefficients for computing spatial image derivatives.
Calculates the font-specific size to use to achieve a given height in pixels.
Calculates the font-specific size to use to achieve a given height in pixels.
Returns Gabor filter coefficients.
Returns Gabor filter coefficients.
Returns Gaussian filter coefficients.
Returns Gaussian filter coefficients.
Returns feature name by ID
getLogLevel
Returns the number of logical CPUs available for the process.
Returns the number of threads used by OpenCV for parallel regions.
Returns the optimal DFT size for a given vector size.
Returns the new camera intrinsic matrix based on the free scaling parameter.
Returns the new camera intrinsic matrix based on the free scaling parameter.
Calculates a perspective transform from four pairs of the corresponding points.
Calculates a perspective transform from four pairs of the corresponding points.
Retrieves a pixel rectangle from an image with sub-pixel accuracy.
Retrieves a pixel rectangle from an image with sub-pixel accuracy.
Calculates an affine matrix of 2D rotation.
Returns a structuring element of the specified size and shape for morphological operations.
Returns a structuring element of the specified size and shape for morphological operations.
Calculates the width and height of a text string.
Returns the index of the currently executed thread within the current parallel region. Always returns 0 if called outside of parallel region.
Returns the number of ticks.
Returns the number of ticks per second.
Returns the trackbar position.
getValidDisparityROI
Returns major library version
Returns minor library version
Returns revision field of the library version
Returns library version string
Provides rectangle of image in the window.
Provides parameters of a window.
Determines strong corners on an image.
Determines strong corners on an image.
goodFeaturesToTrack
goodFeaturesToTrack
Same as above, but returns also quality measure of the detected corners.
Same as above, but returns also quality measure of the detected corners.
Runs the GrabCut algorithm.
Runs the GrabCut algorithm.
groupRectangles
groupRectangles
Checks for the presence of at least one non-zero array element.
Returns true if the specified image can be decoded by OpenCV
Returns true if an image with the specified filename can be encoded by OpenCV
haveOpenVX
hconcat
hconcat
Finds circles in a grayscale image using the Hough transform.
Finds circles in a grayscale image using the Hough transform.
Finds lines in a binary image using the standard Hough transform.
Finds lines in a binary image using the standard Hough transform.
Finds line segments in a binary image using the probabilistic Hough transform.
Finds line segments in a binary image using the probabilistic Hough transform.
Finds lines in a set of points using the standard Hough transform.
Finds lines in a set of points using the standard Hough transform.
Finds lines in a binary image using the standard Hough transform and get accumulator.
Finds lines in a binary image using the standard Hough transform and get accumulator.
HuMoments
HuMoments
Calculates the inverse Discrete Cosine Transform of a 1D or 2D array.
Calculates the inverse Discrete Cosine Transform of a 1D or 2D array.
Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image.
Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image.
Returns the number of images inside the give file
Returns the number of images inside the give file
Reads a multi-page image from a buffer in memory.
Reads a multi-page image from a buffer in memory.
Encodes an image into a memory buffer.
Encodes an image into a memory buffer.
Loads an image from a file.
Loads an image from a file.
Loads a multi-page image from a file.
Loads a multi-page image from a file.
Loads a of images of a multi-page image from a file.
Loads a of images of a multi-page image from a file.
Saves an image to a specified file.
Saves an image to a specified file.
imwritemulti
imwritemulti
Finds an initial camera intrinsic matrix from 3D-2D point correspondences.
Finds an initial camera intrinsic matrix from 3D-2D point correspondences.
Computes the projection and inverse-rectification transformation map. In essense, this is the inverse of #initUndistortRectifyMap to accomodate stereo-rectification of projectors ('inverse-cameras') in projector-camera pairs.
Computes the projection and inverse-rectification transformation map. In essense, this is the inverse of #initUndistortRectifyMap to accomodate stereo-rectification of projectors ('inverse-cameras') in projector-camera pairs.
Computes the undistortion and rectification transformation map.
Computes the undistortion and rectification transformation map.
Restores the selected region in an image using the region neighborhood.
Restores the selected region in an image using the region neighborhood.
Checks if array elements lie between the elements of two other arrays.
Checks if array elements lie between the elements of two other arrays.
Inserts a single channel to dst (coi is 0-based index)
integral2
integral2
Calculates the integral of an image.
Calculates the integral of an image.
integral
integral
Finds intersection of two convex polygons
Finds intersection of two convex polygons
Finds the inverse or pseudo-inverse of a matrix.
Finds the inverse or pseudo-inverse of a matrix.
Inverts an affine transformation.
Inverts an affine transformation.
Tests a contour convexity.
Finds centers of clusters and groups input samples around the clusters.
Finds centers of clusters and groups input samples around the clusters.
Calculates the Laplacian of an image.
Calculates the Laplacian of an image.
Draws a line segment connecting two points.
Draws a line segment connecting two points.
Remaps an image to polar coordinates space.
Remaps an image to polar coordinates space.
Calculates the natural logarithm of every array element.
Calculates the natural logarithm of every array element.
Remaps an image to semilog-polar coordinates space.
Remaps an image to semilog-polar coordinates space.
Performs a look-up table transform of an array.
Performs a look-up table transform of an array.
Calculates the magnitude of 2D vectors.
Calculates the magnitude of 2D vectors.
Calculates the Mahalanobis distance between two vectors.
Compares two shapes.
Compares a template against overlapped image regions.
Compares a template against overlapped image regions.
Computes partial derivatives of the matrix product for each multiplied matrix.
Computes partial derivatives of the matrix product for each multiplied matrix.
Calculates per-element maximum of two arrays or an array and a scalar.
Calculates per-element maximum of two arrays or an array and a scalar.
Calculates an average (mean) of array elements.
Calculates an average (mean) of array elements.
Finds an object on a back projection image.
meanStdDev
meanStdDev
Blurs an image using the median filter.
Blurs an image using the median filter.
merge
merge
Calculates per-element minimum of two arrays or an array and a scalar.
Calculates per-element minimum of two arrays or an array and a scalar.
Finds a rotated rectangle of the minimum area enclosing the input 2D point set.
Finds a circle of the minimum area enclosing a 2D point set.
Finds a triangle of minimum area enclosing a 2D point set and returns its area.
Finds a triangle of minimum area enclosing a 2D point set and returns its area.
Finds the global minimum and maximum in an array.
Finds the global minimum and maximum in an array.
mixChannels
Calculates all of the moments up to the third order of a polygon or rasterized shape.
Calculates all of the moments up to the third order of a polygon or rasterized shape.
Performs advanced morphological transformations.
Performs advanced morphological transformations.
Moves the window to the specified position
Performs the per-element multiplication of two Fourier spectrums.
Performs the per-element multiplication of two Fourier spectrums.
Calculates the product of a matrix and its transposition.
Calculates the product of a matrix and its transposition.
Calculates the per-element scaled product of two arrays.
Calculates the per-element scaled product of two arrays.
Creates a window.
Creates a window.
Calculates the absolute norm of an array.
Variant 1:
Calculates an absolute difference norm or a relative difference norm.
Calculates an absolute difference norm or a relative difference norm.
Normalizes the norm or value range of an array.
Normalizes the norm or value range of an array.
Replaces NaNs by given number
Replaces NaNs by given number
PCABackProject
PCABackProject
PCACompute2
Variant 1:
PCACompute2
PCACompute2
PCACompute
Variant 1:
PCACompute
PCAProject
PCAProject
Pencil-like non-photorealistic line drawing
Pencil-like non-photorealistic line drawing
Performs the perspective matrix transformation of vectors.
Performs the perspective matrix transformation of vectors.
Calculates the rotation angle of 2D vectors.
Calculates the rotation angle of 2D vectors.
The function is used to detect translational shifts that occur between two images.
The function is used to detect translational shifts that occur between two images.
Performs a point-in-contour test.
Calculates x and y coordinates of 2D vectors from their magnitude and angle.
Calculates x and y coordinates of 2D vectors from their magnitude and angle.
Polls for a pressed key.
Draws several polygonal curves.
Draws several polygonal curves.
Raises every array element to a power.
Raises every array element to a power.
Calculates a feature map for corner detection.
Calculates a feature map for corner detection.
Projects 3D points to an image plane.
Projects 3D points to an image plane.
Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric.
Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric.
Draws a text string.
Draws a text string.
Blurs an image and downsamples it.
Blurs an image and downsamples it.
Performs initial step of meanshift segmentation of an image.
Performs initial step of meanshift segmentation of an image.
Upsamples an image and then blurs it.
Upsamples an image and then blurs it.
Fills the array with normally distributed random numbers.
Shuffles the array elements randomly.
Shuffles the array elements randomly.
Generates a single uniformly-distributed random number or an array of random numbers.
Read a .flo file
recoverPose
Variant 1:
Recovers the relative camera rotation and the translation from an estimated essential matrix and the corresponding points in two images, using chirality check. Returns the number of inliers that pass the check.
Variant 1:
recoverPose
Variant 1:
Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of inliers that pass the check.
Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of inliers that pass the check.
rectangle
Variant 1:
Draws a simple, thick, or filled up-right rectangle.
Draws a simple, thick, or filled up-right rectangle.
Finds out if there is any intersection between two rectangles
Reduces a matrix to a vector.
Reduces a matrix to a vector.
Finds indices of max elements along provided axis
Finds indices of max elements along provided axis
Finds indices of min elements along provided axis
Finds indices of min elements along provided axis
Applies a generic geometrical transformation to an image.
Applies a generic geometrical transformation to an image.
Fills the output array with repeated copies of the input array.
Fills the output array with repeated copies of the input array.
Reprojects a disparity image to 3D space.
Reprojects a disparity image to 3D space.
Resizes an image.
Resizes an image.
resizeWindow
Resizes the window to the specified size
Converts a rotation matrix to a rotation vector or vice versa.
Converts a rotation matrix to a rotation vector or vice versa.
Rotates a 2D array in multiples of 90 degrees. The function cv::rotate rotates the array in one of three different ways: Rotate by 90 degrees clockwise (rotateCode = ROTATE_90_CLOCKWISE). Rotate by 180 degrees clockwise (rotateCode = ROTATE_180). Rotate by 270 degrees clockwise (rotateCode = ROTATE_90_COUNTERCLOCKWISE).
Rotates a 2D array in multiples of 90 degrees. The function cv::rotate rotates the array in one of three different ways: Rotate by 90 degrees clockwise (rotateCode = ROTATE_90_CLOCKWISE). Rotate by 180 degrees clockwise (rotateCode = ROTATE_180). Rotate by 270 degrees clockwise (rotateCode = ROTATE_90_COUNTERCLOCKWISE).
Finds out if there is any intersection between two rotated rectangles.
Finds out if there is any intersection between two rotated rectangles.
Computes an RQ decomposition of 3x3 matrices.
Computes an RQ decomposition of 3x3 matrices.
Calculates the Sampson Distance between two points.
Calculates the sum of a scaled array and another array.
Calculates the sum of a scaled array and another array.
Calculates the first x- or y- image derivative using Scharr operator.
Calculates the first x- or y- image derivative using Scharr operator.
Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content @cite PM03 .
Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content @cite PM03 .
selectROI
Variant 1:
Allows users to select a ROI on the given image.
Allows users to select a ROI on the given image.
Allows users to select multiple ROIs on the given image.
Allows users to select multiple ROIs on the given image.
Applies a separable linear filter to an image.
Applies a separable linear filter to an image.
Initializes a scaled identity matrix.
Initializes a scaled identity matrix.
setLogLevel
OpenCV will try to set the number of threads for subsequent parallel regions.
Sets state of default random number generator.
Sets the trackbar maximum position.
Sets the trackbar minimum position.
Sets the trackbar position.
setUseOpenVX
Enables or disables the optimized code.
Changes parameters of a window dynamically.
Updates window title
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
Solves one or more linear systems or least-squares problems.
Solves one or more linear systems or least-squares problems.
Finds the real roots of a cubic equation.
Finds the real roots of a cubic equation.
solveLP
Variant 1:
Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method).
Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method).
Finds an object pose from 3 3D-2D point correspondences.
Finds an object pose from 3 3D-2D point correspondences.
Finds an object pose from 3D-2D point correspondences.
Finds an object pose from 3D-2D point correspondences.
Finds an object pose from 3D-2D point correspondences.
Finds an object pose from 3D-2D point correspondences.
Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
Finds the real or complex roots of a polynomial equation.
Finds the real or complex roots of a polynomial equation.
Sorts each row or each column of a matrix.
Sorts each row or each column of a matrix.
Sorts each row or each column of a matrix.
Sorts each row or each column of a matrix.
Calculates the first order image derivative in both x and y using a Sobel operator
Calculates the first order image derivative in both x and y using a Sobel operator
split
split
Calculates the normalized sum of squares of the pixel values overlapping the filter.
Calculates the normalized sum of squares of the pixel values overlapping the filter.
Calculates a square root of array elements.
Calculates a square root of array elements.
Blurs an image using the stackBlur.
Blurs an image using the stackBlur.
startWindowThread
stereoCalibrate
stereoCalibrate
stereoCalibrate
stereoCalibrate
Calibrates a stereo camera set up. This function finds the intrinsic parameters for each of the two cameras and the extrinsic parameters between the two cameras.
Calibrates a stereo camera set up. This function finds the intrinsic parameters for each of the two cameras and the extrinsic parameters between the two cameras.
Computes rectification transforms for each head of a calibrated stereo camera.
Computes rectification transforms for each head of a calibrated stereo camera.
Computes a rectification transform for an uncalibrated stereo camera.
Computes a rectification transform for an uncalibrated stereo camera.
Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.
Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.
Calculates the per-element difference between two arrays or array and a scalar.
Calculates the per-element difference between two arrays or array and a scalar.
Calculates the sum of array elements.
SVBackSubst
SVBackSubst
SVDecomp
SVDecomp
By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge %Detector is used.
By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge %Detector is used.
Applies a fixed-level threshold to each array element.
Applies a fixed-level threshold to each array element.
Returns the trace of a matrix.
Performs the matrix transformation of every array element.
Performs the matrix transformation of every array element.
Transposes a matrix.
Transposes a matrix.
Transpose for n-dimensional matrices.
Transpose for n-dimensional matrices.
This function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera.
This function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera.
Transforms an image to compensate for lens distortion.
Transforms an image to compensate for lens distortion.
Compute undistorted image points position
Compute undistorted image points position
Computes the ideal point coordinates from the observed point coordinates.
Computes the ideal point coordinates from the observed point coordinates.
undistortPointsIter
undistortPointsIter
useOpenVX
Returns the status of optimized code usage.
validateDisparity
vconcat
vconcat
Similar to #waitKey, but returns full key code.
Similar to #waitKey, but returns full key code.
Applies an affine transformation to an image.
Applies an affine transformation to an image.
Applies a perspective transformation to an image.
Applies a perspective transformation to an image.
Performs a marker-based image segmentation using the watershed algorithm.
Write a .flo to disk
Enumerator
Types
@type enum() :: integer()
@type scalar() :: number() | {number()} | {number(), number()} | {number(), number(), number()} | {number(), number(), number(), number()}
Scalars are n-element tuples, where n can be 1, 2, 3, or 4.
When passing a single number X
as a scalar, it will be converted to {X, 0, 0, 0}
.
When passing a tuple with more than 4 elements, it will raise an error.
Functions
@spec absdiff(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Calculates the per-element absolute difference between two arrays or between an array and a scalar.
Positional Arguments
src1:
Evision.Mat
.first input array or a scalar.
src2:
Evision.Mat
.second input array or a scalar.
Return
dst:
Evision.Mat.t()
.output array that has the same size and type as input arrays.
The function cv::absdiff calculates:
Absolute difference between two arrays when they have the same
size and type:
\f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2}(I)|)\f]
Absolute difference between an array and a scalar when the second
array is constructed from Scalar or has as many elements as the
number of channels in src1
:
\f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2} |)\f]
Absolute difference between a scalar and an array when the first
array is constructed from Scalar or has as many elements as the
number of channels in src2
:
\f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1} - \texttt{src2}(I) |)\f]
where I is a multi-dimensional index of array elements. In case of
multi-channel arrays, each channel is processed independently.
Note: Saturation is not applied when the arrays have the depth CV_32S.
You may even get a negative value in the case of overflow.
Note: (Python) Be careful to difference behaviour between src1/src2 are single number and they are tuple/array.
absdiff(src,X)
means absdiff(src,(X,X,X,X))
.
absdiff(src,(X,))
means absdiff(src,(X,0,0,0))
.
@sa cv::abs(const Mat&)
Python prototype (for reference only):
absdiff(src1, src2[, dst]) -> dst
@spec absdiff( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Calculates the per-element absolute difference between two arrays or between an array and a scalar.
Positional Arguments
src1:
Evision.Mat
.first input array or a scalar.
src2:
Evision.Mat
.second input array or a scalar.
Return
dst:
Evision.Mat.t()
.output array that has the same size and type as input arrays.
The function cv::absdiff calculates:
Absolute difference between two arrays when they have the same
size and type:
\f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2}(I)|)\f]
Absolute difference between an array and a scalar when the second
array is constructed from Scalar or has as many elements as the
number of channels in src1
:
\f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2} |)\f]
Absolute difference between a scalar and an array when the first
array is constructed from Scalar or has as many elements as the
number of channels in src2
:
\f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1} - \texttt{src2}(I) |)\f]
where I is a multi-dimensional index of array elements. In case of
multi-channel arrays, each channel is processed independently.
Note: Saturation is not applied when the arrays have the depth CV_32S.
You may even get a negative value in the case of overflow.
Note: (Python) Be careful to difference behaviour between src1/src2 are single number and they are tuple/array.
absdiff(src,X)
means absdiff(src,(X,X,X,X))
.
absdiff(src,(X,))
means absdiff(src,(X,0,0,0))
.
@sa cv::abs(const Mat&)
Python prototype (for reference only):
absdiff(src1, src2[, dst]) -> dst
@spec accumulate(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Adds an image to the accumulator image.
Positional Arguments
src:
Evision.Mat
.Input image of type CV_8UC(n), CV_16UC(n), CV_32FC(n) or CV_64FC(n), where n is a positive integer.
Keyword Arguments
mask:
Evision.Mat
.Optional operation mask.
Return
dst:
Evision.Mat.t()
.%Accumulator image with the same number of channels as input image, and a depth of CV_32F or CV_64F.
The function adds src or some of its elements to dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently. The function cv::accumulate can be used, for example, to collect statistics of a scene background viewed by a still camera and for the further foreground-background segmentation.
@sa accumulateSquare, accumulateProduct, accumulateWeighted
Python prototype (for reference only):
accumulate(src, dst[, mask]) -> dst
@spec accumulate( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{:mask, term()}] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Adds an image to the accumulator image.
Positional Arguments
src:
Evision.Mat
.Input image of type CV_8UC(n), CV_16UC(n), CV_32FC(n) or CV_64FC(n), where n is a positive integer.
Keyword Arguments
mask:
Evision.Mat
.Optional operation mask.
Return
dst:
Evision.Mat.t()
.%Accumulator image with the same number of channels as input image, and a depth of CV_32F or CV_64F.
The function adds src or some of its elements to dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently. The function cv::accumulate can be used, for example, to collect statistics of a scene background viewed by a still camera and for the further foreground-background segmentation.
@sa accumulateSquare, accumulateProduct, accumulateWeighted
Python prototype (for reference only):
accumulate(src, dst[, mask]) -> dst
@spec accumulateProduct( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: Evision.Mat.t() | {:error, String.t()}
Adds the per-element product of two input images to the accumulator image.
Positional Arguments
src1:
Evision.Mat
.First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
src2:
Evision.Mat
.Second input image of the same type and the same size as src1 .
Keyword Arguments
mask:
Evision.Mat
.Optional operation mask.
Return
dst:
Evision.Mat.t()
.%Accumulator image with the same number of channels as input images, 32-bit or 64-bit floating-point.
The function adds the product of two images or their selected regions to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.
@sa accumulate, accumulateSquare, accumulateWeighted
Python prototype (for reference only):
accumulateProduct(src1, src2, dst[, mask]) -> dst
@spec accumulateProduct( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{:mask, term()}] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Adds the per-element product of two input images to the accumulator image.
Positional Arguments
src1:
Evision.Mat
.First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
src2:
Evision.Mat
.Second input image of the same type and the same size as src1 .
Keyword Arguments
mask:
Evision.Mat
.Optional operation mask.
Return
dst:
Evision.Mat.t()
.%Accumulator image with the same number of channels as input images, 32-bit or 64-bit floating-point.
The function adds the product of two images or their selected regions to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.
@sa accumulate, accumulateSquare, accumulateWeighted
Python prototype (for reference only):
accumulateProduct(src1, src2, dst[, mask]) -> dst
@spec accumulateSquare(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Adds the square of a source image to the accumulator image.
Positional Arguments
src:
Evision.Mat
.Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
Keyword Arguments
mask:
Evision.Mat
.Optional operation mask.
Return
dst:
Evision.Mat.t()
.%Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
The function adds the input image src or its selected region, raised to a power of 2, to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.
@sa accumulateSquare, accumulateProduct, accumulateWeighted
Python prototype (for reference only):
accumulateSquare(src, dst[, mask]) -> dst
@spec accumulateSquare( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{:mask, term()}] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Adds the square of a source image to the accumulator image.
Positional Arguments
src:
Evision.Mat
.Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
Keyword Arguments
mask:
Evision.Mat
.Optional operation mask.
Return
dst:
Evision.Mat.t()
.%Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
The function adds the input image src or its selected region, raised to a power of 2, to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.
@sa accumulateSquare, accumulateProduct, accumulateWeighted
Python prototype (for reference only):
accumulateSquare(src, dst[, mask]) -> dst
@spec accumulateWeighted( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), number() ) :: Evision.Mat.t() | {:error, String.t()}
Updates a running average.
Positional Arguments
src:
Evision.Mat
.Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
alpha:
double
.Weight of the input image.
Keyword Arguments
mask:
Evision.Mat
.Optional operation mask.
Return
dst:
Evision.Mat.t()
.%Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence: \f[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.
@sa accumulate, accumulateSquare, accumulateProduct
Python prototype (for reference only):
accumulateWeighted(src, dst, alpha[, mask]) -> dst
@spec accumulateWeighted( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), number(), [{:mask, term()}] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Updates a running average.
Positional Arguments
src:
Evision.Mat
.Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
alpha:
double
.Weight of the input image.
Keyword Arguments
mask:
Evision.Mat
.Optional operation mask.
Return
dst:
Evision.Mat.t()
.%Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence: \f[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.
@sa accumulate, accumulateSquare, accumulateProduct
Python prototype (for reference only):
accumulateWeighted(src, dst, alpha[, mask]) -> dst
adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, c)
View Source@spec adaptiveThreshold( Evision.Mat.maybe_mat_in(), number(), integer(), integer(), integer(), number() ) :: Evision.Mat.t() | {:error, String.t()}
Applies an adaptive threshold to an array.
Positional Arguments
src:
Evision.Mat
.Source 8-bit single-channel image.
maxValue:
double
.Non-zero value assigned to the pixels for which the condition is satisfied
adaptiveMethod:
integer()
.Adaptive thresholding algorithm to use, see #AdaptiveThresholdTypes. The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries.
thresholdType:
integer()
.Thresholding type that must be either #THRESH_BINARY or #THRESH_BINARY_INV, see #ThresholdTypes.
blockSize:
integer()
.Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
c:
double
.Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.
Return
dst:
Evision.Mat.t()
.Destination image of the same size and the same type as src.
The function transforms a grayscale image to a binary image according to the formulae:
THRESH_BINARY \f[dst(x,y) = \fork{\texttt{maxValue}}{if (src(x,y) > T(x,y))}{0}{otherwise}\f]
THRESH_BINARY_INV \f[dst(x,y) = \fork{0}{if (src(x,y) > T(x,y))}{\texttt{maxValue}}{otherwise}\f] where \f$T(x,y)\f$ is a threshold calculated individually for each pixel (see adaptiveMethod parameter).
The function can process the image in-place.
@sa threshold, blur, GaussianBlur
Python prototype (for reference only):
adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, C[, dst]) -> dst
adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, c, opts)
View Source@spec adaptiveThreshold( Evision.Mat.maybe_mat_in(), number(), integer(), integer(), integer(), number(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Applies an adaptive threshold to an array.
Positional Arguments
src:
Evision.Mat
.Source 8-bit single-channel image.
maxValue:
double
.Non-zero value assigned to the pixels for which the condition is satisfied
adaptiveMethod:
integer()
.Adaptive thresholding algorithm to use, see #AdaptiveThresholdTypes. The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries.
thresholdType:
integer()
.Thresholding type that must be either #THRESH_BINARY or #THRESH_BINARY_INV, see #ThresholdTypes.
blockSize:
integer()
.Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
c:
double
.Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.
Return
dst:
Evision.Mat.t()
.Destination image of the same size and the same type as src.
The function transforms a grayscale image to a binary image according to the formulae:
THRESH_BINARY \f[dst(x,y) = \fork{\texttt{maxValue}}{if (src(x,y) > T(x,y))}{0}{otherwise}\f]
THRESH_BINARY_INV \f[dst(x,y) = \fork{0}{if (src(x,y) > T(x,y))}{\texttt{maxValue}}{otherwise}\f] where \f$T(x,y)\f$ is a threshold calculated individually for each pixel (see adaptiveMethod parameter).
The function can process the image in-place.
@sa threshold, blur, GaussianBlur
Python prototype (for reference only):
adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, C[, dst]) -> dst
@spec add(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Calculates the per-element sum of two arrays or an array and a scalar.
Positional Arguments
src1:
Evision.Mat
.first input array or a scalar.
src2:
Evision.Mat
.second input array or a scalar.
Keyword Arguments
mask:
Evision.Mat
.optional operation mask - 8-bit single channel array, that specifies elements of the output array to be changed.
dtype:
integer()
.optional depth of the output array (see the discussion below).
Return
dst:
Evision.Mat.t()
.output array that has the same size and number of channels as the input array(s); the depth is defined by dtype or src1/src2.
The function add calculates:
Sum of two arrays when both input arrays have the same size and the same number of channels: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of elements as
src1.channels()
: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of elements as
src2.channels()
: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} + \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f] whereI
is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.
The first function in the list above can be replaced with matrix expressions:
dst = src1 + src2;
dst += src1; // equivalent to add(dst, src1, dst);
The input arrays and the output array can all have the same or different depths. For example, you
can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
floating-point array. Depth of the output array is determined by the dtype parameter. In the second
and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
be set to the default -1. In this case, the output array will have the same depth as the input
array, be it src1, src2 or both.
Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
result of an incorrect sign in the case of overflow.
Note: (Python) Be careful to difference behaviour between src1/src2 are single number and they are tuple/array.
add(src,X)
means add(src,(X,X,X,X))
.
add(src,(X,))
means add(src,(X,0,0,0))
.
@sa subtract, addWeighted, scaleAdd, Mat::convertTo
Python prototype (for reference only):
add(src1, src2[, dst[, mask[, dtype]]]) -> dst
@spec add( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [dtype: term(), mask: term()] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Calculates the per-element sum of two arrays or an array and a scalar.
Positional Arguments
src1:
Evision.Mat
.first input array or a scalar.
src2:
Evision.Mat
.second input array or a scalar.
Keyword Arguments
mask:
Evision.Mat
.optional operation mask - 8-bit single channel array, that specifies elements of the output array to be changed.
dtype:
integer()
.optional depth of the output array (see the discussion below).
Return
dst:
Evision.Mat.t()
.output array that has the same size and number of channels as the input array(s); the depth is defined by dtype or src1/src2.
The function add calculates:
Sum of two arrays when both input arrays have the same size and the same number of channels: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of elements as
src1.channels()
: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of elements as
src2.channels()
: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} + \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f] whereI
is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.
The first function in the list above can be replaced with matrix expressions:
dst = src1 + src2;
dst += src1; // equivalent to add(dst, src1, dst);
The input arrays and the output array can all have the same or different depths. For example, you
can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
floating-point array. Depth of the output array is determined by the dtype parameter. In the second
and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
be set to the default -1. In this case, the output array will have the same depth as the input
array, be it src1, src2 or both.
Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
result of an incorrect sign in the case of overflow.
Note: (Python) Be careful to difference behaviour between src1/src2 are single number and they are tuple/array.
add(src,X)
means add(src,(X,X,X,X))
.
add(src,(X,))
means add(src,(X,0,0,0))
.
@sa subtract, addWeighted, scaleAdd, Mat::convertTo
Python prototype (for reference only):
add(src1, src2[, dst[, mask[, dtype]]]) -> dst
@spec addText(Evision.Mat.maybe_mat_in(), binary(), {number(), number()}, binary()) :: :ok | {:error, String.t()}
Draws a text on the image.
Positional Arguments
img:
Evision.Mat
.8-bit 3-channel image where the text should be drawn.
text:
String
.Text to write on an image.
org:
Point
.Point(x,y) where the text should start on an image.
nameFont:
String
.Name of the font. The name should match the name of a system font (such as Times*). If the font is not found, a default one is used.
Keyword Arguments
pointSize:
integer()
.Size of the font. If not specified, equal zero or negative, the point size of the font is set to a system-dependent default value. Generally, this is 12 points.
color:
Evision.scalar()
.Color of the font in BGRA where A = 255 is fully transparent.
weight:
integer()
.Font weight. Available operation flags are : cv::QtFontWeights You can also specify a positive integer for better control.
style:
integer()
.Font style. Available operation flags are : cv::QtFontStyles
spacing:
integer()
.Spacing between characters. It can be negative or positive.
Python prototype (for reference only):
addText(img, text, org, nameFont[, pointSize[, color[, weight[, style[, spacing]]]]]) -> None
@spec addText( Evision.Mat.maybe_mat_in(), binary(), {number(), number()}, binary(), [ color: term(), pointSize: term(), spacing: term(), style: term(), weight: term() ] | nil ) :: :ok | {:error, String.t()}
Draws a text on the image.
Positional Arguments
img:
Evision.Mat
.8-bit 3-channel image where the text should be drawn.
text:
String
.Text to write on an image.
org:
Point
.Point(x,y) where the text should start on an image.
nameFont:
String
.Name of the font. The name should match the name of a system font (such as Times*). If the font is not found, a default one is used.
Keyword Arguments
pointSize:
integer()
.Size of the font. If not specified, equal zero or negative, the point size of the font is set to a system-dependent default value. Generally, this is 12 points.
color:
Evision.scalar()
.Color of the font in BGRA where A = 255 is fully transparent.
weight:
integer()
.Font weight. Available operation flags are : cv::QtFontWeights You can also specify a positive integer for better control.
style:
integer()
.Font style. Available operation flags are : cv::QtFontStyles
spacing:
integer()
.Spacing between characters. It can be negative or positive.
Python prototype (for reference only):
addText(img, text, org, nameFont[, pointSize[, color[, weight[, style[, spacing]]]]]) -> None
@spec addWeighted( Evision.Mat.maybe_mat_in(), number(), Evision.Mat.maybe_mat_in(), number(), number() ) :: Evision.Mat.t() | {:error, String.t()}
Calculates the weighted sum of two arrays.
Positional Arguments
src1:
Evision.Mat
.first input array.
alpha:
double
.weight of the first array elements.
src2:
Evision.Mat
.second input array of the same size and channel number as src1.
beta:
double
.weight of the second array elements.
gamma:
double
.scalar added to each sum.
Keyword Arguments
dtype:
integer()
.optional depth of the output array; when both input arrays have the same depth, dtype can be set to -1, which will be equivalent to src1.depth().
Return
dst:
Evision.Mat.t()
.output array that has the same size and number of channels as the input arrays.
The function addWeighted calculates the weighted sum of two arrays as follows: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The function can be replaced with a matrix expression:
dst = src1*alpha + src2*beta + gamma;
Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. @sa add, subtract, scaleAdd, Mat::convertTo
Python prototype (for reference only):
addWeighted(src1, alpha, src2, beta, gamma[, dst[, dtype]]) -> dst
@spec addWeighted( Evision.Mat.maybe_mat_in(), number(), Evision.Mat.maybe_mat_in(), number(), number(), [{:dtype, term()}] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Calculates the weighted sum of two arrays.
Positional Arguments
src1:
Evision.Mat
.first input array.
alpha:
double
.weight of the first array elements.
src2:
Evision.Mat
.second input array of the same size and channel number as src1.
beta:
double
.weight of the second array elements.
gamma:
double
.scalar added to each sum.
Keyword Arguments
dtype:
integer()
.optional depth of the output array; when both input arrays have the same depth, dtype can be set to -1, which will be equivalent to src1.depth().
Return
dst:
Evision.Mat.t()
.output array that has the same size and number of channels as the input arrays.
The function addWeighted calculates the weighted sum of two arrays as follows: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The function can be replaced with a matrix expression:
dst = src1*alpha + src2*beta + gamma;
Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. @sa add, subtract, scaleAdd, Mat::convertTo
Python prototype (for reference only):
addWeighted(src1, alpha, src2, beta, gamma[, dst[, dtype]]) -> dst
@spec applyColorMap(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
@spec applyColorMap(Evision.Mat.maybe_mat_in(), integer()) :: Evision.Mat.t() | {:error, String.t()}
Variant 1:
Applies a user colormap on a given image.
Positional Arguments
src:
Evision.Mat
.The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. If CV_8UC3, then the CV_8UC1 image is generated internally using cv::COLOR_BGR2GRAY.
userColor:
Evision.Mat
.The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256
Return
dst:
Evision.Mat.t()
.The result is the colormapped source image of the same number of channels as userColor. Note: Mat::create is called on dst.
Python prototype (for reference only):
applyColorMap(src, userColor[, dst]) -> dst
Variant 2:
Applies a GNU Octave/MATLAB equivalent colormap on a given image.
Positional Arguments
src:
Evision.Mat
.The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. If CV_8UC3, then the CV_8UC1 image is generated internally using cv::COLOR_BGR2GRAY.
colormap:
integer()
.The colormap to apply, see #ColormapTypes
Return
dst:
Evision.Mat.t()
.The result is the colormapped source image. Note: Mat::create is called on dst.
Python prototype (for reference only):
applyColorMap(src, colormap[, dst]) -> dst
@spec applyColorMap( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
@spec applyColorMap( Evision.Mat.maybe_mat_in(), integer(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Variant 1:
Applies a user colormap on a given image.
Positional Arguments
src:
Evision.Mat
.The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. If CV_8UC3, then the CV_8UC1 image is generated internally using cv::COLOR_BGR2GRAY.
userColor:
Evision.Mat
.The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256
Return
dst:
Evision.Mat.t()
.The result is the colormapped source image of the same number of channels as userColor. Note: Mat::create is called on dst.
Python prototype (for reference only):
applyColorMap(src, userColor[, dst]) -> dst
Variant 2:
Applies a GNU Octave/MATLAB equivalent colormap on a given image.
Positional Arguments
src:
Evision.Mat
.The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. If CV_8UC3, then the CV_8UC1 image is generated internally using cv::COLOR_BGR2GRAY.
colormap:
integer()
.The colormap to apply, see #ColormapTypes
Return
dst:
Evision.Mat.t()
.The result is the colormapped source image. Note: Mat::create is called on dst.
Python prototype (for reference only):
applyColorMap(src, colormap[, dst]) -> dst
@spec approxPolyDP(Evision.Mat.maybe_mat_in(), number(), boolean()) :: Evision.Mat.t() | {:error, String.t()}
Approximates a polygonal curve(s) with the specified precision.
Positional Arguments
curve:
Evision.Mat
.Input vector of a 2D point stored in std::vector or Mat
epsilon:
double
.Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation.
closed:
bool
.If true, the approximated curve is closed (its first and last vertices are connected). Otherwise, it is not closed.
Return
approxCurve:
Evision.Mat.t()
.Result of the approximation. The type should match the type of the input curve.
The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
Python prototype (for reference only):
approxPolyDP(curve, epsilon, closed[, approxCurve]) -> approxCurve
@spec approxPolyDP( Evision.Mat.maybe_mat_in(), number(), boolean(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Approximates a polygonal curve(s) with the specified precision.
Positional Arguments
curve:
Evision.Mat
.Input vector of a 2D point stored in std::vector or Mat
epsilon:
double
.Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation.
closed:
bool
.If true, the approximated curve is closed (its first and last vertices are connected). Otherwise, it is not closed.
Return
approxCurve:
Evision.Mat.t()
.Result of the approximation. The type should match the type of the input curve.
The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
Python prototype (for reference only):
approxPolyDP(curve, epsilon, closed[, approxCurve]) -> approxCurve
@spec arcLength(Evision.Mat.maybe_mat_in(), boolean()) :: number() | {:error, String.t()}
Calculates a contour perimeter or a curve length.
Positional Arguments
curve:
Evision.Mat
.Input vector of 2D points, stored in std::vector or Mat.
closed:
bool
.Flag indicating whether the curve is closed or not.
Return
- retval:
double
The function computes a curve length or a closed contour perimeter.
Python prototype (for reference only):
arcLength(curve, closed) -> retval
@spec arrowedLine( Evision.Mat.maybe_mat_in(), {number(), number()}, {number(), number()}, scalar() ) :: Evision.Mat.t() | {:error, String.t()}
Draws an arrow segment pointing from the first point to the second one.
Positional Arguments
pt1:
Point
.The point the arrow starts from.
pt2:
Point
.The point the arrow points to.
color:
Evision.scalar()
.Line color.
Keyword Arguments
thickness:
integer()
.Line thickness.
line_type:
integer()
.Type of the line. See #LineTypes
shift:
integer()
.Number of fractional bits in the point coordinates.
tipLength:
double
.The length of the arrow tip in relation to the arrow length
Return
img:
Evision.Mat.t()
.Image.
The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.
Python prototype (for reference only):
arrowedLine(img, pt1, pt2, color[, thickness[, line_type[, shift[, tipLength]]]]) -> img
@spec arrowedLine( Evision.Mat.maybe_mat_in(), {number(), number()}, {number(), number()}, scalar(), [line_type: term(), shift: term(), thickness: term(), tipLength: term()] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Draws an arrow segment pointing from the first point to the second one.
Positional Arguments
pt1:
Point
.The point the arrow starts from.
pt2:
Point
.The point the arrow points to.
color:
Evision.scalar()
.Line color.
Keyword Arguments
thickness:
integer()
.Line thickness.
line_type:
integer()
.Type of the line. See #LineTypes
shift:
integer()
.Number of fractional bits in the point coordinates.
tipLength:
double
.The length of the arrow tip in relation to the arrow length
Return
img:
Evision.Mat.t()
.Image.
The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.
Python prototype (for reference only):
arrowedLine(img, pt1, pt2, color[, thickness[, line_type[, shift[, tipLength]]]]) -> img
@spec batchDistance(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer()) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
naive nearest neighbor finder
Positional Arguments
- src1:
Evision.Mat
- src2:
Evision.Mat
- dtype:
integer()
Keyword Arguments
- normType:
integer()
. - k:
integer()
. - mask:
Evision.Mat
. - update:
integer()
. - crosscheck:
bool
.
Return
- dist:
Evision.Mat.t()
. - nidx:
Evision.Mat.t()
.
see http://en.wikipedia.org/wiki/Nearest_neighbor_search @todo document
Python prototype (for reference only):
batchDistance(src1, src2, dtype[, dist[, nidx[, normType[, K[, mask[, update[, crosscheck]]]]]]]) -> dist, nidx
@spec batchDistance( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer(), [ crosscheck: term(), k: term(), mask: term(), normType: term(), update: term() ] | nil ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
naive nearest neighbor finder
Positional Arguments
- src1:
Evision.Mat
- src2:
Evision.Mat
- dtype:
integer()
Keyword Arguments
- normType:
integer()
. - k:
integer()
. - mask:
Evision.Mat
. - update:
integer()
. - crosscheck:
bool
.
Return
- dist:
Evision.Mat.t()
. - nidx:
Evision.Mat.t()
.
see http://en.wikipedia.org/wiki/Nearest_neighbor_search @todo document
Python prototype (for reference only):
batchDistance(src1, src2, dtype[, dist[, nidx[, normType[, K[, mask[, update[, crosscheck]]]]]]]) -> dist, nidx
@spec bilateralFilter(Evision.Mat.maybe_mat_in(), integer(), number(), number()) :: Evision.Mat.t() | {:error, String.t()}
Applies the bilateral filter to an image.
Positional Arguments
src:
Evision.Mat
.Source 8-bit or floating-point, 1-channel or 3-channel image.
d:
integer()
.Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from sigmaSpace.
sigmaColor:
double
.Filter sigma in the color space. A larger value of the parameter means that farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting in larger areas of semi-equal color.
sigmaSpace:
double
.Filter sigma in the coordinate space. A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see sigmaColor ). When d>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is proportional to sigmaSpace.
Keyword Arguments
borderType:
integer()
.border mode used to extrapolate pixels outside of the image, see #BorderTypes
Return
dst:
Evision.Mat.t()
.Destination image of the same size and type as src .
The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters. Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look "cartoonish". Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering. This filter does not work inplace.
Python prototype (for reference only):
bilateralFilter(src, d, sigmaColor, sigmaSpace[, dst[, borderType]]) -> dst
@spec bilateralFilter( Evision.Mat.maybe_mat_in(), integer(), number(), number(), [{:borderType, term()}] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Applies the bilateral filter to an image.
Positional Arguments
src:
Evision.Mat
.Source 8-bit or floating-point, 1-channel or 3-channel image.
d:
integer()
.Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from sigmaSpace.
sigmaColor:
double
.Filter sigma in the color space. A larger value of the parameter means that farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting in larger areas of semi-equal color.
sigmaSpace:
double
.Filter sigma in the coordinate space. A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see sigmaColor ). When d>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is proportional to sigmaSpace.
Keyword Arguments
borderType:
integer()
.border mode used to extrapolate pixels outside of the image, see #BorderTypes
Return
dst:
Evision.Mat.t()
.Destination image of the same size and type as src .
The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters. Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look "cartoonish". Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering. This filter does not work inplace.
Python prototype (for reference only):
bilateralFilter(src, d, sigmaColor, sigmaSpace[, dst[, borderType]]) -> dst
@spec blendLinear( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: Evision.Mat.t() | {:error, String.t()}
blendLinear
Positional Arguments
- src1:
Evision.Mat
- src2:
Evision.Mat
- weights1:
Evision.Mat
- weights2:
Evision.Mat
Return
- dst:
Evision.Mat.t()
.
Has overloading in C++
variant without mask
parameter
Python prototype (for reference only):
blendLinear(src1, src2, weights1, weights2[, dst]) -> dst
@spec blendLinear( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
blendLinear
Positional Arguments
- src1:
Evision.Mat
- src2:
Evision.Mat
- weights1:
Evision.Mat
- weights2:
Evision.Mat
Return
- dst:
Evision.Mat.t()
.
Has overloading in C++
variant without mask
parameter
Python prototype (for reference only):
blendLinear(src1, src2, weights1, weights2[, dst]) -> dst
@spec blur( Evision.Mat.maybe_mat_in(), {number(), number()} ) :: Evision.Mat.t() | {:error, String.t()}
Blurs an image using the normalized box filter.
Positional Arguments
src:
Evision.Mat
.input image; it can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
ksize:
Size
.blurring kernel size.
Keyword Arguments
anchor:
Point
.anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
borderType:
integer()
.border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
Return
dst:
Evision.Mat.t()
.output image of the same size and type as src.
The function smooths an image using the kernel:
\f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f]
The call blur(src, dst, ksize, anchor, borderType)
is equivalent to boxFilter(src, dst, src.type(), ksize, anchor, true, borderType)
.
@sa boxFilter, bilateralFilter, GaussianBlur, medianBlur
Python prototype (for reference only):
blur(src, ksize[, dst[, anchor[, borderType]]]) -> dst
@spec blur( Evision.Mat.maybe_mat_in(), {number(), number()}, [anchor: term(), borderType: term()] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Blurs an image using the normalized box filter.
Positional Arguments
src:
Evision.Mat
.input image; it can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
ksize:
Size
.blurring kernel size.
Keyword Arguments
anchor:
Point
.anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
borderType:
integer()
.border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
Return
dst:
Evision.Mat.t()
.output image of the same size and type as src.
The function smooths an image using the kernel:
\f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f]
The call blur(src, dst, ksize, anchor, borderType)
is equivalent to boxFilter(src, dst, src.type(), ksize, anchor, true, borderType)
.
@sa boxFilter, bilateralFilter, GaussianBlur, medianBlur
Python prototype (for reference only):
blur(src, ksize[, dst[, anchor[, borderType]]]) -> dst
Computes the source location of an extrapolated pixel.
Positional Arguments
p:
integer()
.0-based coordinate of the extrapolated pixel along one of the axes, likely \<0 or >= len
len:
integer()
.Length of the array along the corresponding axis.
borderType:
integer()
.Border type, one of the #BorderTypes, except for #BORDER_TRANSPARENT and #BORDER_ISOLATED. When borderType==#BORDER_CONSTANT, the function always returns -1, regardless of p and len.
Return
- retval:
integer()
The function computes and returns the coordinate of a donor pixel corresponding to the specified extrapolated pixel when using the specified extrapolation border mode. For example, if you use cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img, it looks like:
float val = img.at<float>(borderInterpolate(100, img.rows, cv::BORDER_REFLECT_101),
borderInterpolate(-5, img.cols, cv::BORDER_WRAP));
Normally, the function is not called directly. It is used inside filtering functions and also in copyMakeBorder.
@sa copyMakeBorder
Python prototype (for reference only):
borderInterpolate(p, len, borderType) -> retval
@spec boundingRect(Keyword.t()) :: any() | {:error, String.t()}
@spec boundingRect(Evision.Mat.maybe_mat_in()) :: {number(), number(), number(), number()} | {:error, String.t()}
Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image.
Positional Arguments
array:
Evision.Mat
.Input gray-scale image or 2D point set, stored in std::vector or Mat.
Return
- retval:
Rect
The function calculates and returns the minimal up-right bounding rectangle for the specified point set or non-zero pixels of gray-scale image.
Python prototype (for reference only):
boundingRect(array) -> retval
@spec boxFilter(Evision.Mat.maybe_mat_in(), integer(), {number(), number()}) :: Evision.Mat.t() | {:error, String.t()}
Blurs an image using the box filter.
Positional Arguments
src:
Evision.Mat
.input image.
ddepth:
integer()
.the output image depth (-1 to use src.depth()).
ksize:
Size
.blurring kernel size.
Keyword Arguments
anchor:
Point
.anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
normalize:
bool
.flag, specifying whether the kernel is normalized by its area or not.
borderType:
integer()
.border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
Return
dst:
Evision.Mat.t()
.output image of the same size and type as src.
The function smooths an image using the kernel: \f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] where \f[\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise}\end{cases}\f] Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral. @sa blur, bilateralFilter, GaussianBlur, medianBlur, integral
Python prototype (for reference only):
boxFilter(src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]) -> dst
@spec boxFilter( Evision.Mat.maybe_mat_in(), integer(), {number(), number()}, [anchor: term(), borderType: term(), normalize: term()] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Blurs an image using the box filter.
Positional Arguments
src:
Evision.Mat
.input image.
ddepth:
integer()
.the output image depth (-1 to use src.depth()).
ksize:
Size
.blurring kernel size.
Keyword Arguments
anchor:
Point
.anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
normalize:
bool
.flag, specifying whether the kernel is normalized by its area or not.
borderType:
integer()
.border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
Return
dst:
Evision.Mat.t()
.output image of the same size and type as src.
The function smooths an image using the kernel: \f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] where \f[\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise}\end{cases}\f] Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral. @sa blur, bilateralFilter, GaussianBlur, medianBlur, integral
Python prototype (for reference only):
boxFilter(src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]) -> dst
@spec boxPoints(Keyword.t()) :: any() | {:error, String.t()}
@spec boxPoints({{number(), number()}, {number(), number()}, number()}) :: Evision.Mat.t() | {:error, String.t()}
Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.
Positional Arguments
box:
{centre={x, y}, size={s1, s2}, angle}
.The input rotated rectangle. It may be the output of @ref minAreaRect.
Return
points:
Evision.Mat.t()
.The output array of four vertices of rectangles.
The function finds the four vertices of a rotated rectangle. This function is useful to draw the rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.
Python prototype (for reference only):
boxPoints(box[, points]) -> points
@spec boxPoints( {{number(), number()}, {number(), number()}, number()}, [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.
Positional Arguments
box:
{centre={x, y}, size={s1, s2}, angle}
.The input rotated rectangle. It may be the output of @ref minAreaRect.
Return
points:
Evision.Mat.t()
.The output array of four vertices of rectangles.
The function finds the four vertices of a rotated rectangle. This function is useful to draw the rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.
Python prototype (for reference only):
boxPoints(box[, points]) -> points
@spec broadcast(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Broadcast the given Mat to the given shape.
Positional Arguments
src:
Evision.Mat
.input array
shape:
Evision.Mat
.target shape. Should be a list of CV_32S numbers. Note that negative values are not supported.
Return
dst:
Evision.Mat.t()
.output array that has the given shape
Python prototype (for reference only):
broadcast(src, shape[, dst]) -> dst
@spec broadcast( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Broadcast the given Mat to the given shape.
Positional Arguments
src:
Evision.Mat
.input array
shape:
Evision.Mat
.target shape. Should be a list of CV_32S numbers. Note that negative values are not supported.
Return
dst:
Evision.Mat.t()
.output array that has the given shape
Python prototype (for reference only):
broadcast(src, shape[, dst]) -> dst
@spec buildOpticalFlowPyramid( Evision.Mat.maybe_mat_in(), {number(), number()}, integer() ) :: {integer(), [Evision.Mat.t()]} | {:error, String.t()}
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.
Positional Arguments
img:
Evision.Mat
.8-bit input image.
winSize:
Size
.window size of optical flow algorithm. Must be not less than winSize argument of calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels.
maxLevel:
integer()
.0-based maximal pyramid level number.
Keyword Arguments
withDerivatives:
bool
.set to precompute gradients for the every pyramid level. If pyramid is constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally.
pyrBorder:
integer()
.the border mode for pyramid layers.
derivBorder:
integer()
.the border mode for gradients.
tryReuseInputImage:
bool
.put ROI of input image into the pyramid if possible. You can pass false to force data copying.
Return
retval:
integer()
pyramid:
[Evision.Mat]
.output pyramid.
@return number of levels in constructed pyramid. Can be less than maxLevel.
Python prototype (for reference only):
buildOpticalFlowPyramid(img, winSize, maxLevel[, pyramid[, withDerivatives[, pyrBorder[, derivBorder[, tryReuseInputImage]]]]]) -> retval, pyramid
@spec buildOpticalFlowPyramid( Evision.Mat.maybe_mat_in(), {number(), number()}, integer(), [ derivBorder: term(), pyrBorder: term(), tryReuseInputImage: term(), withDerivatives: term() ] | nil ) :: {integer(), [Evision.Mat.t()]} | {:error, String.t()}
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.
Positional Arguments
img:
Evision.Mat
.8-bit input image.
winSize:
Size
.window size of optical flow algorithm. Must be not less than winSize argument of calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels.
maxLevel:
integer()
.0-based maximal pyramid level number.
Keyword Arguments
withDerivatives:
bool
.set to precompute gradients for the every pyramid level. If pyramid is constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally.
pyrBorder:
integer()
.the border mode for pyramid layers.
derivBorder:
integer()
.the border mode for gradients.
tryReuseInputImage:
bool
.put ROI of input image into the pyramid if possible. You can pass false to force data copying.
Return
retval:
integer()
pyramid:
[Evision.Mat]
.output pyramid.
@return number of levels in constructed pyramid. Can be less than maxLevel.
Python prototype (for reference only):
buildOpticalFlowPyramid(img, winSize, maxLevel[, pyramid[, withDerivatives[, pyrBorder[, derivBorder[, tryReuseInputImage]]]]]) -> retval, pyramid
@spec calcBackProject( [Evision.Mat.maybe_mat_in()], [integer()], Evision.Mat.maybe_mat_in(), [number()], number() ) :: Evision.Mat.t() | {:error, String.t()}
calcBackProject
Positional Arguments
- images:
[Evision.Mat]
- channels:
[integer()]
- hist:
Evision.Mat
- ranges:
[float]
- scale:
double
Return
- dst:
Evision.Mat.t()
.
Has overloading in C++
Python prototype (for reference only):
calcBackProject(images, channels, hist, ranges, scale[, dst]) -> dst
@spec calcBackProject( [Evision.Mat.maybe_mat_in()], [integer()], Evision.Mat.maybe_mat_in(), [number()], number(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
calcBackProject
Positional Arguments
- images:
[Evision.Mat]
- channels:
[integer()]
- hist:
Evision.Mat
- ranges:
[float]
- scale:
double
Return
- dst:
Evision.Mat.t()
.
Has overloading in C++
Python prototype (for reference only):
calcBackProject(images, channels, hist, ranges, scale[, dst]) -> dst
@spec calcCovarMatrix( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer() ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
calcCovarMatrix
Positional Arguments
samples:
Evision.Mat
.samples stored as rows/columns of a single matrix.
flags:
integer()
.operation flags as a combination of #CovarFlags
Keyword Arguments
ctype:
integer()
.type of the matrixl; it equals 'CV_64F' by default.
Return
covar:
Evision.Mat.t()
.output covariance matrix of the type ctype and square size.
mean:
Evision.Mat.t()
.input or output (depending on the flags) array as the average value of the input vectors.
Has overloading in C++
Note: use #COVAR_ROWS or #COVAR_COLS flag
Python prototype (for reference only):
calcCovarMatrix(samples, mean, flags[, covar[, ctype]]) -> covar, mean
@spec calcCovarMatrix( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer(), [{:ctype, term()}] | nil ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
calcCovarMatrix
Positional Arguments
samples:
Evision.Mat
.samples stored as rows/columns of a single matrix.
flags:
integer()
.operation flags as a combination of #CovarFlags
Keyword Arguments
ctype:
integer()
.type of the matrixl; it equals 'CV_64F' by default.
Return
covar:
Evision.Mat.t()
.output covariance matrix of the type ctype and square size.
mean:
Evision.Mat.t()
.input or output (depending on the flags) array as the average value of the input vectors.
Has overloading in C++
Note: use #COVAR_ROWS or #COVAR_COLS flag
Python prototype (for reference only):
calcCovarMatrix(samples, mean, flags[, covar[, ctype]]) -> covar, mean
@spec calcHist( [Evision.Mat.maybe_mat_in()], [integer()], Evision.Mat.maybe_mat_in(), [integer()], [ number() ] ) :: Evision.Mat.t() | {:error, String.t()}
calcHist
Positional Arguments
- images:
[Evision.Mat]
- channels:
[integer()]
- mask:
Evision.Mat
- histSize:
[integer()]
- ranges:
[float]
Keyword Arguments
- accumulate:
bool
.
Return
- hist:
Evision.Mat.t()
.
Has overloading in C++
this variant supports only uniform histograms. ranges argument is either empty vector or a flattened vector of histSize.size()*2 elements (histSize.size() element pairs). The first and second elements of each pair specify the lower and upper boundaries.
Python prototype (for reference only):
calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) -> hist
@spec calcHist( [Evision.Mat.maybe_mat_in()], [integer()], Evision.Mat.maybe_mat_in(), [integer()], [number()], [{:accumulate, term()}] | nil ) :: Evision.Mat.t() | {:error, String.t()}
calcHist
Positional Arguments
- images:
[Evision.Mat]
- channels:
[integer()]
- mask:
Evision.Mat
- histSize:
[integer()]
- ranges:
[float]
Keyword Arguments
- accumulate:
bool
.
Return
- hist:
Evision.Mat.t()
.
Has overloading in C++
this variant supports only uniform histograms. ranges argument is either empty vector or a flattened vector of histSize.size()*2 elements (histSize.size() element pairs). The first and second elements of each pair specify the lower and upper boundaries.
Python prototype (for reference only):
calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) -> hist
calcOpticalFlowFarneback(prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags)
View Source@spec calcOpticalFlowFarneback( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), number(), integer(), integer(), integer(), integer(), number(), integer() ) :: Evision.Mat.t() | {:error, String.t()}
Computes a dense optical flow using the Gunnar Farneback's algorithm.
Positional Arguments
prev:
Evision.Mat
.first 8-bit single-channel input image.
next:
Evision.Mat
.second input image of the same size and the same type as prev.
pyr_scale:
double
.parameter, specifying the image scale (\<1) to build pyramids for each image; pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous one.
levels:
integer()
.number of pyramid layers including the initial image; levels=1 means that no extra layers are created and only the original images are used.
winsize:
integer()
.averaging window size; larger values increase the algorithm robustness to image noise and give more chances for fast motion detection, but yield more blurred motion field.
iterations:
integer()
.number of iterations the algorithm does at each pyramid level.
poly_n:
integer()
.size of the pixel neighborhood used to find polynomial expansion in each pixel; larger values mean that the image will be approximated with smoother surfaces, yielding more robust algorithm and more blurred motion field, typically poly_n =5 or 7.
poly_sigma:
double
.standard deviation of the Gaussian that is used to smooth derivatives used as a basis for the polynomial expansion; for poly_n=5, you can set poly_sigma=1.1, for poly_n=7, a good value would be poly_sigma=1.5.
flags:
integer()
.operation flags that can be a combination of the following:
- OPTFLOW_USE_INITIAL_FLOW uses the input flow as an initial flow approximation.
- OPTFLOW_FARNEBACK_GAUSSIAN uses the Gaussian \f$\texttt{winsize}\times\texttt{winsize}\f$ filter instead of a box filter of the same size for optical flow estimation; usually, this option gives z more accurate flow than with a box filter, at the cost of lower speed; normally, winsize for a Gaussian window should be set to a larger value to achieve the same level of robustness.
Return
flow:
Evision.Mat.t()
.computed flow image that has the same size as prev and type CV_32FC2.
The function finds an optical flow for each prev pixel using the @cite Farneback2003 algorithm so that \f[\texttt{prev} (y,x) \sim \texttt{next} ( y + \texttt{flow} (y,x)[1], x + \texttt{flow} (y,x)[0])\f] Note: Some examples:
An example using the optical flow algorithm described by Gunnar Farneback can be found at opencv_source_code/samples/cpp/fback.cpp
(Python) An example using the optical flow algorithm described by Gunnar Farneback can be found at opencv_source_code/samples/python/opt_flow.py
Python prototype (for reference only):
calcOpticalFlowFarneback(prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags) -> flow
@spec calcOpticalFlowPyrLK( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: {Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.
Positional Arguments
prevImg:
Evision.Mat
.first 8-bit input image or pyramid constructed by buildOpticalFlowPyramid.
nextImg:
Evision.Mat
.second input image or pyramid of the same size and the same type as prevImg.
prevPts:
Evision.Mat
.vector of 2D points for which the flow needs to be found; point coordinates must be single-precision floating-point numbers.
Keyword Arguments
winSize:
Size
.size of the search window at each pyramid level.
maxLevel:
integer()
.0-based maximal pyramid level number; if set to 0, pyramids are not used (single level), if set to 1, two levels are used, and so on; if pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than maxLevel.
criteria:
TermCriteria
.parameter, specifying the termination criteria of the iterative search algorithm (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon.
flags:
integer()
.operation flags:
- OPTFLOW_USE_INITIAL_FLOW uses initial estimations, stored in nextPts; if the flag is not set, then prevPts is copied to nextPts and is considered the initial estimate.
- OPTFLOW_LK_GET_MIN_EIGENVALS use minimum eigen values as an error measure (see minEigThreshold description); if the flag is not set, then L1 distance between patches around the original and a moved point, divided by number of pixels in a window, is used as a error measure.
minEigThreshold:
double
.the algorithm calculates the minimum eigen value of a 2x2 normal matrix of optical flow equations (this matrix is called a spatial gradient matrix in @cite Bouguet00), divided by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding feature is filtered out and its flow is not processed, so it allows to remove bad points and get a performance boost.
Return
nextPts:
Evision.Mat.t()
.output vector of 2D points (with single-precision floating-point coordinates) containing the calculated new positions of input features in the second image; when OPTFLOW_USE_INITIAL_FLOW flag is passed, the vector must have the same size as in the input.
status:
Evision.Mat.t()
.output status vector (of unsigned chars); each element of the vector is set to 1 if the flow for the corresponding features has been found, otherwise, it is set to 0.
err:
Evision.Mat.t()
.output vector of errors; each element of the vector is set to an error for the corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't found then the error is not defined (use the status parameter to find such cases).
The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See @cite Bouguet00 . The function is parallelized with the TBB library. Note: Some examples:
An example using the Lucas-Kanade optical flow algorithm can be found at opencv_source_code/samples/cpp/lkdemo.cpp
(Python) An example using the Lucas-Kanade optical flow algorithm can be found at opencv_source_code/samples/python/lk_track.py
(Python) An example using the Lucas-Kanade tracker for homography matching can be found at opencv_source_code/samples/python/lk_homography.py
Python prototype (for reference only):
calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts[, status[, err[, winSize[, maxLevel[, criteria[, flags[, minEigThreshold]]]]]]]) -> nextPts, status, err
@spec calcOpticalFlowPyrLK( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [ criteria: term(), flags: term(), maxLevel: term(), minEigThreshold: term(), winSize: term() ] | nil ) :: {Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.
Positional Arguments
prevImg:
Evision.Mat
.first 8-bit input image or pyramid constructed by buildOpticalFlowPyramid.
nextImg:
Evision.Mat
.second input image or pyramid of the same size and the same type as prevImg.
prevPts:
Evision.Mat
.vector of 2D points for which the flow needs to be found; point coordinates must be single-precision floating-point numbers.
Keyword Arguments
winSize:
Size
.size of the search window at each pyramid level.
maxLevel:
integer()
.0-based maximal pyramid level number; if set to 0, pyramids are not used (single level), if set to 1, two levels are used, and so on; if pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than maxLevel.
criteria:
TermCriteria
.parameter, specifying the termination criteria of the iterative search algorithm (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon.
flags:
integer()
.operation flags:
- OPTFLOW_USE_INITIAL_FLOW uses initial estimations, stored in nextPts; if the flag is not set, then prevPts is copied to nextPts and is considered the initial estimate.
- OPTFLOW_LK_GET_MIN_EIGENVALS use minimum eigen values as an error measure (see minEigThreshold description); if the flag is not set, then L1 distance between patches around the original and a moved point, divided by number of pixels in a window, is used as a error measure.
minEigThreshold:
double
.the algorithm calculates the minimum eigen value of a 2x2 normal matrix of optical flow equations (this matrix is called a spatial gradient matrix in @cite Bouguet00), divided by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding feature is filtered out and its flow is not processed, so it allows to remove bad points and get a performance boost.
Return
nextPts:
Evision.Mat.t()
.output vector of 2D points (with single-precision floating-point coordinates) containing the calculated new positions of input features in the second image; when OPTFLOW_USE_INITIAL_FLOW flag is passed, the vector must have the same size as in the input.
status:
Evision.Mat.t()
.output status vector (of unsigned chars); each element of the vector is set to 1 if the flow for the corresponding features has been found, otherwise, it is set to 0.
err:
Evision.Mat.t()
.output vector of errors; each element of the vector is set to an error for the corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't found then the error is not defined (use the status parameter to find such cases).
The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See @cite Bouguet00 . The function is parallelized with the TBB library. Note: Some examples:
An example using the Lucas-Kanade optical flow algorithm can be found at opencv_source_code/samples/cpp/lkdemo.cpp
(Python) An example using the Lucas-Kanade optical flow algorithm can be found at opencv_source_code/samples/python/lk_track.py
(Python) An example using the Lucas-Kanade tracker for homography matching can be found at opencv_source_code/samples/python/lk_homography.py
Python prototype (for reference only):
calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts[, status[, err[, winSize[, maxLevel[, criteria[, flags[, minEigThreshold]]]]]]]) -> nextPts, status, err
calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs)
View Source@spec calibrateCamera( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], {number(), number()}, Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), [Evision.Mat.t()], [Evision.Mat.t()]} | {:error, String.t()}
calibrateCamera
Positional Arguments
- objectPoints:
[Evision.Mat]
- imagePoints:
[Evision.Mat]
- imageSize:
Size
Keyword Arguments
- flags:
integer()
. - criteria:
TermCriteria
.
Return
- retval:
double
- cameraMatrix:
Evision.Mat.t()
- distCoeffs:
Evision.Mat.t()
- rvecs:
[Evision.Mat]
. - tvecs:
[Evision.Mat]
.
Has overloading in C++
Python prototype (for reference only):
calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, opts)
View Source@spec calibrateCamera( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], {number(), number()}, Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [criteria: term(), flags: term()] | nil ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), [Evision.Mat.t()], [Evision.Mat.t()]} | {:error, String.t()}
calibrateCamera
Positional Arguments
- objectPoints:
[Evision.Mat]
- imagePoints:
[Evision.Mat]
- imageSize:
Size
Keyword Arguments
- flags:
integer()
. - criteria:
TermCriteria
.
Return
- retval:
double
- cameraMatrix:
Evision.Mat.t()
- distCoeffs:
Evision.Mat.t()
- rvecs:
[Evision.Mat]
. - tvecs:
[Evision.Mat]
.
Has overloading in C++
Python prototype (for reference only):
calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs)
View Source@spec calibrateCameraExtended( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], {number(), number()}, Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), [Evision.Mat.t()], [Evision.Mat.t()], Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
Positional Arguments
objectPoints:
[Evision.Mat]
.In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer vector contains as many elements as the number of pattern views. If the same calibration pattern is shown in each view and it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns or even different patterns in different views. Then, the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig. In the old interface all the vectors of object points from different views are concatenated together.
imagePoints:
[Evision.Mat]
.In the new interface it is a vector of vectors of the projections of calibration pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal, respectively. In the old interface all the vectors of object points from different views are concatenated together.
imageSize:
Size
.Size of the image used only to initialize the camera intrinsic matrix.
Keyword Arguments
flags:
integer()
.Different flags that may be zero or a combination of the following values:
- @ref CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image center ( imageSize is used), and focal distances are computed in a least-squares fashion. Note, that if intrinsic parameters are known, there is no need to use this function just to estimate extrinsic parameters. Use @ref solvePnP instead.
- @ref CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global optimization. It stays at the center or at a different location specified when
criteria:
TermCriteria
.Termination criteria for the iterative optimization algorithm.
Return
retval:
double
cameraMatrix:
Evision.Mat.t()
.Input/output 3x3 floating-point camera intrinsic matrix \f$\cameramatrix{A}\f$ . If @ref CALIB_USE_INTRINSIC_GUESS and/or @ref CALIB_FIX_ASPECT_RATIO, @ref CALIB_FIX_PRINCIPAL_POINT or @ref CALIB_FIX_FOCAL_LENGTH are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
distCoeffs:
Evision.Mat.t()
.Input/output vector of distortion coefficients \f$\distcoeffs\f$.
rvecs:
[Evision.Mat]
.Output vector of rotation vectors (@ref Rodrigues ) estimated for each pattern view (e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding i-th translation vector (see the next output parameter description) brings the calibration pattern from the object coordinate space (in which object points are specified) to the camera coordinate space. In more technical terms, the tuple of the i-th rotation and translation vector performs a change of basis from object coordinate space to camera coordinate space. Due to its duality, this tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate space.
tvecs:
[Evision.Mat]
.Output vector of translation vectors estimated for each pattern view, see parameter describtion above.
stdDeviationsIntrinsics:
Evision.Mat.t()
.Output vector of standard deviations estimated for intrinsic parameters. Order of deviations values: \f$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3, s_4, \tau_x, \tau_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero.
stdDeviationsExtrinsics:
Evision.Mat.t()
.Output vector of standard deviations estimated for extrinsic parameters. Order of deviations values: \f$(R_0, T_0, \dotsc , R_{M - 1}, T_{M - 1})\f$ where M is the number of pattern views. \f$R_i, T_i\f$ are concatenated 1x3 vectors.
perViewErrors:
Evision.Mat.t()
.Output vector of the RMS re-projection error estimated for each pattern view.
@ref CALIB_USE_INTRINSIC_GUESS is set too.
- @ref CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The ratio fx/fy stays the same as in the input cameraMatrix . When
@ref CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are ignored, only their ratio is computed and used further.
@ref CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients \f$(p\_1, p\_2)\f$ are set to zeros and stay zero.
@ref CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global optimization if @ref CALIB_USE_INTRINSIC_GUESS is set.
@ref CALIB_FIX_K1,..., @ref CALIB_FIX_K6 The corresponding radial distortion coefficient is not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
@ref CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the rational model and return 8 coefficients or more.
@ref CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the thin prism model and return 12 coefficients or more.
@ref CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
@ref CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the tilted sensor model and return 14 coefficients.
@ref CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
@return the overall RMS re-projection error. The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on @cite Zhang2000 and @cite BouguetMCT . The coordinates of 3D object points and their corresponding 2D projections in each view must be specified. That may be achieved by using an object with known geometry and easily detectable feature points. Such an object is called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as a calibration rig (see @ref findChessboardCorners). Currently, initialization of intrinsic parameters (when @ref CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also be used as long as initial cameraMatrix is provided. The algorithm performs the following steps:
Compute the initial intrinsic parameters (the option only available for planar calibration patterns) or read them from the input parameters. The distortion coefficients are all set to zeros initially unless some of CALIB_FIX_K? are specified.
Estimate the initial camera pose as if the intrinsic parameters have been already known. This is done using @ref solvePnP .
Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error, that is, the total sum of squared distances between the observed feature points imagePoints and the projected (using the current estimates for camera parameters and the poses) object points objectPoints. See @ref projectPoints for details.
Note: If you use a non-square (i.e. non-N-by-N) grid and @ref findChessboardCorners for calibration, and @ref calibrateCamera returns bad values (zero distortion coefficients, \f$c\_x\f$ and \f$c\_y\f$ very far from the image center, and/or large differences between \f$f\_x\f$ and \f$f\_y\f$ (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols) instead of using patternSize=cvSize(cols,rows) in @ref findChessboardCorners. Note: The function may throw exceptions, if unsupported combination of parameters is provided or the system is underconstrained. @sa calibrateCameraRO, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
Python prototype (for reference only):
calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, stdDeviationsIntrinsics[, stdDeviationsExtrinsics[, perViewErrors[, flags[, criteria]]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors
calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, opts)
View Source@spec calibrateCameraExtended( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], {number(), number()}, Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [criteria: term(), flags: term()] | nil ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), [Evision.Mat.t()], [Evision.Mat.t()], Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
Positional Arguments
objectPoints:
[Evision.Mat]
.In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer vector contains as many elements as the number of pattern views. If the same calibration pattern is shown in each view and it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns or even different patterns in different views. Then, the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig. In the old interface all the vectors of object points from different views are concatenated together.
imagePoints:
[Evision.Mat]
.In the new interface it is a vector of vectors of the projections of calibration pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal, respectively. In the old interface all the vectors of object points from different views are concatenated together.
imageSize:
Size
.Size of the image used only to initialize the camera intrinsic matrix.
Keyword Arguments
flags:
integer()
.Different flags that may be zero or a combination of the following values:
- @ref CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image center ( imageSize is used), and focal distances are computed in a least-squares fashion. Note, that if intrinsic parameters are known, there is no need to use this function just to estimate extrinsic parameters. Use @ref solvePnP instead.
- @ref CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global optimization. It stays at the center or at a different location specified when
criteria:
TermCriteria
.Termination criteria for the iterative optimization algorithm.
Return
retval:
double
cameraMatrix:
Evision.Mat.t()
.Input/output 3x3 floating-point camera intrinsic matrix \f$\cameramatrix{A}\f$ . If @ref CALIB_USE_INTRINSIC_GUESS and/or @ref CALIB_FIX_ASPECT_RATIO, @ref CALIB_FIX_PRINCIPAL_POINT or @ref CALIB_FIX_FOCAL_LENGTH are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
distCoeffs:
Evision.Mat.t()
.Input/output vector of distortion coefficients \f$\distcoeffs\f$.
rvecs:
[Evision.Mat]
.Output vector of rotation vectors (@ref Rodrigues ) estimated for each pattern view (e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding i-th translation vector (see the next output parameter description) brings the calibration pattern from the object coordinate space (in which object points are specified) to the camera coordinate space. In more technical terms, the tuple of the i-th rotation and translation vector performs a change of basis from object coordinate space to camera coordinate space. Due to its duality, this tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate space.
tvecs:
[Evision.Mat]
.Output vector of translation vectors estimated for each pattern view, see parameter describtion above.
stdDeviationsIntrinsics:
Evision.Mat.t()
.Output vector of standard deviations estimated for intrinsic parameters. Order of deviations values: \f$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3, s_4, \tau_x, \tau_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero.
stdDeviationsExtrinsics:
Evision.Mat.t()
.Output vector of standard deviations estimated for extrinsic parameters. Order of deviations values: \f$(R_0, T_0, \dotsc , R_{M - 1}, T_{M - 1})\f$ where M is the number of pattern views. \f$R_i, T_i\f$ are concatenated 1x3 vectors.
perViewErrors:
Evision.Mat.t()
.Output vector of the RMS re-projection error estimated for each pattern view.
@ref CALIB_USE_INTRINSIC_GUESS is set too.
- @ref CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The ratio fx/fy stays the same as in the input cameraMatrix . When
@ref CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are ignored, only their ratio is computed and used further.
@ref CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients \f$(p\_1, p\_2)\f$ are set to zeros and stay zero.
@ref CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global optimization if @ref CALIB_USE_INTRINSIC_GUESS is set.
@ref CALIB_FIX_K1,..., @ref CALIB_FIX_K6 The corresponding radial distortion coefficient is not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
@ref CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the rational model and return 8 coefficients or more.
@ref CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the thin prism model and return 12 coefficients or more.
@ref CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
@ref CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the tilted sensor model and return 14 coefficients.
@ref CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
@return the overall RMS re-projection error. The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on @cite Zhang2000 and @cite BouguetMCT . The coordinates of 3D object points and their corresponding 2D projections in each view must be specified. That may be achieved by using an object with known geometry and easily detectable feature points. Such an object is called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as a calibration rig (see @ref findChessboardCorners). Currently, initialization of intrinsic parameters (when @ref CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also be used as long as initial cameraMatrix is provided. The algorithm performs the following steps:
Compute the initial intrinsic parameters (the option only available for planar calibration patterns) or read them from the input parameters. The distortion coefficients are all set to zeros initially unless some of CALIB_FIX_K? are specified.
Estimate the initial camera pose as if the intrinsic parameters have been already known. This is done using @ref solvePnP .
Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error, that is, the total sum of squared distances between the observed feature points imagePoints and the projected (using the current estimates for camera parameters and the poses) object points objectPoints. See @ref projectPoints for details.
Note: If you use a non-square (i.e. non-N-by-N) grid and @ref findChessboardCorners for calibration, and @ref calibrateCamera returns bad values (zero distortion coefficients, \f$c\_x\f$ and \f$c\_y\f$ very far from the image center, and/or large differences between \f$f\_x\f$ and \f$f\_y\f$ (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols) instead of using patternSize=cvSize(cols,rows) in @ref findChessboardCorners. Note: The function may throw exceptions, if unsupported combination of parameters is provided or the system is underconstrained. @sa calibrateCameraRO, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
Python prototype (for reference only):
calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, stdDeviationsIntrinsics[, stdDeviationsExtrinsics[, perViewErrors[, flags[, criteria]]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors
calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs)
View Source@spec calibrateCameraRO( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], {number(), number()}, integer(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), [Evision.Mat.t()], [Evision.Mat.t()], Evision.Mat.t()} | {:error, String.t()}
calibrateCameraRO
Positional Arguments
- objectPoints:
[Evision.Mat]
- imagePoints:
[Evision.Mat]
- imageSize:
Size
- iFixedPoint:
integer()
Keyword Arguments
- flags:
integer()
. - criteria:
TermCriteria
.
Return
- retval:
double
- cameraMatrix:
Evision.Mat.t()
- distCoeffs:
Evision.Mat.t()
- rvecs:
[Evision.Mat]
. - tvecs:
[Evision.Mat]
. - newObjPoints:
Evision.Mat.t()
.
Has overloading in C++
Python prototype (for reference only):
calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs[, rvecs[, tvecs[, newObjPoints[, flags[, criteria]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints
calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs, opts)
View Source@spec calibrateCameraRO( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], {number(), number()}, integer(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [criteria: term(), flags: term()] | nil ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), [Evision.Mat.t()], [Evision.Mat.t()], Evision.Mat.t()} | {:error, String.t()}
calibrateCameraRO
Positional Arguments
- objectPoints:
[Evision.Mat]
- imagePoints:
[Evision.Mat]
- imageSize:
Size
- iFixedPoint:
integer()
Keyword Arguments
- flags:
integer()
. - criteria:
TermCriteria
.
Return
- retval:
double
- cameraMatrix:
Evision.Mat.t()
- distCoeffs:
Evision.Mat.t()
- rvecs:
[Evision.Mat]
. - tvecs:
[Evision.Mat]
. - newObjPoints:
Evision.Mat.t()
.
Has overloading in C++
Python prototype (for reference only):
calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs[, rvecs[, tvecs[, newObjPoints[, flags[, criteria]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints
calibrateCameraROExtended(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs)
View Source@spec calibrateCameraROExtended( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], {number(), number()}, integer(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), [Evision.Mat.t()], [Evision.Mat.t()], Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
Positional Arguments
objectPoints:
[Evision.Mat]
.Vector of vectors of calibration pattern points in the calibration pattern coordinate space. See #calibrateCamera for details. If the method of releasing object to be used, the identical calibration board must be used in each view and it must be fully visible, and all objectPoints[i] must be the same and all points should be roughly close to a plane. The calibration target has to be rigid, or at least static if the camera (rather than the calibration target) is shifted for grabbing images.
imagePoints:
[Evision.Mat]
.Vector of vectors of the projections of calibration pattern points. See #calibrateCamera for details.
imageSize:
Size
.Size of the image used only to initialize the intrinsic camera matrix.
iFixedPoint:
integer()
.The index of the 3D object point in objectPoints[0] to be fixed. It also acts as a switch for calibration method selection. If object-releasing method to be used, pass in the parameter in the range of [1, objectPoints[0].size()-2], otherwise a value out of this range will make standard calibration method selected. Usually the top-right corner point of the calibration board grid is recommended to be fixed when object-releasing method being utilized. According to \cite strobl2011iccv, two other points are also fixed. In this implementation, objectPoints[0].front and objectPoints[0].back.z are used. With object-releasing method, accurate rvecs, tvecs and newObjPoints are only possible if coordinates of these three fixed points are accurate enough.
Keyword Arguments
flags:
integer()
.Different flags that may be zero or a combination of some predefined values. See #calibrateCamera for details. If the method of releasing object is used, the calibration time may be much longer. CALIB_USE_QR or CALIB_USE_LU could be used for faster calibration with potentially less precise and less stable in some rare cases.
criteria:
TermCriteria
.Termination criteria for the iterative optimization algorithm.
Return
retval:
double
cameraMatrix:
Evision.Mat.t()
.Output 3x3 floating-point camera matrix. See #calibrateCamera for details.
distCoeffs:
Evision.Mat.t()
.Output vector of distortion coefficients. See #calibrateCamera for details.
rvecs:
[Evision.Mat]
.Output vector of rotation vectors estimated for each pattern view. See #calibrateCamera for details.
tvecs:
[Evision.Mat]
.Output vector of translation vectors estimated for each pattern view.
newObjPoints:
Evision.Mat.t()
.The updated output vector of calibration pattern points. The coordinates might be scaled based on three fixed points. The returned coordinates are accurate only if the above mentioned three fixed points are accurate. If not needed, noArray() can be passed in. This parameter is ignored with standard calibration method.
stdDeviationsIntrinsics:
Evision.Mat.t()
.Output vector of standard deviations estimated for intrinsic parameters. See #calibrateCamera for details.
stdDeviationsExtrinsics:
Evision.Mat.t()
.Output vector of standard deviations estimated for extrinsic parameters. See #calibrateCamera for details.
stdDeviationsObjPoints:
Evision.Mat.t()
.Output vector of standard deviations estimated for refined coordinates of calibration pattern points. It has the same size and order as objectPoints[0] vector. This parameter is ignored with standard calibration method.
perViewErrors:
Evision.Mat.t()
.Output vector of the RMS re-projection error estimated for each pattern view.
This function is an extension of #calibrateCamera with the method of releasing object which was proposed in @cite strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar targets (calibration plates), this method can dramatically improve the precision of the estimated camera parameters. Both the object-releasing method and standard method are supported by this function. Use the parameter iFixedPoint for method selection. In the internal implementation, #calibrateCamera is a wrapper for this function.
@return the overall RMS re-projection error. The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on @cite Zhang2000, @cite BouguetMCT and @cite strobl2011iccv. See #calibrateCamera for other detailed explanations. @sa calibrateCamera, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
Python prototype (for reference only):
calibrateCameraROExtended(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs[, rvecs[, tvecs[, newObjPoints[, stdDeviationsIntrinsics[, stdDeviationsExtrinsics[, stdDeviationsObjPoints[, perViewErrors[, flags[, criteria]]]]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints, stdDeviationsIntrinsics, stdDeviationsExtrinsics, stdDeviationsObjPoints, perViewErrors
calibrateCameraROExtended(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs, opts)
View Source@spec calibrateCameraROExtended( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], {number(), number()}, integer(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [criteria: term(), flags: term()] | nil ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), [Evision.Mat.t()], [Evision.Mat.t()], Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
Positional Arguments
objectPoints:
[Evision.Mat]
.Vector of vectors of calibration pattern points in the calibration pattern coordinate space. See #calibrateCamera for details. If the method of releasing object to be used, the identical calibration board must be used in each view and it must be fully visible, and all objectPoints[i] must be the same and all points should be roughly close to a plane. The calibration target has to be rigid, or at least static if the camera (rather than the calibration target) is shifted for grabbing images.
imagePoints:
[Evision.Mat]
.Vector of vectors of the projections of calibration pattern points. See #calibrateCamera for details.
imageSize:
Size
.Size of the image used only to initialize the intrinsic camera matrix.
iFixedPoint:
integer()
.The index of the 3D object point in objectPoints[0] to be fixed. It also acts as a switch for calibration method selection. If object-releasing method to be used, pass in the parameter in the range of [1, objectPoints[0].size()-2], otherwise a value out of this range will make standard calibration method selected. Usually the top-right corner point of the calibration board grid is recommended to be fixed when object-releasing method being utilized. According to \cite strobl2011iccv, two other points are also fixed. In this implementation, objectPoints[0].front and objectPoints[0].back.z are used. With object-releasing method, accurate rvecs, tvecs and newObjPoints are only possible if coordinates of these three fixed points are accurate enough.
Keyword Arguments
flags:
integer()
.Different flags that may be zero or a combination of some predefined values. See #calibrateCamera for details. If the method of releasing object is used, the calibration time may be much longer. CALIB_USE_QR or CALIB_USE_LU could be used for faster calibration with potentially less precise and less stable in some rare cases.
criteria:
TermCriteria
.Termination criteria for the iterative optimization algorithm.
Return
retval:
double
cameraMatrix:
Evision.Mat.t()
.Output 3x3 floating-point camera matrix. See #calibrateCamera for details.
distCoeffs:
Evision.Mat.t()
.Output vector of distortion coefficients. See #calibrateCamera for details.
rvecs:
[Evision.Mat]
.Output vector of rotation vectors estimated for each pattern view. See #calibrateCamera for details.
tvecs:
[Evision.Mat]
.Output vector of translation vectors estimated for each pattern view.
newObjPoints:
Evision.Mat.t()
.The updated output vector of calibration pattern points. The coordinates might be scaled based on three fixed points. The returned coordinates are accurate only if the above mentioned three fixed points are accurate. If not needed, noArray() can be passed in. This parameter is ignored with standard calibration method.
stdDeviationsIntrinsics:
Evision.Mat.t()
.Output vector of standard deviations estimated for intrinsic parameters. See #calibrateCamera for details.
stdDeviationsExtrinsics:
Evision.Mat.t()
.Output vector of standard deviations estimated for extrinsic parameters. See #calibrateCamera for details.
stdDeviationsObjPoints:
Evision.Mat.t()
.Output vector of standard deviations estimated for refined coordinates of calibration pattern points. It has the same size and order as objectPoints[0] vector. This parameter is ignored with standard calibration method.
perViewErrors:
Evision.Mat.t()
.Output vector of the RMS re-projection error estimated for each pattern view.
This function is an extension of #calibrateCamera with the method of releasing object which was proposed in @cite strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar targets (calibration plates), this method can dramatically improve the precision of the estimated camera parameters. Both the object-releasing method and standard method are supported by this function. Use the parameter iFixedPoint for method selection. In the internal implementation, #calibrateCamera is a wrapper for this function.
@return the overall RMS re-projection error. The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on @cite Zhang2000, @cite BouguetMCT and @cite strobl2011iccv. See #calibrateCamera for other detailed explanations. @sa calibrateCamera, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
Python prototype (for reference only):
calibrateCameraROExtended(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs[, rvecs[, tvecs[, newObjPoints[, stdDeviationsIntrinsics[, stdDeviationsExtrinsics[, stdDeviationsObjPoints[, perViewErrors[, flags[, criteria]]]]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints, stdDeviationsIntrinsics, stdDeviationsExtrinsics, stdDeviationsObjPoints, perViewErrors
calibrateHandEye(r_gripper2base, t_gripper2base, r_target2cam, t_target2cam)
View Source@spec calibrateHandEye( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()] ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Computes Hand-Eye calibration: \f$\_{}^{g}\textrm{T}\_c\f$
Positional Arguments
r_gripper2base:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the robot base frame (\f$_{}^{b}\textrm{T}_g\f$). This is a vector (
vector<Mat>
) that contains the rotation,(3x3)
rotation matrices or(3x1)
rotation vectors, for all the transformations from gripper frame to robot base frame.t_gripper2base:
[Evision.Mat]
.Translation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the robot base frame (\f$_{}^{b}\textrm{T}_g\f$). This is a vector (
vector<Mat>
) that contains the(3x1)
translation vectors for all the transformations from gripper frame to robot base frame.r_target2cam:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the target frame to the camera frame (\f$_{}^{c}\textrm{T}_t\f$). This is a vector (
vector<Mat>
) that contains the rotation,(3x3)
rotation matrices or(3x1)
rotation vectors, for all the transformations from calibration target frame to camera frame.t_target2cam:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the target frame to the camera frame (\f$_{}^{c}\textrm{T}_t\f$). This is a vector (
vector<Mat>
) that contains the(3x1)
translation vectors for all the transformations from calibration target frame to camera frame.
Keyword Arguments
method:
HandEyeCalibrationMethod
.One of the implemented Hand-Eye calibration method, see cv::HandEyeCalibrationMethod
Return
r_cam2gripper:
Evision.Mat.t()
.Estimated
(3x3)
rotation part extracted from the homogeneous matrix that transforms a point expressed in the camera frame to the gripper frame (\f$_{}^{g}\textrm{T}_c\f$).t_cam2gripper:
Evision.Mat.t()
.Estimated
(3x1)
translation part extracted from the homogeneous matrix that transforms a point expressed in the camera frame to the gripper frame (\f$_{}^{g}\textrm{T}_c\f$).
The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation (separable solutions) and the following methods are implemented:
- R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
- F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
- R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95
Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), with the following implemented methods:
- N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99
- K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98
The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye") mounted on a robot gripper ("hand") has to be estimated. This configuration is called eye-in-hand. The eye-to-hand configuration consists in a static camera observing a calibration pattern mounted on the robot end-effector. The transformation from the camera to the robot base frame can then be estimated by inputting the suitable transformations to the function, see below. The calibration procedure is the following:
a static calibration pattern is used to estimate the transformation between the target frame and the camera frame
the robot gripper is moved in order to acquire several poses
for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for instance the robot kinematics \f[ \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix}= \begin{bmatrix} _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \f]
for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using for instance a pose estimation method (PnP) from 2D-3D point correspondences \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix}= \begin{bmatrix} _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_t\\ Y_t\\ Z_t\\ 1 \end{bmatrix} \f]
The Hand-Eye calibration procedure returns the following homogeneous transformation \f[ \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \f] This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}\f$ equation:
for an eye-in-hand configuration \f[ \begin{align*} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &= \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ \end{align*} \f]
for an eye-to-hand configuration \f[ \begin{align*} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= \hspace{0.1em} ^{g}{\textrm{T}_b}^{(2)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ (^{g}{\textrm{T}_b}^{(2)})^{-1} \hspace{0.2em} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c &= \hspace{0.1em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ \end{align*} \f]
\note Additional information can be found on this website. \note A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation. So at least 3 different poses are required, but it is strongly recommended to use many more poses.
Python prototype (for reference only):
calibrateHandEye(R_gripper2base, t_gripper2base, R_target2cam, t_target2cam[, R_cam2gripper[, t_cam2gripper[, method]]]) -> R_cam2gripper, t_cam2gripper
calibrateHandEye(r_gripper2base, t_gripper2base, r_target2cam, t_target2cam, opts)
View Source@spec calibrateHandEye( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [{:method, term()}] | nil ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Computes Hand-Eye calibration: \f$\_{}^{g}\textrm{T}\_c\f$
Positional Arguments
r_gripper2base:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the robot base frame (\f$_{}^{b}\textrm{T}_g\f$). This is a vector (
vector<Mat>
) that contains the rotation,(3x3)
rotation matrices or(3x1)
rotation vectors, for all the transformations from gripper frame to robot base frame.t_gripper2base:
[Evision.Mat]
.Translation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the robot base frame (\f$_{}^{b}\textrm{T}_g\f$). This is a vector (
vector<Mat>
) that contains the(3x1)
translation vectors for all the transformations from gripper frame to robot base frame.r_target2cam:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the target frame to the camera frame (\f$_{}^{c}\textrm{T}_t\f$). This is a vector (
vector<Mat>
) that contains the rotation,(3x3)
rotation matrices or(3x1)
rotation vectors, for all the transformations from calibration target frame to camera frame.t_target2cam:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the target frame to the camera frame (\f$_{}^{c}\textrm{T}_t\f$). This is a vector (
vector<Mat>
) that contains the(3x1)
translation vectors for all the transformations from calibration target frame to camera frame.
Keyword Arguments
method:
HandEyeCalibrationMethod
.One of the implemented Hand-Eye calibration method, see cv::HandEyeCalibrationMethod
Return
r_cam2gripper:
Evision.Mat.t()
.Estimated
(3x3)
rotation part extracted from the homogeneous matrix that transforms a point expressed in the camera frame to the gripper frame (\f$_{}^{g}\textrm{T}_c\f$).t_cam2gripper:
Evision.Mat.t()
.Estimated
(3x1)
translation part extracted from the homogeneous matrix that transforms a point expressed in the camera frame to the gripper frame (\f$_{}^{g}\textrm{T}_c\f$).
The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation (separable solutions) and the following methods are implemented:
- R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
- F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
- R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95
Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), with the following implemented methods:
- N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99
- K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98
The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye") mounted on a robot gripper ("hand") has to be estimated. This configuration is called eye-in-hand. The eye-to-hand configuration consists in a static camera observing a calibration pattern mounted on the robot end-effector. The transformation from the camera to the robot base frame can then be estimated by inputting the suitable transformations to the function, see below. The calibration procedure is the following:
a static calibration pattern is used to estimate the transformation between the target frame and the camera frame
the robot gripper is moved in order to acquire several poses
for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for instance the robot kinematics \f[ \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix}= \begin{bmatrix} _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \f]
for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using for instance a pose estimation method (PnP) from 2D-3D point correspondences \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix}= \begin{bmatrix} _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_t\\ Y_t\\ Z_t\\ 1 \end{bmatrix} \f]
The Hand-Eye calibration procedure returns the following homogeneous transformation \f[ \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \f] This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}\f$ equation:
for an eye-in-hand configuration \f[ \begin{align*} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &= \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ \end{align*} \f]
for an eye-to-hand configuration \f[ \begin{align*} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= \hspace{0.1em} ^{g}{\textrm{T}_b}^{(2)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ (^{g}{\textrm{T}_b}^{(2)})^{-1} \hspace{0.2em} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c &= \hspace{0.1em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ \end{align*} \f]
\note Additional information can be found on this website. \note A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation. So at least 3 different poses are required, but it is strongly recommended to use many more poses.
Python prototype (for reference only):
calibrateHandEye(R_gripper2base, t_gripper2base, R_target2cam, t_target2cam[, R_cam2gripper[, t_cam2gripper[, method]]]) -> R_cam2gripper, t_cam2gripper
calibrateRobotWorldHandEye(r_world2cam, t_world2cam, r_base2gripper, t_base2gripper)
View Source@spec calibrateRobotWorldHandEye( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()] ) :: {Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Computes Robot-World/Hand-Eye calibration: \f$\_{}^{w}\textrm{T}\_b\f$ and \f$\_{}^{c}\textrm{T}\_g\f$
Positional Arguments
r_world2cam:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the world frame to the camera frame (\f$_{}^{c}\textrm{T}_w\f$). This is a vector (
vector<Mat>
) that contains the rotation,(3x3)
rotation matrices or(3x1)
rotation vectors, for all the transformations from world frame to the camera frame.t_world2cam:
[Evision.Mat]
.Translation part extracted from the homogeneous matrix that transforms a point expressed in the world frame to the camera frame (\f$_{}^{c}\textrm{T}_w\f$). This is a vector (
vector<Mat>
) that contains the(3x1)
translation vectors for all the transformations from world frame to the camera frame.r_base2gripper:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the gripper frame (\f$_{}^{g}\textrm{T}_b\f$). This is a vector (
vector<Mat>
) that contains the rotation,(3x3)
rotation matrices or(3x1)
rotation vectors, for all the transformations from robot base frame to the gripper frame.t_base2gripper:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the gripper frame (\f$_{}^{g}\textrm{T}_b\f$). This is a vector (
vector<Mat>
) that contains the(3x1)
translation vectors for all the transformations from robot base frame to the gripper frame.
Keyword Arguments
method:
RobotWorldHandEyeCalibrationMethod
.One of the implemented Robot-World/Hand-Eye calibration method, see cv::RobotWorldHandEyeCalibrationMethod
Return
r_base2world:
Evision.Mat.t()
.Estimated
(3x3)
rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the world frame (\f$_{}^{w}\textrm{T}_b\f$).t_base2world:
Evision.Mat.t()
.Estimated
(3x1)
translation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the world frame (\f$_{}^{w}\textrm{T}_b\f$).r_gripper2cam:
Evision.Mat.t()
.Estimated
(3x3)
rotation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the camera frame (\f$_{}^{c}\textrm{T}_g\f$).t_gripper2cam:
Evision.Mat.t()
.Estimated
(3x1)
translation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the camera frame (\f$_{}^{c}\textrm{T}_g\f$).
The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation (separable solutions):
- M. Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR
Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), with the following implemented method:
- A. Li, L. Wang, and D. Wu, Simultaneous robot-world and hand-eye calibration using dual-quaternions and kronecker product \cite Li2010SimultaneousRA
The following picture describes the Robot-World/Hand-Eye calibration problem where the transformations between a robot and a world frame and between a robot gripper ("hand") and a camera ("eye") mounted at the robot end-effector have to be estimated. The calibration procedure is the following:
a static calibration pattern is used to estimate the transformation between the target frame and the camera frame
the robot gripper is moved in order to acquire several poses
for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for instance the robot kinematics \f[ \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix}= \begin{bmatrix} _{}^{g}\textrm{R}_b & _{}^{g}\textrm{t}_b \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \f]
for each pose, the homogeneous transformation between the calibration target frame (the world frame) and the camera frame is recorded using for instance a pose estimation method (PnP) from 2D-3D point correspondences \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix}= \begin{bmatrix} _{}^{c}\textrm{R}_w & _{}^{c}\textrm{t}_w \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_w\\ Y_w\\ Z_w\\ 1 \end{bmatrix} \f]
The Robot-World/Hand-Eye calibration procedure returns the following homogeneous transformations \f[ \begin{bmatrix} X_w\\ Y_w\\ Z_w\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{w}\textrm{R}_b & _{}^{w}\textrm{t}_b \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \f] \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{c}\textrm{R}_g & _{}^{c}\textrm{t}_g \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \f] This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{Z}\mathbf{B}\f$ equation, with:
- \f$\mathbf{A} \Leftrightarrow \hspace{0.1em} \_{}^{c}\textrm{T}\_w\f$
- \f$\mathbf{X} \Leftrightarrow \hspace{0.1em} \_{}^{w}\textrm{T}\_b\f$
- \f$\mathbf{Z} \Leftrightarrow \hspace{0.1em} \_{}^{c}\textrm{T}\_g\f$
- \f$\mathbf{B} \Leftrightarrow \hspace{0.1em} \_{}^{g}\textrm{T}\_b\f$
\note At least 3 measurements are required (input vectors size must be greater or equal to 3).
Python prototype (for reference only):
calibrateRobotWorldHandEye(R_world2cam, t_world2cam, R_base2gripper, t_base2gripper[, R_base2world[, t_base2world[, R_gripper2cam[, t_gripper2cam[, method]]]]]) -> R_base2world, t_base2world, R_gripper2cam, t_gripper2cam
calibrateRobotWorldHandEye(r_world2cam, t_world2cam, r_base2gripper, t_base2gripper, opts)
View Source@spec calibrateRobotWorldHandEye( [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [Evision.Mat.maybe_mat_in()], [{:method, term()}] | nil ) :: {Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Computes Robot-World/Hand-Eye calibration: \f$\_{}^{w}\textrm{T}\_b\f$ and \f$\_{}^{c}\textrm{T}\_g\f$
Positional Arguments
r_world2cam:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the world frame to the camera frame (\f$_{}^{c}\textrm{T}_w\f$). This is a vector (
vector<Mat>
) that contains the rotation,(3x3)
rotation matrices or(3x1)
rotation vectors, for all the transformations from world frame to the camera frame.t_world2cam:
[Evision.Mat]
.Translation part extracted from the homogeneous matrix that transforms a point expressed in the world frame to the camera frame (\f$_{}^{c}\textrm{T}_w\f$). This is a vector (
vector<Mat>
) that contains the(3x1)
translation vectors for all the transformations from world frame to the camera frame.r_base2gripper:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the gripper frame (\f$_{}^{g}\textrm{T}_b\f$). This is a vector (
vector<Mat>
) that contains the rotation,(3x3)
rotation matrices or(3x1)
rotation vectors, for all the transformations from robot base frame to the gripper frame.t_base2gripper:
[Evision.Mat]
.Rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the gripper frame (\f$_{}^{g}\textrm{T}_b\f$). This is a vector (
vector<Mat>
) that contains the(3x1)
translation vectors for all the transformations from robot base frame to the gripper frame.
Keyword Arguments
method:
RobotWorldHandEyeCalibrationMethod
.One of the implemented Robot-World/Hand-Eye calibration method, see cv::RobotWorldHandEyeCalibrationMethod
Return
r_base2world:
Evision.Mat.t()
.Estimated
(3x3)
rotation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the world frame (\f$_{}^{w}\textrm{T}_b\f$).t_base2world:
Evision.Mat.t()
.Estimated
(3x1)
translation part extracted from the homogeneous matrix that transforms a point expressed in the robot base frame to the world frame (\f$_{}^{w}\textrm{T}_b\f$).r_gripper2cam:
Evision.Mat.t()
.Estimated
(3x3)
rotation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the camera frame (\f$_{}^{c}\textrm{T}_g\f$).t_gripper2cam:
Evision.Mat.t()
.Estimated
(3x1)
translation part extracted from the homogeneous matrix that transforms a point expressed in the gripper frame to the camera frame (\f$_{}^{c}\textrm{T}_g\f$).
The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation (separable solutions):
- M. Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR
Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), with the following implemented method:
- A. Li, L. Wang, and D. Wu, Simultaneous robot-world and hand-eye calibration using dual-quaternions and kronecker product \cite Li2010SimultaneousRA
The following picture describes the Robot-World/Hand-Eye calibration problem where the transformations between a robot and a world frame and between a robot gripper ("hand") and a camera ("eye") mounted at the robot end-effector have to be estimated. The calibration procedure is the following:
a static calibration pattern is used to estimate the transformation between the target frame and the camera frame
the robot gripper is moved in order to acquire several poses
for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for instance the robot kinematics \f[ \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix}= \begin{bmatrix} _{}^{g}\textrm{R}_b & _{}^{g}\textrm{t}_b \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \f]
for each pose, the homogeneous transformation between the calibration target frame (the world frame) and the camera frame is recorded using for instance a pose estimation method (PnP) from 2D-3D point correspondences \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix}= \begin{bmatrix} _{}^{c}\textrm{R}_w & _{}^{c}\textrm{t}_w \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_w\\ Y_w\\ Z_w\\ 1 \end{bmatrix} \f]
The Robot-World/Hand-Eye calibration procedure returns the following homogeneous transformations \f[ \begin{bmatrix} X_w\\ Y_w\\ Z_w\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{w}\textrm{R}_b & _{}^{w}\textrm{t}_b \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \f] \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{c}\textrm{R}_g & _{}^{c}\textrm{t}_g \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \f] This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{Z}\mathbf{B}\f$ equation, with:
- \f$\mathbf{A} \Leftrightarrow \hspace{0.1em} \_{}^{c}\textrm{T}\_w\f$
- \f$\mathbf{X} \Leftrightarrow \hspace{0.1em} \_{}^{w}\textrm{T}\_b\f$
- \f$\mathbf{Z} \Leftrightarrow \hspace{0.1em} \_{}^{c}\textrm{T}\_g\f$
- \f$\mathbf{B} \Leftrightarrow \hspace{0.1em} \_{}^{g}\textrm{T}\_b\f$
\note At least 3 measurements are required (input vectors size must be greater or equal to 3).
Python prototype (for reference only):
calibrateRobotWorldHandEye(R_world2cam, t_world2cam, R_base2gripper, t_base2gripper[, R_base2world[, t_base2world[, R_gripper2cam[, t_gripper2cam[, method]]]]]) -> R_base2world, t_base2world, R_gripper2cam, t_gripper2cam
calibrationMatrixValues(cameraMatrix, imageSize, apertureWidth, apertureHeight)
View Source@spec calibrationMatrixValues( Evision.Mat.maybe_mat_in(), {number(), number()}, number(), number() ) :: {number(), number(), number(), {number(), number()}, number()} | {:error, String.t()}
Computes useful camera characteristics from the camera intrinsic matrix.
Positional Arguments
cameraMatrix:
Evision.Mat
.Input camera intrinsic matrix that can be estimated by #calibrateCamera or #stereoCalibrate .
imageSize:
Size
.Input image size in pixels.
apertureWidth:
double
.Physical width in mm of the sensor.
apertureHeight:
double
.Physical height in mm of the sensor.
Return
fovx:
double
.Output field of view in degrees along the horizontal sensor axis.
fovy:
double
.Output field of view in degrees along the vertical sensor axis.
focalLength:
double
.Focal length of the lens in mm.
principalPoint:
Point2d
.Principal point in mm.
aspectRatio:
double
.\f$f_y/f_x\f$
The function computes various useful camera characteristics from the previously estimated camera matrix. Note: Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for the chessboard pitch (it can thus be any value).
Python prototype (for reference only):
calibrationMatrixValues(cameraMatrix, imageSize, apertureWidth, apertureHeight) -> fovx, fovy, focalLength, principalPoint, aspectRatio
@spec camShift( Evision.Mat.maybe_mat_in(), {number(), number(), number(), number()}, {integer(), integer(), number()} ) :: {{{number(), number()}, {number(), number()}, number()}, {number(), number(), number(), number()}} | {:error, String.t()}
Finds an object center, size, and orientation.
Positional Arguments
probImage:
Evision.Mat
.Back projection of the object histogram. See calcBackProject.
criteria:
TermCriteria
.Stop criteria for the underlying meanShift. returns (in old interfaces) Number of iterations CAMSHIFT took to converge The function implements the CAMSHIFT object tracking algorithm @cite Bradski98 . First, it finds an object center using meanShift and then adjusts the window size and finds the optimal rotation. The function returns the rotated rectangle structure that includes the object position, size, and orientation. The next position of the search window can be obtained with RotatedRect::boundingRect()
Return
retval:
{centre={x, y}, size={s1, s2}, angle}
window:
Rect
.Initial search window.
See the OpenCV sample camshiftdemo.c that tracks colored objects. Note:
- (Python) A sample explaining the camshift tracking algorithm can be found at opencv_source_code/samples/python/camshift.py
Python prototype (for reference only):
CamShift(probImage, window, criteria) -> retval, window
@spec canny(Evision.Mat.maybe_mat_in(), number(), number()) :: Evision.Mat.t() | {:error, String.t()}
Finds edges in an image using the Canny algorithm @cite Canny86 .
Positional Arguments
image:
Evision.Mat
.8-bit input image.
threshold1:
double
.first threshold for the hysteresis procedure.
threshold2:
double
.second threshold for the hysteresis procedure.
Keyword Arguments
apertureSize:
integer()
.aperture size for the Sobel operator.
l2gradient:
bool
.a flag, indicating whether a more accurate \f$L_2\f$ norm \f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( L2gradient=false ).
Return
edges:
Evision.Mat.t()
.output edge map; single channels 8-bit image, which has the same size as image .
The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See http://en.wikipedia.org/wiki/Canny_edge_detector
Python prototype (for reference only):
Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
@spec canny( Evision.Mat.maybe_mat_in(), number(), number(), [apertureSize: term(), l2gradient: term()] | nil ) :: Evision.Mat.t() | {:error, String.t()}
@spec canny( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), number(), number() ) :: Evision.Mat.t() | {:error, String.t()}
Variant 1:
Canny
Positional Arguments
dx:
Evision.Mat
.16-bit x derivative of input image (CV_16SC1 or CV_16SC3).
dy:
Evision.Mat
.16-bit y derivative of input image (same type as dx).
threshold1:
double
.first threshold for the hysteresis procedure.
threshold2:
double
.second threshold for the hysteresis procedure.
Keyword Arguments
l2gradient:
bool
.a flag, indicating whether a more accurate \f$L_2\f$ norm \f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( L2gradient=false ).
Return
edges:
Evision.Mat.t()
.output edge map; single channels 8-bit image, which has the same size as image .
Finds edges in an image using the Canny algorithm with custom image gradient.
Python prototype (for reference only):
Canny(dx, dy, threshold1, threshold2[, edges[, L2gradient]]) -> edges
Variant 2:
Finds edges in an image using the Canny algorithm @cite Canny86 .
Positional Arguments
image:
Evision.Mat
.8-bit input image.
threshold1:
double
.first threshold for the hysteresis procedure.
threshold2:
double
.second threshold for the hysteresis procedure.
Keyword Arguments
apertureSize:
integer()
.aperture size for the Sobel operator.
l2gradient:
bool
.a flag, indicating whether a more accurate \f$L_2\f$ norm \f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( L2gradient=false ).
Return
edges:
Evision.Mat.t()
.output edge map; single channels 8-bit image, which has the same size as image .
The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See http://en.wikipedia.org/wiki/Canny_edge_detector
Python prototype (for reference only):
Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
@spec canny( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), number(), number(), [{:l2gradient, term()}] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Canny
Positional Arguments
dx:
Evision.Mat
.16-bit x derivative of input image (CV_16SC1 or CV_16SC3).
dy:
Evision.Mat
.16-bit y derivative of input image (same type as dx).
threshold1:
double
.first threshold for the hysteresis procedure.
threshold2:
double
.second threshold for the hysteresis procedure.
Keyword Arguments
l2gradient:
bool
.a flag, indicating whether a more accurate \f$L_2\f$ norm \f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( L2gradient=false ).
Return
edges:
Evision.Mat.t()
.output edge map; single channels 8-bit image, which has the same size as image .
Finds edges in an image using the Canny algorithm with custom image gradient.
Python prototype (for reference only):
Canny(dx, dy, threshold1, threshold2[, edges[, L2gradient]]) -> edges
@spec cartToPolar(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Calculates the magnitude and angle of 2D vectors.
Positional Arguments
x:
Evision.Mat
.array of x-coordinates; this must be a single-precision or double-precision floating-point array.
y:
Evision.Mat
.array of y-coordinates, that must have the same size and same type as x.
Keyword Arguments
angleInDegrees:
bool
.a flag, indicating whether the angles are measured in radians (which is by default), or in degrees.
Return
magnitude:
Evision.Mat.t()
.output array of magnitudes of the same size and type as x.
angle:
Evision.Mat.t()
.output array of angles that has the same size and type as x; the angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees).
The function cv::cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)): \f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f] The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0. @sa Sobel, Scharr
Python prototype (for reference only):
cartToPolar(x, y[, magnitude[, angle[, angleInDegrees]]]) -> magnitude, angle
@spec cartToPolar( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{:angleInDegrees, term()}] | nil ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Calculates the magnitude and angle of 2D vectors.
Positional Arguments
x:
Evision.Mat
.array of x-coordinates; this must be a single-precision or double-precision floating-point array.
y:
Evision.Mat
.array of y-coordinates, that must have the same size and same type as x.
Keyword Arguments
angleInDegrees:
bool
.a flag, indicating whether the angles are measured in radians (which is by default), or in degrees.
Return
magnitude:
Evision.Mat.t()
.output array of magnitudes of the same size and type as x.
angle:
Evision.Mat.t()
.output array of angles that has the same size and type as x; the angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees).
The function cv::cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)): \f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f] The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0. @sa Sobel, Scharr
Python prototype (for reference only):
cartToPolar(x, y[, magnitude[, angle[, angleInDegrees]]]) -> magnitude, angle
@spec checkChessboard( Evision.Mat.maybe_mat_in(), {number(), number()} ) :: boolean() | {:error, String.t()}
checkChessboard
Positional Arguments
- img:
Evision.Mat
- size:
Size
Return
- retval:
bool
Python prototype (for reference only):
checkChessboard(img, size) -> retval
@spec checkHardwareSupport(Keyword.t()) :: any() | {:error, String.t()}
@spec checkHardwareSupport(integer()) :: boolean() | {:error, String.t()}
Returns true if the specified feature is supported by the host hardware.
Positional Arguments
feature:
integer()
.The feature of interest, one of cv::CpuFeatures
Return
- retval:
bool
The function returns true if the host hardware supports the specified feature. When user calls setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until setUseOptimized(true) is called. This way user can dynamically switch on and off the optimized code in OpenCV.
Python prototype (for reference only):
checkHardwareSupport(feature) -> retval
@spec checkRange(Keyword.t()) :: any() | {:error, String.t()}
@spec checkRange(Evision.Mat.maybe_mat_in()) :: {number(), number()} | false | {:error, String.t()}
Checks every element of an input array for invalid values.
Positional Arguments
a:
Evision.Mat
.input array.
Keyword Arguments
quiet:
bool
.a flag, indicating whether the functions quietly return false when the array elements are out of range or they throw an exception.
minVal:
double
.inclusive lower boundary of valid values range.
maxVal:
double
.exclusive upper boundary of valid values range.
Return
retval:
bool
pos:
Point*
.optional output parameter, when not NULL, must be a pointer to array of src.dims elements.
The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal >
- DBL_MAX and maxVal \< DBL_MAX, the function also checks that each value is between minVal and maxVal. In case of multi-channel arrays, each channel is processed independently. If some values are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the function either returns false (when quiet=true) or throws an exception.
Python prototype (for reference only):
checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pos
@spec checkRange( Evision.Mat.maybe_mat_in(), [maxVal: term(), minVal: term(), quiet: term()] | nil ) :: {number(), number()} | false | {:error, String.t()}
Checks every element of an input array for invalid values.
Positional Arguments
a:
Evision.Mat
.input array.
Keyword Arguments
quiet:
bool
.a flag, indicating whether the functions quietly return false when the array elements are out of range or they throw an exception.
minVal:
double
.inclusive lower boundary of valid values range.
maxVal:
double
.exclusive upper boundary of valid values range.
Return
retval:
bool
pos:
Point*
.optional output parameter, when not NULL, must be a pointer to array of src.dims elements.
The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal >
- DBL_MAX and maxVal \< DBL_MAX, the function also checks that each value is between minVal and maxVal. In case of multi-channel arrays, each channel is processed independently. If some values are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the function either returns false (when quiet=true) or throws an exception.
Python prototype (for reference only):
checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pos
@spec circle(Evision.Mat.maybe_mat_in(), {number(), number()}, integer(), scalar()) :: Evision.Mat.t() | {:error, String.t()}
Draws a circle.
Positional Arguments
center:
Point
.Center of the circle.
radius:
integer()
.Radius of the circle.
color:
Evision.scalar()
.Circle color.
Keyword Arguments
thickness:
integer()
.Thickness of the circle outline, if positive. Negative values, like #FILLED, mean that a filled circle is to be drawn.
lineType:
integer()
.Type of the circle boundary. See #LineTypes
shift:
integer()
.Number of fractional bits in the coordinates of the center and in the radius value.
Return
img:
Evision.Mat.t()
.Image where the circle is drawn.
The function cv::circle draws a simple or filled circle with a given center and radius.
Python prototype (for reference only):
circle(img, center, radius, color[, thickness[, lineType[, shift]]]) -> img
@spec circle( Evision.Mat.maybe_mat_in(), {number(), number()}, integer(), scalar(), [lineType: term(), shift: term(), thickness: term()] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Draws a circle.
Positional Arguments
center:
Point
.Center of the circle.
radius:
integer()
.Radius of the circle.
color:
Evision.scalar()
.Circle color.
Keyword Arguments
thickness:
integer()
.Thickness of the circle outline, if positive. Negative values, like #FILLED, mean that a filled circle is to be drawn.
lineType:
integer()
.Type of the circle boundary. See #LineTypes
shift:
integer()
.Number of fractional bits in the coordinates of the center and in the radius value.
Return
img:
Evision.Mat.t()
.Image where the circle is drawn.
The function cv::circle draws a simple or filled circle with a given center and radius.
Python prototype (for reference only):
circle(img, center, radius, color[, thickness[, lineType[, shift]]]) -> img
@spec clipLine( {number(), number(), number(), number()}, {number(), number()}, {number(), number()} ) :: {{number(), number()}, {number(), number()}} | false | {:error, String.t()}
clipLine
Positional Arguments
imgRect:
Rect
.Image rectangle.
Return
retval:
bool
pt1:
Point
.First line point.
pt2:
Point
.Second line point.
Has overloading in C++
Python prototype (for reference only):
clipLine(imgRect, pt1, pt2) -> retval, pt1, pt2
@spec colorChange(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Given an original color image, two differently colored versions of this image can be mixed seamlessly.
Positional Arguments
src:
Evision.Mat
.Input 8-bit 3-channel image.
mask:
Evision.Mat
.Input 8-bit 1 or 3-channel image.
Keyword Arguments
red_mul:
float
.R-channel multiply factor.
green_mul:
float
.G-channel multiply factor.
blue_mul:
float
.B-channel multiply factor.
Return
dst:
Evision.Mat.t()
.Output image with the same size and type as src .
Multiplication factor is between .5 to 2.5.
Python prototype (for reference only):
colorChange(src, mask[, dst[, red_mul[, green_mul[, blue_mul]]]]) -> dst
@spec colorChange( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [blue_mul: term(), green_mul: term(), red_mul: term()] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Given an original color image, two differently colored versions of this image can be mixed seamlessly.
Positional Arguments
src:
Evision.Mat
.Input 8-bit 3-channel image.
mask:
Evision.Mat
.Input 8-bit 1 or 3-channel image.
Keyword Arguments
red_mul:
float
.R-channel multiply factor.
green_mul:
float
.G-channel multiply factor.
blue_mul:
float
.B-channel multiply factor.
Return
dst:
Evision.Mat.t()
.Output image with the same size and type as src .
Multiplication factor is between .5 to 2.5.
Python prototype (for reference only):
colorChange(src, mask[, dst[, red_mul[, green_mul[, blue_mul]]]]) -> dst
@spec compare(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer()) :: Evision.Mat.t() | {:error, String.t()}
Performs the per-element comparison of two arrays or an array and scalar value.
Positional Arguments
src1:
Evision.Mat
.first input array or a scalar; when it is an array, it must have a single channel.
src2:
Evision.Mat
.second input array or a scalar; when it is an array, it must have a single channel.
cmpop:
integer()
.a flag, that specifies correspondence between the arrays (cv::CmpTypes)
Return
dst:
Evision.Mat.t()
.output array of type ref CV_8U that has the same size and the same number of channels as the input arrays.
The function compares: Elements of two arrays when src1 and src2 have the same size: \f[\texttt{dst} (I) = \texttt{src1} (I) \,\texttt{cmpop}\, \texttt{src2} (I)\f] Elements of src1 with a scalar src2 when src2 is constructed from Scalar or has a single element: \f[\texttt{dst} (I) = \texttt{src1}(I) \,\texttt{cmpop}\, \texttt{src2}\f] src1 with elements of src2 when src1 is constructed from Scalar or has a single element: \f[\texttt{dst} (I) = \texttt{src1} \,\texttt{cmpop}\, \texttt{src2} (I)\f] When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:
Mat dst1 = src1 >= src2;
Mat dst2 = src1 < 8;
...
@sa checkRange, min, max, threshold
Python prototype (for reference only):
compare(src1, src2, cmpop[, dst]) -> dst
@spec compare( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Performs the per-element comparison of two arrays or an array and scalar value.
Positional Arguments
src1:
Evision.Mat
.first input array or a scalar; when it is an array, it must have a single channel.
src2:
Evision.Mat
.second input array or a scalar; when it is an array, it must have a single channel.
cmpop:
integer()
.a flag, that specifies correspondence between the arrays (cv::CmpTypes)
Return
dst:
Evision.Mat.t()
.output array of type ref CV_8U that has the same size and the same number of channels as the input arrays.
The function compares: Elements of two arrays when src1 and src2 have the same size: \f[\texttt{dst} (I) = \texttt{src1} (I) \,\texttt{cmpop}\, \texttt{src2} (I)\f] Elements of src1 with a scalar src2 when src2 is constructed from Scalar or has a single element: \f[\texttt{dst} (I) = \texttt{src1}(I) \,\texttt{cmpop}\, \texttt{src2}\f] src1 with elements of src2 when src1 is constructed from Scalar or has a single element: \f[\texttt{dst} (I) = \texttt{src1} \,\texttt{cmpop}\, \texttt{src2} (I)\f] When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:
Mat dst1 = src1 >= src2;
Mat dst2 = src1 < 8;
...
@sa checkRange, min, max, threshold
Python prototype (for reference only):
compare(src1, src2, cmpop[, dst]) -> dst
@spec compareHist(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer()) :: number() | {:error, String.t()}
Compares two histograms.
Positional Arguments
h1:
Evision.Mat
.First compared histogram.
h2:
Evision.Mat
.Second compared histogram of the same size as H1 .
method:
integer()
.Comparison method, see #HistCompMethods
Return
- retval:
double
The function cv::compareHist compares two dense or two sparse histograms using the specified method. The function returns \f$d(H\_1, H\_2)\f$ . While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms or more general sparse configurations of weighted points, consider using the #EMD function.
Python prototype (for reference only):
compareHist(H1, H2, method) -> retval
@spec completeSymm(Keyword.t()) :: any() | {:error, String.t()}
@spec completeSymm(Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Copies the lower or the upper half of a square matrix to its another half.
Keyword Arguments
lowerToUpper:
bool
.operation flag; if true, the lower half is copied to the upper half. Otherwise, the upper half is copied to the lower half.
Return
m:
Evision.Mat.t()
.input-output floating-point square matrix.
The function cv::completeSymm copies the lower or the upper half of a square matrix to its another half. The matrix diagonal remains unchanged:
\f$\texttt{m}\_{ij}=\texttt{m}\_{ji}\f$ for \f$i > j\f$ if lowerToUpper=false
\f$\texttt{m}\_{ij}=\texttt{m}\_{ji}\f$ for \f$i < j\f$ if lowerToUpper=true
@sa flip, transpose
Python prototype (for reference only):
completeSymm(m[, lowerToUpper]) -> m
@spec completeSymm(Evision.Mat.maybe_mat_in(), [{:lowerToUpper, term()}] | nil) :: Evision.Mat.t() | {:error, String.t()}
Copies the lower or the upper half of a square matrix to its another half.
Keyword Arguments
lowerToUpper:
bool
.operation flag; if true, the lower half is copied to the upper half. Otherwise, the upper half is copied to the lower half.
Return
m:
Evision.Mat.t()
.input-output floating-point square matrix.
The function cv::completeSymm copies the lower or the upper half of a square matrix to its another half. The matrix diagonal remains unchanged:
\f$\texttt{m}\_{ij}=\texttt{m}\_{ji}\f$ for \f$i > j\f$ if lowerToUpper=false
\f$\texttt{m}\_{ij}=\texttt{m}\_{ji}\f$ for \f$i < j\f$ if lowerToUpper=true
@sa flip, transpose
Python prototype (for reference only):
completeSymm(m[, lowerToUpper]) -> m
@spec composeRT( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: {Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Combines two rotation-and-shift transformations.
Positional Arguments
rvec1:
Evision.Mat
.First rotation vector.
tvec1:
Evision.Mat
.First translation vector.
rvec2:
Evision.Mat
.Second rotation vector.
tvec2:
Evision.Mat
.Second translation vector.
Return
rvec3:
Evision.Mat.t()
.Output rotation vector of the superposition.
tvec3:
Evision.Mat.t()
.Output translation vector of the superposition.
dr3dr1:
Evision.Mat.t()
.Optional output derivative of rvec3 with regard to rvec1
dr3dt1:
Evision.Mat.t()
.Optional output derivative of rvec3 with regard to tvec1
dr3dr2:
Evision.Mat.t()
.Optional output derivative of rvec3 with regard to rvec2
dr3dt2:
Evision.Mat.t()
.Optional output derivative of rvec3 with regard to tvec2
dt3dr1:
Evision.Mat.t()
.Optional output derivative of tvec3 with regard to rvec1
dt3dt1:
Evision.Mat.t()
.Optional output derivative of tvec3 with regard to tvec1
dt3dr2:
Evision.Mat.t()
.Optional output derivative of tvec3 with regard to rvec2
dt3dt2:
Evision.Mat.t()
.Optional output derivative of tvec3 with regard to tvec2
The functions compute: \f[\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\f] where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and \f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See #Rodrigues for details. Also, the functions can compute the derivatives of the output vectors with regards to the input vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a function that contains a matrix multiplication.
Python prototype (for reference only):
composeRT(rvec1, tvec1, rvec2, tvec2[, rvec3[, tvec3[, dr3dr1[, dr3dt1[, dr3dr2[, dr3dt2[, dt3dr1[, dt3dt1[, dt3dr2[, dt3dt2]]]]]]]]]]) -> rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2
@spec composeRT( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: {Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Combines two rotation-and-shift transformations.
Positional Arguments
rvec1:
Evision.Mat
.First rotation vector.
tvec1:
Evision.Mat
.First translation vector.
rvec2:
Evision.Mat
.Second rotation vector.
tvec2:
Evision.Mat
.Second translation vector.
Return
rvec3:
Evision.Mat.t()
.Output rotation vector of the superposition.
tvec3:
Evision.Mat.t()
.Output translation vector of the superposition.
dr3dr1:
Evision.Mat.t()
.Optional output derivative of rvec3 with regard to rvec1
dr3dt1:
Evision.Mat.t()
.Optional output derivative of rvec3 with regard to tvec1
dr3dr2:
Evision.Mat.t()
.Optional output derivative of rvec3 with regard to rvec2
dr3dt2:
Evision.Mat.t()
.Optional output derivative of rvec3 with regard to tvec2
dt3dr1:
Evision.Mat.t()
.Optional output derivative of tvec3 with regard to rvec1
dt3dt1:
Evision.Mat.t()
.Optional output derivative of tvec3 with regard to tvec1
dt3dr2:
Evision.Mat.t()
.Optional output derivative of tvec3 with regard to rvec2
dt3dt2:
Evision.Mat.t()
.Optional output derivative of tvec3 with regard to tvec2
The functions compute: \f[\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\f] where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and \f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See #Rodrigues for details. Also, the functions can compute the derivatives of the output vectors with regards to the input vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a function that contains a matrix multiplication.
Python prototype (for reference only):
composeRT(rvec1, tvec1, rvec2, tvec2[, rvec3[, tvec3[, dr3dr1[, dr3dt1[, dr3dr2[, dr3dt2[, dt3dr1[, dt3dt1[, dt3dr2[, dt3dt2]]]]]]]]]]) -> rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2
@spec computeCorrespondEpilines( Evision.Mat.maybe_mat_in(), integer(), Evision.Mat.maybe_mat_in() ) :: Evision.Mat.t() | {:error, String.t()}
For points in an image of a stereo pair, computes the corresponding epilines in the other image.
Positional Arguments
points:
Evision.Mat
.Input points. \f$N \times 1\f$ or \f$1 \times N\f$ matrix of type CV_32FC2 or vector\<Point2f> .
whichImage:
integer()
.Index of the image (1 or 2) that contains the points .
f:
Evision.Mat
.Fundamental matrix that can be estimated using #findFundamentalMat or #stereoRectify .
Return
lines:
Evision.Mat.t()
.Output vector of the epipolar lines corresponding to the points in the other image. Each line \f$ax + by + c=0\f$ is encoded by 3 numbers \f$(a, b, c)\f$ .
For every point in one of the two images of a stereo pair, the function finds the equation of the corresponding epipolar line in the other image. From the fundamental matrix definition (see #findFundamentalMat ), line \f$l^{(2)}\_i\f$ in the second image for the point \f$p^{(1)}\_i\f$ in the first image (when whichImage=1 ) is computed as: \f[l^{(2)}_i = F p^{(1)}_i\f] And vice versa, when whichImage=2, \f$l^{(1)}\_i\f$ is computed from \f$p^{(2)}\_i\f$ as: \f[l^{(1)}_i = F^T p^{(2)}_i\f] Line coefficients are defined up to a scale. They are normalized so that \f$a\_i^2+b\_i^2=1\f$ .
Python prototype (for reference only):
computeCorrespondEpilines(points, whichImage, F[, lines]) -> lines
@spec computeCorrespondEpilines( Evision.Mat.maybe_mat_in(), integer(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
For points in an image of a stereo pair, computes the corresponding epilines in the other image.
Positional Arguments
points:
Evision.Mat
.Input points. \f$N \times 1\f$ or \f$1 \times N\f$ matrix of type CV_32FC2 or vector\<Point2f> .
whichImage:
integer()
.Index of the image (1 or 2) that contains the points .
f:
Evision.Mat
.Fundamental matrix that can be estimated using #findFundamentalMat or #stereoRectify .
Return
lines:
Evision.Mat.t()
.Output vector of the epipolar lines corresponding to the points in the other image. Each line \f$ax + by + c=0\f$ is encoded by 3 numbers \f$(a, b, c)\f$ .
For every point in one of the two images of a stereo pair, the function finds the equation of the corresponding epipolar line in the other image. From the fundamental matrix definition (see #findFundamentalMat ), line \f$l^{(2)}\_i\f$ in the second image for the point \f$p^{(1)}\_i\f$ in the first image (when whichImage=1 ) is computed as: \f[l^{(2)}_i = F p^{(1)}_i\f] And vice versa, when whichImage=2, \f$l^{(1)}\_i\f$ is computed from \f$p^{(2)}\_i\f$ as: \f[l^{(1)}_i = F^T p^{(2)}_i\f] Line coefficients are defined up to a scale. They are normalized so that \f$a\_i^2+b\_i^2=1\f$ .
Python prototype (for reference only):
computeCorrespondEpilines(points, whichImage, F[, lines]) -> lines
@spec computeECC(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) :: number() | {:error, String.t()}
Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .
Positional Arguments
templateImage:
Evision.Mat
.single-channel template image; CV_8U or CV_32F array.
inputImage:
Evision.Mat
.single-channel input image to be warped to provide an image similar to templateImage, same type as templateImage.
Keyword Arguments
inputMask:
Evision.Mat
.An optional mask to indicate valid values of inputImage.
Return
- retval:
double
@sa findTransformECC
Python prototype (for reference only):
computeECC(templateImage, inputImage[, inputMask]) -> retval
@spec computeECC( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{:inputMask, term()}] | nil ) :: number() | {:error, String.t()}
Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .
Positional Arguments
templateImage:
Evision.Mat
.single-channel template image; CV_8U or CV_32F array.
inputImage:
Evision.Mat
.single-channel input image to be warped to provide an image similar to templateImage, same type as templateImage.
Keyword Arguments
inputMask:
Evision.Mat
.An optional mask to indicate valid values of inputImage.
Return
- retval:
double
@sa findTransformECC
Python prototype (for reference only):
computeECC(templateImage, inputImage[, inputMask]) -> retval
@spec connectedComponents(Keyword.t()) :: any() | {:error, String.t()}
@spec connectedComponents(Evision.Mat.maybe_mat_in()) :: {integer(), Evision.Mat.t()} | {:error, String.t()}
connectedComponents
Positional Arguments
image:
Evision.Mat
.the 8-bit single-channel image to be labeled
Keyword Arguments
connectivity:
integer()
.8 or 4 for 8-way or 4-way connectivity respectively
ltype:
integer()
.output image label type. Currently CV_32S and CV_16U are supported.
Return
retval:
integer()
labels:
Evision.Mat.t()
.destination labeled image
Has overloading in C++
Python prototype (for reference only):
connectedComponents(image[, labels[, connectivity[, ltype]]]) -> retval, labels
@spec connectedComponents( Evision.Mat.maybe_mat_in(), [connectivity: term(), ltype: term()] | nil ) :: {integer(), Evision.Mat.t()} | {:error, String.t()}
connectedComponents
Positional Arguments
image:
Evision.Mat
.the 8-bit single-channel image to be labeled
Keyword Arguments
connectivity:
integer()
.8 or 4 for 8-way or 4-way connectivity respectively
ltype:
integer()
.output image label type. Currently CV_32S and CV_16U are supported.
Return
retval:
integer()
labels:
Evision.Mat.t()
.destination labeled image
Has overloading in C++
Python prototype (for reference only):
connectedComponents(image[, labels[, connectivity[, ltype]]]) -> retval, labels
connectedComponentsWithAlgorithm(image, connectivity, ltype, ccltype)
View Source@spec connectedComponentsWithAlgorithm( Evision.Mat.maybe_mat_in(), integer(), integer(), integer() ) :: {integer(), Evision.Mat.t()} | {:error, String.t()}
computes the connected components labeled image of boolean image
Positional Arguments
image:
Evision.Mat
.the 8-bit single-channel image to be labeled
connectivity:
integer()
.8 or 4 for 8-way or 4-way connectivity respectively
ltype:
integer()
.output image label type. Currently CV_32S and CV_16U are supported.
ccltype:
integer()
.connected components algorithm type (see the #ConnectedComponentsAlgorithmsTypes).
Return
retval:
integer()
labels:
Evision.Mat.t()
.destination labeled image
image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
Python prototype (for reference only):
connectedComponentsWithAlgorithm(image, connectivity, ltype, ccltype[, labels]) -> retval, labels
connectedComponentsWithAlgorithm(image, connectivity, ltype, ccltype, opts)
View Source@spec connectedComponentsWithAlgorithm( Evision.Mat.maybe_mat_in(), integer(), integer(), integer(), [{atom(), term()}, ...] | nil ) :: {integer(), Evision.Mat.t()} | {:error, String.t()}
computes the connected components labeled image of boolean image
Positional Arguments
image:
Evision.Mat
.the 8-bit single-channel image to be labeled
connectivity:
integer()
.8 or 4 for 8-way or 4-way connectivity respectively
ltype:
integer()
.output image label type. Currently CV_32S and CV_16U are supported.
ccltype:
integer()
.connected components algorithm type (see the #ConnectedComponentsAlgorithmsTypes).
Return
retval:
integer()
labels:
Evision.Mat.t()
.destination labeled image
image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
Python prototype (for reference only):
connectedComponentsWithAlgorithm(image, connectivity, ltype, ccltype[, labels]) -> retval, labels
@spec connectedComponentsWithStats(Keyword.t()) :: any() | {:error, String.t()}
@spec connectedComponentsWithStats(Evision.Mat.maybe_mat_in()) :: {integer(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
connectedComponentsWithStats
Positional Arguments
image:
Evision.Mat
.the 8-bit single-channel image to be labeled
Keyword Arguments
connectivity:
integer()
.8 or 4 for 8-way or 4-way connectivity respectively
ltype:
integer()
.output image label type. Currently CV_32S and CV_16U are supported.
Return
retval:
integer()
labels:
Evision.Mat.t()
.destination labeled image
stats:
Evision.Mat.t()
.statistics output for each label, including the background label. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
centroids:
Evision.Mat.t()
.centroid output for each label, including the background label. Centroids are accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
Has overloading in C++
Python prototype (for reference only):
connectedComponentsWithStats(image[, labels[, stats[, centroids[, connectivity[, ltype]]]]]) -> retval, labels, stats, centroids
@spec connectedComponentsWithStats( Evision.Mat.maybe_mat_in(), [connectivity: term(), ltype: term()] | nil ) :: {integer(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
connectedComponentsWithStats
Positional Arguments
image:
Evision.Mat
.the 8-bit single-channel image to be labeled
Keyword Arguments
connectivity:
integer()
.8 or 4 for 8-way or 4-way connectivity respectively
ltype:
integer()
.output image label type. Currently CV_32S and CV_16U are supported.
Return
retval:
integer()
labels:
Evision.Mat.t()
.destination labeled image
stats:
Evision.Mat.t()
.statistics output for each label, including the background label. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
centroids:
Evision.Mat.t()
.centroid output for each label, including the background label. Centroids are accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
Has overloading in C++
Python prototype (for reference only):
connectedComponentsWithStats(image[, labels[, stats[, centroids[, connectivity[, ltype]]]]]) -> retval, labels, stats, centroids
connectedComponentsWithStatsWithAlgorithm(image, connectivity, ltype, ccltype)
View Source@spec connectedComponentsWithStatsWithAlgorithm( Evision.Mat.maybe_mat_in(), integer(), integer(), integer() ) :: {integer(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
computes the connected components labeled image of boolean image and also produces a statistics output for each label
Positional Arguments
image:
Evision.Mat
.the 8-bit single-channel image to be labeled
connectivity:
integer()
.8 or 4 for 8-way or 4-way connectivity respectively
ltype:
integer()
.output image label type. Currently CV_32S and CV_16U are supported.
ccltype:
integer()
.connected components algorithm type (see #ConnectedComponentsAlgorithmsTypes).
Return
retval:
integer()
labels:
Evision.Mat.t()
.destination labeled image
stats:
Evision.Mat.t()
.statistics output for each label, including the background label. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
centroids:
Evision.Mat.t()
.centroid output for each label, including the background label. Centroids are accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms (statistics included) if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
Python prototype (for reference only):
connectedComponentsWithStatsWithAlgorithm(image, connectivity, ltype, ccltype[, labels[, stats[, centroids]]]) -> retval, labels, stats, centroids
connectedComponentsWithStatsWithAlgorithm(image, connectivity, ltype, ccltype, opts)
View Source@spec connectedComponentsWithStatsWithAlgorithm( Evision.Mat.maybe_mat_in(), integer(), integer(), integer(), [{atom(), term()}, ...] | nil ) :: {integer(), Evision.Mat.t(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
computes the connected components labeled image of boolean image and also produces a statistics output for each label
Positional Arguments
image:
Evision.Mat
.the 8-bit single-channel image to be labeled
connectivity:
integer()
.8 or 4 for 8-way or 4-way connectivity respectively
ltype:
integer()
.output image label type. Currently CV_32S and CV_16U are supported.
ccltype:
integer()
.connected components algorithm type (see #ConnectedComponentsAlgorithmsTypes).
Return
retval:
integer()
labels:
Evision.Mat.t()
.destination labeled image
stats:
Evision.Mat.t()
.statistics output for each label, including the background label. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
centroids:
Evision.Mat.t()
.centroid output for each label, including the background label. Centroids are accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms (statistics included) if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
Python prototype (for reference only):
connectedComponentsWithStatsWithAlgorithm(image, connectivity, ltype, ccltype[, labels[, stats[, centroids]]]) -> retval, labels, stats, centroids
@spec contourArea(Keyword.t()) :: any() | {:error, String.t()}
@spec contourArea(Evision.Mat.maybe_mat_in()) :: number() | {:error, String.t()}
Calculates a contour area.
Positional Arguments
contour:
Evision.Mat
.Input vector of 2D points (contour vertices), stored in std::vector or Mat.
Keyword Arguments
oriented:
bool
.Oriented area flag. If it is true, the function returns a signed area value, depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can determine orientation of a contour by taking the sign of an area. By default, the parameter is false, which means that the absolute value is returned.
Return
- retval:
double
The function computes a contour area. Similarly to moments , the area is computed using the Green formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong results for contours with self-intersections. Example:
vector<Point> contour;
contour.push_back(Point2f(0, 0));
contour.push_back(Point2f(10, 0));
contour.push_back(Point2f(10, 10));
contour.push_back(Point2f(5, 4));
double area0 = contourArea(contour);
vector<Point> approx;
approxPolyDP(contour, approx, 5, true);
double area1 = contourArea(approx);
cout << "area0 =" << area0 << endl <<
"area1 =" << area1 << endl <<
"approx poly vertices" << approx.size() << endl;
Python prototype (for reference only):
contourArea(contour[, oriented]) -> retval
@spec contourArea(Evision.Mat.maybe_mat_in(), [{:oriented, term()}] | nil) :: number() | {:error, String.t()}
Calculates a contour area.
Positional Arguments
contour:
Evision.Mat
.Input vector of 2D points (contour vertices), stored in std::vector or Mat.
Keyword Arguments
oriented:
bool
.Oriented area flag. If it is true, the function returns a signed area value, depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can determine orientation of a contour by taking the sign of an area. By default, the parameter is false, which means that the absolute value is returned.
Return
- retval:
double
The function computes a contour area. Similarly to moments , the area is computed using the Green formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong results for contours with self-intersections. Example:
vector<Point> contour;
contour.push_back(Point2f(0, 0));
contour.push_back(Point2f(10, 0));
contour.push_back(Point2f(10, 10));
contour.push_back(Point2f(5, 4));
double area0 = contourArea(contour);
vector<Point> approx;
approxPolyDP(contour, approx, 5, true);
double area1 = contourArea(approx);
cout << "area0 =" << area0 << endl <<
"area1 =" << area1 << endl <<
"approx poly vertices" << approx.size() << endl;
Python prototype (for reference only):
contourArea(contour[, oriented]) -> retval
@spec convertFp16(Keyword.t()) :: any() | {:error, String.t()}
@spec convertFp16(Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Converts an array to half precision floating number.
Positional Arguments
src:
Evision.Mat
.input array.
Return
dst:
Evision.Mat.t()
.output array.
This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data. There are two use modes (src -> dst): CV_32F -> CV_16S and CV_16S -> CV_32F. The input array has to have type of CV_32F or CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error. The format of half precision floating point is defined in IEEE 754-2008.
@deprecated Use Mat::convertTo with CV_16F instead.
Python prototype (for reference only):
convertFp16(src[, dst]) -> dst
@spec convertFp16(Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil) :: Evision.Mat.t() | {:error, String.t()}
Converts an array to half precision floating number.
Positional Arguments
src:
Evision.Mat
.input array.
Return
dst:
Evision.Mat.t()
.output array.
This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data. There are two use modes (src -> dst): CV_32F -> CV_16S and CV_16S -> CV_32F. The input array has to have type of CV_32F or CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error. The format of half precision floating point is defined in IEEE 754-2008.
@deprecated Use Mat::convertTo with CV_16F instead.
Python prototype (for reference only):
convertFp16(src[, dst]) -> dst
@spec convertMaps(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer()) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Converts image transformation maps from one representation to another.
Positional Arguments
map1:
Evision.Mat
.The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .
map2:
Evision.Mat
.The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix), respectively.
dstmap1type:
integer()
.Type of the first output map that should be CV_16SC2, CV_32FC1, or CV_32FC2 .
Keyword Arguments
nninterpolation:
bool
.Flag indicating whether the fixed-point maps are used for the nearest-neighbor or for a more complex interpolation.
Return
dstmap1:
Evision.Mat.t()
.The first output map that has the type dstmap1type and the same size as src .
dstmap2:
Evision.Mat.t()
.The second output map.
The function converts a pair of maps for remap from one representation to another. The following options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are supported:
\f$\texttt{(CV\_32FC1, CV\_32FC1)} \rightarrow \texttt{(CV\_16SC2, CV\_16UC1)}\f$. This is the most frequently used conversion operation, in which the original floating-point maps (see #remap) are converted to a more compact and much faster fixed-point representation. The first output array contains the rounded coordinates and the second array (created only when nninterpolation=false ) contains indices in the interpolation tables.
\f$\texttt{(CV\_32FC2)} \rightarrow \texttt{(CV\_16SC2, CV\_16UC1)}\f$. The same as above but the original maps are stored in one 2-channel matrix.
Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same as the originals.
@sa remap, undistort, initUndistortRectifyMap
Python prototype (for reference only):
convertMaps(map1, map2, dstmap1type[, dstmap1[, dstmap2[, nninterpolation]]]) -> dstmap1, dstmap2
@spec convertMaps( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer(), [{:nninterpolation, term()}] | nil ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
Converts image transformation maps from one representation to another.
Positional Arguments
map1:
Evision.Mat
.The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .
map2:
Evision.Mat
.The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix), respectively.
dstmap1type:
integer()
.Type of the first output map that should be CV_16SC2, CV_32FC1, or CV_32FC2 .
Keyword Arguments
nninterpolation:
bool
.Flag indicating whether the fixed-point maps are used for the nearest-neighbor or for a more complex interpolation.
Return
dstmap1:
Evision.Mat.t()
.The first output map that has the type dstmap1type and the same size as src .
dstmap2:
Evision.Mat.t()
.The second output map.
The function converts a pair of maps for remap from one representation to another. The following options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are supported:
\f$\texttt{(CV\_32FC1, CV\_32FC1)} \rightarrow \texttt{(CV\_16SC2, CV\_16UC1)}\f$. This is the most frequently used conversion operation, in which the original floating-point maps (see #remap) are converted to a more compact and much faster fixed-point representation. The first output array contains the rounded coordinates and the second array (created only when nninterpolation=false ) contains indices in the interpolation tables.
\f$\texttt{(CV\_32FC2)} \rightarrow \texttt{(CV\_16SC2, CV\_16UC1)}\f$. The same as above but the original maps are stored in one 2-channel matrix.
Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same as the originals.
@sa remap, undistort, initUndistortRectifyMap
Python prototype (for reference only):
convertMaps(map1, map2, dstmap1type[, dstmap1[, dstmap2[, nninterpolation]]]) -> dstmap1, dstmap2
@spec convertPointsFromHomogeneous(Keyword.t()) :: any() | {:error, String.t()}
@spec convertPointsFromHomogeneous(Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Converts points from homogeneous to Euclidean space.
Positional Arguments
src:
Evision.Mat
.Input vector of N-dimensional points.
Return
dst:
Evision.Mat.t()
.Output vector of N-1-dimensional points.
The function converts points homogeneous to Euclidean space using perspective projection. That is, each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the output point coordinates will be (0,0,0,...).
Python prototype (for reference only):
convertPointsFromHomogeneous(src[, dst]) -> dst
@spec convertPointsFromHomogeneous( Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Converts points from homogeneous to Euclidean space.
Positional Arguments
src:
Evision.Mat
.Input vector of N-dimensional points.
Return
dst:
Evision.Mat.t()
.Output vector of N-1-dimensional points.
The function converts points homogeneous to Euclidean space using perspective projection. That is, each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the output point coordinates will be (0,0,0,...).
Python prototype (for reference only):
convertPointsFromHomogeneous(src[, dst]) -> dst
@spec convertPointsToHomogeneous(Keyword.t()) :: any() | {:error, String.t()}
@spec convertPointsToHomogeneous(Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Converts points from Euclidean to homogeneous space.
Positional Arguments
src:
Evision.Mat
.Input vector of N-dimensional points.
Return
dst:
Evision.Mat.t()
.Output vector of N+1-dimensional points.
The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).
Python prototype (for reference only):
convertPointsToHomogeneous(src[, dst]) -> dst
@spec convertPointsToHomogeneous( Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: Evision.Mat.t() | {:error, String.t()}
Converts points from Euclidean to homogeneous space.
Positional Arguments
src:
Evision.Mat
.Input vector of N-dimensional points.
Return
dst:
Evision.Mat.t()
.Output vector of N+1-dimensional points.
The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).
Python prototype (for reference only):
convertPointsToHomogeneous(src[, dst]) -> dst
@spec convertScaleAbs(Keyword.t()) :: any() | {:error, String.t()}
@spec convertScaleAbs(Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Scales, calculates absolute values, and converts the result to 8-bit.
Positional Arguments
src:
Evision.Mat
.input array.
Keyword Arguments
alpha:
double
.optional scale factor.
beta:
double
.optional delta added to the scaled values.
Return
dst:
Evision.Mat.t()
.output array.
On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type: \f[\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\f] In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat::convertTo method (or by using matrix expressions) and then by calculating an absolute value of the result. For example:
Mat_<float> A(30,30);
randu(A, Scalar(-100), Scalar(100));
Mat_<float> B = A*5 + 3;
B = abs(B);
// Mat_<float> B = abs(A*5+3) will also do the job,
// but it will allocate a temporary matrix
@sa Mat::convertTo, cv::abs(const Mat&)
Python prototype (for reference only):
convertScaleAbs(src[, dst[, alpha[, beta]]]) -> dst
@spec convertScaleAbs(Evision.Mat.maybe_mat_in(), [alpha: term(), beta: term()] | nil) :: Evision.Mat.t() | {:error, String.t()}
Scales, calculates absolute values, and converts the result to 8-bit.
Positional Arguments
src:
Evision.Mat
.input array.
Keyword Arguments
alpha:
double
.optional scale factor.
beta:
double
.optional delta added to the scaled values.
Return
dst:
Evision.Mat.t()
.output array.
On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type: \f[\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\f] In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat::convertTo method (or by using matrix expressions) and then by calculating an absolute value of the result. For example:
Mat_<float> A(30,30);
randu(A, Scalar(-100), Scalar(100));
Mat_<float> B = A*5 + 3;
B = abs(B);
// Mat_<float> B = abs(A*5+3) will also do the job,
// but it will allocate a temporary matrix
@sa Mat::convertTo, cv::abs(const Mat&)
Python prototype (for reference only):
convertScaleAbs(src[, dst[, alpha[, beta]]]) -> dst
@spec convexHull(Keyword.t()) :: any() | {:error, String.t()}
@spec convexHull(Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}
Finds the convex hull of a point set.
Positional Arguments
points:
Evision.Mat
.Input 2D point set, stored in std::vector or Mat.
Keyword Arguments
clockwise:
bool
.Orientation flag. If it is true, the output convex hull is oriented clockwise. Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing to the right, and its Y axis pointing upwards.
returnPoints:
bool
.Operation flag. In case of a matrix, when the flag is true, the function returns convex hull points. Otherwise, it returns indices of the convex hull points. When the output array is std::vector, the flag is ignored, and the output depends on the type of the vector: std::vector\<int> implies returnPoints=false, std::vector\<Point> implies returnPoints=true.
Return
hull:
Evision.Mat.t()
.Output convex hull. It is either an integer vector of indices or vector of points. In the first case, the hull elements are 0-based indices of the convex hull points in the original array (since the set of convex hull points is a subset of the original point set). In the second case, hull elements are the convex hull points themselves.
The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82 that has O(N logN) complexity in the current implementation.
Note: points
and hull
should be different arrays, inplace processing isn't supported.
Check @ref tutorial_hull "the corresponding tutorial" for more details.
useful links:
https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/
Python prototype (for reference only):
convexHull(points[, hull[, clockwise[, returnPoints]]]) -> hull
@spec convexHull( Evision.Mat.maybe_mat_in(), [clockwise: term(), returnPoints: term()] | nil ) :: Evision.Mat.t() | {:error, String.t()