public class Imgproc extends Object
Constructor and Description |
---|
Imgproc() |
Modifier and Type | Method and Description |
---|---|
static void |
accumulate(Mat src,
Mat dst)
Adds an image to the accumulator image.
|
static void |
accumulate(Mat src,
Mat dst,
Mat mask)
Adds an image to the accumulator image.
|
static void |
accumulateProduct(Mat src1,
Mat src2,
Mat dst)
Adds the per-element product of two input images to the accumulator image.
|
static void |
accumulateProduct(Mat src1,
Mat src2,
Mat dst,
Mat mask)
Adds the per-element product of two input images to the accumulator image.
|
static void |
accumulateSquare(Mat src,
Mat dst)
Adds the square of a source image to the accumulator image.
|
static void |
accumulateSquare(Mat src,
Mat dst,
Mat mask)
Adds the square of a source image to the accumulator image.
|
static void |
accumulateWeighted(Mat src,
Mat dst,
double alpha)
Updates a running average.
|
static void |
accumulateWeighted(Mat src,
Mat dst,
double alpha,
Mat mask)
Updates a running average.
|
static void |
adaptiveThreshold(Mat src,
Mat dst,
double maxValue,
int adaptiveMethod,
int thresholdType,
int blockSize,
double C)
Applies an adaptive threshold to an array.
|
static void |
applyColorMap(Mat src,
Mat dst,
int colormap)
Applies a GNU Octave/MATLAB equivalent colormap on a given image.
|
static void |
applyColorMap(Mat src,
Mat dst,
Mat userColor)
Applies a user colormap on a given image.
|
static void |
approxPolyDP(MatOfPoint2f curve,
MatOfPoint2f approxCurve,
double epsilon,
boolean closed)
Approximates a polygonal curve(s) with the specified precision.
|
static double |
arcLength(MatOfPoint2f curve,
boolean closed)
Calculates a contour perimeter or a curve length.
|
static void |
arrowedLine(Mat img,
Point pt1,
Point pt2,
Scalar color)
Draws a arrow segment pointing from the first point to the second one.
|
static void |
arrowedLine(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness)
Draws a arrow segment pointing from the first point to the second one.
|
static void |
arrowedLine(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness,
int line_type)
Draws a arrow segment pointing from the first point to the second one.
|
static void |
arrowedLine(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness,
int line_type,
int shift)
Draws a arrow segment pointing from the first point to the second one.
|
static void |
arrowedLine(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness,
int line_type,
int shift,
double tipLength)
Draws a arrow segment pointing from the first point to the second one.
|
static void |
bilateralFilter(Mat src,
Mat dst,
int d,
double sigmaColor,
double sigmaSpace)
Applies the bilateral filter to an image.
|
static void |
bilateralFilter(Mat src,
Mat dst,
int d,
double sigmaColor,
double sigmaSpace,
int borderType)
Applies the bilateral filter to an image.
|
static void |
blur(Mat src,
Mat dst,
Size ksize)
Blurs an image using the normalized box filter.
|
static void |
blur(Mat src,
Mat dst,
Size ksize,
Point anchor)
Blurs an image using the normalized box filter.
|
static void |
blur(Mat src,
Mat dst,
Size ksize,
Point anchor,
int borderType)
Blurs an image using the normalized box filter.
|
static Rect |
boundingRect(Mat array)
Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image.
|
static void |
boxFilter(Mat src,
Mat dst,
int ddepth,
Size ksize)
Blurs an image using the box filter.
|
static void |
boxFilter(Mat src,
Mat dst,
int ddepth,
Size ksize,
Point anchor)
Blurs an image using the box filter.
|
static void |
boxFilter(Mat src,
Mat dst,
int ddepth,
Size ksize,
Point anchor,
boolean normalize)
Blurs an image using the box filter.
|
static void |
boxFilter(Mat src,
Mat dst,
int ddepth,
Size ksize,
Point anchor,
boolean normalize,
int borderType)
Blurs an image using the box filter.
|
static void |
boxPoints(RotatedRect box,
Mat points)
Finds the four vertices of a rotated rect.
|
static void |
calcBackProject(List<Mat> images,
MatOfInt channels,
Mat hist,
Mat dst,
MatOfFloat ranges,
double scale) |
static void |
calcHist(List<Mat> images,
MatOfInt channels,
Mat mask,
Mat hist,
MatOfInt histSize,
MatOfFloat ranges) |
static void |
calcHist(List<Mat> images,
MatOfInt channels,
Mat mask,
Mat hist,
MatOfInt histSize,
MatOfFloat ranges,
boolean accumulate) |
static void |
Canny(Mat image,
Mat edges,
double threshold1,
double threshold2)
Finds edges in an image using the Canny algorithm CITE: Canny86 .
|
static void |
Canny(Mat image,
Mat edges,
double threshold1,
double threshold2,
int apertureSize)
Finds edges in an image using the Canny algorithm CITE: Canny86 .
|
static void |
Canny(Mat image,
Mat edges,
double threshold1,
double threshold2,
int apertureSize,
boolean L2gradient)
Finds edges in an image using the Canny algorithm CITE: Canny86 .
|
static void |
Canny(Mat dx,
Mat dy,
Mat edges,
double threshold1,
double threshold2)
\overload
Finds edges in an image using the Canny algorithm with custom image gradient.
|
static void |
Canny(Mat dx,
Mat dy,
Mat edges,
double threshold1,
double threshold2,
boolean L2gradient)
\overload
Finds edges in an image using the Canny algorithm with custom image gradient.
|
static void |
circle(Mat img,
Point center,
int radius,
Scalar color)
Draws a circle.
|
static void |
circle(Mat img,
Point center,
int radius,
Scalar color,
int thickness)
Draws a circle.
|
static void |
circle(Mat img,
Point center,
int radius,
Scalar color,
int thickness,
int lineType)
Draws a circle.
|
static void |
circle(Mat img,
Point center,
int radius,
Scalar color,
int thickness,
int lineType,
int shift)
Draws a circle.
|
static boolean |
clipLine(Rect imgRect,
Point pt1,
Point pt2) |
static double |
compareHist(Mat H1,
Mat H2,
int method)
Compares two histograms.
|
static int |
connectedComponents(Mat image,
Mat labels) |
static int |
connectedComponents(Mat image,
Mat labels,
int connectivity) |
static int |
connectedComponents(Mat image,
Mat labels,
int connectivity,
int ltype) |
static int |
connectedComponentsWithAlgorithm(Mat image,
Mat labels,
int connectivity,
int ltype,
int ccltype)
computes the connected components labeled image of boolean image
image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
represents the background label.
|
static int |
connectedComponentsWithStats(Mat image,
Mat labels,
Mat stats,
Mat centroids) |
static int |
connectedComponentsWithStats(Mat image,
Mat labels,
Mat stats,
Mat centroids,
int connectivity) |
static int |
connectedComponentsWithStats(Mat image,
Mat labels,
Mat stats,
Mat centroids,
int connectivity,
int ltype) |
static int |
connectedComponentsWithStatsWithAlgorithm(Mat image,
Mat labels,
Mat stats,
Mat centroids,
int connectivity,
int ltype,
int ccltype)
computes the connected components labeled image of boolean image and also produces a statistics output for each label
image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
represents the background label.
|
static double |
contourArea(Mat contour)
Calculates a contour area.
|
static double |
contourArea(Mat contour,
boolean oriented)
Calculates a contour area.
|
static void |
convertMaps(Mat map1,
Mat map2,
Mat dstmap1,
Mat dstmap2,
int dstmap1type)
Converts image transformation maps from one representation to another.
|
static void |
convertMaps(Mat map1,
Mat map2,
Mat dstmap1,
Mat dstmap2,
int dstmap1type,
boolean nninterpolation)
Converts image transformation maps from one representation to another.
|
static void |
convexHull(MatOfPoint points,
MatOfInt hull)
Finds the convex hull of a point set.
|
static void |
convexHull(MatOfPoint points,
MatOfInt hull,
boolean clockwise)
Finds the convex hull of a point set.
|
static void |
convexityDefects(MatOfPoint contour,
MatOfInt convexhull,
MatOfInt4 convexityDefects)
Finds the convexity defects of a contour.
|
static void |
cornerEigenValsAndVecs(Mat src,
Mat dst,
int blockSize,
int ksize)
Calculates eigenvalues and eigenvectors of image blocks for corner detection.
|
static void |
cornerEigenValsAndVecs(Mat src,
Mat dst,
int blockSize,
int ksize,
int borderType)
Calculates eigenvalues and eigenvectors of image blocks for corner detection.
|
static void |
cornerHarris(Mat src,
Mat dst,
int blockSize,
int ksize,
double k)
Harris corner detector.
|
static void |
cornerHarris(Mat src,
Mat dst,
int blockSize,
int ksize,
double k,
int borderType)
Harris corner detector.
|
static void |
cornerMinEigenVal(Mat src,
Mat dst,
int blockSize)
Calculates the minimal eigenvalue of gradient matrices for corner detection.
|
static void |
cornerMinEigenVal(Mat src,
Mat dst,
int blockSize,
int ksize)
Calculates the minimal eigenvalue of gradient matrices for corner detection.
|
static void |
cornerMinEigenVal(Mat src,
Mat dst,
int blockSize,
int ksize,
int borderType)
Calculates the minimal eigenvalue of gradient matrices for corner detection.
|
static void |
cornerSubPix(Mat image,
Mat corners,
Size winSize,
Size zeroZone,
TermCriteria criteria)
Refines the corner locations.
|
static CLAHE |
createCLAHE()
Creates a smart pointer to a cv::CLAHE class and initializes it.
|
static CLAHE |
createCLAHE(double clipLimit)
Creates a smart pointer to a cv::CLAHE class and initializes it.
|
static CLAHE |
createCLAHE(double clipLimit,
Size tileGridSize)
Creates a smart pointer to a cv::CLAHE class and initializes it.
|
static GeneralizedHoughBallard |
createGeneralizedHoughBallard()
Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it.
|
static GeneralizedHoughGuil |
createGeneralizedHoughGuil()
Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it.
|
static void |
createHanningWindow(Mat dst,
Size winSize,
int type)
This function computes a Hanning window coefficients in two dimensions.
|
static LineSegmentDetector |
createLineSegmentDetector()
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static LineSegmentDetector |
createLineSegmentDetector(int _refine)
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static LineSegmentDetector |
createLineSegmentDetector(int _refine,
double _scale)
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static LineSegmentDetector |
createLineSegmentDetector(int _refine,
double _scale,
double _sigma_scale)
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static LineSegmentDetector |
createLineSegmentDetector(int _refine,
double _scale,
double _sigma_scale,
double _quant)
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static LineSegmentDetector |
createLineSegmentDetector(int _refine,
double _scale,
double _sigma_scale,
double _quant,
double _ang_th)
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static LineSegmentDetector |
createLineSegmentDetector(int _refine,
double _scale,
double _sigma_scale,
double _quant,
double _ang_th,
double _log_eps)
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static LineSegmentDetector |
createLineSegmentDetector(int _refine,
double _scale,
double _sigma_scale,
double _quant,
double _ang_th,
double _log_eps,
double _density_th)
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static LineSegmentDetector |
createLineSegmentDetector(int _refine,
double _scale,
double _sigma_scale,
double _quant,
double _ang_th,
double _log_eps,
double _density_th,
int _n_bins)
Creates a smart pointer to a LineSegmentDetector object and initializes it.
|
static void |
cvtColor(Mat src,
Mat dst,
int code)
Converts an image from one color space to another.
|
static void |
cvtColor(Mat src,
Mat dst,
int code,
int dstCn)
Converts an image from one color space to another.
|
static void |
cvtColorTwoPlane(Mat src1,
Mat src2,
Mat dst,
int code)
Converts an image from one color space to another where the source image is
stored in two planes.
|
static void |
demosaicing(Mat src,
Mat dst,
int code)
main function for all demosaicing processes
|
static void |
demosaicing(Mat src,
Mat dst,
int code,
int dstCn)
main function for all demosaicing processes
|
static void |
dilate(Mat src,
Mat dst,
Mat kernel)
Dilates an image by using a specific structuring element.
|
static void |
dilate(Mat src,
Mat dst,
Mat kernel,
Point anchor)
Dilates an image by using a specific structuring element.
|
static void |
dilate(Mat src,
Mat dst,
Mat kernel,
Point anchor,
int iterations)
Dilates an image by using a specific structuring element.
|
static void |
dilate(Mat src,
Mat dst,
Mat kernel,
Point anchor,
int iterations,
int borderType)
Dilates an image by using a specific structuring element.
|
static void |
dilate(Mat src,
Mat dst,
Mat kernel,
Point anchor,
int iterations,
int borderType,
Scalar borderValue)
Dilates an image by using a specific structuring element.
|
static void |
distanceTransform(Mat src,
Mat dst,
int distanceType,
int maskSize) |
static void |
distanceTransform(Mat src,
Mat dst,
int distanceType,
int maskSize,
int dstType) |
static void |
distanceTransformWithLabels(Mat src,
Mat dst,
Mat labels,
int distanceType,
int maskSize)
Calculates the distance to the closest zero pixel for each pixel of the source image.
|
static void |
distanceTransformWithLabels(Mat src,
Mat dst,
Mat labels,
int distanceType,
int maskSize,
int labelType)
Calculates the distance to the closest zero pixel for each pixel of the source image.
|
static void |
drawContours(Mat image,
List<MatOfPoint> contours,
int contourIdx,
Scalar color)
Draws contours outlines or filled contours.
|
static void |
drawContours(Mat image,
List<MatOfPoint> contours,
int contourIdx,
Scalar color,
int thickness)
Draws contours outlines or filled contours.
|
static void |
drawContours(Mat image,
List<MatOfPoint> contours,
int contourIdx,
Scalar color,
int thickness,
int lineType)
Draws contours outlines or filled contours.
|
static void |
drawContours(Mat image,
List<MatOfPoint> contours,
int contourIdx,
Scalar color,
int thickness,
int lineType,
Mat hierarchy)
Draws contours outlines or filled contours.
|
static void |
drawContours(Mat image,
List<MatOfPoint> contours,
int contourIdx,
Scalar color,
int thickness,
int lineType,
Mat hierarchy,
int maxLevel)
Draws contours outlines or filled contours.
|
static void |
drawContours(Mat image,
List<MatOfPoint> contours,
int contourIdx,
Scalar color,
int thickness,
int lineType,
Mat hierarchy,
int maxLevel,
Point offset)
Draws contours outlines or filled contours.
|
static void |
drawMarker(Mat img,
Point position,
Scalar color)
Draws a marker on a predefined position in an image.
|
static void |
drawMarker(Mat img,
Point position,
Scalar color,
int markerType)
Draws a marker on a predefined position in an image.
|
static void |
drawMarker(Mat img,
Point position,
Scalar color,
int markerType,
int markerSize)
Draws a marker on a predefined position in an image.
|
static void |
drawMarker(Mat img,
Point position,
Scalar color,
int markerType,
int markerSize,
int thickness)
Draws a marker on a predefined position in an image.
|
static void |
drawMarker(Mat img,
Point position,
Scalar color,
int markerType,
int markerSize,
int thickness,
int line_type)
Draws a marker on a predefined position in an image.
|
static void |
ellipse(Mat img,
Point center,
Size axes,
double angle,
double startAngle,
double endAngle,
Scalar color)
Draws a simple or thick elliptic arc or fills an ellipse sector.
|
static void |
ellipse(Mat img,
Point center,
Size axes,
double angle,
double startAngle,
double endAngle,
Scalar color,
int thickness)
Draws a simple or thick elliptic arc or fills an ellipse sector.
|
static void |
ellipse(Mat img,
Point center,
Size axes,
double angle,
double startAngle,
double endAngle,
Scalar color,
int thickness,
int lineType)
Draws a simple or thick elliptic arc or fills an ellipse sector.
|
static void |
ellipse(Mat img,
Point center,
Size axes,
double angle,
double startAngle,
double endAngle,
Scalar color,
int thickness,
int lineType,
int shift)
Draws a simple or thick elliptic arc or fills an ellipse sector.
|
static void |
ellipse(Mat img,
RotatedRect box,
Scalar color) |
static void |
ellipse(Mat img,
RotatedRect box,
Scalar color,
int thickness) |
static void |
ellipse(Mat img,
RotatedRect box,
Scalar color,
int thickness,
int lineType) |
static void |
ellipse2Poly(Point center,
Size axes,
int angle,
int arcStart,
int arcEnd,
int delta,
MatOfPoint pts)
Approximates an elliptic arc with a polyline.
|
static float |
EMD(Mat signature1,
Mat signature2,
int distType)
Computes the "minimal work" distance between two weighted point configurations.
|
static float |
EMD(Mat signature1,
Mat signature2,
int distType,
Mat cost)
Computes the "minimal work" distance between two weighted point configurations.
|
static float |
EMD(Mat signature1,
Mat signature2,
int distType,
Mat cost,
Mat flow)
Computes the "minimal work" distance between two weighted point configurations.
|
static void |
equalizeHist(Mat src,
Mat dst)
Equalizes the histogram of a grayscale image.
|
static void |
erode(Mat src,
Mat dst,
Mat kernel)
Erodes an image by using a specific structuring element.
|
static void |
erode(Mat src,
Mat dst,
Mat kernel,
Point anchor)
Erodes an image by using a specific structuring element.
|
static void |
erode(Mat src,
Mat dst,
Mat kernel,
Point anchor,
int iterations)
Erodes an image by using a specific structuring element.
|
static void |
erode(Mat src,
Mat dst,
Mat kernel,
Point anchor,
int iterations,
int borderType)
Erodes an image by using a specific structuring element.
|
static void |
erode(Mat src,
Mat dst,
Mat kernel,
Point anchor,
int iterations,
int borderType,
Scalar borderValue)
Erodes an image by using a specific structuring element.
|
static void |
fillConvexPoly(Mat img,
MatOfPoint points,
Scalar color)
Fills a convex polygon.
|
static void |
fillConvexPoly(Mat img,
MatOfPoint points,
Scalar color,
int lineType)
Fills a convex polygon.
|
static void |
fillConvexPoly(Mat img,
MatOfPoint points,
Scalar color,
int lineType,
int shift)
Fills a convex polygon.
|
static void |
fillPoly(Mat img,
List<MatOfPoint> pts,
Scalar color)
Fills the area bounded by one or more polygons.
|
static void |
fillPoly(Mat img,
List<MatOfPoint> pts,
Scalar color,
int lineType)
Fills the area bounded by one or more polygons.
|
static void |
fillPoly(Mat img,
List<MatOfPoint> pts,
Scalar color,
int lineType,
int shift)
Fills the area bounded by one or more polygons.
|
static void |
fillPoly(Mat img,
List<MatOfPoint> pts,
Scalar color,
int lineType,
int shift,
Point offset)
Fills the area bounded by one or more polygons.
|
static void |
filter2D(Mat src,
Mat dst,
int ddepth,
Mat kernel)
Convolves an image with the kernel.
|
static void |
filter2D(Mat src,
Mat dst,
int ddepth,
Mat kernel,
Point anchor)
Convolves an image with the kernel.
|
static void |
filter2D(Mat src,
Mat dst,
int ddepth,
Mat kernel,
Point anchor,
double delta)
Convolves an image with the kernel.
|
static void |
filter2D(Mat src,
Mat dst,
int ddepth,
Mat kernel,
Point anchor,
double delta,
int borderType)
Convolves an image with the kernel.
|
static void |
findContours(Mat image,
List<MatOfPoint> contours,
Mat hierarchy,
int mode,
int method)
Finds contours in a binary image.
|
static void |
findContours(Mat image,
List<MatOfPoint> contours,
Mat hierarchy,
int mode,
int method,
Point offset)
Finds contours in a binary image.
|
static RotatedRect |
fitEllipse(MatOfPoint2f points)
Fits an ellipse around a set of 2D points.
|
static RotatedRect |
fitEllipseAMS(Mat points)
Fits an ellipse around a set of 2D points.
|
static RotatedRect |
fitEllipseDirect(Mat points)
Fits an ellipse around a set of 2D points.
|
static void |
fitLine(Mat points,
Mat line,
int distType,
double param,
double reps,
double aeps)
Fits a line to a 2D or 3D point set.
|
static int |
floodFill(Mat image,
Mat mask,
Point seedPoint,
Scalar newVal)
Fills a connected component with the given color.
|
static int |
floodFill(Mat image,
Mat mask,
Point seedPoint,
Scalar newVal,
Rect rect)
Fills a connected component with the given color.
|
static int |
floodFill(Mat image,
Mat mask,
Point seedPoint,
Scalar newVal,
Rect rect,
Scalar loDiff)
Fills a connected component with the given color.
|
static int |
floodFill(Mat image,
Mat mask,
Point seedPoint,
Scalar newVal,
Rect rect,
Scalar loDiff,
Scalar upDiff)
Fills a connected component with the given color.
|
static int |
floodFill(Mat image,
Mat mask,
Point seedPoint,
Scalar newVal,
Rect rect,
Scalar loDiff,
Scalar upDiff,
int flags)
Fills a connected component with the given color.
|
static void |
GaussianBlur(Mat src,
Mat dst,
Size ksize,
double sigmaX)
Blurs an image using a Gaussian filter.
|
static void |
GaussianBlur(Mat src,
Mat dst,
Size ksize,
double sigmaX,
double sigmaY)
Blurs an image using a Gaussian filter.
|
static void |
GaussianBlur(Mat src,
Mat dst,
Size ksize,
double sigmaX,
double sigmaY,
int borderType)
Blurs an image using a Gaussian filter.
|
static Mat |
getAffineTransform(MatOfPoint2f src,
MatOfPoint2f dst) |
static void |
getDerivKernels(Mat kx,
Mat ky,
int dx,
int dy,
int ksize)
Returns filter coefficients for computing spatial image derivatives.
|
static void |
getDerivKernels(Mat kx,
Mat ky,
int dx,
int dy,
int ksize,
boolean normalize)
Returns filter coefficients for computing spatial image derivatives.
|
static void |
getDerivKernels(Mat kx,
Mat ky,
int dx,
int dy,
int ksize,
boolean normalize,
int ktype)
Returns filter coefficients for computing spatial image derivatives.
|
static double |
getFontScaleFromHeight(int fontFace,
int pixelHeight)
Calculates the font-specific size to use to achieve a given height in pixels.
|
static double |
getFontScaleFromHeight(int fontFace,
int pixelHeight,
int thickness)
Calculates the font-specific size to use to achieve a given height in pixels.
|
static Mat |
getGaborKernel(Size ksize,
double sigma,
double theta,
double lambd,
double gamma)
Returns Gabor filter coefficients.
|
static Mat |
getGaborKernel(Size ksize,
double sigma,
double theta,
double lambd,
double gamma,
double psi)
Returns Gabor filter coefficients.
|
static Mat |
getGaborKernel(Size ksize,
double sigma,
double theta,
double lambd,
double gamma,
double psi,
int ktype)
Returns Gabor filter coefficients.
|
static Mat |
getGaussianKernel(int ksize,
double sigma)
Returns Gaussian filter coefficients.
|
static Mat |
getGaussianKernel(int ksize,
double sigma,
int ktype)
Returns Gaussian filter coefficients.
|
static Mat |
getPerspectiveTransform(Mat src,
Mat dst)
Calculates a perspective transform from four pairs of the corresponding points.
|
static Mat |
getPerspectiveTransform(Mat src,
Mat dst,
int solveMethod)
Calculates a perspective transform from four pairs of the corresponding points.
|
static void |
getRectSubPix(Mat image,
Size patchSize,
Point center,
Mat patch)
Retrieves a pixel rectangle from an image with sub-pixel accuracy.
|
static void |
getRectSubPix(Mat image,
Size patchSize,
Point center,
Mat patch,
int patchType)
Retrieves a pixel rectangle from an image with sub-pixel accuracy.
|
static Mat |
getRotationMatrix2D(Point center,
double angle,
double scale)
Calculates an affine matrix of 2D rotation.
|
static Mat |
getStructuringElement(int shape,
Size ksize)
Returns a structuring element of the specified size and shape for morphological operations.
|
static Mat |
getStructuringElement(int shape,
Size ksize,
Point anchor)
Returns a structuring element of the specified size and shape for morphological operations.
|
static Size |
getTextSize(String text,
int fontFace,
double fontScale,
int thickness,
int[] baseLine) |
static void |
goodFeaturesToTrack(Mat image,
MatOfPoint corners,
int maxCorners,
double qualityLevel,
double minDistance)
Determines strong corners on an image.
|
static void |
goodFeaturesToTrack(Mat image,
MatOfPoint corners,
int maxCorners,
double qualityLevel,
double minDistance,
Mat mask)
Determines strong corners on an image.
|
static void |
goodFeaturesToTrack(Mat image,
MatOfPoint corners,
int maxCorners,
double qualityLevel,
double minDistance,
Mat mask,
int blockSize)
Determines strong corners on an image.
|
static void |
goodFeaturesToTrack(Mat image,
MatOfPoint corners,
int maxCorners,
double qualityLevel,
double minDistance,
Mat mask,
int blockSize,
boolean useHarrisDetector)
Determines strong corners on an image.
|
static void |
goodFeaturesToTrack(Mat image,
MatOfPoint corners,
int maxCorners,
double qualityLevel,
double minDistance,
Mat mask,
int blockSize,
boolean useHarrisDetector,
double k)
Determines strong corners on an image.
|
static void |
goodFeaturesToTrack(Mat image,
MatOfPoint corners,
int maxCorners,
double qualityLevel,
double minDistance,
Mat mask,
int blockSize,
int gradientSize) |
static void |
goodFeaturesToTrack(Mat image,
MatOfPoint corners,
int maxCorners,
double qualityLevel,
double minDistance,
Mat mask,
int blockSize,
int gradientSize,
boolean useHarrisDetector) |
static void |
goodFeaturesToTrack(Mat image,
MatOfPoint corners,
int maxCorners,
double qualityLevel,
double minDistance,
Mat mask,
int blockSize,
int gradientSize,
boolean useHarrisDetector,
double k) |
static void |
grabCut(Mat img,
Mat mask,
Rect rect,
Mat bgdModel,
Mat fgdModel,
int iterCount)
Runs the GrabCut algorithm.
|
static void |
grabCut(Mat img,
Mat mask,
Rect rect,
Mat bgdModel,
Mat fgdModel,
int iterCount,
int mode)
Runs the GrabCut algorithm.
|
static void |
HoughCircles(Mat image,
Mat circles,
int method,
double dp,
double minDist)
Finds circles in a grayscale image using the Hough transform.
|
static void |
HoughCircles(Mat image,
Mat circles,
int method,
double dp,
double minDist,
double param1)
Finds circles in a grayscale image using the Hough transform.
|
static void |
HoughCircles(Mat image,
Mat circles,
int method,
double dp,
double minDist,
double param1,
double param2)
Finds circles in a grayscale image using the Hough transform.
|
static void |
HoughCircles(Mat image,
Mat circles,
int method,
double dp,
double minDist,
double param1,
double param2,
int minRadius)
Finds circles in a grayscale image using the Hough transform.
|
static void |
HoughCircles(Mat image,
Mat circles,
int method,
double dp,
double minDist,
double param1,
double param2,
int minRadius,
int maxRadius)
Finds circles in a grayscale image using the Hough transform.
|
static void |
HoughLines(Mat image,
Mat lines,
double rho,
double theta,
int threshold)
Finds lines in a binary image using the standard Hough transform.
|
static void |
HoughLines(Mat image,
Mat lines,
double rho,
double theta,
int threshold,
double srn)
Finds lines in a binary image using the standard Hough transform.
|
static void |
HoughLines(Mat image,
Mat lines,
double rho,
double theta,
int threshold,
double srn,
double stn)
Finds lines in a binary image using the standard Hough transform.
|
static void |
HoughLines(Mat image,
Mat lines,
double rho,
double theta,
int threshold,
double srn,
double stn,
double min_theta)
Finds lines in a binary image using the standard Hough transform.
|
static void |
HoughLines(Mat image,
Mat lines,
double rho,
double theta,
int threshold,
double srn,
double stn,
double min_theta,
double max_theta)
Finds lines in a binary image using the standard Hough transform.
|
static void |
HoughLinesP(Mat image,
Mat lines,
double rho,
double theta,
int threshold)
Finds line segments in a binary image using the probabilistic Hough transform.
|
static void |
HoughLinesP(Mat image,
Mat lines,
double rho,
double theta,
int threshold,
double minLineLength)
Finds line segments in a binary image using the probabilistic Hough transform.
|
static void |
HoughLinesP(Mat image,
Mat lines,
double rho,
double theta,
int threshold,
double minLineLength,
double maxLineGap)
Finds line segments in a binary image using the probabilistic Hough transform.
|
static void |
HoughLinesPointSet(Mat _point,
Mat _lines,
int lines_max,
int threshold,
double min_rho,
double max_rho,
double rho_step,
double min_theta,
double max_theta,
double theta_step)
Finds lines in a set of points using the standard Hough transform.
|
static void |
HuMoments(Moments m,
Mat hu) |
static void |
integral(Mat src,
Mat sum) |
static void |
integral(Mat src,
Mat sum,
int sdepth) |
static void |
integral2(Mat src,
Mat sum,
Mat sqsum) |
static void |
integral2(Mat src,
Mat sum,
Mat sqsum,
int sdepth) |
static void |
integral2(Mat src,
Mat sum,
Mat sqsum,
int sdepth,
int sqdepth) |
static void |
integral3(Mat src,
Mat sum,
Mat sqsum,
Mat tilted)
Calculates the integral of an image.
|
static void |
integral3(Mat src,
Mat sum,
Mat sqsum,
Mat tilted,
int sdepth)
Calculates the integral of an image.
|
static void |
integral3(Mat src,
Mat sum,
Mat sqsum,
Mat tilted,
int sdepth,
int sqdepth)
Calculates the integral of an image.
|
static float |
intersectConvexConvex(Mat _p1,
Mat _p2,
Mat _p12)
Finds intersection of two convex polygons
|
static float |
intersectConvexConvex(Mat _p1,
Mat _p2,
Mat _p12,
boolean handleNested)
Finds intersection of two convex polygons
|
static void |
invertAffineTransform(Mat M,
Mat iM)
Inverts an affine transformation.
|
static boolean |
isContourConvex(MatOfPoint contour)
Tests a contour convexity.
|
static void |
Laplacian(Mat src,
Mat dst,
int ddepth)
Calculates the Laplacian of an image.
|
static void |
Laplacian(Mat src,
Mat dst,
int ddepth,
int ksize)
Calculates the Laplacian of an image.
|
static void |
Laplacian(Mat src,
Mat dst,
int ddepth,
int ksize,
double scale)
Calculates the Laplacian of an image.
|
static void |
Laplacian(Mat src,
Mat dst,
int ddepth,
int ksize,
double scale,
double delta)
Calculates the Laplacian of an image.
|
static void |
Laplacian(Mat src,
Mat dst,
int ddepth,
int ksize,
double scale,
double delta,
int borderType)
Calculates the Laplacian of an image.
|
static void |
line(Mat img,
Point pt1,
Point pt2,
Scalar color)
Draws a line segment connecting two points.
|
static void |
line(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness)
Draws a line segment connecting two points.
|
static void |
line(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness,
int lineType)
Draws a line segment connecting two points.
|
static void |
line(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness,
int lineType,
int shift)
Draws a line segment connecting two points.
|
static void |
linearPolar(Mat src,
Mat dst,
Point center,
double maxRadius,
int flags)
Deprecated.
This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags)
Transform the source image using the following transformation (See REF: polar_remaps_reference_image "Polar remaps reference image c)"):
\(\begin{array}{l}
dst( \rho , \phi ) = src(x,y) \\
dst.size() \leftarrow src.size()
\end{array}\)
where
\(\begin{array}{l}
I = (dx,dy) = (x - center.x,y - center.y) \\
\rho = Kmag \cdot \texttt{magnitude} (I) ,\\
\phi = angle \cdot \texttt{angle} (I)
\end{array}\)
and
\(\begin{array}{l}
Kx = src.cols / maxRadius \\
Ky = src.rows / 2\Pi
\end{array}\)
|
static void |
logPolar(Mat src,
Mat dst,
Point center,
double M,
int flags)
Deprecated.
This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG);
Transform the source image using the following transformation (See REF: polar_remaps_reference_image "Polar remaps reference image d)"):
\(\begin{array}{l}
dst( \rho , \phi ) = src(x,y) \\
dst.size() \leftarrow src.size()
\end{array}\)
where
\(\begin{array}{l}
I = (dx,dy) = (x - center.x,y - center.y) \\
\rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\
\phi = Kangle \cdot \texttt{angle} (I) \\
\end{array}\)
and
\(\begin{array}{l}
M = src.cols / log_e(maxRadius) \\
Kangle = src.rows / 2\Pi \\
\end{array}\)
The function emulates the human "foveal" vision and can be used for fast scale and
rotation-invariant template matching, for object tracking and so forth.
|
static double |
matchShapes(Mat contour1,
Mat contour2,
int method,
double parameter)
Compares two shapes.
|
static void |
matchTemplate(Mat image,
Mat templ,
Mat result,
int method)
Compares a template against overlapped image regions.
|
static void |
matchTemplate(Mat image,
Mat templ,
Mat result,
int method,
Mat mask)
Compares a template against overlapped image regions.
|
static void |
medianBlur(Mat src,
Mat dst,
int ksize)
Blurs an image using the median filter.
|
static RotatedRect |
minAreaRect(MatOfPoint2f points)
Finds a rotated rectangle of the minimum area enclosing the input 2D point set.
|
static void |
minEnclosingCircle(MatOfPoint2f points,
Point center,
float[] radius)
Finds a circle of the minimum area enclosing a 2D point set.
|
static double |
minEnclosingTriangle(Mat points,
Mat triangle)
Finds a triangle of minimum area enclosing a 2D point set and returns its area.
|
static Moments |
moments(Mat array)
Calculates all of the moments up to the third order of a polygon or rasterized shape.
|
static Moments |
moments(Mat array,
boolean binaryImage)
Calculates all of the moments up to the third order of a polygon or rasterized shape.
|
static void |
morphologyEx(Mat src,
Mat dst,
int op,
Mat kernel)
Performs advanced morphological transformations.
|
static void |
morphologyEx(Mat src,
Mat dst,
int op,
Mat kernel,
Point anchor)
Performs advanced morphological transformations.
|
static void |
morphologyEx(Mat src,
Mat dst,
int op,
Mat kernel,
Point anchor,
int iterations)
Performs advanced morphological transformations.
|
static void |
morphologyEx(Mat src,
Mat dst,
int op,
Mat kernel,
Point anchor,
int iterations,
int borderType)
Performs advanced morphological transformations.
|
static void |
morphologyEx(Mat src,
Mat dst,
int op,
Mat kernel,
Point anchor,
int iterations,
int borderType,
Scalar borderValue)
Performs advanced morphological transformations.
|
static Point |
phaseCorrelate(Mat src1,
Mat src2)
The function is used to detect translational shifts that occur between two images.
|
static Point |
phaseCorrelate(Mat src1,
Mat src2,
Mat window)
The function is used to detect translational shifts that occur between two images.
|
static Point |
phaseCorrelate(Mat src1,
Mat src2,
Mat window,
double[] response)
The function is used to detect translational shifts that occur between two images.
|
static double |
pointPolygonTest(MatOfPoint2f contour,
Point pt,
boolean measureDist)
Performs a point-in-contour test.
|
static void |
polylines(Mat img,
List<MatOfPoint> pts,
boolean isClosed,
Scalar color)
Draws several polygonal curves.
|
static void |
polylines(Mat img,
List<MatOfPoint> pts,
boolean isClosed,
Scalar color,
int thickness)
Draws several polygonal curves.
|
static void |
polylines(Mat img,
List<MatOfPoint> pts,
boolean isClosed,
Scalar color,
int thickness,
int lineType)
Draws several polygonal curves.
|
static void |
polylines(Mat img,
List<MatOfPoint> pts,
boolean isClosed,
Scalar color,
int thickness,
int lineType,
int shift)
Draws several polygonal curves.
|
static void |
preCornerDetect(Mat src,
Mat dst,
int ksize)
Calculates a feature map for corner detection.
|
static void |
preCornerDetect(Mat src,
Mat dst,
int ksize,
int borderType)
Calculates a feature map for corner detection.
|
static void |
putText(Mat img,
String text,
Point org,
int fontFace,
double fontScale,
Scalar color)
Draws a text string.
|
static void |
putText(Mat img,
String text,
Point org,
int fontFace,
double fontScale,
Scalar color,
int thickness)
Draws a text string.
|
static void |
putText(Mat img,
String text,
Point org,
int fontFace,
double fontScale,
Scalar color,
int thickness,
int lineType)
Draws a text string.
|
static void |
putText(Mat img,
String text,
Point org,
int fontFace,
double fontScale,
Scalar color,
int thickness,
int lineType,
boolean bottomLeftOrigin)
Draws a text string.
|
static void |
pyrDown(Mat src,
Mat dst)
Blurs an image and downsamples it.
|
static void |
pyrDown(Mat src,
Mat dst,
Size dstsize)
Blurs an image and downsamples it.
|
static void |
pyrDown(Mat src,
Mat dst,
Size dstsize,
int borderType)
Blurs an image and downsamples it.
|
static void |
pyrMeanShiftFiltering(Mat src,
Mat dst,
double sp,
double sr)
Performs initial step of meanshift segmentation of an image.
|
static void |
pyrMeanShiftFiltering(Mat src,
Mat dst,
double sp,
double sr,
int maxLevel)
Performs initial step of meanshift segmentation of an image.
|
static void |
pyrMeanShiftFiltering(Mat src,
Mat dst,
double sp,
double sr,
int maxLevel,
TermCriteria termcrit)
Performs initial step of meanshift segmentation of an image.
|
static void |
pyrUp(Mat src,
Mat dst)
Upsamples an image and then blurs it.
|
static void |
pyrUp(Mat src,
Mat dst,
Size dstsize)
Upsamples an image and then blurs it.
|
static void |
pyrUp(Mat src,
Mat dst,
Size dstsize,
int borderType)
Upsamples an image and then blurs it.
|
static void |
rectangle(Mat img,
Point pt1,
Point pt2,
Scalar color)
Draws a simple, thick, or filled up-right rectangle.
|
static void |
rectangle(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness)
Draws a simple, thick, or filled up-right rectangle.
|
static void |
rectangle(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness,
int lineType)
Draws a simple, thick, or filled up-right rectangle.
|
static void |
rectangle(Mat img,
Point pt1,
Point pt2,
Scalar color,
int thickness,
int lineType,
int shift)
Draws a simple, thick, or filled up-right rectangle.
|
static void |
rectangle(Mat img,
Rect rec,
Scalar color)
use
rec parameter as alternative specification of the drawn rectangle: `r.tl() and
r.br()-Point(1,1)` are opposite corners |
static void |
rectangle(Mat img,
Rect rec,
Scalar color,
int thickness)
use
rec parameter as alternative specification of the drawn rectangle: `r.tl() and
r.br()-Point(1,1)` are opposite corners |
static void |
rectangle(Mat img,
Rect rec,
Scalar color,
int thickness,
int lineType)
use
rec parameter as alternative specification of the drawn rectangle: `r.tl() and
r.br()-Point(1,1)` are opposite corners |
static void |
rectangle(Mat img,
Rect rec,
Scalar color,
int thickness,
int lineType,
int shift)
use
rec parameter as alternative specification of the drawn rectangle: `r.tl() and
r.br()-Point(1,1)` are opposite corners |
static void |
remap(Mat src,
Mat dst,
Mat map1,
Mat map2,
int interpolation)
Applies a generic geometrical transformation to an image.
|
static void |
remap(Mat src,
Mat dst,
Mat map1,
Mat map2,
int interpolation,
int borderMode)
Applies a generic geometrical transformation to an image.
|
static void |
remap(Mat src,
Mat dst,
Mat map1,
Mat map2,
int interpolation,
int borderMode,
Scalar borderValue)
Applies a generic geometrical transformation to an image.
|
static void |
resize(Mat src,
Mat dst,
Size dsize)
Resizes an image.
|
static void |
resize(Mat src,
Mat dst,
Size dsize,
double fx)
Resizes an image.
|
static void |
resize(Mat src,
Mat dst,
Size dsize,
double fx,
double fy)
Resizes an image.
|
static void |
resize(Mat src,
Mat dst,
Size dsize,
double fx,
double fy,
int interpolation)
Resizes an image.
|
static int |
rotatedRectangleIntersection(RotatedRect rect1,
RotatedRect rect2,
Mat intersectingRegion)
Finds out if there is any intersection between two rotated rectangles.
|
static void |
Scharr(Mat src,
Mat dst,
int ddepth,
int dx,
int dy)
Calculates the first x- or y- image derivative using Scharr operator.
|
static void |
Scharr(Mat src,
Mat dst,
int ddepth,
int dx,
int dy,
double scale)
Calculates the first x- or y- image derivative using Scharr operator.
|
static void |
Scharr(Mat src,
Mat dst,
int ddepth,
int dx,
int dy,
double scale,
double delta)
Calculates the first x- or y- image derivative using Scharr operator.
|
static void |
Scharr(Mat src,
Mat dst,
int ddepth,
int dx,
int dy,
double scale,
double delta,
int borderType)
Calculates the first x- or y- image derivative using Scharr operator.
|
static void |
sepFilter2D(Mat src,
Mat dst,
int ddepth,
Mat kernelX,
Mat kernelY)
Applies a separable linear filter to an image.
|
static void |
sepFilter2D(Mat src,
Mat dst,
int ddepth,
Mat kernelX,
Mat kernelY,
Point anchor)
Applies a separable linear filter to an image.
|
static void |
sepFilter2D(Mat src,
Mat dst,
int ddepth,
Mat kernelX,
Mat kernelY,
Point anchor,
double delta)
Applies a separable linear filter to an image.
|
static void |
sepFilter2D(Mat src,
Mat dst,
int ddepth,
Mat kernelX,
Mat kernelY,
Point anchor,
double delta,
int borderType)
Applies a separable linear filter to an image.
|
static void |
Sobel(Mat src,
Mat dst,
int ddepth,
int dx,
int dy)
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
|
static void |
Sobel(Mat src,
Mat dst,
int ddepth,
int dx,
int dy,
int ksize)
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
|
static void |
Sobel(Mat src,
Mat dst,
int ddepth,
int dx,
int dy,
int ksize,
double scale)
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
|
static void |
Sobel(Mat src,
Mat dst,
int ddepth,
int dx,
int dy,
int ksize,
double scale,
double delta)
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
|
static void |
Sobel(Mat src,
Mat dst,
int ddepth,
int dx,
int dy,
int ksize,
double scale,
double delta,
int borderType)
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
|
static void |
spatialGradient(Mat src,
Mat dx,
Mat dy)
Calculates the first order image derivative in both x and y using a Sobel operator
Equivalent to calling:
Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
|
static void |
spatialGradient(Mat src,
Mat dx,
Mat dy,
int ksize)
Calculates the first order image derivative in both x and y using a Sobel operator
Equivalent to calling:
Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
|
static void |
spatialGradient(Mat src,
Mat dx,
Mat dy,
int ksize,
int borderType)
Calculates the first order image derivative in both x and y using a Sobel operator
Equivalent to calling:
Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
|
static void |
sqrBoxFilter(Mat src,
Mat dst,
int ddepth,
Size ksize)
Calculates the normalized sum of squares of the pixel values overlapping the filter.
|
static void |
sqrBoxFilter(Mat src,
Mat dst,
int ddepth,
Size ksize,
Point anchor)
Calculates the normalized sum of squares of the pixel values overlapping the filter.
|
static void |
sqrBoxFilter(Mat src,
Mat dst,
int ddepth,
Size ksize,
Point anchor,
boolean normalize)
Calculates the normalized sum of squares of the pixel values overlapping the filter.
|
static void |
sqrBoxFilter(Mat src,
Mat dst,
int ddepth,
Size ksize,
Point anchor,
boolean normalize,
int borderType)
Calculates the normalized sum of squares of the pixel values overlapping the filter.
|
static double |
threshold(Mat src,
Mat dst,
double thresh,
double maxval,
int type)
Applies a fixed-level threshold to each array element.
|
static void |
warpAffine(Mat src,
Mat dst,
Mat M,
Size dsize)
Applies an affine transformation to an image.
|
static void |
warpAffine(Mat src,
Mat dst,
Mat M,
Size dsize,
int flags)
Applies an affine transformation to an image.
|
static void |
warpAffine(Mat src,
Mat dst,
Mat M,
Size dsize,
int flags,
int borderMode)
Applies an affine transformation to an image.
|
static void |
warpAffine(Mat src,
Mat dst,
Mat M,
Size dsize,
int flags,
int borderMode,
Scalar borderValue)
Applies an affine transformation to an image.
|
static void |
warpPerspective(Mat src,
Mat dst,
Mat M,
Size dsize)
Applies a perspective transformation to an image.
|
static void |
warpPerspective(Mat src,
Mat dst,
Mat M,
Size dsize,
int flags)
Applies a perspective transformation to an image.
|
static void |
warpPerspective(Mat src,
Mat dst,
Mat M,
Size dsize,
int flags,
int borderMode)
Applies a perspective transformation to an image.
|
static void |
warpPerspective(Mat src,
Mat dst,
Mat M,
Size dsize,
int flags,
int borderMode,
Scalar borderValue)
Applies a perspective transformation to an image.
|
static void |
warpPolar(Mat src,
Mat dst,
Size dsize,
Point center,
double maxRadius,
int flags)
Remaps an image to polar or semilog-polar coordinates space
polar_remaps_reference_image
![Polar remaps reference](pics/polar_remap_doc.png)
Transform the source image using the following transformation:
\(
dst(\rho , \phi ) = src(x,y)
\)
where
\(
\begin{array}{l}
\vec{I} = (x - center.x, \;y - center.y) \\
\phi = Kangle \cdot \texttt{angle} (\vec{I}) \\
\rho = \left\{\begin{matrix}
Klin \cdot \texttt{magnitude} (\vec{I}) & default \\
Klog \cdot log_e(\texttt{magnitude} (\vec{I})) & if \; semilog \\
\end{matrix}\right.
|
static void |
watershed(Mat image,
Mat markers)
Performs a marker-based image segmentation using the watershed algorithm.
|
public static final int FONT_HERSHEY_SIMPLEX
public static final int FONT_HERSHEY_PLAIN
public static final int FONT_HERSHEY_DUPLEX
public static final int FONT_HERSHEY_COMPLEX
public static final int FONT_HERSHEY_TRIPLEX
public static final int FONT_HERSHEY_COMPLEX_SMALL
public static final int FONT_HERSHEY_SCRIPT_SIMPLEX
public static final int FONT_HERSHEY_SCRIPT_COMPLEX
public static final int FONT_ITALIC
public static final int INTER_BITS
public static final int INTER_BITS2
public static final int INTER_TAB_SIZE
public static final int INTER_TAB_SIZE2
public static final int MORPH_ERODE
public static final int MORPH_DILATE
public static final int MORPH_OPEN
public static final int MORPH_CLOSE
public static final int MORPH_GRADIENT
public static final int MORPH_TOPHAT
public static final int MORPH_BLACKHAT
public static final int MORPH_HITMISS
public static final int FLOODFILL_FIXED_RANGE
public static final int FLOODFILL_MASK_ONLY
public static final int CV_GAUSSIAN_5x5
public static final int CV_SCHARR
public static final int CV_MAX_SOBEL_KSIZE
public static final int CV_RGBA2mRGBA
public static final int CV_mRGBA2RGBA
public static final int CV_WARP_FILL_OUTLIERS
public static final int CV_WARP_INVERSE_MAP
public static final int CV_CHAIN_CODE
public static final int CV_LINK_RUNS
public static final int CV_POLY_APPROX_DP
public static final int CV_CONTOURS_MATCH_I1
public static final int CV_CONTOURS_MATCH_I2
public static final int CV_CONTOURS_MATCH_I3
public static final int CV_CLOCKWISE
public static final int CV_COUNTER_CLOCKWISE
public static final int CV_COMP_CORREL
public static final int CV_COMP_CHISQR
public static final int CV_COMP_INTERSECT
public static final int CV_COMP_BHATTACHARYYA
public static final int CV_COMP_HELLINGER
public static final int CV_COMP_CHISQR_ALT
public static final int CV_COMP_KL_DIV
public static final int CV_DIST_MASK_3
public static final int CV_DIST_MASK_5
public static final int CV_DIST_MASK_PRECISE
public static final int CV_DIST_LABEL_CCOMP
public static final int CV_DIST_LABEL_PIXEL
public static final int CV_DIST_USER
public static final int CV_DIST_L1
public static final int CV_DIST_L2
public static final int CV_DIST_C
public static final int CV_DIST_L12
public static final int CV_DIST_FAIR
public static final int CV_DIST_WELSCH
public static final int CV_DIST_HUBER
public static final int CV_CANNY_L2_GRADIENT
public static final int CV_HOUGH_STANDARD
public static final int CV_HOUGH_PROBABILISTIC
public static final int CV_HOUGH_MULTI_SCALE
public static final int CV_HOUGH_GRADIENT
public static final int HOUGH_STANDARD
public static final int HOUGH_PROBABILISTIC
public static final int HOUGH_MULTI_SCALE
public static final int HOUGH_GRADIENT
public static final int HOUGH_GRADIENT_ALT
public static final int CCL_WU
public static final int CCL_DEFAULT
public static final int CCL_GRANA
public static final int RETR_EXTERNAL
public static final int RETR_LIST
public static final int RETR_CCOMP
public static final int RETR_TREE
public static final int RETR_FLOODFILL
public static final int GC_BGD
public static final int GC_FGD
public static final int GC_PR_BGD
public static final int GC_PR_FGD
public static final int COLORMAP_AUTUMN
public static final int COLORMAP_BONE
public static final int COLORMAP_JET
public static final int COLORMAP_WINTER
public static final int COLORMAP_RAINBOW
public static final int COLORMAP_OCEAN
public static final int COLORMAP_SUMMER
public static final int COLORMAP_SPRING
public static final int COLORMAP_COOL
public static final int COLORMAP_HSV
public static final int COLORMAP_PINK
public static final int COLORMAP_HOT
public static final int COLORMAP_PARULA
public static final int COLORMAP_MAGMA
public static final int COLORMAP_INFERNO
public static final int COLORMAP_PLASMA
public static final int COLORMAP_VIRIDIS
public static final int COLORMAP_CIVIDIS
public static final int COLORMAP_TWILIGHT
public static final int COLORMAP_TWILIGHT_SHIFTED
public static final int COLORMAP_TURBO
public static final int HISTCMP_CORREL
public static final int HISTCMP_CHISQR
public static final int HISTCMP_INTERSECT
public static final int HISTCMP_BHATTACHARYYA
public static final int HISTCMP_HELLINGER
public static final int HISTCMP_CHISQR_ALT
public static final int HISTCMP_KL_DIV
public static final int FILLED
public static final int LINE_4
public static final int LINE_8
public static final int LINE_AA
public static final int INTER_NEAREST
public static final int INTER_LINEAR
public static final int INTER_CUBIC
public static final int INTER_AREA
public static final int INTER_LANCZOS4
public static final int INTER_LINEAR_EXACT
public static final int INTER_MAX
public static final int WARP_FILL_OUTLIERS
public static final int WARP_INVERSE_MAP
public static final int FILTER_SCHARR
public static final int CHAIN_APPROX_NONE
public static final int CHAIN_APPROX_SIMPLE
public static final int CHAIN_APPROX_TC89_L1
public static final int CHAIN_APPROX_TC89_KCOS
public static final int INTERSECT_NONE
public static final int INTERSECT_PARTIAL
public static final int INTERSECT_FULL
public static final int CONTOURS_MATCH_I1
public static final int CONTOURS_MATCH_I2
public static final int CONTOURS_MATCH_I3
public static final int WARP_POLAR_LINEAR
public static final int WARP_POLAR_LOG
public static final int COLOR_BGR2BGRA
public static final int COLOR_RGB2RGBA
public static final int COLOR_BGRA2BGR
public static final int COLOR_RGBA2RGB
public static final int COLOR_BGR2RGBA
public static final int COLOR_RGB2BGRA
public static final int COLOR_RGBA2BGR
public static final int COLOR_BGRA2RGB
public static final int COLOR_BGR2RGB
public static final int COLOR_RGB2BGR
public static final int COLOR_BGRA2RGBA
public static final int COLOR_RGBA2BGRA
public static final int COLOR_BGR2GRAY
public static final int COLOR_RGB2GRAY
public static final int COLOR_GRAY2BGR
public static final int COLOR_GRAY2RGB
public static final int COLOR_GRAY2BGRA
public static final int COLOR_GRAY2RGBA
public static final int COLOR_BGRA2GRAY
public static final int COLOR_RGBA2GRAY
public static final int COLOR_BGR2BGR565
public static final int COLOR_RGB2BGR565
public static final int COLOR_BGR5652BGR
public static final int COLOR_BGR5652RGB
public static final int COLOR_BGRA2BGR565
public static final int COLOR_RGBA2BGR565
public static final int COLOR_BGR5652BGRA
public static final int COLOR_BGR5652RGBA
public static final int COLOR_GRAY2BGR565
public static final int COLOR_BGR5652GRAY
public static final int COLOR_BGR2BGR555
public static final int COLOR_RGB2BGR555
public static final int COLOR_BGR5552BGR
public static final int COLOR_BGR5552RGB
public static final int COLOR_BGRA2BGR555
public static final int COLOR_RGBA2BGR555
public static final int COLOR_BGR5552BGRA
public static final int COLOR_BGR5552RGBA
public static final int COLOR_GRAY2BGR555
public static final int COLOR_BGR5552GRAY
public static final int COLOR_BGR2XYZ
public static final int COLOR_RGB2XYZ
public static final int COLOR_XYZ2BGR
public static final int COLOR_XYZ2RGB
public static final int COLOR_BGR2YCrCb
public static final int COLOR_RGB2YCrCb
public static final int COLOR_YCrCb2BGR
public static final int COLOR_YCrCb2RGB
public static final int COLOR_BGR2HSV
public static final int COLOR_RGB2HSV
public static final int COLOR_BGR2Lab
public static final int COLOR_RGB2Lab
public static final int COLOR_BGR2Luv
public static final int COLOR_RGB2Luv
public static final int COLOR_BGR2HLS
public static final int COLOR_RGB2HLS
public static final int COLOR_HSV2BGR
public static final int COLOR_HSV2RGB
public static final int COLOR_Lab2BGR
public static final int COLOR_Lab2RGB
public static final int COLOR_Luv2BGR
public static final int COLOR_Luv2RGB
public static final int COLOR_HLS2BGR
public static final int COLOR_HLS2RGB
public static final int COLOR_BGR2HSV_FULL
public static final int COLOR_RGB2HSV_FULL
public static final int COLOR_BGR2HLS_FULL
public static final int COLOR_RGB2HLS_FULL
public static final int COLOR_HSV2BGR_FULL
public static final int COLOR_HSV2RGB_FULL
public static final int COLOR_HLS2BGR_FULL
public static final int COLOR_HLS2RGB_FULL
public static final int COLOR_LBGR2Lab
public static final int COLOR_LRGB2Lab
public static final int COLOR_LBGR2Luv
public static final int COLOR_LRGB2Luv
public static final int COLOR_Lab2LBGR
public static final int COLOR_Lab2LRGB
public static final int COLOR_Luv2LBGR
public static final int COLOR_Luv2LRGB
public static final int COLOR_BGR2YUV
public static final int COLOR_RGB2YUV
public static final int COLOR_YUV2BGR
public static final int COLOR_YUV2RGB
public static final int COLOR_YUV2RGB_NV12
public static final int COLOR_YUV2BGR_NV12
public static final int COLOR_YUV2RGB_NV21
public static final int COLOR_YUV2BGR_NV21
public static final int COLOR_YUV420sp2RGB
public static final int COLOR_YUV420sp2BGR
public static final int COLOR_YUV2RGBA_NV12
public static final int COLOR_YUV2BGRA_NV12
public static final int COLOR_YUV2RGBA_NV21
public static final int COLOR_YUV2BGRA_NV21
public static final int COLOR_YUV420sp2RGBA
public static final int COLOR_YUV420sp2BGRA
public static final int COLOR_YUV2RGB_YV12
public static final int COLOR_YUV2BGR_YV12
public static final int COLOR_YUV2RGB_IYUV
public static final int COLOR_YUV2BGR_IYUV
public static final int COLOR_YUV2RGB_I420
public static final int COLOR_YUV2BGR_I420
public static final int COLOR_YUV420p2RGB
public static final int COLOR_YUV420p2BGR
public static final int COLOR_YUV2RGBA_YV12
public static final int COLOR_YUV2BGRA_YV12
public static final int COLOR_YUV2RGBA_IYUV
public static final int COLOR_YUV2BGRA_IYUV
public static final int COLOR_YUV2RGBA_I420
public static final int COLOR_YUV2BGRA_I420
public static final int COLOR_YUV420p2RGBA
public static final int COLOR_YUV420p2BGRA
public static final int COLOR_YUV2GRAY_420
public static final int COLOR_YUV2GRAY_NV21
public static final int COLOR_YUV2GRAY_NV12
public static final int COLOR_YUV2GRAY_YV12
public static final int COLOR_YUV2GRAY_IYUV
public static final int COLOR_YUV2GRAY_I420
public static final int COLOR_YUV420sp2GRAY
public static final int COLOR_YUV420p2GRAY
public static final int COLOR_YUV2RGB_UYVY
public static final int COLOR_YUV2BGR_UYVY
public static final int COLOR_YUV2RGB_Y422
public static final int COLOR_YUV2BGR_Y422
public static final int COLOR_YUV2RGB_UYNV
public static final int COLOR_YUV2BGR_UYNV
public static final int COLOR_YUV2RGBA_UYVY
public static final int COLOR_YUV2BGRA_UYVY
public static final int COLOR_YUV2RGBA_Y422
public static final int COLOR_YUV2BGRA_Y422
public static final int COLOR_YUV2RGBA_UYNV
public static final int COLOR_YUV2BGRA_UYNV
public static final int COLOR_YUV2RGB_YUY2
public static final int COLOR_YUV2BGR_YUY2
public static final int COLOR_YUV2RGB_YVYU
public static final int COLOR_YUV2BGR_YVYU
public static final int COLOR_YUV2RGB_YUYV
public static final int COLOR_YUV2BGR_YUYV
public static final int COLOR_YUV2RGB_YUNV
public static final int COLOR_YUV2BGR_YUNV
public static final int COLOR_YUV2RGBA_YUY2
public static final int COLOR_YUV2BGRA_YUY2
public static final int COLOR_YUV2RGBA_YVYU
public static final int COLOR_YUV2BGRA_YVYU
public static final int COLOR_YUV2RGBA_YUYV
public static final int COLOR_YUV2BGRA_YUYV
public static final int COLOR_YUV2RGBA_YUNV
public static final int COLOR_YUV2BGRA_YUNV
public static final int COLOR_YUV2GRAY_UYVY
public static final int COLOR_YUV2GRAY_YUY2
public static final int COLOR_YUV2GRAY_Y422
public static final int COLOR_YUV2GRAY_UYNV
public static final int COLOR_YUV2GRAY_YVYU
public static final int COLOR_YUV2GRAY_YUYV
public static final int COLOR_YUV2GRAY_YUNV
public static final int COLOR_RGBA2mRGBA
public static final int COLOR_mRGBA2RGBA
public static final int COLOR_RGB2YUV_I420
public static final int COLOR_BGR2YUV_I420
public static final int COLOR_RGB2YUV_IYUV
public static final int COLOR_BGR2YUV_IYUV
public static final int COLOR_RGBA2YUV_I420
public static final int COLOR_BGRA2YUV_I420
public static final int COLOR_RGBA2YUV_IYUV
public static final int COLOR_BGRA2YUV_IYUV
public static final int COLOR_RGB2YUV_YV12
public static final int COLOR_BGR2YUV_YV12
public static final int COLOR_RGBA2YUV_YV12
public static final int COLOR_BGRA2YUV_YV12
public static final int COLOR_BayerBG2BGR
public static final int COLOR_BayerGB2BGR
public static final int COLOR_BayerRG2BGR
public static final int COLOR_BayerGR2BGR
public static final int COLOR_BayerBG2RGB
public static final int COLOR_BayerGB2RGB
public static final int COLOR_BayerRG2RGB
public static final int COLOR_BayerGR2RGB
public static final int COLOR_BayerBG2GRAY
public static final int COLOR_BayerGB2GRAY
public static final int COLOR_BayerRG2GRAY
public static final int COLOR_BayerGR2GRAY
public static final int COLOR_BayerBG2BGR_VNG
public static final int COLOR_BayerGB2BGR_VNG
public static final int COLOR_BayerRG2BGR_VNG
public static final int COLOR_BayerGR2BGR_VNG
public static final int COLOR_BayerBG2RGB_VNG
public static final int COLOR_BayerGB2RGB_VNG
public static final int COLOR_BayerRG2RGB_VNG
public static final int COLOR_BayerGR2RGB_VNG
public static final int COLOR_BayerBG2BGR_EA
public static final int COLOR_BayerGB2BGR_EA
public static final int COLOR_BayerRG2BGR_EA
public static final int COLOR_BayerGR2BGR_EA
public static final int COLOR_BayerBG2RGB_EA
public static final int COLOR_BayerGB2RGB_EA
public static final int COLOR_BayerRG2RGB_EA
public static final int COLOR_BayerGR2RGB_EA
public static final int COLOR_BayerBG2BGRA
public static final int COLOR_BayerGB2BGRA
public static final int COLOR_BayerRG2BGRA
public static final int COLOR_BayerGR2BGRA
public static final int COLOR_BayerBG2RGBA
public static final int COLOR_BayerGB2RGBA
public static final int COLOR_BayerRG2RGBA
public static final int COLOR_BayerGR2RGBA
public static final int COLOR_COLORCVT_MAX
public static final int LSD_REFINE_NONE
public static final int LSD_REFINE_STD
public static final int LSD_REFINE_ADV
public static final int THRESH_BINARY
public static final int THRESH_BINARY_INV
public static final int THRESH_TRUNC
public static final int THRESH_TOZERO
public static final int THRESH_TOZERO_INV
public static final int THRESH_MASK
public static final int THRESH_OTSU
public static final int THRESH_TRIANGLE
public static final int ADAPTIVE_THRESH_MEAN_C
public static final int ADAPTIVE_THRESH_GAUSSIAN_C
public static final int CV_SHAPE_RECT
public static final int CV_SHAPE_CROSS
public static final int CV_SHAPE_ELLIPSE
public static final int CV_SHAPE_CUSTOM
public static final int GC_INIT_WITH_RECT
public static final int GC_INIT_WITH_MASK
public static final int GC_EVAL
public static final int GC_EVAL_FREEZE_MODEL
public static final int MORPH_RECT
public static final int MORPH_CROSS
public static final int MORPH_ELLIPSE
public static final int DIST_LABEL_CCOMP
public static final int DIST_LABEL_PIXEL
public static final int DIST_USER
public static final int DIST_L1
public static final int DIST_L2
public static final int DIST_C
public static final int DIST_L12
public static final int DIST_FAIR
public static final int DIST_WELSCH
public static final int DIST_HUBER
public static final int TM_SQDIFF
public static final int TM_SQDIFF_NORMED
public static final int TM_CCORR
public static final int TM_CCORR_NORMED
public static final int TM_CCOEFF
public static final int TM_CCOEFF_NORMED
public static final int DIST_MASK_3
public static final int DIST_MASK_5
public static final int DIST_MASK_PRECISE
public static final int CC_STAT_LEFT
public static final int CC_STAT_TOP
public static final int CC_STAT_WIDTH
public static final int CC_STAT_HEIGHT
public static final int CC_STAT_AREA
public static final int CC_STAT_MAX
public static final int CV_BLUR_NO_SCALE
public static final int CV_BLUR
public static final int CV_GAUSSIAN
public static final int CV_MEDIAN
public static final int CV_BILATERAL
public static final int MARKER_CROSS
public static final int MARKER_TILTED_CROSS
public static final int MARKER_STAR
public static final int MARKER_DIAMOND
public static final int MARKER_SQUARE
public static final int MARKER_TRIANGLE_UP
public static final int MARKER_TRIANGLE_DOWN
public static Mat getAffineTransform(MatOfPoint2f src, MatOfPoint2f dst)
public static Mat getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi, int ktype)
ksize
- Size of the filter returned.sigma
- Standard deviation of the gaussian envelope.theta
- Orientation of the normal to the parallel stripes of a Gabor function.lambd
- Wavelength of the sinusoidal factor.gamma
- Spatial aspect ratio.psi
- Phase offset.ktype
- Type of filter coefficients. It can be CV_32F or CV_64F .public static Mat getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi)
ksize
- Size of the filter returned.sigma
- Standard deviation of the gaussian envelope.theta
- Orientation of the normal to the parallel stripes of a Gabor function.lambd
- Wavelength of the sinusoidal factor.gamma
- Spatial aspect ratio.psi
- Phase offset.public static Mat getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma)
ksize
- Size of the filter returned.sigma
- Standard deviation of the gaussian envelope.theta
- Orientation of the normal to the parallel stripes of a Gabor function.lambd
- Wavelength of the sinusoidal factor.gamma
- Spatial aspect ratio.public static Mat getGaussianKernel(int ksize, double sigma, int ktype)
ksize
- Aperture size. It should be odd ( \(\texttt{ksize} \mod 2 = 1\) ) and positive.sigma
- Gaussian standard deviation. If it is non-positive, it is computed from ksize as
sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8
.ktype
- Type of filter coefficients. It can be CV_32F or CV_64F .
SEE: sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlurpublic static Mat getGaussianKernel(int ksize, double sigma)
ksize
- Aperture size. It should be odd ( \(\texttt{ksize} \mod 2 = 1\) ) and positive.sigma
- Gaussian standard deviation. If it is non-positive, it is computed from ksize as
sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8
.
SEE: sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlurpublic static Mat getPerspectiveTransform(Mat src, Mat dst, int solveMethod)
src
- Coordinates of quadrangle vertices in the source image.dst
- Coordinates of the corresponding quadrangle vertices in the destination image.solveMethod
- method passed to cv::solve (#DecompTypes)
SEE: findHomography, warpPerspective, perspectiveTransformpublic static Mat getPerspectiveTransform(Mat src, Mat dst)
src
- Coordinates of quadrangle vertices in the source image.dst
- Coordinates of the corresponding quadrangle vertices in the destination image.
SEE: findHomography, warpPerspective, perspectiveTransformpublic static Mat getRotationMatrix2D(Point center, double angle, double scale)
center
- Center of the rotation in the source image.angle
- Rotation angle in degrees. Positive values mean counter-clockwise rotation (the
coordinate origin is assumed to be the top-left corner).scale
- Isotropic scale factor.
SEE: getAffineTransform, warpAffine, transformpublic static Mat getStructuringElement(int shape, Size ksize, Point anchor)
shape
- Element shape that could be one of #MorphShapesksize
- Size of the structuring element.anchor
- Anchor position within the element. The default value \((-1, -1)\) means that the
anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor
position. In other cases the anchor just regulates how much the result of the morphological
operation is shifted.public static Mat getStructuringElement(int shape, Size ksize)
shape
- Element shape that could be one of #MorphShapesksize
- Size of the structuring element.
anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor
position. In other cases the anchor just regulates how much the result of the morphological
operation is shifted.public static Moments moments(Mat array, boolean binaryImage)
array
- Raster image (single-channel, 8-bit or floating-point 2D array) or an array (
\(1 \times N\) or \(N \times 1\) ) of 2D points (Point or Point2f ).binaryImage
- If it is true, all non-zero image pixels are treated as 1's. The parameter is
used for images only.public static Moments moments(Mat array)
array
- Raster image (single-channel, 8-bit or floating-point 2D array) or an array (
\(1 \times N\) or \(N \times 1\) ) of 2D points (Point or Point2f ).
used for images only.public static Point phaseCorrelate(Mat src1, Mat src2, Mat window, double[] response)
src1
- Source floating point array (CV_32FC1 or CV_64FC1)src2
- Source floating point array (CV_32FC1 or CV_64FC1)window
- Floating point array with windowing coefficients to reduce edge effects (optional).response
- Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional).public static Point phaseCorrelate(Mat src1, Mat src2, Mat window)
src1
- Source floating point array (CV_32FC1 or CV_64FC1)src2
- Source floating point array (CV_32FC1 or CV_64FC1)window
- Floating point array with windowing coefficients to reduce edge effects (optional).public static Point phaseCorrelate(Mat src1, Mat src2)
src1
- Source floating point array (CV_32FC1 or CV_64FC1)src2
- Source floating point array (CV_32FC1 or CV_64FC1)public static CLAHE createCLAHE(double clipLimit, Size tileGridSize)
clipLimit
- Threshold for contrast limiting.tileGridSize
- Size of grid for histogram equalization. Input image will be divided into
equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.public static CLAHE createCLAHE(double clipLimit)
clipLimit
- Threshold for contrast limiting.
equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.public static CLAHE createCLAHE()
public static GeneralizedHoughBallard createGeneralizedHoughBallard()
public static GeneralizedHoughGuil createGeneralizedHoughGuil()
public static LineSegmentDetector createLineSegmentDetector(int _refine, double _scale, double _sigma_scale, double _quant, double _ang_th, double _log_eps, double _density_th, int _n_bins)
_refine
- The way found lines will be refined, see #LineSegmentDetectorModes_scale
- The scale of the image that will be used to find the lines. Range (0..1]._sigma_scale
- Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale._quant
- Bound to the quantization error on the gradient norm._ang_th
- Gradient angle tolerance in degrees._log_eps
- Detection threshold: -log10(NFA) > log_eps. Used only when advance refinement
is chosen._density_th
- Minimal density of aligned region points in the enclosing rectangle._n_bins
- Number of bins in pseudo-ordering of gradient modulus.
Note: Implementation has been removed due original code license conflictpublic static LineSegmentDetector createLineSegmentDetector(int _refine, double _scale, double _sigma_scale, double _quant, double _ang_th, double _log_eps, double _density_th)
_refine
- The way found lines will be refined, see #LineSegmentDetectorModes_scale
- The scale of the image that will be used to find the lines. Range (0..1]._sigma_scale
- Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale._quant
- Bound to the quantization error on the gradient norm._ang_th
- Gradient angle tolerance in degrees._log_eps
- Detection threshold: -log10(NFA) > log_eps. Used only when advance refinement
is chosen._density_th
- Minimal density of aligned region points in the enclosing rectangle.
Note: Implementation has been removed due original code license conflictpublic static LineSegmentDetector createLineSegmentDetector(int _refine, double _scale, double _sigma_scale, double _quant, double _ang_th, double _log_eps)
_refine
- The way found lines will be refined, see #LineSegmentDetectorModes_scale
- The scale of the image that will be used to find the lines. Range (0..1]._sigma_scale
- Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale._quant
- Bound to the quantization error on the gradient norm._ang_th
- Gradient angle tolerance in degrees._log_eps
- Detection threshold: -log10(NFA) > log_eps. Used only when advance refinement
is chosen.
Note: Implementation has been removed due original code license conflictpublic static LineSegmentDetector createLineSegmentDetector(int _refine, double _scale, double _sigma_scale, double _quant, double _ang_th)
_refine
- The way found lines will be refined, see #LineSegmentDetectorModes_scale
- The scale of the image that will be used to find the lines. Range (0..1]._sigma_scale
- Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale._quant
- Bound to the quantization error on the gradient norm._ang_th
- Gradient angle tolerance in degrees.
is chosen.
Note: Implementation has been removed due original code license conflictpublic static LineSegmentDetector createLineSegmentDetector(int _refine, double _scale, double _sigma_scale, double _quant)
_refine
- The way found lines will be refined, see #LineSegmentDetectorModes_scale
- The scale of the image that will be used to find the lines. Range (0..1]._sigma_scale
- Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale._quant
- Bound to the quantization error on the gradient norm.
is chosen.
Note: Implementation has been removed due original code license conflictpublic static LineSegmentDetector createLineSegmentDetector(int _refine, double _scale, double _sigma_scale)
_refine
- The way found lines will be refined, see #LineSegmentDetectorModes_scale
- The scale of the image that will be used to find the lines. Range (0..1]._sigma_scale
- Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale.
is chosen.
Note: Implementation has been removed due original code license conflictpublic static LineSegmentDetector createLineSegmentDetector(int _refine, double _scale)
_refine
- The way found lines will be refined, see #LineSegmentDetectorModes_scale
- The scale of the image that will be used to find the lines. Range (0..1].
is chosen.
Note: Implementation has been removed due original code license conflictpublic static LineSegmentDetector createLineSegmentDetector(int _refine)
_refine
- The way found lines will be refined, see #LineSegmentDetectorModes
is chosen.
Note: Implementation has been removed due original code license conflictpublic static LineSegmentDetector createLineSegmentDetector()
public static Rect boundingRect(Mat array)
array
- Input gray-scale image or 2D point set, stored in std::vector or Mat.public static RotatedRect fitEllipse(MatOfPoint2f points)
points
- Input 2D point set, stored in std::vector<> or Matpublic static RotatedRect fitEllipseAMS(Mat points)
points
- Input 2D point set, stored in std::vector<> or Matpublic static RotatedRect fitEllipseDirect(Mat points)
points
- Input 2D point set, stored in std::vector<> or Matpublic static RotatedRect minAreaRect(MatOfPoint2f points)
points
- Input vector of 2D points, stored in std::vector<> or Matpublic static boolean clipLine(Rect imgRect, Point pt1, Point pt2)
imgRect
- Image rectangle.pt1
- First line point.pt2
- Second line point.public static boolean isContourConvex(MatOfPoint contour)
contour
- Input vector of 2D points, stored in std::vector<> or Matpublic static double arcLength(MatOfPoint2f curve, boolean closed)
curve
- Input vector of 2D points, stored in std::vector or Mat.closed
- Flag indicating whether the curve is closed or not.public static double compareHist(Mat H1, Mat H2, int method)
H1
- First compared histogram.H2
- Second compared histogram of the same size as H1 .method
- Comparison method, see #HistCompMethodspublic static double contourArea(Mat contour, boolean oriented)
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;
contour
- Input vector of 2D points (contour vertices), stored in std::vector or Mat.oriented
- 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.public static double contourArea(Mat contour)
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;
contour
- Input vector of 2D points (contour vertices), stored in std::vector or Mat.
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.public static double getFontScaleFromHeight(int fontFace, int pixelHeight, int thickness)
fontFace
- Font to use, see cv::HersheyFonts.pixelHeight
- Pixel height to compute the fontScale forthickness
- Thickness of lines used to render the text.See putText for details.public static double getFontScaleFromHeight(int fontFace, int pixelHeight)
fontFace
- Font to use, see cv::HersheyFonts.pixelHeight
- Pixel height to compute the fontScale forpublic static double matchShapes(Mat contour1, Mat contour2, int method, double parameter)
contour1
- First contour or grayscale image.contour2
- Second contour or grayscale image.method
- Comparison method, see #ShapeMatchModesparameter
- Method-specific parameter (not supported now).public static double minEnclosingTriangle(Mat points, Mat triangle)
points
- Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector<> or Mattriangle
- Output vector of three 2D points defining the vertices of the triangle. The depth
of the OutputArray must be CV_32F.public static double pointPolygonTest(MatOfPoint2f contour, Point pt, boolean measureDist)
contour
- Input contour.pt
- Point tested against the contour.measureDist
- If true, the function estimates the signed distance from the point to the
nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.public static double threshold(Mat src, Mat dst, double thresh, double maxval, int type)
src
- input array (multiple-channel, 8-bit or 32-bit floating point).dst
- output array of the same size and type and the same number of channels as src.thresh
- threshold value.maxval
- maximum value to use with the #THRESH_BINARY and #THRESH_BINARY_INV thresholding
types.type
- thresholding type (see #ThresholdTypes).public static float intersectConvexConvex(Mat _p1, Mat _p2, Mat _p12, boolean handleNested)
_p1
- First polygon_p2
- Second polygon_p12
- Output polygon describing the intersecting areahandleNested
- When true, an intersection is found if one of the polygons is fully enclosed in the other.
When false, no intersection is found. If the polygons share a side or the vertex of one polygon lies on an edge
of the other, they are not considered nested and an intersection will be found regardless of the value of handleNested.public static float intersectConvexConvex(Mat _p1, Mat _p2, Mat _p12)
_p1
- First polygon_p2
- Second polygon_p12
- Output polygon describing the intersecting area
When false, no intersection is found. If the polygons share a side or the vertex of one polygon lies on an edge
of the other, they are not considered nested and an intersection will be found regardless of the value of handleNested.public static float EMD(Mat signature1, Mat signature2, int distType, Mat cost, Mat flow)
signature1
- First signature, a \(\texttt{size1}\times \texttt{dims}+1\) floating-point matrix.
Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
a single column (weights only) if the user-defined cost matrix is used. The weights must be
non-negative and have at least one non-zero value.signature2
- Second signature of the same format as signature1 , though the number of rows
may be different. The total weights may be different. In this case an extra "dummy" point is added
to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
value.distType
- Used metric. See #DistanceTypes.cost
- User-defined \(\texttt{size1}\times \texttt{size2}\) cost matrix. Also, if a cost matrix
is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
signatures that is a distance between mass centers. The lower boundary may not be calculated if
the user-defined cost matrix is used, the total weights of point configurations are not equal, or
if the signatures consist of weights only (the signature matrices have a single column). You
must initialize \*lowerBound . If the calculated distance between mass centers is greater or
equal to \*lowerBound (it means that the signatures are far enough), the function does not
calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
should be set to 0.flow
- Resultant \(\texttt{size1} \times \texttt{size2}\) flow matrix: \(\texttt{flow}_{i,j}\) is
a flow from \(i\) -th point of signature1 to \(j\) -th point of signature2 .public static float EMD(Mat signature1, Mat signature2, int distType, Mat cost)
signature1
- First signature, a \(\texttt{size1}\times \texttt{dims}+1\) floating-point matrix.
Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
a single column (weights only) if the user-defined cost matrix is used. The weights must be
non-negative and have at least one non-zero value.signature2
- Second signature of the same format as signature1 , though the number of rows
may be different. The total weights may be different. In this case an extra "dummy" point is added
to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
value.distType
- Used metric. See #DistanceTypes.cost
- User-defined \(\texttt{size1}\times \texttt{size2}\) cost matrix. Also, if a cost matrix
is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
signatures that is a distance between mass centers. The lower boundary may not be calculated if
the user-defined cost matrix is used, the total weights of point configurations are not equal, or
if the signatures consist of weights only (the signature matrices have a single column). You
must initialize \*lowerBound . If the calculated distance between mass centers is greater or
equal to \*lowerBound (it means that the signatures are far enough), the function does not
calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
should be set to 0.
a flow from \(i\) -th point of signature1 to \(j\) -th point of signature2 .public static float EMD(Mat signature1, Mat signature2, int distType)
signature1
- First signature, a \(\texttt{size1}\times \texttt{dims}+1\) floating-point matrix.
Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
a single column (weights only) if the user-defined cost matrix is used. The weights must be
non-negative and have at least one non-zero value.signature2
- Second signature of the same format as signature1 , though the number of rows
may be different. The total weights may be different. In this case an extra "dummy" point is added
to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
value.distType
- Used metric. See #DistanceTypes.
is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
signatures that is a distance between mass centers. The lower boundary may not be calculated if
the user-defined cost matrix is used, the total weights of point configurations are not equal, or
if the signatures consist of weights only (the signature matrices have a single column). You
must initialize \*lowerBound . If the calculated distance between mass centers is greater or
equal to \*lowerBound (it means that the signatures are far enough), the function does not
calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
should be set to 0.
a flow from \(i\) -th point of signature1 to \(j\) -th point of signature2 .public static int connectedComponentsWithAlgorithm(Mat image, Mat labels, int connectivity, int ltype, int ccltype)
image
- the 8-bit single-channel image to be labeledlabels
- destination labeled imageconnectivity
- 8 or 4 for 8-way or 4-way connectivity respectivelyltype
- output image label type. Currently CV_32S and CV_16U are supported.ccltype
- connected components algorithm type (see the #ConnectedComponentsAlgorithmsTypes).public static int connectedComponents(Mat image, Mat labels, int connectivity, int ltype)
image
- the 8-bit single-channel image to be labeledlabels
- destination labeled imageconnectivity
- 8 or 4 for 8-way or 4-way connectivity respectivelyltype
- output image label type. Currently CV_32S and CV_16U are supported.public static int connectedComponents(Mat image, Mat labels, int connectivity)
image
- the 8-bit single-channel image to be labeledlabels
- destination labeled imageconnectivity
- 8 or 4 for 8-way or 4-way connectivity respectivelypublic static int connectedComponents(Mat image, Mat labels)
image
- the 8-bit single-channel image to be labeledlabels
- destination labeled imagepublic static int connectedComponentsWithStatsWithAlgorithm(Mat image, Mat labels, Mat stats, Mat centroids, int connectivity, int ltype, int ccltype)
image
- the 8-bit single-channel image to be labeledlabels
- destination labeled imagestats
- statistics output for each label, including the background label, see below for
available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
#ConnectedComponentsTypes. The data type is CV_32S.centroids
- centroid output for each label, including the background label. Centroids are
accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.connectivity
- 8 or 4 for 8-way or 4-way connectivity respectivelyltype
- output image label type. Currently CV_32S and CV_16U are supported.ccltype
- connected components algorithm type (see #ConnectedComponentsAlgorithmsTypes).public static int connectedComponentsWithStats(Mat image, Mat labels, Mat stats, Mat centroids, int connectivity, int ltype)
image
- the 8-bit single-channel image to be labeledlabels
- destination labeled imagestats
- statistics output for each label, including the background label, see below for
available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
#ConnectedComponentsTypes. The data type is CV_32S.centroids
- centroid output for each label, including the background label. Centroids are
accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.connectivity
- 8 or 4 for 8-way or 4-way connectivity respectivelyltype
- output image label type. Currently CV_32S and CV_16U are supported.public static int connectedComponentsWithStats(Mat image, Mat labels, Mat stats, Mat centroids, int connectivity)
image
- the 8-bit single-channel image to be labeledlabels
- destination labeled imagestats
- statistics output for each label, including the background label, see below for
available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
#ConnectedComponentsTypes. The data type is CV_32S.centroids
- centroid output for each label, including the background label. Centroids are
accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.connectivity
- 8 or 4 for 8-way or 4-way connectivity respectivelypublic static int connectedComponentsWithStats(Mat image, Mat labels, Mat stats, Mat centroids)
image
- the 8-bit single-channel image to be labeledlabels
- destination labeled imagestats
- statistics output for each label, including the background label, see below for
available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
#ConnectedComponentsTypes. The data type is CV_32S.centroids
- centroid output for each label, including the background label. Centroids are
accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff, Scalar upDiff, int flags)
image
- Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
the details below.mask
- Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
taller than image. Since this is both an input and output parameter, you must take responsibility
of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example,
an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags
as described below. Additionally, the function fills the border of the mask with ones to simplify
internal processing. It is therefore possible to use the same mask in multiple calls to the function
to make sure the filled areas do not overlap.seedPoint
- Starting point.newVal
- New value of the repainted domain pixels.loDiff
- Maximal lower brightness/color difference between the currently observed pixel and
one of its neighbors belonging to the component, or a seed pixel being added to the component.upDiff
- Maximal upper brightness/color difference between the currently observed pixel and
one of its neighbors belonging to the component, or a seed pixel being added to the component.rect
- Optional output parameter set by the function to the minimum bounding rectangle of the
repainted domain.flags
- Operation flags. The first 8 bits contain a connectivity value. The default value of
4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
the mask (the default value is 1). For example, 4 | ( 255 << 8 ) will consider 4 nearest
neighbours and fill the mask with a value of 255. The following additional options occupy higher
bits and therefore may be further combined with the connectivity and mask fill values using
bit-wise or (|), see #FloodFillFlags.
Note: Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
pixel \((x+1, y+1)\) in the mask .
SEE: findContourspublic static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff, Scalar upDiff)
image
- Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
the details below.mask
- Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
taller than image. Since this is both an input and output parameter, you must take responsibility
of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example,
an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags
as described below. Additionally, the function fills the border of the mask with ones to simplify
internal processing. It is therefore possible to use the same mask in multiple calls to the function
to make sure the filled areas do not overlap.seedPoint
- Starting point.newVal
- New value of the repainted domain pixels.loDiff
- Maximal lower brightness/color difference between the currently observed pixel and
one of its neighbors belonging to the component, or a seed pixel being added to the component.upDiff
- Maximal upper brightness/color difference between the currently observed pixel and
one of its neighbors belonging to the component, or a seed pixel being added to the component.rect
- Optional output parameter set by the function to the minimum bounding rectangle of the
repainted domain.
4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
the mask (the default value is 1). For example, 4 | ( 255 << 8 ) will consider 4 nearest
neighbours and fill the mask with a value of 255. The following additional options occupy higher
bits and therefore may be further combined with the connectivity and mask fill values using
bit-wise or (|), see #FloodFillFlags.
Note: Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
pixel \((x+1, y+1)\) in the mask .
SEE: findContourspublic static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff)
image
- Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
the details below.mask
- Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
taller than image. Since this is both an input and output parameter, you must take responsibility
of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example,
an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags
as described below. Additionally, the function fills the border of the mask with ones to simplify
internal processing. It is therefore possible to use the same mask in multiple calls to the function
to make sure the filled areas do not overlap.seedPoint
- Starting point.newVal
- New value of the repainted domain pixels.loDiff
- Maximal lower brightness/color difference between the currently observed pixel and
one of its neighbors belonging to the component, or a seed pixel being added to the component.
one of its neighbors belonging to the component, or a seed pixel being added to the component.rect
- Optional output parameter set by the function to the minimum bounding rectangle of the
repainted domain.
4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
the mask (the default value is 1). For example, 4 | ( 255 << 8 ) will consider 4 nearest
neighbours and fill the mask with a value of 255. The following additional options occupy higher
bits and therefore may be further combined with the connectivity and mask fill values using
bit-wise or (|), see #FloodFillFlags.
Note: Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
pixel \((x+1, y+1)\) in the mask .
SEE: findContourspublic static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect)
image
- Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
the details below.mask
- Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
taller than image. Since this is both an input and output parameter, you must take responsibility
of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example,
an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags
as described below. Additionally, the function fills the border of the mask with ones to simplify
internal processing. It is therefore possible to use the same mask in multiple calls to the function
to make sure the filled areas do not overlap.seedPoint
- Starting point.newVal
- New value of the repainted domain pixels.
one of its neighbors belonging to the component, or a seed pixel being added to the component.
one of its neighbors belonging to the component, or a seed pixel being added to the component.rect
- Optional output parameter set by the function to the minimum bounding rectangle of the
repainted domain.
4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
the mask (the default value is 1). For example, 4 | ( 255 << 8 ) will consider 4 nearest
neighbours and fill the mask with a value of 255. The following additional options occupy higher
bits and therefore may be further combined with the connectivity and mask fill values using
bit-wise or (|), see #FloodFillFlags.
Note: Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
pixel \((x+1, y+1)\) in the mask .
SEE: findContourspublic static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal)
image
- Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
the details below.mask
- Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
taller than image. Since this is both an input and output parameter, you must take responsibility
of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example,
an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags
as described below. Additionally, the function fills the border of the mask with ones to simplify
internal processing. It is therefore possible to use the same mask in multiple calls to the function
to make sure the filled areas do not overlap.seedPoint
- Starting point.newVal
- New value of the repainted domain pixels.
one of its neighbors belonging to the component, or a seed pixel being added to the component.
one of its neighbors belonging to the component, or a seed pixel being added to the component.
repainted domain.
4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
the mask (the default value is 1). For example, 4 | ( 255 << 8 ) will consider 4 nearest
neighbours and fill the mask with a value of 255. The following additional options occupy higher
bits and therefore may be further combined with the connectivity and mask fill values using
bit-wise or (|), see #FloodFillFlags.
Note: Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
pixel \((x+1, y+1)\) in the mask .
SEE: findContourspublic static int rotatedRectangleIntersection(RotatedRect rect1, RotatedRect rect2, Mat intersectingRegion)
rect1
- First rectanglerect2
- Second rectangleintersectingRegion
- The output array of the vertices of the intersecting region. It returns
at most 8 vertices. Stored as std::vector<cv::Point2f> or cv::Mat as Mx1 of type CV_32FC2.public static void Canny(Mat dx, Mat dy, Mat edges, double threshold1, double threshold2, boolean L2gradient)
dx
- 16-bit x derivative of input image (CV_16SC1 or CV_16SC3).dy
- 16-bit y derivative of input image (same type as dx).edges
- output edge map; single channels 8-bit image, which has the same size as image .threshold1
- first threshold for the hysteresis procedure.threshold2
- second threshold for the hysteresis procedure.L2gradient
- a flag, indicating whether a more accurate \(L_2\) norm
\(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
L2gradient=false ).public static void Canny(Mat dx, Mat dy, Mat edges, double threshold1, double threshold2)
dx
- 16-bit x derivative of input image (CV_16SC1 or CV_16SC3).dy
- 16-bit y derivative of input image (same type as dx).edges
- output edge map; single channels 8-bit image, which has the same size as image .threshold1
- first threshold for the hysteresis procedure.threshold2
- second threshold for the hysteresis procedure.
\(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
L2gradient=false ).public static void Canny(Mat image, Mat edges, double threshold1, double threshold2, int apertureSize, boolean L2gradient)
image
- 8-bit input image.edges
- output edge map; single channels 8-bit image, which has the same size as image .threshold1
- first threshold for the hysteresis procedure.threshold2
- second threshold for the hysteresis procedure.apertureSize
- aperture size for the Sobel operator.L2gradient
- a flag, indicating whether a more accurate \(L_2\) norm
\(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
L2gradient=false ).public static void Canny(Mat image, Mat edges, double threshold1, double threshold2, int apertureSize)
image
- 8-bit input image.edges
- output edge map; single channels 8-bit image, which has the same size as image .threshold1
- first threshold for the hysteresis procedure.threshold2
- second threshold for the hysteresis procedure.apertureSize
- aperture size for the Sobel operator.
\(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
L2gradient=false ).public static void Canny(Mat image, Mat edges, double threshold1, double threshold2)
image
- 8-bit input image.edges
- output edge map; single channels 8-bit image, which has the same size as image .threshold1
- first threshold for the hysteresis procedure.threshold2
- second threshold for the hysteresis procedure.
\(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
L2gradient=false ).public static void GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX, double sigmaY, int borderType)
src
- input image; the image can have any number of channels, which are processed
independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.ksize
- Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
positive and odd. Or, they can be zero's and then they are computed from sigma.sigmaX
- Gaussian kernel standard deviation in X direction.sigmaY
- Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be
equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
respectively (see #getGaussianKernel for details); to fully control the result regardless of
possible future modifications of all this semantics, it is recommended to specify all of ksize,
sigmaX, and sigmaY.borderType
- pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlurpublic static void GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX, double sigmaY)
src
- input image; the image can have any number of channels, which are processed
independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.ksize
- Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
positive and odd. Or, they can be zero's and then they are computed from sigma.sigmaX
- Gaussian kernel standard deviation in X direction.sigmaY
- Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be
equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
respectively (see #getGaussianKernel for details); to fully control the result regardless of
possible future modifications of all this semantics, it is recommended to specify all of ksize,
sigmaX, and sigmaY.
SEE: sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlurpublic static void GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX)
src
- input image; the image can have any number of channels, which are processed
independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.ksize
- Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
positive and odd. Or, they can be zero's and then they are computed from sigma.sigmaX
- Gaussian kernel standard deviation in X direction.
equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
respectively (see #getGaussianKernel for details); to fully control the result regardless of
possible future modifications of all this semantics, it is recommended to specify all of ksize,
sigmaX, and sigmaY.
SEE: sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlurpublic static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius)
image
- 8-bit, single-channel, grayscale input image.circles
- Output vector of found circles. Each vector is encoded as 3 or 4 element
floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .method
- Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.dp
- Inverse ratio of the accumulator resolution to the image resolution. For example, if
dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
unless some small very circles need to be detected.minDist
- Minimum distance between the centers of the detected circles. If the parameter is
too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
too large, some circles may be missed.param1
- First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT,
it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
shough normally be higher, such as 300 or normally exposed and contrasty images.param2
- Second method-specific parameter. In case of #HOUGH_GRADIENT, it is the
accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
false circles may be detected. Circles, corresponding to the larger accumulator values, will be
returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.minRadius
- Minimum circle radius.maxRadius
- Maximum circle radius. If <= 0, uses the maximum image dimension. If < 0, #HOUGH_GRADIENT returns
centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
SEE: fitEllipse, minEnclosingCirclepublic static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist, double param1, double param2, int minRadius)
image
- 8-bit, single-channel, grayscale input image.circles
- Output vector of found circles. Each vector is encoded as 3 or 4 element
floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .method
- Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.dp
- Inverse ratio of the accumulator resolution to the image resolution. For example, if
dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
unless some small very circles need to be detected.minDist
- Minimum distance between the centers of the detected circles. If the parameter is
too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
too large, some circles may be missed.param1
- First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT,
it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
shough normally be higher, such as 300 or normally exposed and contrasty images.param2
- Second method-specific parameter. In case of #HOUGH_GRADIENT, it is the
accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
false circles may be detected. Circles, corresponding to the larger accumulator values, will be
returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.minRadius
- Minimum circle radius.
centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
SEE: fitEllipse, minEnclosingCirclepublic static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist, double param1, double param2)
image
- 8-bit, single-channel, grayscale input image.circles
- Output vector of found circles. Each vector is encoded as 3 or 4 element
floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .method
- Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.dp
- Inverse ratio of the accumulator resolution to the image resolution. For example, if
dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
unless some small very circles need to be detected.minDist
- Minimum distance between the centers of the detected circles. If the parameter is
too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
too large, some circles may be missed.param1
- First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT,
it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
shough normally be higher, such as 300 or normally exposed and contrasty images.param2
- Second method-specific parameter. In case of #HOUGH_GRADIENT, it is the
accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
false circles may be detected. Circles, corresponding to the larger accumulator values, will be
returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
SEE: fitEllipse, minEnclosingCirclepublic static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist, double param1)
image
- 8-bit, single-channel, grayscale input image.circles
- Output vector of found circles. Each vector is encoded as 3 or 4 element
floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .method
- Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.dp
- Inverse ratio of the accumulator resolution to the image resolution. For example, if
dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
unless some small very circles need to be detected.minDist
- Minimum distance between the centers of the detected circles. If the parameter is
too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
too large, some circles may be missed.param1
- First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT,
it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
shough normally be higher, such as 300 or normally exposed and contrasty images.
accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
false circles may be detected. Circles, corresponding to the larger accumulator values, will be
returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
SEE: fitEllipse, minEnclosingCirclepublic static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist)
image
- 8-bit, single-channel, grayscale input image.circles
- Output vector of found circles. Each vector is encoded as 3 or 4 element
floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .method
- Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.dp
- Inverse ratio of the accumulator resolution to the image resolution. For example, if
dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
unless some small very circles need to be detected.minDist
- Minimum distance between the centers of the detected circles. If the parameter is
too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
too large, some circles may be missed.
it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
shough normally be higher, such as 300 or normally exposed and contrasty images.
accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
false circles may be detected. Circles, corresponding to the larger accumulator values, will be
returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
SEE: fitEllipse, minEnclosingCirclepublic static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn, double min_theta, double max_theta)
image
- 8-bit, single-channel binary source image. The image may be modified by the function.lines
- Output vector of lines. Each line is represented by a 2 or 3 element vector
\((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\) . \(\rho\) is the distance from the coordinate origin \((0,0)\) (top-left corner of
the image). \(\theta\) is the line rotation angle in radians (
\(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ).
\(\textrm{votes}\) is the value of accumulator.rho
- Distance resolution of the accumulator in pixels.theta
- Angle resolution of the accumulator in radians.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) ).srn
- For the multi-scale Hough transform, it is a divisor for the distance resolution rho .
The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
parameters should be positive.stn
- For the multi-scale Hough transform, it is a divisor for the distance resolution theta.min_theta
- For standard and multi-scale Hough transform, minimum angle to check for lines.
Must fall between 0 and max_theta.max_theta
- For standard and multi-scale Hough transform, maximum angle to check for lines.
Must fall between min_theta and CV_PI.public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn, double min_theta)
image
- 8-bit, single-channel binary source image. The image may be modified by the function.lines
- Output vector of lines. Each line is represented by a 2 or 3 element vector
\((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\) . \(\rho\) is the distance from the coordinate origin \((0,0)\) (top-left corner of
the image). \(\theta\) is the line rotation angle in radians (
\(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ).
\(\textrm{votes}\) is the value of accumulator.rho
- Distance resolution of the accumulator in pixels.theta
- Angle resolution of the accumulator in radians.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) ).srn
- For the multi-scale Hough transform, it is a divisor for the distance resolution rho .
The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
parameters should be positive.stn
- For the multi-scale Hough transform, it is a divisor for the distance resolution theta.min_theta
- For standard and multi-scale Hough transform, minimum angle to check for lines.
Must fall between 0 and max_theta.
Must fall between min_theta and CV_PI.public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn)
image
- 8-bit, single-channel binary source image. The image may be modified by the function.lines
- Output vector of lines. Each line is represented by a 2 or 3 element vector
\((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\) . \(\rho\) is the distance from the coordinate origin \((0,0)\) (top-left corner of
the image). \(\theta\) is the line rotation angle in radians (
\(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ).
\(\textrm{votes}\) is the value of accumulator.rho
- Distance resolution of the accumulator in pixels.theta
- Angle resolution of the accumulator in radians.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) ).srn
- For the multi-scale Hough transform, it is a divisor for the distance resolution rho .
The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
parameters should be positive.stn
- For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
Must fall between 0 and max_theta.
Must fall between min_theta and CV_PI.public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold, double srn)
image
- 8-bit, single-channel binary source image. The image may be modified by the function.lines
- Output vector of lines. Each line is represented by a 2 or 3 element vector
\((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\) . \(\rho\) is the distance from the coordinate origin \((0,0)\) (top-left corner of
the image). \(\theta\) is the line rotation angle in radians (
\(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ).
\(\textrm{votes}\) is the value of accumulator.rho
- Distance resolution of the accumulator in pixels.theta
- Angle resolution of the accumulator in radians.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) ).srn
- For the multi-scale Hough transform, it is a divisor for the distance resolution rho .
The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
parameters should be positive.
Must fall between 0 and max_theta.
Must fall between min_theta and CV_PI.public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold)
image
- 8-bit, single-channel binary source image. The image may be modified by the function.lines
- Output vector of lines. Each line is represented by a 2 or 3 element vector
\((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\) . \(\rho\) is the distance from the coordinate origin \((0,0)\) (top-left corner of
the image). \(\theta\) is the line rotation angle in radians (
\(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ).
\(\textrm{votes}\) is the value of accumulator.rho
- Distance resolution of the accumulator in pixels.theta
- Angle resolution of the accumulator in radians.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) ).
The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
parameters should be positive.
Must fall between 0 and max_theta.
Must fall between min_theta and CV_PI.public static void HoughLinesP(Mat image, Mat lines, double rho, double theta, int threshold, double minLineLength, double maxLineGap)
image
- 8-bit, single-channel binary source image. The image may be modified by the function.lines
- Output vector of lines. Each line is represented by a 4-element vector
\((x_1, y_1, x_2, y_2)\) , where \((x_1,y_1)\) and \((x_2, y_2)\) are the ending points of each detected
line segment.rho
- Distance resolution of the accumulator in pixels.theta
- Angle resolution of the accumulator in radians.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) ).minLineLength
- Minimum line length. Line segments shorter than that are rejected.maxLineGap
- Maximum allowed gap between points on the same line to link them.
SEE: LineSegmentDetectorpublic static void HoughLinesP(Mat image, Mat lines, double rho, double theta, int threshold, double minLineLength)
image
- 8-bit, single-channel binary source image. The image may be modified by the function.lines
- Output vector of lines. Each line is represented by a 4-element vector
\((x_1, y_1, x_2, y_2)\) , where \((x_1,y_1)\) and \((x_2, y_2)\) are the ending points of each detected
line segment.rho
- Distance resolution of the accumulator in pixels.theta
- Angle resolution of the accumulator in radians.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) ).minLineLength
- Minimum line length. Line segments shorter than that are rejected.
SEE: LineSegmentDetectorpublic static void HoughLinesP(Mat image, Mat lines, double rho, double theta, int threshold)
image
- 8-bit, single-channel binary source image. The image may be modified by the function.lines
- Output vector of lines. Each line is represented by a 4-element vector
\((x_1, y_1, x_2, y_2)\) , where \((x_1,y_1)\) and \((x_2, y_2)\) are the ending points of each detected
line segment.rho
- Distance resolution of the accumulator in pixels.theta
- Angle resolution of the accumulator in radians.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) ).
SEE: LineSegmentDetectorpublic static void HoughLinesPointSet(Mat _point, Mat _lines, int lines_max, int threshold, double min_rho, double max_rho, double rho_step, double min_theta, double max_theta, double theta_step)
_point
- Input vector of points. Each vector must be encoded as a Point vector \((x,y)\). Type must be CV_32FC2 or CV_32SC2._lines
- Output vector of found lines. Each vector is encoded as a vector<Vec3d> \((votes, rho, theta)\).
The larger the value of 'votes', the higher the reliability of the Hough line.lines_max
- Max count of hough lines.threshold
- Accumulator threshold parameter. Only those lines are returned that get enough
votes ( \(>\texttt{threshold}\) )min_rho
- Minimum Distance value of the accumulator in pixels.max_rho
- Maximum Distance value of the accumulator in pixels.rho_step
- Distance resolution of the accumulator in pixels.min_theta
- Minimum angle value of the accumulator in radians.max_theta
- Maximum angle value of the accumulator in radians.theta_step
- Angle resolution of the accumulator in radians.public static void Laplacian(Mat src, Mat dst, int ddepth, int ksize, double scale, double delta, int borderType)
ksize > 1
. When ksize == 1
, the Laplacian is computed by filtering the image
with the following \(3 \times 3\) aperture:
\(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Desired depth of the destination image.ksize
- Aperture size used to compute the second-derivative filters. See #getDerivKernels for
details. The size must be positive and odd.scale
- Optional scale factor for the computed Laplacian values. By default, no scaling is
applied. See #getDerivKernels for details.delta
- Optional delta value that is added to the results prior to storing them in dst .borderType
- Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: Sobel, Scharrpublic static void Laplacian(Mat src, Mat dst, int ddepth, int ksize, double scale, double delta)
ksize > 1
. When ksize == 1
, the Laplacian is computed by filtering the image
with the following \(3 \times 3\) aperture:
\(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Desired depth of the destination image.ksize
- Aperture size used to compute the second-derivative filters. See #getDerivKernels for
details. The size must be positive and odd.scale
- Optional scale factor for the computed Laplacian values. By default, no scaling is
applied. See #getDerivKernels for details.delta
- Optional delta value that is added to the results prior to storing them in dst .
SEE: Sobel, Scharrpublic static void Laplacian(Mat src, Mat dst, int ddepth, int ksize, double scale)
ksize > 1
. When ksize == 1
, the Laplacian is computed by filtering the image
with the following \(3 \times 3\) aperture:
\(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Desired depth of the destination image.ksize
- Aperture size used to compute the second-derivative filters. See #getDerivKernels for
details. The size must be positive and odd.scale
- Optional scale factor for the computed Laplacian values. By default, no scaling is
applied. See #getDerivKernels for details.
SEE: Sobel, Scharrpublic static void Laplacian(Mat src, Mat dst, int ddepth, int ksize)
ksize > 1
. When ksize == 1
, the Laplacian is computed by filtering the image
with the following \(3 \times 3\) aperture:
\(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Desired depth of the destination image.ksize
- Aperture size used to compute the second-derivative filters. See #getDerivKernels for
details. The size must be positive and odd.
applied. See #getDerivKernels for details.
SEE: Sobel, Scharrpublic static void Laplacian(Mat src, Mat dst, int ddepth)
ksize > 1
. When ksize == 1
, the Laplacian is computed by filtering the image
with the following \(3 \times 3\) aperture:
\(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Desired depth of the destination image.
details. The size must be positive and odd.
applied. See #getDerivKernels for details.
SEE: Sobel, Scharrpublic static void Scharr(Mat src, Mat dst, int ddepth, int dx, int dy, double scale, double delta, int borderType)
src
- input image.dst
- output image of the same size and the same number of channels as src.ddepth
- output image depth, see REF: filter_depths "combinations"dx
- order of the derivative x.dy
- order of the derivative y.scale
- optional scale factor for the computed derivative values; by default, no scaling is
applied (see #getDerivKernels for details).delta
- optional delta value that is added to the results prior to storing them in dst.borderType
- pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: cartToPolarpublic static void Scharr(Mat src, Mat dst, int ddepth, int dx, int dy, double scale, double delta)
src
- input image.dst
- output image of the same size and the same number of channels as src.ddepth
- output image depth, see REF: filter_depths "combinations"dx
- order of the derivative x.dy
- order of the derivative y.scale
- optional scale factor for the computed derivative values; by default, no scaling is
applied (see #getDerivKernels for details).delta
- optional delta value that is added to the results prior to storing them in dst.
SEE: cartToPolarpublic static void Scharr(Mat src, Mat dst, int ddepth, int dx, int dy, double scale)
src
- input image.dst
- output image of the same size and the same number of channels as src.ddepth
- output image depth, see REF: filter_depths "combinations"dx
- order of the derivative x.dy
- order of the derivative y.scale
- optional scale factor for the computed derivative values; by default, no scaling is
applied (see #getDerivKernels for details).
SEE: cartToPolarpublic static void Scharr(Mat src, Mat dst, int ddepth, int dx, int dy)
src
- input image.dst
- output image of the same size and the same number of channels as src.ddepth
- output image depth, see REF: filter_depths "combinations"dx
- order of the derivative x.dy
- order of the derivative y.
applied (see #getDerivKernels for details).
SEE: cartToPolarpublic static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType)
ksize = 1
can only be used for the first
or the second x- or y- derivatives.
There is also the special value ksize = #FILTER_SCHARR (-1)
that corresponds to the \(3\times3\) Scharr
filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
\(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
for the x-derivative, or transposed for the y-derivative.
The function calculates an image derivative by convolving the image with the appropriate kernel:
\(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
case corresponds to a kernel of:
\(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
The second case corresponds to a kernel of:
\(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)src
- input image.dst
- output image of the same size and the same number of channels as src .ddepth
- output image depth, see REF: filter_depths "combinations"; in the case of
8-bit input images it will result in truncated derivatives.dx
- order of the derivative x.dy
- order of the derivative y.ksize
- size of the extended Sobel kernel; it must be 1, 3, 5, or 7.scale
- optional scale factor for the computed derivative values; by default, no scaling is
applied (see #getDerivKernels for details).delta
- optional delta value that is added to the results prior to storing them in dst.borderType
- pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolarpublic static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize, double scale, double delta)
ksize = 1
can only be used for the first
or the second x- or y- derivatives.
There is also the special value ksize = #FILTER_SCHARR (-1)
that corresponds to the \(3\times3\) Scharr
filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
\(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
for the x-derivative, or transposed for the y-derivative.
The function calculates an image derivative by convolving the image with the appropriate kernel:
\(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
case corresponds to a kernel of:
\(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
The second case corresponds to a kernel of:
\(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)src
- input image.dst
- output image of the same size and the same number of channels as src .ddepth
- output image depth, see REF: filter_depths "combinations"; in the case of
8-bit input images it will result in truncated derivatives.dx
- order of the derivative x.dy
- order of the derivative y.ksize
- size of the extended Sobel kernel; it must be 1, 3, 5, or 7.scale
- optional scale factor for the computed derivative values; by default, no scaling is
applied (see #getDerivKernels for details).delta
- optional delta value that is added to the results prior to storing them in dst.
SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolarpublic static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize, double scale)
ksize = 1
can only be used for the first
or the second x- or y- derivatives.
There is also the special value ksize = #FILTER_SCHARR (-1)
that corresponds to the \(3\times3\) Scharr
filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
\(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
for the x-derivative, or transposed for the y-derivative.
The function calculates an image derivative by convolving the image with the appropriate kernel:
\(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
case corresponds to a kernel of:
\(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
The second case corresponds to a kernel of:
\(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)src
- input image.dst
- output image of the same size and the same number of channels as src .ddepth
- output image depth, see REF: filter_depths "combinations"; in the case of
8-bit input images it will result in truncated derivatives.dx
- order of the derivative x.dy
- order of the derivative y.ksize
- size of the extended Sobel kernel; it must be 1, 3, 5, or 7.scale
- optional scale factor for the computed derivative values; by default, no scaling is
applied (see #getDerivKernels for details).
SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolarpublic static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize)
ksize = 1
can only be used for the first
or the second x- or y- derivatives.
There is also the special value ksize = #FILTER_SCHARR (-1)
that corresponds to the \(3\times3\) Scharr
filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
\(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
for the x-derivative, or transposed for the y-derivative.
The function calculates an image derivative by convolving the image with the appropriate kernel:
\(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
case corresponds to a kernel of:
\(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
The second case corresponds to a kernel of:
\(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)src
- input image.dst
- output image of the same size and the same number of channels as src .ddepth
- output image depth, see REF: filter_depths "combinations"; in the case of
8-bit input images it will result in truncated derivatives.dx
- order of the derivative x.dy
- order of the derivative y.ksize
- size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
applied (see #getDerivKernels for details).
SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolarpublic static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy)
ksize = 1
can only be used for the first
or the second x- or y- derivatives.
There is also the special value ksize = #FILTER_SCHARR (-1)
that corresponds to the \(3\times3\) Scharr
filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
\(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
for the x-derivative, or transposed for the y-derivative.
The function calculates an image derivative by convolving the image with the appropriate kernel:
\(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
case corresponds to a kernel of:
\(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
The second case corresponds to a kernel of:
\(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)src
- input image.dst
- output image of the same size and the same number of channels as src .ddepth
- output image depth, see REF: filter_depths "combinations"; in the case of
8-bit input images it will result in truncated derivatives.dx
- order of the derivative x.dy
- order of the derivative y.
applied (see #getDerivKernels for details).
SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolarpublic static void accumulate(Mat src, Mat dst, Mat mask)
src
- Input image of type CV_8UC(n), CV_16UC(n), CV_32FC(n) or CV_64FC(n), where n is a positive integer.dst
- %Accumulator image with the same number of channels as input image, and a depth of CV_32F or CV_64F.mask
- Optional operation mask.
SEE: accumulateSquare, accumulateProduct, accumulateWeightedpublic static void accumulate(Mat src, Mat dst)
src
- Input image of type CV_8UC(n), CV_16UC(n), CV_32FC(n) or CV_64FC(n), where n is a positive integer.dst
- %Accumulator image with the same number of channels as input image, and a depth of CV_32F or CV_64F.
SEE: accumulateSquare, accumulateProduct, accumulateWeightedpublic static void accumulateProduct(Mat src1, Mat src2, Mat dst, Mat mask)
src1
- First input image, 1- or 3-channel, 8-bit or 32-bit floating point.src2
- Second input image of the same type and the same size as src1 .dst
- %Accumulator image with the same number of channels as input images, 32-bit or 64-bit
floating-point.mask
- Optional operation mask.
SEE: accumulate, accumulateSquare, accumulateWeightedpublic static void accumulateProduct(Mat src1, Mat src2, Mat dst)
src1
- First input image, 1- or 3-channel, 8-bit or 32-bit floating point.src2
- Second input image of the same type and the same size as src1 .dst
- %Accumulator image with the same number of channels as input images, 32-bit or 64-bit
floating-point.
SEE: accumulate, accumulateSquare, accumulateWeightedpublic static void accumulateSquare(Mat src, Mat dst, Mat mask)
src
- Input image as 1- or 3-channel, 8-bit or 32-bit floating point.dst
- %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
floating-point.mask
- Optional operation mask.
SEE: accumulateSquare, accumulateProduct, accumulateWeightedpublic static void accumulateSquare(Mat src, Mat dst)
src
- Input image as 1- or 3-channel, 8-bit or 32-bit floating point.dst
- %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
floating-point.
SEE: accumulateSquare, accumulateProduct, accumulateWeightedpublic static void accumulateWeighted(Mat src, Mat dst, double alpha, Mat mask)
src
- Input image as 1- or 3-channel, 8-bit or 32-bit floating point.dst
- %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
floating-point.alpha
- Weight of the input image.mask
- Optional operation mask.
SEE: accumulate, accumulateSquare, accumulateProductpublic static void accumulateWeighted(Mat src, Mat dst, double alpha)
src
- Input image as 1- or 3-channel, 8-bit or 32-bit floating point.dst
- %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
floating-point.alpha
- Weight of the input image.
SEE: accumulate, accumulateSquare, accumulateProductpublic static void adaptiveThreshold(Mat src, Mat dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C)
src
- Source 8-bit single-channel image.dst
- Destination image of the same size and the same type as src.maxValue
- Non-zero value assigned to the pixels for which the condition is satisfiedadaptiveMethod
- Adaptive thresholding algorithm to use, see #AdaptiveThresholdTypes.
The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries.thresholdType
- Thresholding type that must be either #THRESH_BINARY or #THRESH_BINARY_INV,
see #ThresholdTypes.blockSize
- Size of a pixel neighborhood that is used to calculate a threshold value for the
pixel: 3, 5, 7, and so on.C
- Constant subtracted from the mean or weighted mean (see the details below). Normally, it
is positive but may be zero or negative as well.
SEE: threshold, blur, GaussianBlurpublic static void applyColorMap(Mat src, Mat dst, Mat userColor)
src
- The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.dst
- The result is the colormapped source image. Note: Mat::create is called on dst.userColor
- The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256public static void applyColorMap(Mat src, Mat dst, int colormap)
src
- The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.dst
- The result is the colormapped source image. Note: Mat::create is called on dst.colormap
- The colormap to apply, see #ColormapTypespublic static void approxPolyDP(MatOfPoint2f curve, MatOfPoint2f approxCurve, double epsilon, boolean closed)
curve
- Input vector of a 2D point stored in std::vector or MatapproxCurve
- Result of the approximation. The type should match the type of the input curve.epsilon
- Parameter specifying the approximation accuracy. This is the maximum distance
between the original curve and its approximation.closed
- If true, the approximated curve is closed (its first and last vertices are
connected). Otherwise, it is not closed.public static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int line_type, int shift, double tipLength)
img
- Image.pt1
- The point the arrow starts from.pt2
- The point the arrow points to.color
- Line color.thickness
- Line thickness.line_type
- Type of the line. See #LineTypesshift
- Number of fractional bits in the point coordinates.tipLength
- The length of the arrow tip in relation to the arrow lengthpublic static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int line_type, int shift)
img
- Image.pt1
- The point the arrow starts from.pt2
- The point the arrow points to.color
- Line color.thickness
- Line thickness.line_type
- Type of the line. See #LineTypesshift
- Number of fractional bits in the point coordinates.public static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int line_type)
img
- Image.pt1
- The point the arrow starts from.pt2
- The point the arrow points to.color
- Line color.thickness
- Line thickness.line_type
- Type of the line. See #LineTypespublic static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness)
img
- Image.pt1
- The point the arrow starts from.pt2
- The point the arrow points to.color
- Line color.thickness
- Line thickness.public static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color)
img
- Image.pt1
- The point the arrow starts from.pt2
- The point the arrow points to.color
- Line color.public static void bilateralFilter(Mat src, Mat dst, int d, double sigmaColor, double sigmaSpace, int borderType)
src
- Source 8-bit or floating-point, 1-channel or 3-channel image.dst
- Destination image of the same size and type as src .d
- Diameter of each pixel neighborhood that is used during filtering. If it is non-positive,
it is computed from sigmaSpace.sigmaColor
- 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
- 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.borderType
- border mode used to extrapolate pixels outside of the image, see #BorderTypespublic static void bilateralFilter(Mat src, Mat dst, int d, double sigmaColor, double sigmaSpace)
src
- Source 8-bit or floating-point, 1-channel or 3-channel image.dst
- Destination image of the same size and type as src .d
- Diameter of each pixel neighborhood that is used during filtering. If it is non-positive,
it is computed from sigmaSpace.sigmaColor
- 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
- 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.public static void blur(Mat src, Mat dst, Size ksize, Point anchor, int borderType)
blur(src, dst, ksize, anchor, borderType)
is equivalent to `boxFilter(src, dst, src.type(),
anchor, true, borderType)`.src
- 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.dst
- output image of the same size and type as src.ksize
- blurring kernel size.anchor
- anchor point; default value Point(-1,-1) means that the anchor is at the kernel
center.borderType
- border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: boxFilter, bilateralFilter, GaussianBlur, medianBlurpublic static void blur(Mat src, Mat dst, Size ksize, Point anchor)
blur(src, dst, ksize, anchor, borderType)
is equivalent to `boxFilter(src, dst, src.type(),
anchor, true, borderType)`.src
- 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.dst
- output image of the same size and type as src.ksize
- blurring kernel size.anchor
- anchor point; default value Point(-1,-1) means that the anchor is at the kernel
center.
SEE: boxFilter, bilateralFilter, GaussianBlur, medianBlurpublic static void blur(Mat src, Mat dst, Size ksize)
blur(src, dst, ksize, anchor, borderType)
is equivalent to `boxFilter(src, dst, src.type(),
anchor, true, borderType)`.src
- 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.dst
- output image of the same size and type as src.ksize
- blurring kernel size.
center.
SEE: boxFilter, bilateralFilter, GaussianBlur, medianBlurpublic static void boxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor, boolean normalize, int borderType)
src
- input image.dst
- output image of the same size and type as src.ddepth
- the output image depth (-1 to use src.depth()).ksize
- blurring kernel size.anchor
- anchor point; default value Point(-1,-1) means that the anchor is at the kernel
center.normalize
- flag, specifying whether the kernel is normalized by its area or not.borderType
- border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: blur, bilateralFilter, GaussianBlur, medianBlur, integralpublic static void boxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor, boolean normalize)
src
- input image.dst
- output image of the same size and type as src.ddepth
- the output image depth (-1 to use src.depth()).ksize
- blurring kernel size.anchor
- anchor point; default value Point(-1,-1) means that the anchor is at the kernel
center.normalize
- flag, specifying whether the kernel is normalized by its area or not.
SEE: blur, bilateralFilter, GaussianBlur, medianBlur, integralpublic static void boxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor)
src
- input image.dst
- output image of the same size and type as src.ddepth
- the output image depth (-1 to use src.depth()).ksize
- blurring kernel size.anchor
- anchor point; default value Point(-1,-1) means that the anchor is at the kernel
center.
SEE: blur, bilateralFilter, GaussianBlur, medianBlur, integralpublic static void boxFilter(Mat src, Mat dst, int ddepth, Size ksize)
src
- input image.dst
- output image of the same size and type as src.ddepth
- the output image depth (-1 to use src.depth()).ksize
- blurring kernel size.
center.
SEE: blur, bilateralFilter, GaussianBlur, medianBlur, integralpublic static void boxPoints(RotatedRect box, Mat points)
box
- The input rotated rectangle. It may be the output ofpoints
- The output array of four vertices of rectangles.public static void calcBackProject(List<Mat> images, MatOfInt channels, Mat hist, Mat dst, MatOfFloat ranges, double scale)
public static void calcHist(List<Mat> images, MatOfInt channels, Mat mask, Mat hist, MatOfInt histSize, MatOfFloat ranges, boolean accumulate)
public static void calcHist(List<Mat> images, MatOfInt channels, Mat mask, Mat hist, MatOfInt histSize, MatOfFloat ranges)
public static void circle(Mat img, Point center, int radius, Scalar color, int thickness, int lineType, int shift)
img
- Image where the circle is drawn.center
- Center of the circle.radius
- Radius of the circle.color
- Circle color.thickness
- Thickness of the circle outline, if positive. Negative values, like #FILLED,
mean that a filled circle is to be drawn.lineType
- Type of the circle boundary. See #LineTypesshift
- Number of fractional bits in the coordinates of the center and in the radius value.public static void circle(Mat img, Point center, int radius, Scalar color, int thickness, int lineType)
img
- Image where the circle is drawn.center
- Center of the circle.radius
- Radius of the circle.color
- Circle color.thickness
- Thickness of the circle outline, if positive. Negative values, like #FILLED,
mean that a filled circle is to be drawn.lineType
- Type of the circle boundary. See #LineTypespublic static void circle(Mat img, Point center, int radius, Scalar color, int thickness)
img
- Image where the circle is drawn.center
- Center of the circle.radius
- Radius of the circle.color
- Circle color.thickness
- Thickness of the circle outline, if positive. Negative values, like #FILLED,
mean that a filled circle is to be drawn.public static void circle(Mat img, Point center, int radius, Scalar color)
img
- Image where the circle is drawn.center
- Center of the circle.radius
- Radius of the circle.color
- Circle color.
mean that a filled circle is to be drawn.public static void convertMaps(Mat map1, Mat map2, Mat dstmap1, Mat dstmap2, int dstmap1type, boolean nninterpolation)
map1
- The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .map2
- The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix),
respectively.dstmap1
- The first output map that has the type dstmap1type and the same size as src .dstmap2
- The second output map.dstmap1type
- Type of the first output map that should be CV_16SC2, CV_32FC1, or
CV_32FC2 .nninterpolation
- Flag indicating whether the fixed-point maps are used for the
nearest-neighbor or for a more complex interpolation.
SEE: remap, undistort, initUndistortRectifyMappublic static void convertMaps(Mat map1, Mat map2, Mat dstmap1, Mat dstmap2, int dstmap1type)
map1
- The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .map2
- The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix),
respectively.dstmap1
- The first output map that has the type dstmap1type and the same size as src .dstmap2
- The second output map.dstmap1type
- Type of the first output map that should be CV_16SC2, CV_32FC1, or
CV_32FC2 .
nearest-neighbor or for a more complex interpolation.
SEE: remap, undistort, initUndistortRectifyMappublic static void convexHull(MatOfPoint points, MatOfInt hull, boolean clockwise)
points
- Input 2D point set, stored in std::vector or Mat.hull
- 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.clockwise
- 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.
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.
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/public static void convexHull(MatOfPoint points, MatOfInt hull)
points
- Input 2D point set, stored in std::vector or Mat.hull
- 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.
Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing
to the right, and its Y axis pointing upwards.
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.
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/public static void convexityDefects(MatOfPoint contour, MatOfInt convexhull, MatOfInt4 convexityDefects)
contour
- Input contour.convexhull
- Convex hull obtained using convexHull that should contain indices of the contour
points that make the hull.convexityDefects
- The output vector of convexity defects. In C++ and the new Python/Java
interface each convexity defect is represented as 4-element integer vector (a.k.a. #Vec4i):
(start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices
in the original contour of the convexity defect beginning, end and the farthest point, and
fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the
farthest contour point and the hull. That is, to get the floating-point value of the depth will be
fixpt_depth/256.0.public static void cornerEigenValsAndVecs(Mat src, Mat dst, int blockSize, int ksize, int borderType)
src
- Input single-channel 8-bit or floating-point image.dst
- Image to store the results. It has the same size as src and the type CV_32FC(6) .blockSize
- Neighborhood size (see details below).ksize
- Aperture parameter for the Sobel operator.borderType
- Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
SEE: cornerMinEigenVal, cornerHarris, preCornerDetectpublic static void cornerEigenValsAndVecs(Mat src, Mat dst, int blockSize, int ksize)
src
- Input single-channel 8-bit or floating-point image.dst
- Image to store the results. It has the same size as src and the type CV_32FC(6) .blockSize
- Neighborhood size (see details below).ksize
- Aperture parameter for the Sobel operator.
SEE: cornerMinEigenVal, cornerHarris, preCornerDetectpublic static void cornerHarris(Mat src, Mat dst, int blockSize, int ksize, double k, int borderType)
src
- Input single-channel 8-bit or floating-point image.dst
- Image to store the Harris detector responses. It has the type CV_32FC1 and the same
size as src .blockSize
- Neighborhood size (see the details on #cornerEigenValsAndVecs ).ksize
- Aperture parameter for the Sobel operator.k
- Harris detector free parameter. See the formula above.borderType
- Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.public static void cornerHarris(Mat src, Mat dst, int blockSize, int ksize, double k)
src
- Input single-channel 8-bit or floating-point image.dst
- Image to store the Harris detector responses. It has the type CV_32FC1 and the same
size as src .blockSize
- Neighborhood size (see the details on #cornerEigenValsAndVecs ).ksize
- Aperture parameter for the Sobel operator.k
- Harris detector free parameter. See the formula above.public static void cornerMinEigenVal(Mat src, Mat dst, int blockSize, int ksize, int borderType)
src
- Input single-channel 8-bit or floating-point image.dst
- Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as
src .blockSize
- Neighborhood size (see the details on #cornerEigenValsAndVecs ).ksize
- Aperture parameter for the Sobel operator.borderType
- Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.public static void cornerMinEigenVal(Mat src, Mat dst, int blockSize, int ksize)
src
- Input single-channel 8-bit or floating-point image.dst
- Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as
src .blockSize
- Neighborhood size (see the details on #cornerEigenValsAndVecs ).ksize
- Aperture parameter for the Sobel operator.public static void cornerMinEigenVal(Mat src, Mat dst, int blockSize)
src
- Input single-channel 8-bit or floating-point image.dst
- Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as
src .blockSize
- Neighborhood size (see the details on #cornerEigenValsAndVecs ).public static void cornerSubPix(Mat image, Mat corners, Size winSize, Size zeroZone, TermCriteria criteria)
image
- Input single-channel, 8-bit or float image.corners
- Initial coordinates of the input corners and refined coordinates provided for
output.winSize
- Half of the side length of the search window. For example, if winSize=Size(5,5) ,
then a \((5*2+1) \times (5*2+1) = 11 \times 11\) search window is used.zeroZone
- Half of the size of the dead region in the middle of the search zone over which
the summation in the formula below is not done. It is used sometimes to avoid possible
singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such
a size.criteria
- Criteria for termination of the iterative process of corner refinement. That is,
the process of corner position refinement stops either after criteria.maxCount iterations or when
the corner position moves by less than criteria.epsilon on some iteration.public static void createHanningWindow(Mat dst, Size winSize, int type)
// create hanning window of size 100x100 and type CV_32F
Mat hann;
createHanningWindow(hann, Size(100, 100), CV_32F);
dst
- Destination array to place Hann coefficients inwinSize
- The window size specifications (both width and height must be > 1)type
- Created array typepublic static void cvtColor(Mat src, Mat dst, int code, int dstCn)
img *= 1./255;
cvtColor(img, img, COLOR_BGR2Luv);
If you use #cvtColor with 8-bit images, the conversion will have some information lost. For many
applications, this will not be noticeable but it is recommended to use 32-bit images in applications
that need the full range of colors or that convert an image before an operation and then convert
back.
If conversion adds the alpha channel, its value will set to the maximum of corresponding channel
range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F.src
- input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision
floating-point.dst
- output image of the same size and depth as src.code
- color space conversion code (see #ColorConversionCodes).dstCn
- number of channels in the destination image; if the parameter is 0, the number of the
channels is derived automatically from src and code.
SEE: REF: imgproc_color_conversionspublic static void cvtColor(Mat src, Mat dst, int code)
img *= 1./255;
cvtColor(img, img, COLOR_BGR2Luv);
If you use #cvtColor with 8-bit images, the conversion will have some information lost. For many
applications, this will not be noticeable but it is recommended to use 32-bit images in applications
that need the full range of colors or that convert an image before an operation and then convert
back.
If conversion adds the alpha channel, its value will set to the maximum of corresponding channel
range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F.src
- input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision
floating-point.dst
- output image of the same size and depth as src.code
- color space conversion code (see #ColorConversionCodes).
channels is derived automatically from src and code.
SEE: REF: imgproc_color_conversionspublic static void cvtColorTwoPlane(Mat src1, Mat src2, Mat dst, int code)
src1
- automatically generatedsrc2
- automatically generateddst
- automatically generatedcode
- automatically generatedpublic static void demosaicing(Mat src, Mat dst, int code, int dstCn)
src
- input image: 8-bit unsigned or 16-bit unsigned.dst
- output image of the same size and depth as src.code
- Color space conversion code (see the description below).dstCn
- number of channels in the destination image; if the parameter is 0, the number of the
channels is derived automatically from src and code.
The function can do the following transformations:
public static void demosaicing(Mat src, Mat dst, int code)
src
- input image: 8-bit unsigned or 16-bit unsigned.dst
- output image of the same size and depth as src.code
- Color space conversion code (see the description below).
channels is derived automatically from src and code.
The function can do the following transformations:
public static void dilate(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
structuring element is used. Kernel can be created using #getStructuringElementanchor
- position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.iterations
- number of times dilation is applied.borderType
- pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not suported.borderValue
- border value in case of a constant border
SEE: erode, morphologyEx, getStructuringElementpublic static void dilate(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
structuring element is used. Kernel can be created using #getStructuringElementanchor
- position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.iterations
- number of times dilation is applied.borderType
- pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not suported.
SEE: erode, morphologyEx, getStructuringElementpublic static void dilate(Mat src, Mat dst, Mat kernel, Point anchor, int iterations)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
structuring element is used. Kernel can be created using #getStructuringElementanchor
- position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.iterations
- number of times dilation is applied.
SEE: erode, morphologyEx, getStructuringElementpublic static void dilate(Mat src, Mat dst, Mat kernel, Point anchor)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
structuring element is used. Kernel can be created using #getStructuringElementanchor
- position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.
SEE: erode, morphologyEx, getStructuringElementpublic static void dilate(Mat src, Mat dst, Mat kernel)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
structuring element is used. Kernel can be created using #getStructuringElement
anchor is at the element center.
SEE: erode, morphologyEx, getStructuringElementpublic static void distanceTransformWithLabels(Mat src, Mat dst, Mat labels, int distanceType, int maskSize, int labelType)
b
), and all knight's moves must have the
same cost (denoted as c
). For the #DIST_C and #DIST_L1 types, the distance is calculated
precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a
relative error (a \(5\times 5\) mask gives more accurate results). For a
,b
, and c
, OpenCV
uses the values suggested in the original paper:
a = 1, b = 2
3 x 3
: a=0.955, b=1.3693
5 x 5
: a=1, b=1.4, c=2.1969
a = 1, b = 1
labels(x, y)
. When labelType==#DIST_LABEL_CCOMP, the function
automatically finds connected components of zero pixels in the input image and marks them with
distinct labels. When labelType==#DIST_LABEL_CCOMP, the function scans through the input image and
marks all the zero pixels with distinct labels.
In this mode, the complexity is still linear. That is, the function provides a very fast way to
compute the Voronoi diagram for a binary image. Currently, the second variant can use only the
approximate distance transform algorithm, i.e. maskSize=#DIST_MASK_PRECISE is not supported
yet.src
- 8-bit, single-channel (binary) source image.dst
- Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
single-channel image of the same size as src.labels
- Output 2D array of labels (the discrete Voronoi diagram). It has the type
CV_32SC1 and the same size as src.distanceType
- Type of distance, see #DistanceTypesmaskSize
- Size of the distance transform mask, see #DistanceTransformMasks.
#DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type,
the parameter is forced to 3 because a \(3\times 3\) mask gives the same result as \(5\times
5\) or any larger aperture.labelType
- Type of the label array to build, see #DistanceTransformLabelTypes.public static void distanceTransformWithLabels(Mat src, Mat dst, Mat labels, int distanceType, int maskSize)
b
), and all knight's moves must have the
same cost (denoted as c
). For the #DIST_C and #DIST_L1 types, the distance is calculated
precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a
relative error (a \(5\times 5\) mask gives more accurate results). For a
,b
, and c
, OpenCV
uses the values suggested in the original paper:
a = 1, b = 2
3 x 3
: a=0.955, b=1.3693
5 x 5
: a=1, b=1.4, c=2.1969
a = 1, b = 1
labels(x, y)
. When labelType==#DIST_LABEL_CCOMP, the function
automatically finds connected components of zero pixels in the input image and marks them with
distinct labels. When labelType==#DIST_LABEL_CCOMP, the function scans through the input image and
marks all the zero pixels with distinct labels.
In this mode, the complexity is still linear. That is, the function provides a very fast way to
compute the Voronoi diagram for a binary image. Currently, the second variant can use only the
approximate distance transform algorithm, i.e. maskSize=#DIST_MASK_PRECISE is not supported
yet.src
- 8-bit, single-channel (binary) source image.dst
- Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
single-channel image of the same size as src.labels
- Output 2D array of labels (the discrete Voronoi diagram). It has the type
CV_32SC1 and the same size as src.distanceType
- Type of distance, see #DistanceTypesmaskSize
- Size of the distance transform mask, see #DistanceTransformMasks.
#DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type,
the parameter is forced to 3 because a \(3\times 3\) mask gives the same result as \(5\times
5\) or any larger aperture.public static void distanceTransform(Mat src, Mat dst, int distanceType, int maskSize, int dstType)
src
- 8-bit, single-channel (binary) source image.dst
- Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
single-channel image of the same size as src .distanceType
- Type of distance, see #DistanceTypesmaskSize
- Size of the distance transform mask, see #DistanceTransformMasks. In case of the
#DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \(3\times 3\) mask gives
the same result as \(5\times 5\) or any larger aperture.dstType
- Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for
the first variant of the function and distanceType == #DIST_L1.public static void distanceTransform(Mat src, Mat dst, int distanceType, int maskSize)
src
- 8-bit, single-channel (binary) source image.dst
- Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
single-channel image of the same size as src .distanceType
- Type of distance, see #DistanceTypesmaskSize
- Size of the distance transform mask, see #DistanceTransformMasks. In case of the
#DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \(3\times 3\) mask gives
the same result as \(5\times 5\) or any larger aperture.
the first variant of the function and distanceType == #DIST_L1.public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy, int maxLevel, Point offset)
image
- Destination image.contours
- All the input contours. Each contour is stored as a point vector.contourIdx
- Parameter indicating a contour to draw. If it is negative, all the contours are drawn.color
- Color of the contours.thickness
- Thickness of lines the contours are drawn with. If it is negative (for example,
thickness=#FILLED ), the contour interiors are drawn.lineType
- Line connectivity. See #LineTypeshierarchy
- Optional information about hierarchy. It is only needed if you want to draw only
some of the contours (see maxLevel ).maxLevel
- Maximal level for drawn contours. If it is 0, only the specified contour is drawn.
If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
parameter is only taken into account when there is hierarchy available.offset
- Optional contour shift parameter. Shift all the drawn contours by the specified
\(\texttt{offset}=(dx,dy)\) .
Note: When thickness=#FILLED, the function is designed to handle connected components with holes correctly
even when no hierarchy date is provided. This is done by analyzing all the outlines together
using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
of contours, or iterate over the collection using contourIdx parameter.public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy, int maxLevel)
image
- Destination image.contours
- All the input contours. Each contour is stored as a point vector.contourIdx
- Parameter indicating a contour to draw. If it is negative, all the contours are drawn.color
- Color of the contours.thickness
- Thickness of lines the contours are drawn with. If it is negative (for example,
thickness=#FILLED ), the contour interiors are drawn.lineType
- Line connectivity. See #LineTypeshierarchy
- Optional information about hierarchy. It is only needed if you want to draw only
some of the contours (see maxLevel ).maxLevel
- Maximal level for drawn contours. If it is 0, only the specified contour is drawn.
If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
parameter is only taken into account when there is hierarchy available.
\(\texttt{offset}=(dx,dy)\) .
Note: When thickness=#FILLED, the function is designed to handle connected components with holes correctly
even when no hierarchy date is provided. This is done by analyzing all the outlines together
using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
of contours, or iterate over the collection using contourIdx parameter.public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy)
image
- Destination image.contours
- All the input contours. Each contour is stored as a point vector.contourIdx
- Parameter indicating a contour to draw. If it is negative, all the contours are drawn.color
- Color of the contours.thickness
- Thickness of lines the contours are drawn with. If it is negative (for example,
thickness=#FILLED ), the contour interiors are drawn.lineType
- Line connectivity. See #LineTypeshierarchy
- Optional information about hierarchy. It is only needed if you want to draw only
some of the contours (see maxLevel ).
If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
parameter is only taken into account when there is hierarchy available.
\(\texttt{offset}=(dx,dy)\) .
Note: When thickness=#FILLED, the function is designed to handle connected components with holes correctly
even when no hierarchy date is provided. This is done by analyzing all the outlines together
using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
of contours, or iterate over the collection using contourIdx parameter.public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType)
image
- Destination image.contours
- All the input contours. Each contour is stored as a point vector.contourIdx
- Parameter indicating a contour to draw. If it is negative, all the contours are drawn.color
- Color of the contours.thickness
- Thickness of lines the contours are drawn with. If it is negative (for example,
thickness=#FILLED ), the contour interiors are drawn.lineType
- Line connectivity. See #LineTypes
some of the contours (see maxLevel ).
If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
parameter is only taken into account when there is hierarchy available.
\(\texttt{offset}=(dx,dy)\) .
Note: When thickness=#FILLED, the function is designed to handle connected components with holes correctly
even when no hierarchy date is provided. This is done by analyzing all the outlines together
using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
of contours, or iterate over the collection using contourIdx parameter.public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness)
image
- Destination image.contours
- All the input contours. Each contour is stored as a point vector.contourIdx
- Parameter indicating a contour to draw. If it is negative, all the contours are drawn.color
- Color of the contours.thickness
- Thickness of lines the contours are drawn with. If it is negative (for example,
thickness=#FILLED ), the contour interiors are drawn.
some of the contours (see maxLevel ).
If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
parameter is only taken into account when there is hierarchy available.
\(\texttt{offset}=(dx,dy)\) .
Note: When thickness=#FILLED, the function is designed to handle connected components with holes correctly
even when no hierarchy date is provided. This is done by analyzing all the outlines together
using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
of contours, or iterate over the collection using contourIdx parameter.public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color)
image
- Destination image.contours
- All the input contours. Each contour is stored as a point vector.contourIdx
- Parameter indicating a contour to draw. If it is negative, all the contours are drawn.color
- Color of the contours.
thickness=#FILLED ), the contour interiors are drawn.
some of the contours (see maxLevel ).
If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
parameter is only taken into account when there is hierarchy available.
\(\texttt{offset}=(dx,dy)\) .
Note: When thickness=#FILLED, the function is designed to handle connected components with holes correctly
even when no hierarchy date is provided. This is done by analyzing all the outlines together
using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
of contours, or iterate over the collection using contourIdx parameter.public static void drawMarker(Mat img, Point position, Scalar color, int markerType, int markerSize, int thickness, int line_type)
img
- Image.position
- The point where the crosshair is positioned.color
- Line color.markerType
- The specific type of marker you want to use, see #MarkerTypesthickness
- Line thickness.line_type
- Type of the line, See #LineTypesmarkerSize
- The length of the marker axis [default = 20 pixels]public static void drawMarker(Mat img, Point position, Scalar color, int markerType, int markerSize, int thickness)
img
- Image.position
- The point where the crosshair is positioned.color
- Line color.markerType
- The specific type of marker you want to use, see #MarkerTypesthickness
- Line thickness.markerSize
- The length of the marker axis [default = 20 pixels]public static void drawMarker(Mat img, Point position, Scalar color, int markerType, int markerSize)
img
- Image.position
- The point where the crosshair is positioned.color
- Line color.markerType
- The specific type of marker you want to use, see #MarkerTypesmarkerSize
- The length of the marker axis [default = 20 pixels]public static void drawMarker(Mat img, Point position, Scalar color, int markerType)
img
- Image.position
- The point where the crosshair is positioned.color
- Line color.markerType
- The specific type of marker you want to use, see #MarkerTypespublic static void drawMarker(Mat img, Point position, Scalar color)
img
- Image.position
- The point where the crosshair is positioned.color
- Line color.public static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness, int lineType, int shift)
startAngle=0
and
endAngle=360
. If startAngle
is greater than endAngle
, they are swapped. The figure below explains
the meaning of the parameters to draw the blue arc.
![Parameters of Elliptic Arc](pics/ellipse.svg)img
- Image.center
- Center of the ellipse.axes
- Half of the size of the ellipse main axes.angle
- Ellipse rotation angle in degrees.startAngle
- Starting angle of the elliptic arc in degrees.endAngle
- Ending angle of the elliptic arc in degrees.color
- Ellipse color.thickness
- Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
a filled ellipse sector is to be drawn.lineType
- Type of the ellipse boundary. See #LineTypesshift
- Number of fractional bits in the coordinates of the center and values of axes.public static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness, int lineType)
startAngle=0
and
endAngle=360
. If startAngle
is greater than endAngle
, they are swapped. The figure below explains
the meaning of the parameters to draw the blue arc.
![Parameters of Elliptic Arc](pics/ellipse.svg)img
- Image.center
- Center of the ellipse.axes
- Half of the size of the ellipse main axes.angle
- Ellipse rotation angle in degrees.startAngle
- Starting angle of the elliptic arc in degrees.endAngle
- Ending angle of the elliptic arc in degrees.color
- Ellipse color.thickness
- Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
a filled ellipse sector is to be drawn.lineType
- Type of the ellipse boundary. See #LineTypespublic static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness)
startAngle=0
and
endAngle=360
. If startAngle
is greater than endAngle
, they are swapped. The figure below explains
the meaning of the parameters to draw the blue arc.
![Parameters of Elliptic Arc](pics/ellipse.svg)img
- Image.center
- Center of the ellipse.axes
- Half of the size of the ellipse main axes.angle
- Ellipse rotation angle in degrees.startAngle
- Starting angle of the elliptic arc in degrees.endAngle
- Ending angle of the elliptic arc in degrees.color
- Ellipse color.thickness
- Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
a filled ellipse sector is to be drawn.public static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color)
startAngle=0
and
endAngle=360
. If startAngle
is greater than endAngle
, they are swapped. The figure below explains
the meaning of the parameters to draw the blue arc.
![Parameters of Elliptic Arc](pics/ellipse.svg)img
- Image.center
- Center of the ellipse.axes
- Half of the size of the ellipse main axes.angle
- Ellipse rotation angle in degrees.startAngle
- Starting angle of the elliptic arc in degrees.endAngle
- Ending angle of the elliptic arc in degrees.color
- Ellipse color.
a filled ellipse sector is to be drawn.public static void ellipse(Mat img, RotatedRect box, Scalar color, int thickness, int lineType)
img
- Image.box
- Alternative ellipse representation via RotatedRect. This means that the function draws
an ellipse inscribed in the rotated rectangle.color
- Ellipse color.thickness
- Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
a filled ellipse sector is to be drawn.lineType
- Type of the ellipse boundary. See #LineTypespublic static void ellipse(Mat img, RotatedRect box, Scalar color, int thickness)
img
- Image.box
- Alternative ellipse representation via RotatedRect. This means that the function draws
an ellipse inscribed in the rotated rectangle.color
- Ellipse color.thickness
- Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
a filled ellipse sector is to be drawn.public static void ellipse(Mat img, RotatedRect box, Scalar color)
img
- Image.box
- Alternative ellipse representation via RotatedRect. This means that the function draws
an ellipse inscribed in the rotated rectangle.color
- Ellipse color.
a filled ellipse sector is to be drawn.public static void ellipse2Poly(Point center, Size axes, int angle, int arcStart, int arcEnd, int delta, MatOfPoint pts)
arcStart
is greater than arcEnd
, they are swapped.center
- Center of the arc.axes
- Half of the size of the ellipse main axes. See #ellipse for details.angle
- Rotation angle of the ellipse in degrees. See #ellipse for details.arcStart
- Starting angle of the elliptic arc in degrees.arcEnd
- Ending angle of the elliptic arc in degrees.delta
- Angle between the subsequent polyline vertices. It defines the approximation
accuracy.pts
- Output vector of polyline vertices.public static void equalizeHist(Mat src, Mat dst)
src
- Source 8-bit single channel image.dst
- Destination image of the same size and type as src .public static void erode(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for erosion; if element=Mat()
, a 3 x 3
rectangular
structuring element is used. Kernel can be created using #getStructuringElement.anchor
- position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.iterations
- number of times erosion is applied.borderType
- pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.borderValue
- border value in case of a constant border
SEE: dilate, morphologyEx, getStructuringElementpublic static void erode(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for erosion; if element=Mat()
, a 3 x 3
rectangular
structuring element is used. Kernel can be created using #getStructuringElement.anchor
- position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.iterations
- number of times erosion is applied.borderType
- pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: dilate, morphologyEx, getStructuringElementpublic static void erode(Mat src, Mat dst, Mat kernel, Point anchor, int iterations)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for erosion; if element=Mat()
, a 3 x 3
rectangular
structuring element is used. Kernel can be created using #getStructuringElement.anchor
- position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.iterations
- number of times erosion is applied.
SEE: dilate, morphologyEx, getStructuringElementpublic static void erode(Mat src, Mat dst, Mat kernel, Point anchor)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for erosion; if element=Mat()
, a 3 x 3
rectangular
structuring element is used. Kernel can be created using #getStructuringElement.anchor
- position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.
SEE: dilate, morphologyEx, getStructuringElementpublic static void erode(Mat src, Mat dst, Mat kernel)
src
- input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- output image of the same size and type as src.kernel
- structuring element used for erosion; if element=Mat()
, a 3 x 3
rectangular
structuring element is used. Kernel can be created using #getStructuringElement.
anchor is at the element center.
SEE: dilate, morphologyEx, getStructuringElementpublic static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color, int lineType, int shift)
img
- Image.points
- Polygon vertices.color
- Polygon color.lineType
- Type of the polygon boundaries. See #LineTypesshift
- Number of fractional bits in the vertex coordinates.public static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color, int lineType)
img
- Image.points
- Polygon vertices.color
- Polygon color.lineType
- Type of the polygon boundaries. See #LineTypespublic static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color)
img
- Image.points
- Polygon vertices.color
- Polygon color.public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color, int lineType, int shift, Point offset)
img
- Image.pts
- Array of polygons where each polygon is represented as an array of points.color
- Polygon color.lineType
- Type of the polygon boundaries. See #LineTypesshift
- Number of fractional bits in the vertex coordinates.offset
- Optional offset of all points of the contours.public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color, int lineType, int shift)
img
- Image.pts
- Array of polygons where each polygon is represented as an array of points.color
- Polygon color.lineType
- Type of the polygon boundaries. See #LineTypesshift
- Number of fractional bits in the vertex coordinates.public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color, int lineType)
img
- Image.pts
- Array of polygons where each polygon is represented as an array of points.color
- Polygon color.lineType
- Type of the polygon boundaries. See #LineTypespublic static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color)
img
- Image.pts
- Array of polygons where each polygon is represented as an array of points.color
- Polygon color.public static void filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta, int borderType)
11 x 11
or
larger) and the direct algorithm for small kernels.src
- input image.dst
- output image of the same size and the same number of channels as src.ddepth
- desired depth of the destination image, see REF: filter_depths "combinations"kernel
- convolution kernel (or rather a correlation kernel), a single-channel floating point
matrix; if you want to apply different kernels to different channels, split the image into
separate color planes using split and process them individually.anchor
- anchor of the kernel that indicates the relative position of a filtered point within
the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.delta
- optional value added to the filtered pixels before storing them in dst.borderType
- pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: sepFilter2D, dft, matchTemplatepublic static void filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta)
11 x 11
or
larger) and the direct algorithm for small kernels.src
- input image.dst
- output image of the same size and the same number of channels as src.ddepth
- desired depth of the destination image, see REF: filter_depths "combinations"kernel
- convolution kernel (or rather a correlation kernel), a single-channel floating point
matrix; if you want to apply different kernels to different channels, split the image into
separate color planes using split and process them individually.anchor
- anchor of the kernel that indicates the relative position of a filtered point within
the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.delta
- optional value added to the filtered pixels before storing them in dst.
SEE: sepFilter2D, dft, matchTemplatepublic static void filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor)
11 x 11
or
larger) and the direct algorithm for small kernels.src
- input image.dst
- output image of the same size and the same number of channels as src.ddepth
- desired depth of the destination image, see REF: filter_depths "combinations"kernel
- convolution kernel (or rather a correlation kernel), a single-channel floating point
matrix; if you want to apply different kernels to different channels, split the image into
separate color planes using split and process them individually.anchor
- anchor of the kernel that indicates the relative position of a filtered point within
the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.
SEE: sepFilter2D, dft, matchTemplatepublic static void filter2D(Mat src, Mat dst, int ddepth, Mat kernel)
11 x 11
or
larger) and the direct algorithm for small kernels.src
- input image.dst
- output image of the same size and the same number of channels as src.ddepth
- desired depth of the destination image, see REF: filter_depths "combinations"kernel
- convolution kernel (or rather a correlation kernel), a single-channel floating point
matrix; if you want to apply different kernels to different channels, split the image into
separate color planes using split and process them individually.
the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.
SEE: sepFilter2D, dft, matchTemplatepublic static void findContours(Mat image, List<MatOfPoint> contours, Mat hierarchy, int mode, int method, Point offset)
image
- Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero
pixels remain 0's, so the image is treated as binary . You can use #compare, #inRange, #threshold ,
#adaptiveThreshold, #Canny, and others to create a binary image out of a grayscale or color one.
If mode equals to #RETR_CCOMP or #RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).contours
- Detected contours. Each contour is stored as a vector of points (e.g.
std::vector<std::vector<cv::Point> >).hierarchy
- Optional output vector (e.g. std::vector<cv::Vec4i>), containing information about the image topology. It has
as many elements as the number of contours. For each i-th contour contours[i], the elements
hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices
in contours of the next and previous contours at the same hierarchical level, the first child
contour and the parent contour, respectively. If for the contour i there are no next, previous,
parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.mode
- Contour retrieval mode, see #RetrievalModesmethod
- Contour approximation method, see #ContourApproximationModesoffset
- Optional offset by which every contour point is shifted. This is useful if the
contours are extracted from the image ROI and then they should be analyzed in the whole image
context.public static void findContours(Mat image, List<MatOfPoint> contours, Mat hierarchy, int mode, int method)
image
- Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero
pixels remain 0's, so the image is treated as binary . You can use #compare, #inRange, #threshold ,
#adaptiveThreshold, #Canny, and others to create a binary image out of a grayscale or color one.
If mode equals to #RETR_CCOMP or #RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).contours
- Detected contours. Each contour is stored as a vector of points (e.g.
std::vector<std::vector<cv::Point> >).hierarchy
- Optional output vector (e.g. std::vector<cv::Vec4i>), containing information about the image topology. It has
as many elements as the number of contours. For each i-th contour contours[i], the elements
hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices
in contours of the next and previous contours at the same hierarchical level, the first child
contour and the parent contour, respectively. If for the contour i there are no next, previous,
parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.mode
- Contour retrieval mode, see #RetrievalModesmethod
- Contour approximation method, see #ContourApproximationModes
contours are extracted from the image ROI and then they should be analyzed in the whole image
context.public static void fitLine(Mat points, Mat line, int distType, double param, double reps, double aeps)
points
- Input vector of 2D or 3D points, stored in std::vector<> or Mat.line
- Output line parameters. In case of 2D fitting, it should be a vector of 4 elements
(like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and
(x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like
Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line
and (x0, y0, z0) is a point on the line.distType
- Distance used by the M-estimator, see #DistanceTypesparam
- Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value
is chosen.reps
- Sufficient accuracy for the radius (distance between the coordinate origin and the line).aeps
- Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.public static void getDerivKernels(Mat kx, Mat ky, int dx, int dy, int ksize, boolean normalize, int ktype)
ksize=FILTER_SCHARR
, the Scharr \(3 \times 3\) kernels are generated (see #Scharr). Otherwise, Sobel
kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or tokx
- Output matrix of row filter coefficients. It has the type ktype .ky
- Output matrix of column filter coefficients. It has the type ktype .dx
- Derivative order in respect of x.dy
- Derivative order in respect of y.ksize
- Aperture size. It can be FILTER_SCHARR, 1, 3, 5, or 7.normalize
- Flag indicating whether to normalize (scale down) the filter coefficients or not.
Theoretically, the coefficients should have the denominator \(=2^{ksize*2-dx-dy-2}\). If you are
going to filter floating-point images, you are likely to use the normalized kernels. But if you
compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
all the fractional bits, you may want to set normalize=false .ktype
- Type of filter coefficients. It can be CV_32f or CV_64F .public static void getDerivKernels(Mat kx, Mat ky, int dx, int dy, int ksize, boolean normalize)
ksize=FILTER_SCHARR
, the Scharr \(3 \times 3\) kernels are generated (see #Scharr). Otherwise, Sobel
kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or tokx
- Output matrix of row filter coefficients. It has the type ktype .ky
- Output matrix of column filter coefficients. It has the type ktype .dx
- Derivative order in respect of x.dy
- Derivative order in respect of y.ksize
- Aperture size. It can be FILTER_SCHARR, 1, 3, 5, or 7.normalize
- Flag indicating whether to normalize (scale down) the filter coefficients or not.
Theoretically, the coefficients should have the denominator \(=2^{ksize*2-dx-dy-2}\). If you are
going to filter floating-point images, you are likely to use the normalized kernels. But if you
compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
all the fractional bits, you may want to set normalize=false .public static void getDerivKernels(Mat kx, Mat ky, int dx, int dy, int ksize)
ksize=FILTER_SCHARR
, the Scharr \(3 \times 3\) kernels are generated (see #Scharr). Otherwise, Sobel
kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or tokx
- Output matrix of row filter coefficients. It has the type ktype .ky
- Output matrix of column filter coefficients. It has the type ktype .dx
- Derivative order in respect of x.dy
- Derivative order in respect of y.ksize
- Aperture size. It can be FILTER_SCHARR, 1, 3, 5, or 7.
Theoretically, the coefficients should have the denominator \(=2^{ksize*2-dx-dy-2}\). If you are
going to filter floating-point images, you are likely to use the normalized kernels. But if you
compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
all the fractional bits, you may want to set normalize=false .public static void getRectSubPix(Mat image, Size patchSize, Point center, Mat patch, int patchType)
image
- Source image.patchSize
- Size of the extracted patch.center
- Floating point coordinates of the center of the extracted rectangle within the
source image. The center must be inside the image.patch
- Extracted patch that has the size patchSize and the same number of channels as src .patchType
- Depth of the extracted pixels. By default, they have the same depth as src .
SEE: warpAffine, warpPerspectivepublic static void getRectSubPix(Mat image, Size patchSize, Point center, Mat patch)
image
- Source image.patchSize
- Size of the extracted patch.center
- Floating point coordinates of the center of the extracted rectangle within the
source image. The center must be inside the image.patch
- Extracted patch that has the size patchSize and the same number of channels as src .
SEE: warpAffine, warpPerspectivepublic static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, int gradientSize, boolean useHarrisDetector, double k)
public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, int gradientSize, boolean useHarrisDetector)
public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, int gradientSize)
public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, boolean useHarrisDetector, double k)
image
- Input 8-bit or floating-point 32-bit, single-channel image.corners
- Output vector of detected corners.maxCorners
- Maximum number of corners to return. If there are more corners than are found,
the strongest of them is returned. maxCorners <= 0
implies that no limit on the maximum is set
and all detected corners are returned.qualityLevel
- Parameter characterizing the minimal accepted quality of image corners. The
parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
(see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
quality measure less than the product are rejected. For example, if the best corner has the
quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
less than 15 are rejected.minDistance
- Minimum possible Euclidean distance between the returned corners.mask
- Optional region of interest. If the image is not empty (it needs to have the type
CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.blockSize
- Size of an average block for computing a derivative covariation matrix over each
pixel neighborhood. See cornerEigenValsAndVecs .useHarrisDetector
- Parameter indicating whether to use a Harris detector (see #cornerHarris)
or #cornerMinEigenVal.k
- Free parameter of the Harris detector.
SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, boolean useHarrisDetector)
image
- Input 8-bit or floating-point 32-bit, single-channel image.corners
- Output vector of detected corners.maxCorners
- Maximum number of corners to return. If there are more corners than are found,
the strongest of them is returned. maxCorners <= 0
implies that no limit on the maximum is set
and all detected corners are returned.qualityLevel
- Parameter characterizing the minimal accepted quality of image corners. The
parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
(see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
quality measure less than the product are rejected. For example, if the best corner has the
quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
less than 15 are rejected.minDistance
- Minimum possible Euclidean distance between the returned corners.mask
- Optional region of interest. If the image is not empty (it needs to have the type
CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.blockSize
- Size of an average block for computing a derivative covariation matrix over each
pixel neighborhood. See cornerEigenValsAndVecs .useHarrisDetector
- Parameter indicating whether to use a Harris detector (see #cornerHarris)
or #cornerMinEigenVal.
SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize)
image
- Input 8-bit or floating-point 32-bit, single-channel image.corners
- Output vector of detected corners.maxCorners
- Maximum number of corners to return. If there are more corners than are found,
the strongest of them is returned. maxCorners <= 0
implies that no limit on the maximum is set
and all detected corners are returned.qualityLevel
- Parameter characterizing the minimal accepted quality of image corners. The
parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
(see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
quality measure less than the product are rejected. For example, if the best corner has the
quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
less than 15 are rejected.minDistance
- Minimum possible Euclidean distance between the returned corners.mask
- Optional region of interest. If the image is not empty (it needs to have the type
CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.blockSize
- Size of an average block for computing a derivative covariation matrix over each
pixel neighborhood. See cornerEigenValsAndVecs .
or #cornerMinEigenVal.
SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask)
image
- Input 8-bit or floating-point 32-bit, single-channel image.corners
- Output vector of detected corners.maxCorners
- Maximum number of corners to return. If there are more corners than are found,
the strongest of them is returned. maxCorners <= 0
implies that no limit on the maximum is set
and all detected corners are returned.qualityLevel
- Parameter characterizing the minimal accepted quality of image corners. The
parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
(see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
quality measure less than the product are rejected. For example, if the best corner has the
quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
less than 15 are rejected.minDistance
- Minimum possible Euclidean distance between the returned corners.mask
- Optional region of interest. If the image is not empty (it needs to have the type
CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
pixel neighborhood. See cornerEigenValsAndVecs .
or #cornerMinEigenVal.
SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance)
image
- Input 8-bit or floating-point 32-bit, single-channel image.corners
- Output vector of detected corners.maxCorners
- Maximum number of corners to return. If there are more corners than are found,
the strongest of them is returned. maxCorners <= 0
implies that no limit on the maximum is set
and all detected corners are returned.qualityLevel
- Parameter characterizing the minimal accepted quality of image corners. The
parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
(see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
quality measure less than the product are rejected. For example, if the best corner has the
quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
less than 15 are rejected.minDistance
- Minimum possible Euclidean distance between the returned corners.
CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
pixel neighborhood. See cornerEigenValsAndVecs .
or #cornerMinEigenVal.
SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,public static void grabCut(Mat img, Mat mask, Rect rect, Mat bgdModel, Mat fgdModel, int iterCount, int mode)
img
- Input 8-bit 3-channel image.mask
- Input/output 8-bit single-channel mask. The mask is initialized by the function when
mode is set to #GC_INIT_WITH_RECT. Its elements may have one of the #GrabCutClasses.rect
- ROI containing a segmented object. The pixels outside of the ROI are marked as
"obvious background". The parameter is only used when mode==#GC_INIT_WITH_RECT .bgdModel
- Temporary array for the background model. Do not modify it while you are
processing the same image.fgdModel
- Temporary arrays for the foreground model. Do not modify it while you are
processing the same image.iterCount
- Number of iterations the algorithm should make before returning the result. Note
that the result can be refined with further calls with mode==#GC_INIT_WITH_MASK or
mode==GC_EVAL .mode
- Operation mode that could be one of the #GrabCutModespublic static void grabCut(Mat img, Mat mask, Rect rect, Mat bgdModel, Mat fgdModel, int iterCount)
img
- Input 8-bit 3-channel image.mask
- Input/output 8-bit single-channel mask. The mask is initialized by the function when
mode is set to #GC_INIT_WITH_RECT. Its elements may have one of the #GrabCutClasses.rect
- ROI containing a segmented object. The pixels outside of the ROI are marked as
"obvious background". The parameter is only used when mode==#GC_INIT_WITH_RECT .bgdModel
- Temporary array for the background model. Do not modify it while you are
processing the same image.fgdModel
- Temporary arrays for the foreground model. Do not modify it while you are
processing the same image.iterCount
- Number of iterations the algorithm should make before returning the result. Note
that the result can be refined with further calls with mode==#GC_INIT_WITH_MASK or
mode==GC_EVAL .public static void integral3(Mat src, Mat sum, Mat sqsum, Mat tilted, int sdepth, int sqdepth)
src
- input image as \(W \times H\), 8-bit or floating-point (32f or 64f).sum
- integral image as \((W+1)\times (H+1)\) , 32-bit integer or floating-point (32f or 64f).sqsum
- integral image for squared pixel values; it is \((W+1)\times (H+1)\), double-precision
floating-point (64f) array.tilted
- integral for the image rotated by 45 degrees; it is \((W+1)\times (H+1)\) array with
the same data type as sum.sdepth
- desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or
CV_64F.sqdepth
- desired depth of the integral image of squared pixel values, CV_32F or CV_64F.public static void integral3(Mat src, Mat sum, Mat sqsum, Mat tilted, int sdepth)
src
- input image as \(W \times H\), 8-bit or floating-point (32f or 64f).sum
- integral image as \((W+1)\times (H+1)\) , 32-bit integer or floating-point (32f or 64f).sqsum
- integral image for squared pixel values; it is \((W+1)\times (H+1)\), double-precision
floating-point (64f) array.tilted
- integral for the image rotated by 45 degrees; it is \((W+1)\times (H+1)\) array with
the same data type as sum.sdepth
- desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or
CV_64F.public static void integral3(Mat src, Mat sum, Mat sqsum, Mat tilted)
src
- input image as \(W \times H\), 8-bit or floating-point (32f or 64f).sum
- integral image as \((W+1)\times (H+1)\) , 32-bit integer or floating-point (32f or 64f).sqsum
- integral image for squared pixel values; it is \((W+1)\times (H+1)\), double-precision
floating-point (64f) array.tilted
- integral for the image rotated by 45 degrees; it is \((W+1)\times (H+1)\) array with
the same data type as sum.
CV_64F.public static void invertAffineTransform(Mat M, Mat iM)
M
- Original affine transformation.iM
- Output reverse affine transformation.public static void line(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift)
img
- Image.pt1
- First point of the line segment.pt2
- Second point of the line segment.color
- Line color.thickness
- Line thickness.lineType
- Type of the line. See #LineTypes.shift
- Number of fractional bits in the point coordinates.public static void line(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType)
img
- Image.pt1
- First point of the line segment.pt2
- Second point of the line segment.color
- Line color.thickness
- Line thickness.lineType
- Type of the line. See #LineTypes.public static void line(Mat img, Point pt1, Point pt2, Scalar color, int thickness)
img
- Image.pt1
- First point of the line segment.pt2
- Second point of the line segment.color
- Line color.thickness
- Line thickness.public static void line(Mat img, Point pt1, Point pt2, Scalar color)
img
- Image.pt1
- First point of the line segment.pt2
- Second point of the line segment.color
- Line color.@Deprecated public static void linearPolar(Mat src, Mat dst, Point center, double maxRadius, int flags)
src
- Source imagedst
- Destination image. It will have same size and type as src.center
- The transformation center;maxRadius
- The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.flags
- A combination of interpolation methods, see #InterpolationFlags
Note:
@Deprecated public static void logPolar(Mat src, Mat dst, Point center, double M, int flags)
src
- Source imagedst
- Destination image. It will have same size and type as src.center
- The transformation center; where the output precision is maximalM
- Magnitude scale parameter. It determines the radius of the bounding circle to transform too.flags
- A combination of interpolation methods, see #InterpolationFlags
Note:
public static void matchTemplate(Mat image, Mat templ, Mat result, int method, Mat mask)
image
- Image where the search is running. It must be 8-bit or 32-bit floating-point.templ
- Searched template. It must be not greater than the source image and have the same
data type.result
- Map of comparison results. It must be single-channel 32-bit floating-point. If image
is \(W \times H\) and templ is \(w \times h\) , then result is \((W-w+1) \times (H-h+1)\) .method
- Parameter specifying the comparison method, see #TemplateMatchModesmask
- Mask of searched template. It must have the same datatype and size with templ. It is
not set by default. Currently, only the #TM_SQDIFF and #TM_CCORR_NORMED methods are supported.public static void matchTemplate(Mat image, Mat templ, Mat result, int method)
image
- Image where the search is running. It must be 8-bit or 32-bit floating-point.templ
- Searched template. It must be not greater than the source image and have the same
data type.result
- Map of comparison results. It must be single-channel 32-bit floating-point. If image
is \(W \times H\) and templ is \(w \times h\) , then result is \((W-w+1) \times (H-h+1)\) .method
- Parameter specifying the comparison method, see #TemplateMatchModes
not set by default. Currently, only the #TM_SQDIFF and #TM_CCORR_NORMED methods are supported.public static void medianBlur(Mat src, Mat dst, int ksize)
src
- input 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be
CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.dst
- destination array of the same size and type as src.ksize
- aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ...
SEE: bilateralFilter, blur, boxFilter, GaussianBlurpublic static void minEnclosingCircle(MatOfPoint2f points, Point center, float[] radius)
points
- Input vector of 2D points, stored in std::vector<> or Matcenter
- Output center of the circle.radius
- Output radius of the circle.public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue)
src
- Source image. The number of channels can be arbitrary. The depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- Destination image of the same size and type as source image.op
- Type of a morphological operation, see #MorphTypeskernel
- Structuring element. It can be created using #getStructuringElement.anchor
- Anchor position with the kernel. Negative values mean that the anchor is at the
kernel center.iterations
- Number of times erosion and dilation are applied.borderType
- Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.borderValue
- Border value in case of a constant border. The default value has a special
meaning.
SEE: dilate, erode, getStructuringElement
Note: The number of iterations is the number of times erosion or dilatation operation will be applied.
For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel, Point anchor, int iterations, int borderType)
src
- Source image. The number of channels can be arbitrary. The depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- Destination image of the same size and type as source image.op
- Type of a morphological operation, see #MorphTypeskernel
- Structuring element. It can be created using #getStructuringElement.anchor
- Anchor position with the kernel. Negative values mean that the anchor is at the
kernel center.iterations
- Number of times erosion and dilation are applied.borderType
- Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
meaning.
SEE: dilate, erode, getStructuringElement
Note: The number of iterations is the number of times erosion or dilatation operation will be applied.
For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel, Point anchor, int iterations)
src
- Source image. The number of channels can be arbitrary. The depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- Destination image of the same size and type as source image.op
- Type of a morphological operation, see #MorphTypeskernel
- Structuring element. It can be created using #getStructuringElement.anchor
- Anchor position with the kernel. Negative values mean that the anchor is at the
kernel center.iterations
- Number of times erosion and dilation are applied.
meaning.
SEE: dilate, erode, getStructuringElement
Note: The number of iterations is the number of times erosion or dilatation operation will be applied.
For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel, Point anchor)
src
- Source image. The number of channels can be arbitrary. The depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- Destination image of the same size and type as source image.op
- Type of a morphological operation, see #MorphTypeskernel
- Structuring element. It can be created using #getStructuringElement.anchor
- Anchor position with the kernel. Negative values mean that the anchor is at the
kernel center.
meaning.
SEE: dilate, erode, getStructuringElement
Note: The number of iterations is the number of times erosion or dilatation operation will be applied.
For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel)
src
- Source image. The number of channels can be arbitrary. The depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.dst
- Destination image of the same size and type as source image.op
- Type of a morphological operation, see #MorphTypeskernel
- Structuring element. It can be created using #getStructuringElement.
kernel center.
meaning.
SEE: dilate, erode, getStructuringElement
Note: The number of iterations is the number of times erosion or dilatation operation will be applied.
For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).public static void polylines(Mat img, List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness, int lineType, int shift)
img
- Image.pts
- Array of polygonal curves.isClosed
- Flag indicating whether the drawn polylines are closed or not. If they are closed,
the function draws a line from the last vertex of each curve to its first vertex.color
- Polyline color.thickness
- Thickness of the polyline edges.lineType
- Type of the line segments. See #LineTypesshift
- Number of fractional bits in the vertex coordinates.
The function cv::polylines draws one or more polygonal curves.public static void polylines(Mat img, List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness, int lineType)
img
- Image.pts
- Array of polygonal curves.isClosed
- Flag indicating whether the drawn polylines are closed or not. If they are closed,
the function draws a line from the last vertex of each curve to its first vertex.color
- Polyline color.thickness
- Thickness of the polyline edges.lineType
- Type of the line segments. See #LineTypes
The function cv::polylines draws one or more polygonal curves.public static void polylines(Mat img, List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness)
img
- Image.pts
- Array of polygonal curves.isClosed
- Flag indicating whether the drawn polylines are closed or not. If they are closed,
the function draws a line from the last vertex of each curve to its first vertex.color
- Polyline color.thickness
- Thickness of the polyline edges.
The function cv::polylines draws one or more polygonal curves.public static void polylines(Mat img, List<MatOfPoint> pts, boolean isClosed, Scalar color)
img
- Image.pts
- Array of polygonal curves.isClosed
- Flag indicating whether the drawn polylines are closed or not. If they are closed,
the function draws a line from the last vertex of each curve to its first vertex.color
- Polyline color.
The function cv::polylines draws one or more polygonal curves.public static void preCornerDetect(Mat src, Mat dst, int ksize, int borderType)
Mat corners, dilated_corners;
preCornerDetect(image, corners, 3);
// dilation with 3x3 rectangular structuring element
dilate(corners, dilated_corners, Mat(), 1);
Mat corner_mask = corners == dilated_corners;
src
- Source single-channel 8-bit of floating-point image.dst
- Output image that has the type CV_32F and the same size as src .ksize
- %Aperture size of the Sobel .borderType
- Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.public static void preCornerDetect(Mat src, Mat dst, int ksize)
Mat corners, dilated_corners;
preCornerDetect(image, corners, 3);
// dilation with 3x3 rectangular structuring element
dilate(corners, dilated_corners, Mat(), 1);
Mat corner_mask = corners == dilated_corners;
src
- Source single-channel 8-bit of floating-point image.dst
- Output image that has the type CV_32F and the same size as src .ksize
- %Aperture size of the Sobel .public static void putText(Mat img, String text, Point org, int fontFace, double fontScale, Scalar color, int thickness, int lineType, boolean bottomLeftOrigin)
img
- Image.text
- Text string to be drawn.org
- Bottom-left corner of the text string in the image.fontFace
- Font type, see #HersheyFonts.fontScale
- Font scale factor that is multiplied by the font-specific base size.color
- Text color.thickness
- Thickness of the lines used to draw a text.lineType
- Line type. See #LineTypesbottomLeftOrigin
- When true, the image data origin is at the bottom-left corner. Otherwise,
it is at the top-left corner.public static void putText(Mat img, String text, Point org, int fontFace, double fontScale, Scalar color, int thickness, int lineType)
img
- Image.text
- Text string to be drawn.org
- Bottom-left corner of the text string in the image.fontFace
- Font type, see #HersheyFonts.fontScale
- Font scale factor that is multiplied by the font-specific base size.color
- Text color.thickness
- Thickness of the lines used to draw a text.lineType
- Line type. See #LineTypes
it is at the top-left corner.public static void putText(Mat img, String text, Point org, int fontFace, double fontScale, Scalar color, int thickness)
img
- Image.text
- Text string to be drawn.org
- Bottom-left corner of the text string in the image.fontFace
- Font type, see #HersheyFonts.fontScale
- Font scale factor that is multiplied by the font-specific base size.color
- Text color.thickness
- Thickness of the lines used to draw a text.
it is at the top-left corner.public static void putText(Mat img, String text, Point org, int fontFace, double fontScale, Scalar color)
img
- Image.text
- Text string to be drawn.org
- Bottom-left corner of the text string in the image.fontFace
- Font type, see #HersheyFonts.fontScale
- Font scale factor that is multiplied by the font-specific base size.color
- Text color.
it is at the top-left corner.public static void pyrDown(Mat src, Mat dst, Size dstsize, int borderType)
Size((src.cols+1)/2, (src.rows+1)/2)
, but in
any case, the following conditions should be satisfied:
\(\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\)
The function performs the downsampling step of the Gaussian pyramid construction. First, it
convolves the source image with the kernel:
\(\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\)
Then, it downsamples the image by rejecting even rows and columns.src
- input image.dst
- output image; it has the specified size and the same type as src.dstsize
- size of the output image.borderType
- Pixel extrapolation method, see #BorderTypes (#BORDER_CONSTANT isn't supported)public static void pyrDown(Mat src, Mat dst, Size dstsize)
Size((src.cols+1)/2, (src.rows+1)/2)
, but in
any case, the following conditions should be satisfied:
\(\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\)
The function performs the downsampling step of the Gaussian pyramid construction. First, it
convolves the source image with the kernel:
\(\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\)
Then, it downsamples the image by rejecting even rows and columns.src
- input image.dst
- output image; it has the specified size and the same type as src.dstsize
- size of the output image.public static void pyrDown(Mat src, Mat dst)
Size((src.cols+1)/2, (src.rows+1)/2)
, but in
any case, the following conditions should be satisfied:
\(\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\)
The function performs the downsampling step of the Gaussian pyramid construction. First, it
convolves the source image with the kernel:
\(\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\)
Then, it downsamples the image by rejecting even rows and columns.src
- input image.dst
- output image; it has the specified size and the same type as src.public static void pyrMeanShiftFiltering(Mat src, Mat dst, double sp, double sr, int maxLevel, TermCriteria termcrit)
src
- The source 8-bit, 3-channel image.dst
- The destination image of the same format and the same size as the source.sp
- The spatial window radius.sr
- The color window radius.maxLevel
- Maximum level of the pyramid for the segmentation.termcrit
- Termination criteria: when to stop meanshift iterations.public static void pyrMeanShiftFiltering(Mat src, Mat dst, double sp, double sr, int maxLevel)
src
- The source 8-bit, 3-channel image.dst
- The destination image of the same format and the same size as the source.sp
- The spatial window radius.sr
- The color window radius.maxLevel
- Maximum level of the pyramid for the segmentation.public static void pyrMeanShiftFiltering(Mat src, Mat dst, double sp, double sr)
src
- The source 8-bit, 3-channel image.dst
- The destination image of the same format and the same size as the source.sp
- The spatial window radius.sr
- The color window radius.public static void pyrUp(Mat src, Mat dst, Size dstsize, int borderType)
Size(src.cols\*2, (src.rows\*2)
, but in any
case, the following conditions should be satisfied:
\(\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\)
The function performs the upsampling step of the Gaussian pyramid construction, though it can
actually be used to construct the Laplacian pyramid. First, it upsamples the source image by
injecting even zero rows and columns and then convolves the result with the same kernel as in
pyrDown multiplied by 4.src
- input image.dst
- output image. It has the specified size and the same type as src .dstsize
- size of the output image.borderType
- Pixel extrapolation method, see #BorderTypes (only #BORDER_DEFAULT is supported)public static void pyrUp(Mat src, Mat dst, Size dstsize)
Size(src.cols\*2, (src.rows\*2)
, but in any
case, the following conditions should be satisfied:
\(\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\)
The function performs the upsampling step of the Gaussian pyramid construction, though it can
actually be used to construct the Laplacian pyramid. First, it upsamples the source image by
injecting even zero rows and columns and then convolves the result with the same kernel as in
pyrDown multiplied by 4.src
- input image.dst
- output image. It has the specified size and the same type as src .dstsize
- size of the output image.public static void pyrUp(Mat src, Mat dst)
Size(src.cols\*2, (src.rows\*2)
, but in any
case, the following conditions should be satisfied:
\(\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\)
The function performs the upsampling step of the Gaussian pyramid construction, though it can
actually be used to construct the Laplacian pyramid. First, it upsamples the source image by
injecting even zero rows and columns and then convolves the result with the same kernel as in
pyrDown multiplied by 4.src
- input image.dst
- output image. It has the specified size and the same type as src .public static void rectangle(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift)
img
- Image.pt1
- Vertex of the rectangle.pt2
- Vertex of the rectangle opposite to pt1 .color
- Rectangle color or brightness (grayscale image).thickness
- Thickness of lines that make up the rectangle. Negative values, like #FILLED,
mean that the function has to draw a filled rectangle.lineType
- Type of the line. See #LineTypesshift
- Number of fractional bits in the point coordinates.public static void rectangle(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType)
img
- Image.pt1
- Vertex of the rectangle.pt2
- Vertex of the rectangle opposite to pt1 .color
- Rectangle color or brightness (grayscale image).thickness
- Thickness of lines that make up the rectangle. Negative values, like #FILLED,
mean that the function has to draw a filled rectangle.lineType
- Type of the line. See #LineTypespublic static void rectangle(Mat img, Point pt1, Point pt2, Scalar color, int thickness)
img
- Image.pt1
- Vertex of the rectangle.pt2
- Vertex of the rectangle opposite to pt1 .color
- Rectangle color or brightness (grayscale image).thickness
- Thickness of lines that make up the rectangle. Negative values, like #FILLED,
mean that the function has to draw a filled rectangle.public static void rectangle(Mat img, Point pt1, Point pt2, Scalar color)
img
- Image.pt1
- Vertex of the rectangle.pt2
- Vertex of the rectangle opposite to pt1 .color
- Rectangle color or brightness (grayscale image).
mean that the function has to draw a filled rectangle.public static void rectangle(Mat img, Rect rec, Scalar color, int thickness, int lineType, int shift)
rec
parameter as alternative specification of the drawn rectangle: `r.tl() and
r.br()-Point(1,1)` are opposite cornersimg
- automatically generatedrec
- automatically generatedcolor
- automatically generatedthickness
- automatically generatedlineType
- automatically generatedshift
- automatically generatedpublic static void rectangle(Mat img, Rect rec, Scalar color, int thickness, int lineType)
rec
parameter as alternative specification of the drawn rectangle: `r.tl() and
r.br()-Point(1,1)` are opposite cornersimg
- automatically generatedrec
- automatically generatedcolor
- automatically generatedthickness
- automatically generatedlineType
- automatically generatedpublic static void rectangle(Mat img, Rect rec, Scalar color, int thickness)
rec
parameter as alternative specification of the drawn rectangle: `r.tl() and
r.br()-Point(1,1)` are opposite cornersimg
- automatically generatedrec
- automatically generatedcolor
- automatically generatedthickness
- automatically generatedpublic static void rectangle(Mat img, Rect rec, Scalar color)
rec
parameter as alternative specification of the drawn rectangle: `r.tl() and
r.br()-Point(1,1)` are opposite cornersimg
- automatically generatedrec
- automatically generatedcolor
- automatically generatedpublic static void remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation, int borderMode, Scalar borderValue)
src
- Source image.dst
- Destination image. It has the same size as map1 and the same type as src .map1
- The first map of either (x,y) points or just x values having the type CV_16SC2 ,
CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point
representation to fixed-point for speed.map2
- The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map
if map1 is (x,y) points), respectively.interpolation
- Interpolation method (see #InterpolationFlags). The method #INTER_AREA is
not supported by this function.borderMode
- Pixel extrapolation method (see #BorderTypes). When
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that
corresponds to the "outliers" in the source image are not modified by the function.borderValue
- Value used in case of a constant border. By default, it is 0.
Note:
Due to current implementation limitations the size of an input and output images should be less than 32767x32767.public static void remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation, int borderMode)
src
- Source image.dst
- Destination image. It has the same size as map1 and the same type as src .map1
- The first map of either (x,y) points or just x values having the type CV_16SC2 ,
CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point
representation to fixed-point for speed.map2
- The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map
if map1 is (x,y) points), respectively.interpolation
- Interpolation method (see #InterpolationFlags). The method #INTER_AREA is
not supported by this function.borderMode
- Pixel extrapolation method (see #BorderTypes). When
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that
corresponds to the "outliers" in the source image are not modified by the function.
Note:
Due to current implementation limitations the size of an input and output images should be less than 32767x32767.public static void remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation)
src
- Source image.dst
- Destination image. It has the same size as map1 and the same type as src .map1
- The first map of either (x,y) points or just x values having the type CV_16SC2 ,
CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point
representation to fixed-point for speed.map2
- The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map
if map1 is (x,y) points), respectively.interpolation
- Interpolation method (see #InterpolationFlags). The method #INTER_AREA is
not supported by this function.
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that
corresponds to the "outliers" in the source image are not modified by the function.
Note:
Due to current implementation limitations the size of an input and output images should be less than 32767x32767.public static void resize(Mat src, Mat dst, Size dsize, double fx, double fy, int interpolation)
src
,dsize
,fx
, and fy
. If you want to resize src so that it fits the pre-created dst,
you may call the function as follows:
// explicitly specify dsize=dst.size(); fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);
If you want to decimate the image by factor of 2 in each direction, you can call the function this
way:
// specify fx and fy and let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);
To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to
enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR
(faster but still looks OK).src
- input image.dst
- output image; it has the size dsize (when it is non-zero) or the size computed from
src.size(), fx, and fy; the type of dst is the same as of src.dsize
- output image size; if it equals zero, it is computed as:
\(\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\)
Either dsize or both fx and fy must be non-zero.fx
- scale factor along the horizontal axis; when it equals 0, it is computed as
\(\texttt{(double)dsize.width/src.cols}\)fy
- scale factor along the vertical axis; when it equals 0, it is computed as
\(\texttt{(double)dsize.height/src.rows}\)interpolation
- interpolation method, see #InterpolationFlags
SEE: warpAffine, warpPerspective, remappublic static void resize(Mat src, Mat dst, Size dsize, double fx, double fy)
src
,dsize
,fx
, and fy
. If you want to resize src so that it fits the pre-created dst,
you may call the function as follows:
// explicitly specify dsize=dst.size(); fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);
If you want to decimate the image by factor of 2 in each direction, you can call the function this
way:
// specify fx and fy and let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);
To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to
enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR
(faster but still looks OK).src
- input image.dst
- output image; it has the size dsize (when it is non-zero) or the size computed from
src.size(), fx, and fy; the type of dst is the same as of src.dsize
- output image size; if it equals zero, it is computed as:
\(\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\)
Either dsize or both fx and fy must be non-zero.fx
- scale factor along the horizontal axis; when it equals 0, it is computed as
\(\texttt{(double)dsize.width/src.cols}\)fy
- scale factor along the vertical axis; when it equals 0, it is computed as
\(\texttt{(double)dsize.height/src.rows}\)
SEE: warpAffine, warpPerspective, remappublic static void resize(Mat src, Mat dst, Size dsize, double fx)
src
,dsize
,fx
, and fy
. If you want to resize src so that it fits the pre-created dst,
you may call the function as follows:
// explicitly specify dsize=dst.size(); fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);
If you want to decimate the image by factor of 2 in each direction, you can call the function this
way:
// specify fx and fy and let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);
To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to
enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR
(faster but still looks OK).src
- input image.dst
- output image; it has the size dsize (when it is non-zero) or the size computed from
src.size(), fx, and fy; the type of dst is the same as of src.dsize
- output image size; if it equals zero, it is computed as:
\(\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\)
Either dsize or both fx and fy must be non-zero.fx
- scale factor along the horizontal axis; when it equals 0, it is computed as
\(\texttt{(double)dsize.width/src.cols}\)
\(\texttt{(double)dsize.height/src.rows}\)
SEE: warpAffine, warpPerspective, remappublic static void resize(Mat src, Mat dst, Size dsize)
src
,dsize
,fx
, and fy
. If you want to resize src so that it fits the pre-created dst,
you may call the function as follows:
// explicitly specify dsize=dst.size(); fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);
If you want to decimate the image by factor of 2 in each direction, you can call the function this
way:
// specify fx and fy and let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);
To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to
enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR
(faster but still looks OK).src
- input image.dst
- output image; it has the size dsize (when it is non-zero) or the size computed from
src.size(), fx, and fy; the type of dst is the same as of src.dsize
- output image size; if it equals zero, it is computed as:
\(\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\)
Either dsize or both fx and fy must be non-zero.
\(\texttt{(double)dsize.width/src.cols}\)
\(\texttt{(double)dsize.height/src.rows}\)
SEE: warpAffine, warpPerspective, remappublic static void sepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor, double delta, int borderType)
src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Destination image depth, see REF: filter_depths "combinations"kernelX
- Coefficients for filtering each row.kernelY
- Coefficients for filtering each column.anchor
- Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor
is at the kernel center.delta
- Value added to the filtered results before storing them.borderType
- Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: filter2D, Sobel, GaussianBlur, boxFilter, blurpublic static void sepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor, double delta)
src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Destination image depth, see REF: filter_depths "combinations"kernelX
- Coefficients for filtering each row.kernelY
- Coefficients for filtering each column.anchor
- Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor
is at the kernel center.delta
- Value added to the filtered results before storing them.
SEE: filter2D, Sobel, GaussianBlur, boxFilter, blurpublic static void sepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor)
src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Destination image depth, see REF: filter_depths "combinations"kernelX
- Coefficients for filtering each row.kernelY
- Coefficients for filtering each column.anchor
- Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor
is at the kernel center.
SEE: filter2D, Sobel, GaussianBlur, boxFilter, blurpublic static void sepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY)
src
- Source image.dst
- Destination image of the same size and the same number of channels as src .ddepth
- Destination image depth, see REF: filter_depths "combinations"kernelX
- Coefficients for filtering each row.kernelY
- Coefficients for filtering each column.
is at the kernel center.
SEE: filter2D, Sobel, GaussianBlur, boxFilter, blurpublic static void spatialGradient(Mat src, Mat dx, Mat dy, int ksize, int borderType)
Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
src
- input image.dx
- output image with first-order derivative in x.dy
- output image with first-order derivative in y.ksize
- size of Sobel kernel. It must be 3.borderType
- pixel extrapolation method, see #BorderTypes.
Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.
SEE: Sobelpublic static void spatialGradient(Mat src, Mat dx, Mat dy, int ksize)
Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
src
- input image.dx
- output image with first-order derivative in x.dy
- output image with first-order derivative in y.ksize
- size of Sobel kernel. It must be 3.
Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.
SEE: Sobelpublic static void spatialGradient(Mat src, Mat dx, Mat dy)
Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
src
- input image.dx
- output image with first-order derivative in x.dy
- output image with first-order derivative in y.
Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.
SEE: Sobelpublic static void sqrBoxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor, boolean normalize, int borderType)
src
- input imagedst
- output image of the same size and type as _srcddepth
- the output image depth (-1 to use src.depth())ksize
- kernel sizeanchor
- kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
center.normalize
- flag, specifying whether the kernel is to be normalized by it's area or not.borderType
- border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
SEE: boxFilterpublic static void sqrBoxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor, boolean normalize)
src
- input imagedst
- output image of the same size and type as _srcddepth
- the output image depth (-1 to use src.depth())ksize
- kernel sizeanchor
- kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
center.normalize
- flag, specifying whether the kernel is to be normalized by it's area or not.
SEE: boxFilterpublic static void sqrBoxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor)
src
- input imagedst
- output image of the same size and type as _srcddepth
- the output image depth (-1 to use src.depth())ksize
- kernel sizeanchor
- kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
center.
SEE: boxFilterpublic static void sqrBoxFilter(Mat src, Mat dst, int ddepth, Size ksize)
src
- input imagedst
- output image of the same size and type as _srcddepth
- the output image depth (-1 to use src.depth())ksize
- kernel size
center.
SEE: boxFilterpublic static void warpAffine(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode, Scalar borderValue)
src
- input image.dst
- output image that has the size dsize and the same type as src .M
- \(2\times 3\) transformation matrix.dsize
- size of the output image.flags
- combination of interpolation methods (see #InterpolationFlags) and the optional
flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
\(\texttt{dst}\rightarrow\texttt{src}\) ).borderMode
- pixel extrapolation method (see #BorderTypes); when
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
the "outliers" in the source image are not modified by the function.borderValue
- value used in case of a constant border; by default, it is 0.
SEE: warpPerspective, resize, remap, getRectSubPix, transformpublic static void warpAffine(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode)
src
- input image.dst
- output image that has the size dsize and the same type as src .M
- \(2\times 3\) transformation matrix.dsize
- size of the output image.flags
- combination of interpolation methods (see #InterpolationFlags) and the optional
flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
\(\texttt{dst}\rightarrow\texttt{src}\) ).borderMode
- pixel extrapolation method (see #BorderTypes); when
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
the "outliers" in the source image are not modified by the function.
SEE: warpPerspective, resize, remap, getRectSubPix, transformpublic static void warpAffine(Mat src, Mat dst, Mat M, Size dsize, int flags)
src
- input image.dst
- output image that has the size dsize and the same type as src .M
- \(2\times 3\) transformation matrix.dsize
- size of the output image.flags
- combination of interpolation methods (see #InterpolationFlags) and the optional
flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
\(\texttt{dst}\rightarrow\texttt{src}\) ).
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
the "outliers" in the source image are not modified by the function.
SEE: warpPerspective, resize, remap, getRectSubPix, transformpublic static void warpAffine(Mat src, Mat dst, Mat M, Size dsize)
src
- input image.dst
- output image that has the size dsize and the same type as src .M
- \(2\times 3\) transformation matrix.dsize
- size of the output image.
flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
\(\texttt{dst}\rightarrow\texttt{src}\) ).
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
the "outliers" in the source image are not modified by the function.
SEE: warpPerspective, resize, remap, getRectSubPix, transformpublic static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode, Scalar borderValue)
src
- input image.dst
- output image that has the size dsize and the same type as src .M
- \(3\times 3\) transformation matrix.dsize
- size of the output image.flags
- combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the
optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
\(\texttt{dst}\rightarrow\texttt{src}\) ).borderMode
- pixel extrapolation method (#BORDER_CONSTANT or #BORDER_REPLICATE).borderValue
- value used in case of a constant border; by default, it equals 0.
SEE: warpAffine, resize, remap, getRectSubPix, perspectiveTransformpublic static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode)
src
- input image.dst
- output image that has the size dsize and the same type as src .M
- \(3\times 3\) transformation matrix.dsize
- size of the output image.flags
- combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the
optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
\(\texttt{dst}\rightarrow\texttt{src}\) ).borderMode
- pixel extrapolation method (#BORDER_CONSTANT or #BORDER_REPLICATE).
SEE: warpAffine, resize, remap, getRectSubPix, perspectiveTransformpublic static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize, int flags)
src
- input image.dst
- output image that has the size dsize and the same type as src .M
- \(3\times 3\) transformation matrix.dsize
- size of the output image.flags
- combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the
optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
\(\texttt{dst}\rightarrow\texttt{src}\) ).
SEE: warpAffine, resize, remap, getRectSubPix, perspectiveTransformpublic static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize)
src
- input image.dst
- output image that has the size dsize and the same type as src .M
- \(3\times 3\) transformation matrix.dsize
- size of the output image.
optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
\(\texttt{dst}\rightarrow\texttt{src}\) ).
SEE: warpAffine, resize, remap, getRectSubPix, perspectiveTransformpublic static void warpPolar(Mat src, Mat dst, Size dsize, Point center, double maxRadius, int flags)
flags
to specify the polar mapping mode.
Linear is the default mode.
The semilog mapping emulates the human "foveal" vision that permit very high acuity on the line of sight (central vision)
in contrast to peripheral vision where acuity is minor.
\par Option on dsize
:
dsize <=0
(default),
the destination image will have (almost) same area of source bounding circle:
\(\begin{array}{l}
dsize.area \leftarrow (maxRadius^2 \cdot \Pi) \\
dsize.width = \texttt{cvRound}(maxRadius) \\
dsize.height = \texttt{cvRound}(maxRadius \cdot \Pi) \\
\end{array}\)
dsize.height <= 0
,
the destination image area will be proportional to the bounding circle area but scaled by Kx * Kx
:
\(\begin{array}{l}
dsize.height = \texttt{cvRound}(dsize.width \cdot \Pi) \\
\end{array}
\)
dsize > 0
,
the destination image will have the given size therefore the area of the bounding circle will be scaled to dsize
.
flags
\snippet polar_transforms.cpp InverseMap
In addiction, to calculate the original coordinate from a polar mapped coordinate \((rho, phi)->(x, y)\):
\snippet polar_transforms.cpp InverseCoordinatesrc
- Source image.dst
- Destination image. It will have same type as src.dsize
- The destination image size (see description for valid options).center
- The transformation center.maxRadius
- The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.flags
- A combination of interpolation methods, #InterpolationFlags + #WarpPolarMode.
public static void watershed(Mat image, Mat markers)
image
- Input 8-bit 3-channel image.markers
- Input/output 32-bit single-channel image (map) of markers. It should have the same
size as image .
SEE: findContours
imgproc_miscCopyright © 2020. All rights reserved.