OpenCV 2.4.2

org.opencv.core
Class Core

java.lang.Object
  extended by org.opencv.core.Core

public class Core
extends java.lang.Object


Nested Class Summary
static class Core.MinMaxLocResult
           
 
Field Summary
static int CMP_EQ
           
static int CMP_GE
           
static int CMP_GT
           
static int CMP_LE
           
static int CMP_LT
           
static int CMP_NE
           
static int COVAR_COLS
           
static int COVAR_NORMAL
           
static int COVAR_ROWS
           
static int COVAR_SCALE
           
static int COVAR_SCRAMBLED
           
static int COVAR_USE_AVG
           
static int DCT_INVERSE
           
static int DCT_ROWS
           
static int DECOMP_CHOLESKY
           
static int DECOMP_EIG
           
static int DECOMP_LU
           
static int DECOMP_NORMAL
           
static int DECOMP_QR
           
static int DECOMP_SVD
           
static int DEPTH_MASK
           
static int DEPTH_MASK_16S
           
static int DEPTH_MASK_16U
           
static int DEPTH_MASK_32F
           
static int DEPTH_MASK_32S
           
static int DEPTH_MASK_64F
           
static int DEPTH_MASK_8S
           
static int DEPTH_MASK_8U
           
static int DEPTH_MASK_ALL
           
static int DEPTH_MASK_ALL_BUT_8S
           
static int DEPTH_MASK_FLT
           
static int DFT_COMPLEX_OUTPUT
           
static int DFT_INVERSE
           
static int DFT_REAL_OUTPUT
           
static int DFT_ROWS
           
static int DFT_SCALE
           
static int FILLED
           
static int FONT_HERSHEY_COMPLEX
           
static int FONT_HERSHEY_COMPLEX_SMALL
           
static int FONT_HERSHEY_DUPLEX
           
static int FONT_HERSHEY_PLAIN
           
static int FONT_HERSHEY_SCRIPT_COMPLEX
           
static int FONT_HERSHEY_SCRIPT_SIMPLEX
           
static int FONT_HERSHEY_SIMPLEX
           
static int FONT_HERSHEY_TRIPLEX
           
static int FONT_ITALIC
           
static int GEMM_1_T
           
static int GEMM_2_T
           
static int GEMM_3_T
           
static int KMEANS_PP_CENTERS
           
static int KMEANS_RANDOM_CENTERS
           
static int KMEANS_USE_INITIAL_LABELS
           
static int LINE_4
           
static int LINE_8
           
static int LINE_AA
           
static int MAGIC_MASK
           
static int NORM_HAMMING
           
static int NORM_HAMMING2
           
static int NORM_INF
           
static int NORM_L1
           
static int NORM_L2
           
static int NORM_L2SQR
           
static int NORM_MINMAX
           
static int NORM_RELATIVE
           
static int NORM_TYPE_MASK
           
static int REDUCE_AVG
           
static int REDUCE_MAX
           
static int REDUCE_MIN
           
static int REDUCE_SUM
           
static int SORT_ASCENDING
           
static int SORT_DESCENDING
           
static int SORT_EVERY_COLUMN
           
static int SORT_EVERY_ROW
           
static int SVD_FULL_UV
           
static int SVD_MODIFY_A
           
static int SVD_NO_UV
           
static int TYPE_MASK
           
 
Constructor Summary
Core()
           
 
Method Summary
static void absdiff(Mat src1, Mat src2, Mat dst)
          Computes the per-element absolute difference between two arrays or between an array and a scalar.
static void absdiff(Mat src1, Scalar src2, Mat dst)
          Computes the per-element absolute difference between two arrays or between an array and a scalar.
static void add(Mat src1, Mat src2, Mat dst)
          Computes the per-element sum of two arrays or an array and a scalar.
static void add(Mat src1, Mat src2, Mat dst, Mat mask)
          Computes the per-element sum of two arrays or an array and a scalar.
static void add(Mat src1, Mat src2, Mat dst, Mat mask, int dtype)
          Computes the per-element sum of two arrays or an array and a scalar.
static void add(Mat src1, Scalar src2, Mat dst)
          Computes the per-element sum of two arrays or an array and a scalar.
static void add(Mat src1, Scalar src2, Mat dst, Mat mask)
          Computes the per-element sum of two arrays or an array and a scalar.
static void add(Mat src1, Scalar src2, Mat dst, Mat mask, int dtype)
          Computes the per-element sum of two arrays or an array and a scalar.
static void addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst)
          Computes the weighted sum of two arrays.
static void addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst, int dtype)
          Computes the weighted sum of two arrays.
static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx)
           
static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K)
           
static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask, int update, boolean crosscheck)
           
static void bitwise_and(Mat src1, Mat src2, Mat dst)
          Calculates the per-element bit-wise conjunction of two arrays or an array and a scalar.
static void bitwise_and(Mat src1, Mat src2, Mat dst, Mat mask)
          Calculates the per-element bit-wise conjunction of two arrays or an array and a scalar.
static void bitwise_not(Mat src, Mat dst)
          Inverts every bit of an array.
static void bitwise_not(Mat src, Mat dst, Mat mask)
          Inverts every bit of an array.
static void bitwise_or(Mat src1, Mat src2, Mat dst)
          Calculates the per-element bit-wise disjunction of two arrays or an array and a scalar.
static void bitwise_or(Mat src1, Mat src2, Mat dst, Mat mask)
          Calculates the per-element bit-wise disjunction of two arrays or an array and a scalar.
static void bitwise_xor(Mat src1, Mat src2, Mat dst)
          Calculates the per-element bit-wise "exclusive or" operation on two arrays or an array and a scalar.
static void bitwise_xor(Mat src1, Mat src2, Mat dst, Mat mask)
          Calculates the per-element bit-wise "exclusive or" operation on two arrays or an array and a scalar.
static void calcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags)
          Calculates the covariance matrix of a set of vectors.
static void calcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags, int ctype)
          Calculates the covariance matrix of a set of vectors.
static void cartToPolar(Mat x, Mat y, Mat magnitude, Mat angle)
          Calculates the magnitude and angle of 2D vectors.
static void cartToPolar(Mat x, Mat y, Mat magnitude, Mat angle, boolean angleInDegrees)
          Calculates the magnitude and angle of 2D vectors.
static boolean checkRange(Mat a)
          Checks every element of an input array for invalid values.
static boolean checkRange(Mat a, boolean quiet, double minVal, double maxVal)
          Checks every element of an input array for invalid values.
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, int shift)
          Draws a circle.
static boolean clipLine(Rect imgRect, Point pt1, Point pt2)
          Clips the line against the image rectangle.
static void compare(Mat src1, Mat src2, Mat dst, int cmpop)
          Performs the per-element comparison of two arrays or an array and scalar value.
static void compare(Mat src1, Scalar src2, Mat dst, int cmpop)
          Performs the per-element comparison of two arrays or an array and scalar value.
static void completeSymm(Mat mtx)
          Copies the lower or the upper half of a square matrix to another half.
static void completeSymm(Mat mtx, boolean lowerToUpper)
          Copies the lower or the upper half of a square matrix to another half.
static void convertScaleAbs(Mat src, Mat dst)
          Scales, computes absolute values, and converts the result to 8-bit.
static void convertScaleAbs(Mat src, Mat dst, double alpha, double beta)
          Scales, computes absolute values, and converts the result to 8-bit.
static int countNonZero(Mat src)
          Counts non-zero array elements.
static float cubeRoot(float val)
          Computes the cube root of an argument.
static void dct(Mat src, Mat dst)
          Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
static void dct(Mat src, Mat dst, int flags)
          Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
static double determinant(Mat mtx)
          Returns the determinant of a square floating-point matrix.
static void dft(Mat src, Mat dst)
          Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
static void dft(Mat src, Mat dst, int flags, int nonzeroRows)
          Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
static void divide(double scale, Mat src2, Mat dst)
          Performs per-element division of two arrays or a scalar by an array.
static void divide(double scale, Mat src2, Mat dst, int dtype)
          Performs per-element division of two arrays or a scalar by an array.
static void divide(Mat src1, Mat src2, Mat dst)
          Performs per-element division of two arrays or a scalar by an array.
static void divide(Mat src1, Mat src2, Mat dst, double scale)
          Performs per-element division of two arrays or a scalar by an array.
static void divide(Mat src1, Mat src2, Mat dst, double scale, int dtype)
          Performs per-element division of two arrays or a scalar by an array.
static void divide(Mat src1, Scalar src2, Mat dst)
          Performs per-element division of two arrays or a scalar by an array.
static void divide(Mat src1, Scalar src2, Mat dst, double scale)
          Performs per-element division of two arrays or a scalar by an array.
static void divide(Mat src1, Scalar src2, Mat dst, double scale, int dtype)
          Performs per-element division of two arrays or a scalar by an array.
static boolean eigen(Mat src, boolean computeEigenvectors, Mat eigenvalues, Mat eigenvectors)
          Computes eigenvalues and eigenvectors of a symmetric matrix.
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, int shift)
          Draws a simple or thick elliptic arc or fills an ellipse sector.
static void ellipse(Mat img, RotatedRect box, Scalar color)
          Draws a simple or thick elliptic arc or fills an ellipse sector.
static void ellipse(Mat img, RotatedRect box, Scalar color, int thickness)
          Draws a simple or thick elliptic arc or fills an ellipse sector.
static void ellipse(Mat img, RotatedRect box, Scalar color, int thickness, int lineType)
          Draws a simple or thick elliptic arc or fills an ellipse sector.
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 void exp(Mat src, Mat dst)
          Calculates the exponent of every array element.
static void extractChannel(Mat src, Mat dst, int coi)
           
static float fastAtan2(float y, float x)
          Calculates the angle of a 2D vector in degrees.
static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color)
          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, java.util.List<MatOfPoint> pts, Scalar color)
          Fills the area bounded by one or more polygons.
static void fillPoly(Mat img, java.util.List<MatOfPoint> pts, Scalar color, int lineType, int shift, Point offset)
          Fills the area bounded by one or more polygons.
static void flip(Mat src, Mat dst, int flipCode)
          Flips a 2D array around vertical, horizontal, or both axes.
static void gemm(Mat src1, Mat src2, double alpha, Mat src3, double gamma, Mat dst)
          Performs generalized matrix multiplication.
static void gemm(Mat src1, Mat src2, double alpha, Mat src3, double gamma, Mat dst, int flags)
          Performs generalized matrix multiplication.
static java.lang.String getBuildInformation()
           
static long getCPUTickCount()
          Returns the number of CPU ticks.
static int getNumberOfCPUs()
           
static int getOptimalDFTSize(int vecsize)
          Returns the optimal DFT size for a given vector size.
static Size getTextSize(java.lang.String text, int fontFace, double fontScale, int thickness, int[] baseLine)
          Calculates the width and height of a text string.
static long getTickCount()
          Returns the number of ticks.
static double getTickFrequency()
          Returns the number of ticks per second.
static void hconcat(java.util.List<Mat> src, Mat dst)
           
static void idct(Mat src, Mat dst)
          Computes the inverse Discrete Cosine Transform of a 1D or 2D array.
static void idct(Mat src, Mat dst, int flags)
          Computes the inverse Discrete Cosine Transform of a 1D or 2D array.
static void idft(Mat src, Mat dst)
          Computes the inverse Discrete Fourier Transform of a 1D or 2D array.
static void idft(Mat src, Mat dst, int flags, int nonzeroRows)
          Computes the inverse Discrete Fourier Transform of a 1D or 2D array.
static void inRange(Mat src, Scalar lowerb, Scalar upperb, Mat dst)
          Checks if array elements lie between the elements of two other arrays.
static void insertChannel(Mat src, Mat dst, int coi)
           
static double invert(Mat src, Mat dst)
          Finds the inverse or pseudo-inverse of a matrix.
static double invert(Mat src, Mat dst, int flags)
          Finds the inverse or pseudo-inverse of a matrix.
static double kmeans(Mat data, int K, Mat bestLabels, TermCriteria criteria, int attempts, int flags)
          Finds centers of clusters and groups input samples around the clusters.
static double kmeans(Mat data, int K, Mat bestLabels, TermCriteria criteria, int attempts, int flags, Mat centers)
          Finds centers of clusters and groups input samples around the clusters.
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, int shift)
          Draws a line segment connecting two points.
static void log(Mat src, Mat dst)
          Calculates the natural logarithm of every array element.
static void LUT(Mat src, Mat lut, Mat dst)
          Performs a look-up table transform of an array.
static void LUT(Mat src, Mat lut, Mat dst, int interpolation)
          Performs a look-up table transform of an array.
static void magnitude(Mat x, Mat y, Mat magnitude)
          Calculates the magnitude of 2D vectors.
static double Mahalanobis(Mat v1, Mat v2, Mat icovar)
          Calculates the Mahalanobis distance between two vectors.
static void max(Mat src1, Mat src2, Mat dst)
          Calculates per-element maximum of two arrays or an array and a scalar.
static void max(Mat src1, Scalar src2, Mat dst)
          Calculates per-element maximum of two arrays or an array and a scalar.
static Scalar mean(Mat src)
          Calculates an average (mean) of array elements.
static Scalar mean(Mat src, Mat mask)
          Calculates an average (mean) of array elements.
static void meanStdDev(Mat src, MatOfDouble mean, MatOfDouble stddev)
          Calculates a mean and standard deviation of array elements.
static void meanStdDev(Mat src, MatOfDouble mean, MatOfDouble stddev, Mat mask)
          Calculates a mean and standard deviation of array elements.
static void merge(java.util.List<Mat> mv, Mat dst)
          Composes a multi-channel array from several single-channel arrays.
static void min(Mat src1, Mat src2, Mat dst)
          Calculates per-element minimum of two arrays or array and a scalar.
static void min(Mat src1, Scalar src2, Mat dst)
          Calculates per-element minimum of two arrays or array and a scalar.
static Core.MinMaxLocResult minMaxLoc(Mat src)
          Finds the global minimum and maximum in an array.
static Core.MinMaxLocResult minMaxLoc(Mat src, Mat mask)
          Finds the global minimum and maximum in an array.
static void mixChannels(java.util.List<Mat> src, java.util.List<Mat> dst, MatOfInt fromTo)
          Copies specified channels from input arrays to the specified channels of output arrays.
static void mulSpectrums(Mat a, Mat b, Mat c, int flags)
          Performs the per-element multiplication of two Fourier spectrums.
static void mulSpectrums(Mat a, Mat b, Mat c, int flags, boolean conjB)
          Performs the per-element multiplication of two Fourier spectrums.
static void multiply(Mat src1, Mat src2, Mat dst)
          Calculates the per-element scaled product of two arrays.
static void multiply(Mat src1, Mat src2, Mat dst, double scale)
          Calculates the per-element scaled product of two arrays.
static void multiply(Mat src1, Mat src2, Mat dst, double scale, int dtype)
          Calculates the per-element scaled product of two arrays.
static void multiply(Mat src1, Scalar src2, Mat dst)
          Calculates the per-element scaled product of two arrays.
static void multiply(Mat src1, Scalar src2, Mat dst, double scale)
          Calculates the per-element scaled product of two arrays.
static void multiply(Mat src1, Scalar src2, Mat dst, double scale, int dtype)
          Calculates the per-element scaled product of two arrays.
static void mulTransposed(Mat src, Mat dst, boolean aTa)
          Calculates the product of a matrix and its transposition.
static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta, double scale)
          Calculates the product of a matrix and its transposition.
static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta, double scale, int dtype)
          Calculates the product of a matrix and its transposition.
static double norm(Mat src1)
          Calculates an absolute array norm, an absolute difference norm, or a relative difference norm.
static double norm(Mat src1, int normType)
          Calculates an absolute array norm, an absolute difference norm, or a relative difference norm.
static double norm(Mat src1, int normType, Mat mask)
          Calculates an absolute array norm, an absolute difference norm, or a relative difference norm.
static double norm(Mat src1, Mat src2)
          Calculates an absolute array norm, an absolute difference norm, or a relative difference norm.
static double norm(Mat src1, Mat src2, int normType)
          Calculates an absolute array norm, an absolute difference norm, or a relative difference norm.
static double norm(Mat src1, Mat src2, int normType, Mat mask)
          Calculates an absolute array norm, an absolute difference norm, or a relative difference norm.
static void normalize(Mat src, Mat dst)
          Normalizes the norm or value range of an array.
static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type)
          Normalizes the norm or value range of an array.
static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type, int dtype)
          Normalizes the norm or value range of an array.
static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type, int dtype, Mat mask)
          Normalizes the norm or value range of an array.
static void patchNaNs(Mat a)
           
static void patchNaNs(Mat a, double val)
           
static void PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat result)
           
static void PCACompute(Mat data, Mat mean, Mat eigenvectors)
           
static void PCACompute(Mat data, Mat mean, Mat eigenvectors, int maxComponents)
           
static void PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat result)
           
static void perspectiveTransform(Mat src, Mat dst, Mat m)
          Performs the perspective matrix transformation of vectors.
static void phase(Mat x, Mat y, Mat angle)
          Calculates the rotation angle of 2D vectors.
static void phase(Mat x, Mat y, Mat angle, boolean angleInDegrees)
          Calculates the rotation angle of 2D vectors.
static void polarToCart(Mat magnitude, Mat angle, Mat x, Mat y)
          Computes x and y coordinates of 2D vectors from their magnitude and angle.
static void polarToCart(Mat magnitude, Mat angle, Mat x, Mat y, boolean angleInDegrees)
          Computes x and y coordinates of 2D vectors from their magnitude and angle.
static void polylines(Mat img, java.util.List<MatOfPoint> pts, boolean isClosed, Scalar color)
          Draws several polygonal curves.
static void polylines(Mat img, java.util.List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness)
          Draws several polygonal curves.
static void polylines(Mat img, java.util.List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness, int lineType, int shift)
          Draws several polygonal curves.
static void pow(Mat src, double power, Mat dst)
          Raises every array element to a power.
static void putText(Mat img, java.lang.String text, Point org, int fontFace, double fontScale, Scalar color)
          Draws a text string.
static void putText(Mat img, java.lang.String text, Point org, int fontFace, double fontScale, Scalar color, int thickness)
          Draws a text string.
static void putText(Mat img, java.lang.String text, Point org, int fontFace, double fontScale, Scalar color, int thickness, int lineType, boolean bottomLeftOrigin)
          Draws a text string.
static void randn(Mat dst, double mean, double stddev)
          Fills the array with normally distributed random numbers.
static void randShuffle(Mat dst)
           
static void randShuffle(Mat dst, double iterFactor)
           
static void randu(Mat dst, double low, double high)
          Generates a single uniformly-distributed random number or an array of random numbers.
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, int shift)
          Draws a simple, thick, or filled up-right rectangle.
static void reduce(Mat src, Mat dst, int dim, int rtype)
          Reduces a matrix to a vector.
static void reduce(Mat src, Mat dst, int dim, int rtype, int dtype)
          Reduces a matrix to a vector.
static void repeat(Mat src, int ny, int nx, Mat dst)
          Fills the destination array with repeated copies of the source array.
static void scaleAdd(Mat src1, double alpha, Mat src2, Mat dst)
          Calculates the sum of a scaled array and another array.
static void setIdentity(Mat mtx)
          Initializes a scaled identity matrix.
static void setIdentity(Mat mtx, Scalar s)
          Initializes a scaled identity matrix.
static boolean solve(Mat src1, Mat src2, Mat dst)
          Solves one or more linear systems or least-squares problems.
static boolean solve(Mat src1, Mat src2, Mat dst, int flags)
          Solves one or more linear systems or least-squares problems.
static int solveCubic(Mat coeffs, Mat roots)
          Finds the real roots of a cubic equation.
static double solvePoly(Mat coeffs, Mat roots)
          Finds the real or complex roots of a polynomial equation.
static double solvePoly(Mat coeffs, Mat roots, int maxIters)
          Finds the real or complex roots of a polynomial equation.
static void sort(Mat src, Mat dst, int flags)
          Sorts each row or each column of a matrix.
static void sortIdx(Mat src, Mat dst, int flags)
          Sorts each row or each column of a matrix.
static void split(Mat m, java.util.List<Mat> mv)
          Divides a multi-channel array into several single-channel arrays.
static void sqrt(Mat src, Mat dst)
          Calculates a square root of array elements.
static void subtract(Mat src1, Mat src2, Mat dst)
          Calculates the per-element difference between two arrays or array and a scalar.
static void subtract(Mat src1, Mat src2, Mat dst, Mat mask)
          Calculates the per-element difference between two arrays or array and a scalar.
static void subtract(Mat src1, Mat src2, Mat dst, Mat mask, int dtype)
          Calculates the per-element difference between two arrays or array and a scalar.
static void subtract(Mat src1, Scalar src2, Mat dst)
          Calculates the per-element difference between two arrays or array and a scalar.
static void subtract(Mat src1, Scalar src2, Mat dst, Mat mask)
          Calculates the per-element difference between two arrays or array and a scalar.
static void subtract(Mat src1, Scalar src2, Mat dst, Mat mask, int dtype)
          Calculates the per-element difference between two arrays or array and a scalar.
static Scalar sumElems(Mat src)
          Calculates the sum of array elements.
static void SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat dst)
           
static void SVDecomp(Mat src, Mat w, Mat u, Mat vt)
           
static void SVDecomp(Mat src, Mat w, Mat u, Mat vt, int flags)
           
static Scalar trace(Mat mtx)
          Returns the trace of a matrix.
static void transform(Mat src, Mat dst, Mat m)
          Performs the matrix transformation of every array element.
static void transpose(Mat src, Mat dst)
          Transposes a matrix.
static void vconcat(java.util.List<Mat> src, Mat dst)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CMP_EQ

public static final int CMP_EQ
See Also:
Constant Field Values

CMP_GE

public static final int CMP_GE
See Also:
Constant Field Values

CMP_GT

public static final int CMP_GT
See Also:
Constant Field Values

CMP_LE

public static final int CMP_LE
See Also:
Constant Field Values

CMP_LT

public static final int CMP_LT
See Also:
Constant Field Values

CMP_NE

public static final int CMP_NE
See Also:
Constant Field Values

COVAR_COLS

public static final int COVAR_COLS
See Also:
Constant Field Values

COVAR_NORMAL

public static final int COVAR_NORMAL
See Also:
Constant Field Values

COVAR_ROWS

public static final int COVAR_ROWS
See Also:
Constant Field Values

COVAR_SCALE

public static final int COVAR_SCALE
See Also:
Constant Field Values

COVAR_SCRAMBLED

public static final int COVAR_SCRAMBLED
See Also:
Constant Field Values

COVAR_USE_AVG

public static final int COVAR_USE_AVG
See Also:
Constant Field Values

DCT_INVERSE

public static final int DCT_INVERSE
See Also:
Constant Field Values

DCT_ROWS

public static final int DCT_ROWS
See Also:
Constant Field Values

DECOMP_CHOLESKY

public static final int DECOMP_CHOLESKY
See Also:
Constant Field Values

DECOMP_EIG

public static final int DECOMP_EIG
See Also:
Constant Field Values

DECOMP_LU

public static final int DECOMP_LU
See Also:
Constant Field Values

DECOMP_NORMAL

public static final int DECOMP_NORMAL
See Also:
Constant Field Values

DECOMP_QR

public static final int DECOMP_QR
See Also:
Constant Field Values

DECOMP_SVD

public static final int DECOMP_SVD
See Also:
Constant Field Values

DEPTH_MASK

public static final int DEPTH_MASK
See Also:
Constant Field Values

DEPTH_MASK_16S

public static final int DEPTH_MASK_16S
See Also:
Constant Field Values

DEPTH_MASK_16U

public static final int DEPTH_MASK_16U
See Also:
Constant Field Values

DEPTH_MASK_32F

public static final int DEPTH_MASK_32F
See Also:
Constant Field Values

DEPTH_MASK_32S

public static final int DEPTH_MASK_32S
See Also:
Constant Field Values

DEPTH_MASK_64F

public static final int DEPTH_MASK_64F
See Also:
Constant Field Values

DEPTH_MASK_8S

public static final int DEPTH_MASK_8S
See Also:
Constant Field Values

DEPTH_MASK_8U

public static final int DEPTH_MASK_8U
See Also:
Constant Field Values

DEPTH_MASK_ALL

public static final int DEPTH_MASK_ALL
See Also:
Constant Field Values

DEPTH_MASK_ALL_BUT_8S

public static final int DEPTH_MASK_ALL_BUT_8S
See Also:
Constant Field Values

DEPTH_MASK_FLT

public static final int DEPTH_MASK_FLT
See Also:
Constant Field Values

DFT_COMPLEX_OUTPUT

public static final int DFT_COMPLEX_OUTPUT
See Also:
Constant Field Values

DFT_INVERSE

public static final int DFT_INVERSE
See Also:
Constant Field Values

DFT_REAL_OUTPUT

public static final int DFT_REAL_OUTPUT
See Also:
Constant Field Values

DFT_ROWS

public static final int DFT_ROWS
See Also:
Constant Field Values

DFT_SCALE

public static final int DFT_SCALE
See Also:
Constant Field Values

FILLED

public static final int FILLED
See Also:
Constant Field Values

FONT_HERSHEY_COMPLEX

public static final int FONT_HERSHEY_COMPLEX
See Also:
Constant Field Values

FONT_HERSHEY_COMPLEX_SMALL

public static final int FONT_HERSHEY_COMPLEX_SMALL
See Also:
Constant Field Values

FONT_HERSHEY_DUPLEX

public static final int FONT_HERSHEY_DUPLEX
See Also:
Constant Field Values

FONT_HERSHEY_PLAIN

public static final int FONT_HERSHEY_PLAIN
See Also:
Constant Field Values

FONT_HERSHEY_SCRIPT_COMPLEX

public static final int FONT_HERSHEY_SCRIPT_COMPLEX
See Also:
Constant Field Values

FONT_HERSHEY_SCRIPT_SIMPLEX

public static final int FONT_HERSHEY_SCRIPT_SIMPLEX
See Also:
Constant Field Values

FONT_HERSHEY_SIMPLEX

public static final int FONT_HERSHEY_SIMPLEX
See Also:
Constant Field Values

FONT_HERSHEY_TRIPLEX

public static final int FONT_HERSHEY_TRIPLEX
See Also:
Constant Field Values

FONT_ITALIC

public static final int FONT_ITALIC
See Also:
Constant Field Values

GEMM_1_T

public static final int GEMM_1_T
See Also:
Constant Field Values

GEMM_2_T

public static final int GEMM_2_T
See Also:
Constant Field Values

GEMM_3_T

public static final int GEMM_3_T
See Also:
Constant Field Values

KMEANS_PP_CENTERS

public static final int KMEANS_PP_CENTERS
See Also:
Constant Field Values

KMEANS_RANDOM_CENTERS

public static final int KMEANS_RANDOM_CENTERS
See Also:
Constant Field Values

KMEANS_USE_INITIAL_LABELS

public static final int KMEANS_USE_INITIAL_LABELS
See Also:
Constant Field Values

LINE_4

public static final int LINE_4
See Also:
Constant Field Values

LINE_8

public static final int LINE_8
See Also:
Constant Field Values

LINE_AA

public static final int LINE_AA
See Also:
Constant Field Values

MAGIC_MASK

public static final int MAGIC_MASK
See Also:
Constant Field Values

NORM_HAMMING

public static final int NORM_HAMMING
See Also:
Constant Field Values

NORM_HAMMING2

public static final int NORM_HAMMING2
See Also:
Constant Field Values

NORM_INF

public static final int NORM_INF
See Also:
Constant Field Values

NORM_L1

public static final int NORM_L1
See Also:
Constant Field Values

NORM_L2

public static final int NORM_L2
See Also:
Constant Field Values

NORM_L2SQR

public static final int NORM_L2SQR
See Also:
Constant Field Values

NORM_MINMAX

public static final int NORM_MINMAX
See Also:
Constant Field Values

NORM_RELATIVE

public static final int NORM_RELATIVE
See Also:
Constant Field Values

NORM_TYPE_MASK

public static final int NORM_TYPE_MASK
See Also:
Constant Field Values

REDUCE_AVG

public static final int REDUCE_AVG
See Also:
Constant Field Values

REDUCE_MAX

public static final int REDUCE_MAX
See Also:
Constant Field Values

REDUCE_MIN

public static final int REDUCE_MIN
See Also:
Constant Field Values

REDUCE_SUM

public static final int REDUCE_SUM
See Also:
Constant Field Values

SORT_ASCENDING

public static final int SORT_ASCENDING
See Also:
Constant Field Values

SORT_DESCENDING

public static final int SORT_DESCENDING
See Also:
Constant Field Values

SORT_EVERY_COLUMN

public static final int SORT_EVERY_COLUMN
See Also:
Constant Field Values

SORT_EVERY_ROW

public static final int SORT_EVERY_ROW
See Also:
Constant Field Values

SVD_FULL_UV

public static final int SVD_FULL_UV
See Also:
Constant Field Values

SVD_MODIFY_A

public static final int SVD_MODIFY_A
See Also:
Constant Field Values

SVD_NO_UV

public static final int SVD_NO_UV
See Also:
Constant Field Values

TYPE_MASK

public static final int TYPE_MASK
See Also:
Constant Field Values
Constructor Detail

Core

public Core()
Method Detail

absdiff

public static void absdiff(Mat src1,
                           Mat src2,
                           Mat dst)

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

The function absdiff computes:

dst(I) = saturate(| src1(I) - src2(I)|)

dst(I) = saturate(| src1(I) - src2|)

dst(I) = saturate(| src1 - src2(I)|)

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

Note: Saturation is not applied when the arrays have the depth CV_32S. You may even get a negative value in the case of overflow.

Parameters:
src1 - First input array or a scalar.
src2 - Second input array or a scalar.
dst - Destination array that has the same size and type as src1 (or src2).
See Also:
org.opencv.core.Core.absdiff, org.opencv.core.Core#abs

absdiff

public static void absdiff(Mat src1,
                           Scalar src2,
                           Mat dst)

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

The function absdiff computes:

dst(I) = saturate(| src1(I) - src2(I)|)

dst(I) = saturate(| src1(I) - src2|)

dst(I) = saturate(| src1 - src2(I)|)

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

Note: Saturation is not applied when the arrays have the depth CV_32S. You may even get a negative value in the case of overflow.

Parameters:
src1 - First input array or a scalar.
src2 - Second input array or a scalar.
dst - Destination array that has the same size and type as src1 (or src2).
See Also:
org.opencv.core.Core.absdiff, org.opencv.core.Core#abs

add

public static void add(Mat src1,
                       Mat src2,
                       Mat dst)

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

The function add computes:

dst(I) = saturate(src1(I) + src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) + src2) if mask(I) != 0

dst(I) = saturate(src1 + src2(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case, the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1/src2.
See Also:
org.opencv.core.Core.add, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

add

public static void add(Mat src1,
                       Mat src2,
                       Mat dst,
                       Mat mask)

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

The function add computes:

dst(I) = saturate(src1(I) + src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) + src2) if mask(I) != 0

dst(I) = saturate(src1 + src2(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case, the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1/src2.
mask - Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
See Also:
org.opencv.core.Core.add, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

add

public static void add(Mat src1,
                       Mat src2,
                       Mat dst,
                       Mat mask,
                       int dtype)

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

The function add computes:

dst(I) = saturate(src1(I) + src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) + src2) if mask(I) != 0

dst(I) = saturate(src1 + src2(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case, the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1/src2.
mask - Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
dtype - Optional depth of the output array. See the discussion below.
See Also:
org.opencv.core.Core.add, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

add

public static void add(Mat src1,
                       Scalar src2,
                       Mat dst)

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

The function add computes:

dst(I) = saturate(src1(I) + src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) + src2) if mask(I) != 0

dst(I) = saturate(src1 + src2(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case, the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1/src2.
See Also:
org.opencv.core.Core.add, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

add

public static void add(Mat src1,
                       Scalar src2,
                       Mat dst,
                       Mat mask)

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

The function add computes:

dst(I) = saturate(src1(I) + src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) + src2) if mask(I) != 0

dst(I) = saturate(src1 + src2(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case, the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1/src2.
mask - Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
See Also:
org.opencv.core.Core.add, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

add

public static void add(Mat src1,
                       Scalar src2,
                       Mat dst,
                       Mat mask,
                       int dtype)

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

The function add computes:

dst(I) = saturate(src1(I) + src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) + src2) if mask(I) != 0

dst(I) = saturate(src1 + src2(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case, the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1/src2.
mask - Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
dtype - Optional depth of the output array. See the discussion below.
See Also:
org.opencv.core.Core.add, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

addWeighted

public static void addWeighted(Mat src1,
                               double alpha,
                               Mat src2,
                               double beta,
                               double gamma,
                               Mat dst)

Computes the weighted sum of two arrays.

The function addWeighted calculates the weighted sum of two arrays as follows:

dst(I)= saturate(src1(I)* alpha + src2(I)* beta + gamma)

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The function can be replaced with a matrix expression:

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
alpha - Weight for the first array elements.
src2 - Second source array of the same size and channel number as src1.
beta - Weight for the second array elements.
gamma - Scalar added to each sum.
dst - Destination array that has the same size and number of channels as the input arrays.
See Also:
org.opencv.core.Core.addWeighted, add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), MatrixExpressions

addWeighted

public static void addWeighted(Mat src1,
                               double alpha,
                               Mat src2,
                               double beta,
                               double gamma,
                               Mat dst,
                               int dtype)

Computes the weighted sum of two arrays.

The function addWeighted calculates the weighted sum of two arrays as follows:

dst(I)= saturate(src1(I)* alpha + src2(I)* beta + gamma)

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The function can be replaced with a matrix expression:

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
alpha - Weight for the first array elements.
src2 - Second source array of the same size and channel number as src1.
beta - Weight for the second array elements.
gamma - Scalar added to each sum.
dst - Destination array that has the same size and number of channels as the input arrays.
dtype - Optional depth of the destination array. When both input arrays have the same depth, dtype can be set to -1, which will be equivalent to src1.depth().
See Also:
org.opencv.core.Core.addWeighted, add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), MatrixExpressions

batchDistance

public static void batchDistance(Mat src1,
                                 Mat src2,
                                 Mat dist,
                                 int dtype,
                                 Mat nidx)

batchDistance

public static void batchDistance(Mat src1,
                                 Mat src2,
                                 Mat dist,
                                 int dtype,
                                 Mat nidx,
                                 int normType,
                                 int K)

batchDistance

public static void batchDistance(Mat src1,
                                 Mat src2,
                                 Mat dist,
                                 int dtype,
                                 Mat nidx,
                                 int normType,
                                 int K,
                                 Mat mask,
                                 int update,
                                 boolean crosscheck)

bitwise_and

public static void bitwise_and(Mat src1,
                               Mat src2,
                               Mat dst)

Calculates the per-element bit-wise conjunction of two arrays or an array and a scalar.

The function computes the per-element bit-wise logical conjunction for:

dst(I) = src1(I) / src2(I) if mask(I) != 0

dst(I) = src1(I) / src2 if mask(I) != 0

dst(I) = src1 / src2(I) if mask(I) != 0

In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the second and third cases above, the scalar is first converted to the array type.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and type as the input array(s).
See Also:
org.opencv.core.Core.bitwise_and

bitwise_and

public static void bitwise_and(Mat src1,
                               Mat src2,
                               Mat dst,
                               Mat mask)

Calculates the per-element bit-wise conjunction of two arrays or an array and a scalar.

The function computes the per-element bit-wise logical conjunction for:

dst(I) = src1(I) / src2(I) if mask(I) != 0

dst(I) = src1(I) / src2 if mask(I) != 0

dst(I) = src1 / src2(I) if mask(I) != 0

In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the second and third cases above, the scalar is first converted to the array type.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and type as the input array(s).
mask - Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
See Also:
org.opencv.core.Core.bitwise_and

bitwise_not

public static void bitwise_not(Mat src,
                               Mat dst)

Inverts every bit of an array.

The function computes per-element bit-wise inversion of the source array:

dst(I) = !src(I)

In case of a floating-point source array, its machine-specific bit representation (usually IEEE754-compliant) is used for the operation. In case of multi-channel arrays, each channel is processed independently.

Parameters:
src - Source array.
dst - Destination array that has the same size and type as the input array.
See Also:
org.opencv.core.Core.bitwise_not

bitwise_not

public static void bitwise_not(Mat src,
                               Mat dst,
                               Mat mask)

Inverts every bit of an array.

The function computes per-element bit-wise inversion of the source array:

dst(I) = !src(I)

In case of a floating-point source array, its machine-specific bit representation (usually IEEE754-compliant) is used for the operation. In case of multi-channel arrays, each channel is processed independently.

Parameters:
src - Source array.
dst - Destination array that has the same size and type as the input array.
mask - Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
See Also:
org.opencv.core.Core.bitwise_not

bitwise_or

public static void bitwise_or(Mat src1,
                              Mat src2,
                              Mat dst)

Calculates the per-element bit-wise disjunction of two arrays or an array and a scalar.

The function computes the per-element bit-wise logical disjunction for:

dst(I) = src1(I) V src2(I) if mask(I) != 0

dst(I) = src1(I) V src2 if mask(I) != 0

dst(I) = src1 V src2(I) if mask(I) != 0

In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the second and third cases above, the scalar is first converted to the array type.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and type as the input array(s).
See Also:
org.opencv.core.Core.bitwise_or

bitwise_or

public static void bitwise_or(Mat src1,
                              Mat src2,
                              Mat dst,
                              Mat mask)

Calculates the per-element bit-wise disjunction of two arrays or an array and a scalar.

The function computes the per-element bit-wise logical disjunction for:

dst(I) = src1(I) V src2(I) if mask(I) != 0

dst(I) = src1(I) V src2 if mask(I) != 0

dst(I) = src1 V src2(I) if mask(I) != 0

In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the second and third cases above, the scalar is first converted to the array type.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and type as the input array(s).
mask - Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
See Also:
org.opencv.core.Core.bitwise_or

bitwise_xor

public static void bitwise_xor(Mat src1,
                               Mat src2,
                               Mat dst)

Calculates the per-element bit-wise "exclusive or" operation on two arrays or an array and a scalar.

The function computes the per-element bit-wise logical "exclusive-or" operation for:

dst(I) = src1(I)(+) src2(I) if mask(I) != 0

dst(I) = src1(I)(+) src2 if mask(I) != 0

dst(I) = src1(+) src2(I) if mask(I) != 0

In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the 2nd and 3rd cases above, the scalar is first converted to the array type.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and type as the input array(s).
See Also:
org.opencv.core.Core.bitwise_xor

bitwise_xor

public static void bitwise_xor(Mat src1,
                               Mat src2,
                               Mat dst,
                               Mat mask)

Calculates the per-element bit-wise "exclusive or" operation on two arrays or an array and a scalar.

The function computes the per-element bit-wise logical "exclusive-or" operation for:

dst(I) = src1(I)(+) src2(I) if mask(I) != 0

dst(I) = src1(I)(+) src2 if mask(I) != 0

dst(I) = src1(+) src2(I) if mask(I) != 0

In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the 2nd and 3rd cases above, the scalar is first converted to the array type.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array that has the same size and type as the input array(s).
mask - Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
See Also:
org.opencv.core.Core.bitwise_xor

calcCovarMatrix

public static void calcCovarMatrix(Mat samples,
                                   Mat covar,
                                   Mat mean,
                                   int flags)

Calculates the covariance matrix of a set of vectors.

The functions calcCovarMatrix calculate the covariance matrix and, optionally, the mean vector of the set of input vectors.

Parameters:
samples - Samples stored either as separate matrices or as rows/columns of a single matrix.
covar - Output covariance matrix of the type ctype and square size.
mean - Input or output (depending on the flags) array as the average value of the input vectors.
flags - Operation flags as a combination of the following values:
  • CV_COVAR_SCRAMBLED The output covariance matrix is calculated as:

scale * [ vects [0]- mean, vects [1]- mean,...]^T * [ vects [0]- mean, vects [1]- mean,...],

The covariance matrix will be nsamples x nsamples. Such an unusual covariance matrix is used for fast PCA of a set of very large vectors (see, for example, the EigenFaces technique for face recognition). Eigenvalues of this "scrambled" matrix match the eigenvalues of the true covariance matrix. The "true" eigenvectors can be easily calculated from the eigenvectors of the "scrambled" covariance matrix.

  • CV_COVAR_NORMAL The output covariance matrix is calculated as:

scale * [ vects [0]- mean, vects [1]- mean,...] * [ vects [0]- mean, vects [1]- mean,...]^T,

covar will be a square matrix of the same size as the total number of elements in each input vector. One and only one of CV_COVAR_SCRAMBLED and CV_COVAR_NORMAL must be specified.

  • CV_COVAR_USE_AVG If the flag is specified, the function does not calculate mean from the input vectors but, instead, uses the passed mean vector. This is useful if mean has been pre-computed or known in advance, or if the covariance matrix is calculated by parts. In this case, mean is not a mean vector of the input sub-set of vectors but rather the mean vector of the whole set.
  • CV_COVAR_SCALE If the flag is specified, the covariance matrix is scaled. In the "normal" mode, scale is 1./nsamples. In the "scrambled" mode, scale is the reciprocal of the total number of elements in each input vector. By default (if the flag is not specified), the covariance matrix is not scaled (scale=1).
  • CV_COVAR_ROWS [Only useful in the second variant of the function] If the flag is specified, all the input vectors are stored as rows of the samples matrix. mean should be a single-row vector in this case.
  • CV_COVAR_COLS [Only useful in the second variant of the function] If the flag is specified, all the input vectors are stored as columns of the samples matrix. mean should be a single-column vector in this case.
See Also:
org.opencv.core.Core.calcCovarMatrix, Mahalanobis(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), org.opencv.core.PCA, mulTransposed(org.opencv.core.Mat, org.opencv.core.Mat, boolean, org.opencv.core.Mat, double, int)

calcCovarMatrix

public static void calcCovarMatrix(Mat samples,
                                   Mat covar,
                                   Mat mean,
                                   int flags,
                                   int ctype)

Calculates the covariance matrix of a set of vectors.

The functions calcCovarMatrix calculate the covariance matrix and, optionally, the mean vector of the set of input vectors.

Parameters:
samples - Samples stored either as separate matrices or as rows/columns of a single matrix.
covar - Output covariance matrix of the type ctype and square size.
mean - Input or output (depending on the flags) array as the average value of the input vectors.
flags - Operation flags as a combination of the following values:
  • CV_COVAR_SCRAMBLED The output covariance matrix is calculated as:

scale * [ vects [0]- mean, vects [1]- mean,...]^T * [ vects [0]- mean, vects [1]- mean,...],

The covariance matrix will be nsamples x nsamples. Such an unusual covariance matrix is used for fast PCA of a set of very large vectors (see, for example, the EigenFaces technique for face recognition). Eigenvalues of this "scrambled" matrix match the eigenvalues of the true covariance matrix. The "true" eigenvectors can be easily calculated from the eigenvectors of the "scrambled" covariance matrix.

  • CV_COVAR_NORMAL The output covariance matrix is calculated as:

scale * [ vects [0]- mean, vects [1]- mean,...] * [ vects [0]- mean, vects [1]- mean,...]^T,

covar will be a square matrix of the same size as the total number of elements in each input vector. One and only one of CV_COVAR_SCRAMBLED and CV_COVAR_NORMAL must be specified.

  • CV_COVAR_USE_AVG If the flag is specified, the function does not calculate mean from the input vectors but, instead, uses the passed mean vector. This is useful if mean has been pre-computed or known in advance, or if the covariance matrix is calculated by parts. In this case, mean is not a mean vector of the input sub-set of vectors but rather the mean vector of the whole set.
  • CV_COVAR_SCALE If the flag is specified, the covariance matrix is scaled. In the "normal" mode, scale is 1./nsamples. In the "scrambled" mode, scale is the reciprocal of the total number of elements in each input vector. By default (if the flag is not specified), the covariance matrix is not scaled (scale=1).
  • CV_COVAR_ROWS [Only useful in the second variant of the function] If the flag is specified, all the input vectors are stored as rows of the samples matrix. mean should be a single-row vector in this case.
  • CV_COVAR_COLS [Only useful in the second variant of the function] If the flag is specified, all the input vectors are stored as columns of the samples matrix. mean should be a single-column vector in this case.
ctype - a ctype
See Also:
org.opencv.core.Core.calcCovarMatrix, Mahalanobis(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), org.opencv.core.PCA, mulTransposed(org.opencv.core.Mat, org.opencv.core.Mat, boolean, org.opencv.core.Mat, double, int)

cartToPolar

public static void cartToPolar(Mat x,
                               Mat y,
                               Mat magnitude,
                               Mat angle)

Calculates the magnitude and angle of 2D vectors.

The function cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)):

magnitude(I)= sqrt(x(I)^2+y(I)^2), angle(I)= atan2(y(I), x(I))[ *180 / pi ]

The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0.

Parameters:
x - Array of x-coordinates. This must be a single-precision or double-precision floating-point array.
y - Array of y-coordinates that must have the same size and same type as x.
magnitude - Destination array of magnitudes of the same size and type as x.
angle - Destination array of angles that has the same size and type as x. The angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees).
See Also:
org.opencv.core.Core.cartToPolar, Imgproc.Scharr(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int, double, double, int), Imgproc.Sobel(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int, int, double, double, int)

cartToPolar

public static void cartToPolar(Mat x,
                               Mat y,
                               Mat magnitude,
                               Mat angle,
                               boolean angleInDegrees)

Calculates the magnitude and angle of 2D vectors.

The function cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)):

magnitude(I)= sqrt(x(I)^2+y(I)^2), angle(I)= atan2(y(I), x(I))[ *180 / pi ]

The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0.

Parameters:
x - Array of x-coordinates. This must be a single-precision or double-precision floating-point array.
y - Array of y-coordinates that must have the same size and same type as x.
magnitude - Destination array of magnitudes of the same size and type as x.
angle - Destination array of angles that has the same size and type as x. The angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees).
angleInDegrees - Flag indicating whether the angles are measured in radians, which is the default mode, or in degrees.
See Also:
org.opencv.core.Core.cartToPolar, Imgproc.Scharr(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int, double, double, int), Imgproc.Sobel(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int, int, double, double, int)

checkRange

public static boolean checkRange(Mat a)

Checks every element of an input array for invalid values.

The functions checkRange check that every array element is neither NaN nor infinite. When minVal < -DBL_MAX and maxVal < DBL_MAX, the functions also check that each value is between minVal and maxVal. In case of multi-channel arrays, each channel is processed independently. If some values are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the functions either return false (when quiet=true) or throw an exception.

Parameters:
a - Array to check.
See Also:
org.opencv.core.Core.checkRange

checkRange

public static boolean checkRange(Mat a,
                                 boolean quiet,
                                 double minVal,
                                 double maxVal)

Checks every element of an input array for invalid values.

The functions checkRange check that every array element is neither NaN nor infinite. When minVal < -DBL_MAX and maxVal < DBL_MAX, the functions also check that each value is between minVal and maxVal. In case of multi-channel arrays, each channel is processed independently. If some values are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the functions either return false (when quiet=true) or throw an exception.

Parameters:
a - Array to check.
quiet - Flag indicating whether the functions quietly return false when the array elements are out of range or they throw an exception.
minVal - Inclusive lower boundary of valid values range.
maxVal - Exclusive upper boundary of valid values range.
See Also:
org.opencv.core.Core.checkRange

circle

public static void circle(Mat img,
                          Point center,
                          int radius,
                          Scalar color)

Draws a circle.

The function circle draws a simple or filled circle with a given center and radius.

Parameters:
img - Image where the circle is drawn.
center - Center of the circle.
radius - Radius of the circle.
color - Circle color.
See Also:
org.opencv.core.Core.circle

circle

public static void circle(Mat img,
                          Point center,
                          int radius,
                          Scalar color,
                          int thickness)

Draws a circle.

The function circle draws a simple or filled circle with a given center and radius.

Parameters:
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 thickness means that a filled circle is to be drawn.
See Also:
org.opencv.core.Core.circle

circle

public static void circle(Mat img,
                          Point center,
                          int radius,
                          Scalar color,
                          int thickness,
                          int lineType,
                          int shift)

Draws a circle.

The function circle draws a simple or filled circle with a given center and radius.

Parameters:
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 thickness means that a filled circle is to be drawn.
lineType - Type of the circle boundary. See the "line" description.
shift - Number of fractional bits in the coordinates of the center and in the radius value.
See Also:
org.opencv.core.Core.circle

clipLine

public static boolean clipLine(Rect imgRect,
                               Point pt1,
                               Point pt2)

Clips the line against the image rectangle.

The functions clipLine calculate a part of the line segment that is entirely within the specified rectangle. They return false if the line segment is completely outside the rectangle. Otherwise, they return true.

Parameters:
imgRect - Image rectangle.
pt1 - First line point.
pt2 - Second line point.
See Also:
org.opencv.core.Core.clipLine

compare

public static void compare(Mat src1,
                           Mat src2,
                           Mat dst,
                           int cmpop)

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

The function compares:

dst(I) = src1(I) cmpop src2(I)

dst(I) = src1(I) cmpop src2

dst(I) = src1 cmpop src2(I)

When the comparison result is true, the corresponding element of destination array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

Parameters:
src1 - First source array or a scalar (in the case of cvCmp, cv.Cmp, cvCmpS, cv.CmpS it is always an array). When it is array, it must have a single channel.
src2 - Second source array or a scalar (in the case of cvCmp and cv.Cmp it is always an array; in the case of cvCmpS, cv.CmpS it is always a scalar). When it is array, it must have a single channel.
dst - Destination array that has the same size as the input array(s) and type= CV_8UC1.
cmpop - Flag specifying the relation between the elements to be checked.
  • CMP_EQ src1 equal to src2.
  • CMP_GT src1 greater than src2.
  • CMP_GE src1 greater than or equal to src2.
  • CMP_LT src1 less than src2.
  • CMP_LE src1 less than or equal to src2.
  • CMP_NE src1 not equal to src2.
See Also:
org.opencv.core.Core.compare, Imgproc.threshold(org.opencv.core.Mat, org.opencv.core.Mat, double, double, int), max(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), MatrixExpressions, checkRange(org.opencv.core.Mat, boolean, double, double), min(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

compare

public static void compare(Mat src1,
                           Scalar src2,
                           Mat dst,
                           int cmpop)

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

The function compares:

dst(I) = src1(I) cmpop src2(I)

dst(I) = src1(I) cmpop src2

dst(I) = src1 cmpop src2(I)

When the comparison result is true, the corresponding element of destination array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

Parameters:
src1 - First source array or a scalar (in the case of cvCmp, cv.Cmp, cvCmpS, cv.CmpS it is always an array). When it is array, it must have a single channel.
src2 - Second source array or a scalar (in the case of cvCmp and cv.Cmp it is always an array; in the case of cvCmpS, cv.CmpS it is always a scalar). When it is array, it must have a single channel.
dst - Destination array that has the same size as the input array(s) and type= CV_8UC1.
cmpop - Flag specifying the relation between the elements to be checked.
  • CMP_EQ src1 equal to src2.
  • CMP_GT src1 greater than src2.
  • CMP_GE src1 greater than or equal to src2.
  • CMP_LT src1 less than src2.
  • CMP_LE src1 less than or equal to src2.
  • CMP_NE src1 not equal to src2.
See Also:
org.opencv.core.Core.compare, Imgproc.threshold(org.opencv.core.Mat, org.opencv.core.Mat, double, double, int), max(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), MatrixExpressions, checkRange(org.opencv.core.Mat, boolean, double, double), min(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

completeSymm

public static void completeSymm(Mat mtx)

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

The function completeSymm copies the lower half of a square matrix to its another half. The matrix diagonal remains unchanged:

Parameters:
mtx - Input-output floating-point square matrix.
See Also:
org.opencv.core.Core.completeSymm, transpose(org.opencv.core.Mat, org.opencv.core.Mat), flip(org.opencv.core.Mat, org.opencv.core.Mat, int)

completeSymm

public static void completeSymm(Mat mtx,
                                boolean lowerToUpper)

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

The function completeSymm copies the lower half of a square matrix to its another half. The matrix diagonal remains unchanged:

Parameters:
mtx - Input-output floating-point square matrix.
lowerToUpper - Operation flag. If it is true, the lower half is copied to the upper half. Otherwise, the upper half is copied to the lower half.
See Also:
org.opencv.core.Core.completeSymm, transpose(org.opencv.core.Mat, org.opencv.core.Mat), flip(org.opencv.core.Mat, org.opencv.core.Mat, int)

convertScaleAbs

public static void convertScaleAbs(Mat src,
                                   Mat dst)

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

On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type:

dst(I)= saturate_cast (| src(I)* alpha + beta|)

In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat.convertTo method (or by using matrix expressions) and then by computing an absolute value of the result. For example:

Parameters:
src - Source array.
dst - Destination array.
See Also:
org.opencv.core.Core.convertScaleAbs, Mat.convertTo(org.opencv.core.Mat, int, double, double), org.opencv.core.Core#abs

convertScaleAbs

public static void convertScaleAbs(Mat src,
                                   Mat dst,
                                   double alpha,
                                   double beta)

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

On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type:

dst(I)= saturate_cast (| src(I)* alpha + beta|)

In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat.convertTo method (or by using matrix expressions) and then by computing an absolute value of the result. For example:

Parameters:
src - Source array.
dst - Destination array.
alpha - Optional scale factor.
beta - Optional delta added to the scaled values.
See Also:
org.opencv.core.Core.convertScaleAbs, Mat.convertTo(org.opencv.core.Mat, int, double, double), org.opencv.core.Core#abs

countNonZero

public static int countNonZero(Mat src)

Counts non-zero array elements.

The function returns the number of non-zero elements in src :

sum(by: I: src(I) != 0) 1

Parameters:
src - Single-channel array.
See Also:
org.opencv.core.Core.countNonZero, minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat), calcCovarMatrix(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, int), meanStdDev(org.opencv.core.Mat, org.opencv.core.MatOfDouble, org.opencv.core.MatOfDouble, org.opencv.core.Mat), norm(org.opencv.core.Mat, int, org.opencv.core.Mat), mean(org.opencv.core.Mat, org.opencv.core.Mat)

cubeRoot

public static float cubeRoot(float val)

Computes the cube root of an argument.

The function cubeRoot computes sqrt3(val). Negative arguments are handled correctly. NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for single-precision data.

Parameters:
val - A function argument.
See Also:
org.opencv.core.Core.cubeRoot

dct

public static void dct(Mat src,
                       Mat dst)

Performs a forward or inverse discrete Cosine transform of 1D or 2D array.

The function dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D floating-point array:

Y = C^N * X

where

C^N_(jk)= sqrt(alpha_j/N) cos((pi(2k+1)j)/(2N))

and

alpha_0=1, alpha_j=2 for *j > 0*.

X = (C^N)^(-1) * Y = (C^N)^T * Y

(since C^N is an orthogonal matrix, C^N * (C^N)^T = I)

Y = C^N * X * (C^N)^T

X = (C^N)^T * X * C^N

The function chooses the mode of operation by looking at the flags and size of the input array:

Note:

Currently dct supports even-size arrays (2, 4, 6...). For data analysis and approximation, you can pad the array when necessary.

Also, the function performance depends very much, and not monotonically, on the array size (see "getOptimalDFTSize"). In the current implementation DCT of a vector of size N is computed via DFT of a vector of size N/2. Thus, the optimal DCT size N1 >= N can be computed as:

Parameters:
src - Source floating-point array.
dst - Destination array of the same size and type as src.
See Also:
org.opencv.core.Core.dct, dft(org.opencv.core.Mat, org.opencv.core.Mat, int, int), idct(org.opencv.core.Mat, org.opencv.core.Mat, int), getOptimalDFTSize(int)

dct

public static void dct(Mat src,
                       Mat dst,
                       int flags)

Performs a forward or inverse discrete Cosine transform of 1D or 2D array.

The function dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D floating-point array:

Y = C^N * X

where

C^N_(jk)= sqrt(alpha_j/N) cos((pi(2k+1)j)/(2N))

and

alpha_0=1, alpha_j=2 for *j > 0*.

X = (C^N)^(-1) * Y = (C^N)^T * Y

(since C^N is an orthogonal matrix, C^N * (C^N)^T = I)

Y = C^N * X * (C^N)^T

X = (C^N)^T * X * C^N

The function chooses the mode of operation by looking at the flags and size of the input array:

Note:

Currently dct supports even-size arrays (2, 4, 6...). For data analysis and approximation, you can pad the array when necessary.

Also, the function performance depends very much, and not monotonically, on the array size (see "getOptimalDFTSize"). In the current implementation DCT of a vector of size N is computed via DFT of a vector of size N/2. Thus, the optimal DCT size N1 >= N can be computed as:

Parameters:
src - Source floating-point array.
dst - Destination array of the same size and type as src.
flags - Transformation flags as a combination of the following values:
  • DCT_INVERSE performs an inverse 1D or 2D transform instead of the default forward transform.
  • DCT_ROWS performs a forward or inverse transform of every individual row of the input matrix. This flag enables you to transform multiple vectors simultaneously and can be used to decrease the overhead (which is sometimes several times larger than the processing itself) to perform 3D and higher-dimensional transforms and so forth.
See Also:
org.opencv.core.Core.dct, dft(org.opencv.core.Mat, org.opencv.core.Mat, int, int), idct(org.opencv.core.Mat, org.opencv.core.Mat, int), getOptimalDFTSize(int)

determinant

public static double determinant(Mat mtx)

Returns the determinant of a square floating-point matrix.

The function determinant computes and returns the determinant of the specified matrix. For small matrices (mtx.cols=mtx.rows<=3), the direct method is used. For larger matrices, the function uses LU factorization with partial pivoting.

For symmetric positively-determined matrices, it is also possible to use "eigen" decomposition to compute the determinant.

Parameters:
mtx - Input matrix that must have CV_32FC1 or CV_64FC1 type and square size.
See Also:
org.opencv.core.Core.determinant, invert(org.opencv.core.Mat, org.opencv.core.Mat, int), solve(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), eigen(org.opencv.core.Mat, boolean, org.opencv.core.Mat, org.opencv.core.Mat), trace(org.opencv.core.Mat), MatrixExpressions

dft

public static void dft(Mat src,
                       Mat dst)

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

The function performs one of the following:

Y = F^N * X,

where F^N_(jk)=exp(-2pi i j k/N) and i=sqrt(-1)

X'= (F^N)^(-1) * Y = (F^N)^* * y X = (1/N) * X,

where F^*=(Re(F^N)-Im(F^N))^T

Y = F^M * X * F^N

X'= (F^M)^* * Y * (F^N)^* X = 1/(M * N) * X'

In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input spectrum of the inverse Fourier transform can be represented in a packed format called *CCS* (complex-conjugate-symmetrical). It was borrowed from IPL (Intel* Image Processing Library). Here is how 2D *CCS* spectrum looks:

Re Y_(0,0) Re Y_(0,1) Im Y_(0,1) Re Y_(0,2) Im Y_(0,2) *s Re Y_(0,N/2-1) Im Y_(0,N/2-1) Re Y_(0,N/2) Re Y_(1,0) Re Y_(1,1) Im Y_(1,1) Re Y_(1,2) Im Y_(1,2) *s Re Y_(1,N/2-1) Im Y_(1,N/2-1) Re Y_(1,N/2) Im Y_(1,0) Re Y_(2,1) Im Y_(2,1) Re Y_(2,2) Im Y_(2,2) *s Re Y_(2,N/2-1) Im Y_(2,N/2-1) Im Y_(1,N/2)........................... Re Y_(M/2-1,0) Re Y_(M-3,1) Im Y_(M-3,1)......... Re Y_(M-3,N/2-1) Im Y_(M-3,N/2-1) Re Y_(M/2-1,N/2) Im Y_(M/2-1,0) Re Y_(M-2,1) Im Y_(M-2,1)......... Re Y_(M-2,N/2-1) Im Y_(M-2,N/2-1) Im Y_(M/2-1,N/2) Re Y_(M/2,0) Re Y_(M-1,1) Im Y_(M-1,1)......... Re Y_(M-1,N/2-1) Im Y_(M-1,N/2-1) Re Y_(M/2,N/2)

In case of 1D transform of a real vector, the output looks like the first row of the matrix above.

So, the function chooses an operation mode depending on the flags and size of the input array:

If DFT_SCALE is set, the scaling is done after the transformation.

Unlike "dct", the function supports arrays of arbitrary size. But only those arrays are processed efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the current implementation). Such an efficient DFT size can be computed using the "getOptimalDFTSize" method.

The sample below illustrates how to compute a DFT-based convolution of two 2D real arrays:

To optimize this sample, consider the following approaches:

All of the above improvements have been implemented in "matchTemplate" and "filter2D". Therefore, by using them, you can get the performance even better than with the above theoretically optimal implementation. Though, those two functions actually compute cross-correlation, not convolution, so you need to "flip" the second convolution operand B vertically and horizontally using "flip".

Parameters:
src - Source array that could be real or complex.
dst - Destination array whose size and type depends on the flags.
See Also:
org.opencv.core.Core.dft, Imgproc.matchTemplate(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), mulSpectrums(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, boolean), cartToPolar(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), flip(org.opencv.core.Mat, org.opencv.core.Mat, int), magnitude(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), phase(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), dct(org.opencv.core.Mat, org.opencv.core.Mat, int), Imgproc.filter2D(org.opencv.core.Mat, org.opencv.core.Mat, int, org.opencv.core.Mat, org.opencv.core.Point, double, int), getOptimalDFTSize(int)

dft

public static void dft(Mat src,
                       Mat dst,
                       int flags,
                       int nonzeroRows)

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

The function performs one of the following:

Y = F^N * X,

where F^N_(jk)=exp(-2pi i j k/N) and i=sqrt(-1)

X'= (F^N)^(-1) * Y = (F^N)^* * y X = (1/N) * X,

where F^*=(Re(F^N)-Im(F^N))^T

Y = F^M * X * F^N

X'= (F^M)^* * Y * (F^N)^* X = 1/(M * N) * X'

In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input spectrum of the inverse Fourier transform can be represented in a packed format called *CCS* (complex-conjugate-symmetrical). It was borrowed from IPL (Intel* Image Processing Library). Here is how 2D *CCS* spectrum looks:

Re Y_(0,0) Re Y_(0,1) Im Y_(0,1) Re Y_(0,2) Im Y_(0,2) *s Re Y_(0,N/2-1) Im Y_(0,N/2-1) Re Y_(0,N/2) Re Y_(1,0) Re Y_(1,1) Im Y_(1,1) Re Y_(1,2) Im Y_(1,2) *s Re Y_(1,N/2-1) Im Y_(1,N/2-1) Re Y_(1,N/2) Im Y_(1,0) Re Y_(2,1) Im Y_(2,1) Re Y_(2,2) Im Y_(2,2) *s Re Y_(2,N/2-1) Im Y_(2,N/2-1) Im Y_(1,N/2)........................... Re Y_(M/2-1,0) Re Y_(M-3,1) Im Y_(M-3,1)......... Re Y_(M-3,N/2-1) Im Y_(M-3,N/2-1) Re Y_(M/2-1,N/2) Im Y_(M/2-1,0) Re Y_(M-2,1) Im Y_(M-2,1)......... Re Y_(M-2,N/2-1) Im Y_(M-2,N/2-1) Im Y_(M/2-1,N/2) Re Y_(M/2,0) Re Y_(M-1,1) Im Y_(M-1,1)......... Re Y_(M-1,N/2-1) Im Y_(M-1,N/2-1) Re Y_(M/2,N/2)

In case of 1D transform of a real vector, the output looks like the first row of the matrix above.

So, the function chooses an operation mode depending on the flags and size of the input array:

If DFT_SCALE is set, the scaling is done after the transformation.

Unlike "dct", the function supports arrays of arbitrary size. But only those arrays are processed efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the current implementation). Such an efficient DFT size can be computed using the "getOptimalDFTSize" method.

The sample below illustrates how to compute a DFT-based convolution of two 2D real arrays:

To optimize this sample, consider the following approaches:

All of the above improvements have been implemented in "matchTemplate" and "filter2D". Therefore, by using them, you can get the performance even better than with the above theoretically optimal implementation. Though, those two functions actually compute cross-correlation, not convolution, so you need to "flip" the second convolution operand B vertically and horizontally using "flip".

Parameters:
src - Source array that could be real or complex.
dst - Destination array whose size and type depends on the flags.
flags - Transformation flags representing a combination of the following values:
  • DFT_INVERSE performs an inverse 1D or 2D transform instead of the default forward transform.
  • DFT_SCALE scales the result: divide it by the number of array elements. Normally, it is combined with DFT_INVERSE.
  • DFT_ROWS performs a forward or inverse transform of every individual row of the input matrix. This flag enables you to transform multiple vectors simultaneously and can be used to decrease the overhead (which is sometimes several times larger than the processing itself) to perform 3D and higher-dimensional transforms and so forth.
  • DFT_COMPLEX_OUTPUT performs a forward transformation of 1D or 2D real array. The result, though being a complex array, has complex-conjugate symmetry (*CCS*, see the function description below for details). Such an array can be packed into a real array of the same size as input, which is the fastest option and which is what the function does by default. However, you may wish to get a full complex array (for simpler spectrum analysis, and so on). Pass the flag to enable the function to produce a full-size complex output array.
  • DFT_REAL_OUTPUT performs an inverse transformation of a 1D or 2D complex array. The result is normally a complex array of the same size. However, if the source array has conjugate-complex symmetry (for example, it is a result of forward transformation with DFT_COMPLEX_OUTPUT flag), the output is a real array. While the function itself does not check whether the input is symmetrical or not, you can pass the flag and then the function will assume the symmetry and produce the real output array. Note that when the input is packed into a real array and inverse transformation is executed, the function treats the input as a packed complex-conjugate symmetrical array. So, the output will also be a real array.
nonzeroRows - When the parameter is not zero, the function assumes that only the first nonzeroRows rows of the input array (DFT_INVERSE is not set) or only the first nonzeroRows of the output array (DFT_INVERSE is set) contain non-zeros. Thus, the function can handle the rest of the rows more efficiently and save some time. This technique is very useful for computing array cross-correlation or convolution using DFT.
See Also:
org.opencv.core.Core.dft, Imgproc.matchTemplate(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), mulSpectrums(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, boolean), cartToPolar(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), flip(org.opencv.core.Mat, org.opencv.core.Mat, int), magnitude(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), phase(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), dct(org.opencv.core.Mat, org.opencv.core.Mat, int), Imgproc.filter2D(org.opencv.core.Mat, org.opencv.core.Mat, int, org.opencv.core.Mat, org.opencv.core.Point, double, int), getOptimalDFTSize(int)

divide

public static void divide(double scale,
                          Mat src2,
                          Mat dst)

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

The functions divide divide one array by another:

dst(I) = saturate(src1(I)*scale/src2(I))

or a scalar by an array when there is no src1 :

dst(I) = saturate(scale/src2(I))

When src2(I) is zero, dst(I) will also be zero. Different channels of multi-channel arrays are processed independently.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
scale - Scalar factor.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src2.
See Also:
org.opencv.core.Core.divide, multiply(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

divide

public static void divide(double scale,
                          Mat src2,
                          Mat dst,
                          int dtype)

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

The functions divide divide one array by another:

dst(I) = saturate(src1(I)*scale/src2(I))

or a scalar by an array when there is no src1 :

dst(I) = saturate(scale/src2(I))

When src2(I) is zero, dst(I) will also be zero. Different channels of multi-channel arrays are processed independently.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
scale - Scalar factor.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src2.
dtype - Optional depth of the destination array. If it is -1, dst will have depth src2.depth(). In case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
See Also:
org.opencv.core.Core.divide, multiply(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

divide

public static void divide(Mat src1,
                          Mat src2,
                          Mat dst)

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

The functions divide divide one array by another:

dst(I) = saturate(src1(I)*scale/src2(I))

or a scalar by an array when there is no src1 :

dst(I) = saturate(scale/src2(I))

When src2(I) is zero, dst(I) will also be zero. Different channels of multi-channel arrays are processed independently.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src2.
See Also:
org.opencv.core.Core.divide, multiply(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

divide

public static void divide(Mat src1,
                          Mat src2,
                          Mat dst,
                          double scale)

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

The functions divide divide one array by another:

dst(I) = saturate(src1(I)*scale/src2(I))

or a scalar by an array when there is no src1 :

dst(I) = saturate(scale/src2(I))

When src2(I) is zero, dst(I) will also be zero. Different channels of multi-channel arrays are processed independently.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src2.
scale - Scalar factor.
See Also:
org.opencv.core.Core.divide, multiply(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

divide

public static void divide(Mat src1,
                          Mat src2,
                          Mat dst,
                          double scale,
                          int dtype)

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

The functions divide divide one array by another:

dst(I) = saturate(src1(I)*scale/src2(I))

or a scalar by an array when there is no src1 :

dst(I) = saturate(scale/src2(I))

When src2(I) is zero, dst(I) will also be zero. Different channels of multi-channel arrays are processed independently.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src2.
scale - Scalar factor.
dtype - Optional depth of the destination array. If it is -1, dst will have depth src2.depth(). In case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
See Also:
org.opencv.core.Core.divide, multiply(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

divide

public static void divide(Mat src1,
                          Scalar src2,
                          Mat dst)

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

The functions divide divide one array by another:

dst(I) = saturate(src1(I)*scale/src2(I))

or a scalar by an array when there is no src1 :

dst(I) = saturate(scale/src2(I))

When src2(I) is zero, dst(I) will also be zero. Different channels of multi-channel arrays are processed independently.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src2.
See Also:
org.opencv.core.Core.divide, multiply(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

divide

public static void divide(Mat src1,
                          Scalar src2,
                          Mat dst,
                          double scale)

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

The functions divide divide one array by another:

dst(I) = saturate(src1(I)*scale/src2(I))

or a scalar by an array when there is no src1 :

dst(I) = saturate(scale/src2(I))

When src2(I) is zero, dst(I) will also be zero. Different channels of multi-channel arrays are processed independently.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src2.
scale - Scalar factor.
See Also:
org.opencv.core.Core.divide, multiply(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

divide

public static void divide(Mat src1,
                          Scalar src2,
                          Mat dst,
                          double scale,
                          int dtype)

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

The functions divide divide one array by another:

dst(I) = saturate(src1(I)*scale/src2(I))

or a scalar by an array when there is no src1 :

dst(I) = saturate(scale/src2(I))

When src2(I) is zero, dst(I) will also be zero. Different channels of multi-channel arrays are processed independently.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src2.
scale - Scalar factor.
dtype - Optional depth of the destination array. If it is -1, dst will have depth src2.depth(). In case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
See Also:
org.opencv.core.Core.divide, multiply(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

eigen

public static boolean eigen(Mat src,
                            boolean computeEigenvectors,
                            Mat eigenvalues,
                            Mat eigenvectors)

Computes eigenvalues and eigenvectors of a symmetric matrix.

The functions eigen compute just eigenvalues, or eigenvalues and eigenvectors of the symmetric matrix src :

Note: in the new and the old interfaces different ordering of eigenvalues and eigenvectors parameters is used.

Parameters:
src - Input matrix that must have CV_32FC1 or CV_64FC1 type, square size and be symmetrical (src^"T" == src).
computeEigenvectors - a computeEigenvectors
eigenvalues - Output vector of eigenvalues of the same type as src. The eigenvalues are stored in the descending order.
eigenvectors - Output matrix of eigenvectors. It has the same size and type as src. The eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding eigenvalues.
See Also:
org.opencv.core.Core.eigen, org.opencv.core.PCA, completeSymm(org.opencv.core.Mat, boolean)

ellipse

public 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.

The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using "ellipse2Poly" and then render it with "polylines" or fill it with "fillPoly". If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. The figure below explains the meaning of the parameters. Figure 1. Parameters of Elliptic Arc

Parameters:
img - Image.
center - Center of the ellipse.
axes - Length of the ellipse 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.
See Also:
org.opencv.core.Core.ellipse

ellipse

public 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.

The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using "ellipse2Poly" and then render it with "polylines" or fill it with "fillPoly". If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. The figure below explains the meaning of the parameters. Figure 1. Parameters of Elliptic Arc

Parameters:
img - Image.
center - Center of the ellipse.
axes - Length of the ellipse 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.
See Also:
org.opencv.core.Core.ellipse

ellipse

public 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.

The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using "ellipse2Poly" and then render it with "polylines" or fill it with "fillPoly". If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. The figure below explains the meaning of the parameters. Figure 1. Parameters of Elliptic Arc

Parameters:
img - Image.
center - Center of the ellipse.
axes - Length of the ellipse 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 the "line" description.
shift - Number of fractional bits in the coordinates of the center and values of axes.
See Also:
org.opencv.core.Core.ellipse

ellipse

public static void ellipse(Mat img,
                           RotatedRect box,
                           Scalar color)

Draws a simple or thick elliptic arc or fills an ellipse sector.

The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using "ellipse2Poly" and then render it with "polylines" or fill it with "fillPoly". If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. The figure below explains the meaning of the parameters. Figure 1. Parameters of Elliptic Arc

Parameters:
img - Image.
box - Alternative ellipse representation via "RotatedRect" or CvBox2D. This means that the function draws an ellipse inscribed in the rotated rectangle.
color - Ellipse color.
See Also:
org.opencv.core.Core.ellipse

ellipse

public static void ellipse(Mat img,
                           RotatedRect box,
                           Scalar color,
                           int thickness)

Draws a simple or thick elliptic arc or fills an ellipse sector.

The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using "ellipse2Poly" and then render it with "polylines" or fill it with "fillPoly". If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. The figure below explains the meaning of the parameters. Figure 1. Parameters of Elliptic Arc

Parameters:
img - Image.
box - Alternative ellipse representation via "RotatedRect" or CvBox2D. 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.
See Also:
org.opencv.core.Core.ellipse

ellipse

public static void ellipse(Mat img,
                           RotatedRect box,
                           Scalar color,
                           int thickness,
                           int lineType)

Draws a simple or thick elliptic arc or fills an ellipse sector.

The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using "ellipse2Poly" and then render it with "polylines" or fill it with "fillPoly". If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. The figure below explains the meaning of the parameters. Figure 1. Parameters of Elliptic Arc

Parameters:
img - Image.
box - Alternative ellipse representation via "RotatedRect" or CvBox2D. 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 the "line" description.
See Also:
org.opencv.core.Core.ellipse

ellipse2Poly

public static void ellipse2Poly(Point center,
                                Size axes,
                                int angle,
                                int arcStart,
                                int arcEnd,
                                int delta,
                                MatOfPoint pts)

Approximates an elliptic arc with a polyline.

The function ellipse2Poly computes the vertices of a polyline that approximates the specified elliptic arc. It is used by "ellipse".

Parameters:
center - Center of the arc.
axes - Half-sizes of the arc. See the "ellipse" for details.
angle - Rotation angle of the ellipse in degrees. See the "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.
See Also:
org.opencv.core.Core.ellipse2Poly

exp

public static void exp(Mat src,
                       Mat dst)

Calculates the exponent of every array element.

The function exp calculates the exponent of every element of the input array:

dst [I] = e^(src(I))

The maximum relative error is about 7e-6 for single-precision input and less than 1e-10 for double-precision input. Currently, the function converts denormalized values to zeros on output. Special values (NaN, Inf) are not handled.

Parameters:
src - Source array.
dst - Destination array of the same size and type as src.
See Also:
org.opencv.core.Core.exp, log(org.opencv.core.Mat, org.opencv.core.Mat), cartToPolar(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), pow(org.opencv.core.Mat, double, org.opencv.core.Mat), sqrt(org.opencv.core.Mat, org.opencv.core.Mat), magnitude(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), polarToCart(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), phase(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean)

extractChannel

public static void extractChannel(Mat src,
                                  Mat dst,
                                  int coi)

fastAtan2

public static float fastAtan2(float y,
                              float x)

Calculates the angle of a 2D vector in degrees.

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

Parameters:
y - y-coordinate of the vector.
x - x-coordinate of the vector.
See Also:
org.opencv.core.Core.fastAtan2

fillConvexPoly

public static void fillConvexPoly(Mat img,
                                  MatOfPoint points,
                                  Scalar color)

Fills a convex polygon.

The function fillConvexPoly draws a filled convex polygon. This function is much faster than the function fillPoly. It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).

Parameters:
img - Image.
points - a points
color - Polygon color.
See Also:
org.opencv.core.Core.fillConvexPoly

fillConvexPoly

public static void fillConvexPoly(Mat img,
                                  MatOfPoint points,
                                  Scalar color,
                                  int lineType,
                                  int shift)

Fills a convex polygon.

The function fillConvexPoly draws a filled convex polygon. This function is much faster than the function fillPoly. It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).

Parameters:
img - Image.
points - a points
color - Polygon color.
lineType - Type of the polygon boundaries. See the "line" description.
shift - Number of fractional bits in the vertex coordinates.
See Also:
org.opencv.core.Core.fillConvexPoly

fillPoly

public static void fillPoly(Mat img,
                            java.util.List<MatOfPoint> pts,
                            Scalar color)

Fills the area bounded by one or more polygons.

The function fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.

Parameters:
img - Image.
pts - Array of polygons where each polygon is represented as an array of points.
color - Polygon color.
See Also:
org.opencv.core.Core.fillPoly

fillPoly

public static void fillPoly(Mat img,
                            java.util.List<MatOfPoint> pts,
                            Scalar color,
                            int lineType,
                            int shift,
                            Point offset)

Fills the area bounded by one or more polygons.

The function fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.

Parameters:
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 the "line" description.
shift - Number of fractional bits in the vertex coordinates.
offset - Optional offset of all points of the contours.
See Also:
org.opencv.core.Core.fillPoly

flip

public static void flip(Mat src,
                        Mat dst,
                        int flipCode)

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

The function flip flips the array in one of three different ways (row and column indices are 0-based):

dst _(ij) = <= ft(

src _(src.rows-i-1,j) if flipCode = 0

src _(i, src.cols -j-1) if flipCode > 0

src _(src.rows -i-1, src.cols -j-1) if flipCode < 0

right.

The example scenarios of using the function are the following:

Parameters:
src - Source array.
dst - Destination array of the same size and type as src.
flipCode - Flag to specify how to flip the array. 0 means flipping around the x-axis. Positive value (for example, 1) means flipping around y-axis. Negative value (for example, -1) means flipping around both axes. See the discussion below for the formulas.
See Also:
org.opencv.core.Core.flip, repeat(org.opencv.core.Mat, int, int, org.opencv.core.Mat), transpose(org.opencv.core.Mat, org.opencv.core.Mat), completeSymm(org.opencv.core.Mat, boolean)

gemm

public static void gemm(Mat src1,
                        Mat src2,
                        double alpha,
                        Mat src3,
                        double gamma,
                        Mat dst)

Performs generalized matrix multiplication.

The function performs generalized matrix multiplication similar to the gemm functions in BLAS level 3. For example, gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T) corresponds to

dst = alpha * src1 ^T * src2 + beta * src3 ^T

The function can be replaced with a matrix expression. For example, the above call can be replaced with:

Parameters:
src1 - First multiplied input matrix that should have CV_32FC1, CV_64FC1, CV_32FC2, or CV_64FC2 type.
src2 - Second multiplied input matrix of the same type as src1.
alpha - Weight of the matrix product.
src3 - Third optional delta matrix added to the matrix product. It should have the same type as src1 and src2.
gamma - a gamma
dst - Destination matrix. It has the proper size and the same type as input matrices.
See Also:
org.opencv.core.Core.gemm, mulTransposed(org.opencv.core.Mat, org.opencv.core.Mat, boolean, org.opencv.core.Mat, double, int), transform(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), MatrixExpressions

gemm

public static void gemm(Mat src1,
                        Mat src2,
                        double alpha,
                        Mat src3,
                        double gamma,
                        Mat dst,
                        int flags)

Performs generalized matrix multiplication.

The function performs generalized matrix multiplication similar to the gemm functions in BLAS level 3. For example, gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T) corresponds to

dst = alpha * src1 ^T * src2 + beta * src3 ^T

The function can be replaced with a matrix expression. For example, the above call can be replaced with:

Parameters:
src1 - First multiplied input matrix that should have CV_32FC1, CV_64FC1, CV_32FC2, or CV_64FC2 type.
src2 - Second multiplied input matrix of the same type as src1.
alpha - Weight of the matrix product.
src3 - Third optional delta matrix added to the matrix product. It should have the same type as src1 and src2.
gamma - a gamma
dst - Destination matrix. It has the proper size and the same type as input matrices.
flags - Operation flags:
  • GEMM_1_T transpose src1
  • GEMM_2_T transpose src2
  • GEMM_3_T transpose src3
See Also:
org.opencv.core.Core.gemm, mulTransposed(org.opencv.core.Mat, org.opencv.core.Mat, boolean, org.opencv.core.Mat, double, int), transform(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), MatrixExpressions

getBuildInformation

public static java.lang.String getBuildInformation()

getCPUTickCount

public static long getCPUTickCount()

Returns the number of CPU ticks.

The function returns the current number of CPU ticks on some architectures (such as x86, x64, PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU with its own counter. So, theoretically (and practically) the subsequent calls to the function do not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU frequency depending on the load, the number of CPU clocks spent in some code cannot be directly converted to time units. Therefore, getTickCount is generally a preferable solution for measuring execution time.

See Also:
org.opencv.core.Core.getCPUTickCount

getNumberOfCPUs

public static int getNumberOfCPUs()

getOptimalDFTSize

public static int getOptimalDFTSize(int vecsize)

Returns the optimal DFT size for a given vector size.

DFT performance is not a monotonic function of a vector size. Therefore, when you compute convolution of two arrays or perform the spectral analysis of an array, it usually makes sense to pad the input data with zeros to get a bit larger array that can be transformed much faster than the original one. Arrays whose size is a power-of-two (2, 4, 8, 16, 32,...) are the fastest to process. Though, the arrays whose size is a product of 2's, 3's, and 5's (for example, 300 = 5*5*3*2*2) are also processed quite efficiently.

The function getOptimalDFTSize returns the minimum number N that is greater than or equal to vecsize so that the DFT of a vector of size N can be computed efficiently. In the current implementation N = 2^"p" * 3^"q" * 5^"r" for some integer p, q, r.

The function returns a negative number if vecsize is too large (very close to INT_MAX).

While the function cannot be used directly to estimate the optimal vector size for DCT transform (since the current DCT implementation supports only even-size vectors), it can be easily computed as getOptimalDFTSize((vecsize+1)/2)*2.

Parameters:
vecsize - Vector size.
See Also:
org.opencv.core.Core.getOptimalDFTSize, dft(org.opencv.core.Mat, org.opencv.core.Mat, int, int), dct(org.opencv.core.Mat, org.opencv.core.Mat, int), idct(org.opencv.core.Mat, org.opencv.core.Mat, int), mulSpectrums(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, boolean), idft(org.opencv.core.Mat, org.opencv.core.Mat, int, int)

getTextSize

public static Size getTextSize(java.lang.String text,
                               int fontFace,
                               double fontScale,
                               int thickness,
                               int[] baseLine)

Calculates the width and height of a text string.

The function getTextSize calculates and returns the size of a box that contains the specified text. That is, the following code renders some text, the tight box surrounding it, and the baseline:

Parameters:
text - Input text string.
fontFace - Font to use. See the "putText" for details.
fontScale - Font scale. See the "putText" for details.
thickness - Thickness of lines used to render the text. See "putText" for details.
baseLine - Output parameter - y-coordinate of the baseline relative to the bottom-most text point.
See Also:
org.opencv.core.Core.getTextSize

getTickCount

public static long getTickCount()

Returns the number of ticks.

The function returns the number of ticks after the certain event (for example, when the machine was turned on). It can be used to initialize "RNG" or to measure a function execution time by reading the tick count before and after the function call. See also the tick frequency.

See Also:
org.opencv.core.Core.getTickCount

getTickFrequency

public static double getTickFrequency()

Returns the number of ticks per second.

The function returns the number of ticks per second. That is, the following code computes the execution time in seconds:

See Also:
org.opencv.core.Core.getTickFrequency

hconcat

public static void hconcat(java.util.List<Mat> src,
                           Mat dst)

idct

public static void idct(Mat src,
                        Mat dst)

Computes the inverse Discrete Cosine Transform of a 1D or 2D array.

idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE).

Parameters:
src - Source floating-point single-channel array.
dst - Destination array of the same size and type as src.
See Also:
org.opencv.core.Core.idct, dft(org.opencv.core.Mat, org.opencv.core.Mat, int, int), dct(org.opencv.core.Mat, org.opencv.core.Mat, int), getOptimalDFTSize(int), idft(org.opencv.core.Mat, org.opencv.core.Mat, int, int)

idct

public static void idct(Mat src,
                        Mat dst,
                        int flags)

Computes the inverse Discrete Cosine Transform of a 1D or 2D array.

idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE).

Parameters:
src - Source floating-point single-channel array.
dst - Destination array of the same size and type as src.
flags - Operation flags.
See Also:
org.opencv.core.Core.idct, dft(org.opencv.core.Mat, org.opencv.core.Mat, int, int), dct(org.opencv.core.Mat, org.opencv.core.Mat, int), getOptimalDFTSize(int), idft(org.opencv.core.Mat, org.opencv.core.Mat, int, int)

idft

public static void idft(Mat src,
                        Mat dst)

Computes the inverse Discrete Fourier Transform of a 1D or 2D array.

idft(src, dst, flags) is equivalent to dft(src, dst, flags | DFT_INVERSE).

See "dft" for details.

Note: None of dft and idft scales the result by default. So, you should pass DFT_SCALE to one of dft or idft explicitly to make these transforms mutually inverse.

Parameters:
src - Source floating-point real or complex array.
dst - Destination array whose size and type depend on the flags.
See Also:
org.opencv.core.Core.idft, dft(org.opencv.core.Mat, org.opencv.core.Mat, int, int), dct(org.opencv.core.Mat, org.opencv.core.Mat, int), getOptimalDFTSize(int), idct(org.opencv.core.Mat, org.opencv.core.Mat, int), mulSpectrums(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, boolean)

idft

public static void idft(Mat src,
                        Mat dst,
                        int flags,
                        int nonzeroRows)

Computes the inverse Discrete Fourier Transform of a 1D or 2D array.

idft(src, dst, flags) is equivalent to dft(src, dst, flags | DFT_INVERSE).

See "dft" for details.

Note: None of dft and idft scales the result by default. So, you should pass DFT_SCALE to one of dft or idft explicitly to make these transforms mutually inverse.

Parameters:
src - Source floating-point real or complex array.
dst - Destination array whose size and type depend on the flags.
flags - Operation flags. See "dft".
nonzeroRows - Number of dst rows to compute. The rest of the rows have undefined content. See the convolution sample in "dft" description.
See Also:
org.opencv.core.Core.idft, dft(org.opencv.core.Mat, org.opencv.core.Mat, int, int), dct(org.opencv.core.Mat, org.opencv.core.Mat, int), getOptimalDFTSize(int), idct(org.opencv.core.Mat, org.opencv.core.Mat, int), mulSpectrums(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, boolean)

inRange

public static void inRange(Mat src,
                           Scalar lowerb,
                           Scalar upperb,
                           Mat dst)

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

The function checks the range as follows:

dst(I)= lowerb(I)_0 <= src(I)_0 <= upperb(I)_0

dst(I)= lowerb(I)_0 <= src(I)_0 <= upperb(I)_0 land lowerb(I)_1 <= src(I)_1 <= upperb(I)_1

That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the specified 1D, 2D, 3D,... box and 0 otherwise.

When the lower and/or upper boundary parameters are scalars, the indexes (I) at lowerb and upperb in the above formulas should be omitted.

Parameters:
src - First source array.
lowerb - Inclusive lower boundary array or a scalar.
upperb - Inclusive upper boundary array or a scalar.
dst - Destination array of the same size as src and CV_8U type.
See Also:
org.opencv.core.Core.inRange

insertChannel

public static void insertChannel(Mat src,
                                 Mat dst,
                                 int coi)

invert

public static double invert(Mat src,
                            Mat dst)

Finds the inverse or pseudo-inverse of a matrix.

The function invert inverts the matrix src and stores the result in dst. When the matrix src is singular or non-square, the function computes the pseudo-inverse matrix (the dst matrix) so that norm(src*dst - I) is minimal, where I is an identity matrix.

In case of the DECOMP_LU method, the function returns non-zero value if the inverse has been successfully computed and 0 if src is singular.

In case of the DECOMP_SVD method, the function returns the inverse condition number of src (the ratio of the smallest singular value to the largest singular value) and 0 if src is singular. The SVD method calculates a pseudo-inverse matrix if src is singular.

Similarly to DECOMP_LU, the method DECOMP_CHOLESKY works only with non-singular square matrices that should also be symmetrical and positively defined. In this case, the function stores the inverted matrix in dst and returns non-zero. Otherwise, it returns 0.

Parameters:
src - Source floating-point M x N matrix.
dst - Destination matrix of N x M size and the same type as src.
See Also:
org.opencv.core.Core.invert, org.opencv.core.SVD, solve(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int)

invert

public static double invert(Mat src,
                            Mat dst,
                            int flags)

Finds the inverse or pseudo-inverse of a matrix.

The function invert inverts the matrix src and stores the result in dst. When the matrix src is singular or non-square, the function computes the pseudo-inverse matrix (the dst matrix) so that norm(src*dst - I) is minimal, where I is an identity matrix.

In case of the DECOMP_LU method, the function returns non-zero value if the inverse has been successfully computed and 0 if src is singular.

In case of the DECOMP_SVD method, the function returns the inverse condition number of src (the ratio of the smallest singular value to the largest singular value) and 0 if src is singular. The SVD method calculates a pseudo-inverse matrix if src is singular.

Similarly to DECOMP_LU, the method DECOMP_CHOLESKY works only with non-singular square matrices that should also be symmetrical and positively defined. In this case, the function stores the inverted matrix in dst and returns non-zero. Otherwise, it returns 0.

Parameters:
src - Source floating-point M x N matrix.
dst - Destination matrix of N x M size and the same type as src.
flags - Inversion method :
  • DECOMP_LU Gaussian elimination with the optimal pivot element chosen.
  • DECOMP_SVD Singular value decomposition (SVD) method.
  • DECOMP_CHOLESKY Cholesky decomposition. The matrix must be symmetrical and positively defined.
See Also:
org.opencv.core.Core.invert, org.opencv.core.SVD, solve(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int)

kmeans

public static double kmeans(Mat data,
                            int K,
                            Mat bestLabels,
                            TermCriteria criteria,
                            int attempts,
                            int flags)

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

The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters and groups the input samples around the clusters. As an output, labels_i contains a 0-based cluster index for the sample stored in the i^(th) row of the samples matrix.

The function returns the compactness measure that is computed as

sum _i|samples _i - centers _(labels _i)| ^2

after every attempt. The best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function. Basically, you can use only the core of the function, set the number of attempts to 1, initialize labels each time using a custom algorithm, pass them with the (flags = KMEANS_USE_INITIAL_LABELS) flag, and then choose the best (most-compact) clustering.

Parameters:
data - a data
K - a K
bestLabels - a bestLabels
criteria - The algorithm termination criteria, that is, the maximum number of iterations and/or the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
attempts - Flag to specify the number of times the algorithm is executed using different initial labellings. The algorithm returns the labels that yield the best compactness (see the last function parameter).
flags - Flag that can take the following values:
  • KMEANS_RANDOM_CENTERS Select random initial centers in each attempt.
  • KMEANS_PP_CENTERS Use kmeans++ center initialization by Arthur and Vassilvitskii [Arthur2007].
  • KMEANS_USE_INITIAL_LABELS During the first (and possibly the only) attempt, use the user-supplied labels instead of computing them from the initial centers. For the second and further attempts, use the random or semi-random centers. Use one of KMEANS_*_CENTERS flag to specify the exact method.
See Also:
org.opencv.core.Core.kmeans

kmeans

public static double kmeans(Mat data,
                            int K,
                            Mat bestLabels,
                            TermCriteria criteria,
                            int attempts,
                            int flags,
                            Mat centers)

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

The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters and groups the input samples around the clusters. As an output, labels_i contains a 0-based cluster index for the sample stored in the i^(th) row of the samples matrix.

The function returns the compactness measure that is computed as

sum _i|samples _i - centers _(labels _i)| ^2

after every attempt. The best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function. Basically, you can use only the core of the function, set the number of attempts to 1, initialize labels each time using a custom algorithm, pass them with the (flags = KMEANS_USE_INITIAL_LABELS) flag, and then choose the best (most-compact) clustering.

Parameters:
data - a data
K - a K
bestLabels - a bestLabels
criteria - The algorithm termination criteria, that is, the maximum number of iterations and/or the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
attempts - Flag to specify the number of times the algorithm is executed using different initial labellings. The algorithm returns the labels that yield the best compactness (see the last function parameter).
flags - Flag that can take the following values:
  • KMEANS_RANDOM_CENTERS Select random initial centers in each attempt.
  • KMEANS_PP_CENTERS Use kmeans++ center initialization by Arthur and Vassilvitskii [Arthur2007].
  • KMEANS_USE_INITIAL_LABELS During the first (and possibly the only) attempt, use the user-supplied labels instead of computing them from the initial centers. For the second and further attempts, use the random or semi-random centers. Use one of KMEANS_*_CENTERS flag to specify the exact method.
centers - Output matrix of the cluster centers, one row per each cluster center.
See Also:
org.opencv.core.Core.kmeans

line

public static void line(Mat img,
                        Point pt1,
                        Point pt2,
                        Scalar color)

Draws a line segment connecting two points.

The function line draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering. To specify the line color, you may use the macro CV_RGB(r, g, b).

Parameters:
img - Image.
pt1 - First point of the line segment.
pt2 - Second point of the line segment.
color - Line color.
See Also:
org.opencv.core.Core.line

line

public static void line(Mat img,
                        Point pt1,
                        Point pt2,
                        Scalar color,
                        int thickness)

Draws a line segment connecting two points.

The function line draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering. To specify the line color, you may use the macro CV_RGB(r, g, b).

Parameters:
img - Image.
pt1 - First point of the line segment.
pt2 - Second point of the line segment.
color - Line color.
thickness - Line thickness.
See Also:
org.opencv.core.Core.line

line

public static void line(Mat img,
                        Point pt1,
                        Point pt2,
                        Scalar color,
                        int thickness,
                        int lineType,
                        int shift)

Draws a line segment connecting two points.

The function line draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering. To specify the line color, you may use the macro CV_RGB(r, g, b).

Parameters:
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:
  • 8 (or omitted) - 8-connected line.
  • 4 - 4-connected line.
  • CV_AA - antialiased line.
shift - Number of fractional bits in the point coordinates.
See Also:
org.opencv.core.Core.line

log

public static void log(Mat src,
                       Mat dst)

Calculates the natural logarithm of every array element.

The function log calculates the natural logarithm of the absolute value of every element of the input array:

dst(I) = log|src(I)| if src(I) != 0 ; C otherwise

where C is a large negative number (about -700 in the current implementation). The maximum relative error is about 7e-6 for single-precision input and less than 1e-10 for double-precision input. Special values (NaN, Inf) are not handled.

Parameters:
src - Source array.
dst - Destination array of the same size and type as src.
See Also:
org.opencv.core.Core.log, cartToPolar(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), pow(org.opencv.core.Mat, double, org.opencv.core.Mat), sqrt(org.opencv.core.Mat, org.opencv.core.Mat), magnitude(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), polarToCart(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), exp(org.opencv.core.Mat, org.opencv.core.Mat), phase(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean)

LUT

public static void LUT(Mat src,
                       Mat lut,
                       Mat dst)

Performs a look-up table transform of an array.

The function LUT fills the destination array with values from the look-up table. Indices of the entries are taken from the source array. That is, the function processes each element of src as follows:

dst(I) <- lut(src(I) + d)

where

d = 0 if src has depth CV_8U; 128 if src has depth CV_8S

Parameters:
src - Source array of 8-bit elements.
lut - Look-up table of 256 elements. In case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array.
dst - Destination array of the same size and the same number of channels as src, and the same depth as lut.
See Also:
org.opencv.core.Core.LUT, Mat.convertTo(org.opencv.core.Mat, int, double, double), convertScaleAbs(org.opencv.core.Mat, org.opencv.core.Mat, double, double)

LUT

public static void LUT(Mat src,
                       Mat lut,
                       Mat dst,
                       int interpolation)

Performs a look-up table transform of an array.

The function LUT fills the destination array with values from the look-up table. Indices of the entries are taken from the source array. That is, the function processes each element of src as follows:

dst(I) <- lut(src(I) + d)

where

d = 0 if src has depth CV_8U; 128 if src has depth CV_8S

Parameters:
src - Source array of 8-bit elements.
lut - Look-up table of 256 elements. In case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array.
dst - Destination array of the same size and the same number of channels as src, and the same depth as lut.
interpolation - a interpolation
See Also:
org.opencv.core.Core.LUT, Mat.convertTo(org.opencv.core.Mat, int, double, double), convertScaleAbs(org.opencv.core.Mat, org.opencv.core.Mat, double, double)

magnitude

public static void magnitude(Mat x,
                             Mat y,
                             Mat magnitude)

Calculates the magnitude of 2D vectors.

The function magnitude calculates the magnitude of 2D vectors formed from the corresponding elements of x and y arrays:

dst(I) = sqrt(x(I)^2 + y(I)^2)

Parameters:
x - Floating-point array of x-coordinates of the vectors.
y - Floating-point array of y-coordinates of the vectors. It must have the same size as x.
magnitude - Destination array of the same size and type as x.
See Also:
org.opencv.core.Core.magnitude, cartToPolar(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), phase(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), sqrt(org.opencv.core.Mat, org.opencv.core.Mat), polarToCart(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean)

Mahalanobis

public static double Mahalanobis(Mat v1,
                                 Mat v2,
                                 Mat icovar)

Calculates the Mahalanobis distance between two vectors.

The function Mahalanobis calculates and returns the weighted distance between two vectors:

d(vec1, vec2)= sqrt(sum_(i,j)(icovar(i,j)*(vec1(I)-vec2(I))*(vec1(j)-vec2(j))))

The covariance matrix may be calculated using the "calcCovarMatrix" function and then inverted using the "invert" function (preferably using the DECOMP_SVD method, as the most accurate).

Parameters:
v1 - a v1
v2 - a v2
icovar - Inverse covariance matrix.
See Also:
org.opencv.core.Core.Mahalanobis

max

public static void max(Mat src1,
                       Mat src2,
                       Mat dst)

Calculates per-element maximum of two arrays or an array and a scalar.

The functions max compute the per-element maximum of two arrays:

dst(I)= max(src1(I), src2(I))

or array and a scalar:

dst(I)= max(src1(I), value)

In the second variant, when the source array is multi-channel, each channel is compared with value independently.

The first 3 variants of the function listed above are actually a part of "MatrixExpressions". They return an expression object that can be further either transformed/ assigned to a matrix, or passed to a function, and so on.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src1.
See Also:
org.opencv.core.Core.max, compare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), inRange(org.opencv.core.Mat, org.opencv.core.Scalar, org.opencv.core.Scalar, org.opencv.core.Mat), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat), MatrixExpressions, min(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

max

public static void max(Mat src1,
                       Scalar src2,
                       Mat dst)

Calculates per-element maximum of two arrays or an array and a scalar.

The functions max compute the per-element maximum of two arrays:

dst(I)= max(src1(I), src2(I))

or array and a scalar:

dst(I)= max(src1(I), value)

In the second variant, when the source array is multi-channel, each channel is compared with value independently.

The first 3 variants of the function listed above are actually a part of "MatrixExpressions". They return an expression object that can be further either transformed/ assigned to a matrix, or passed to a function, and so on.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src1.
See Also:
org.opencv.core.Core.max, compare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), inRange(org.opencv.core.Mat, org.opencv.core.Scalar, org.opencv.core.Scalar, org.opencv.core.Mat), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat), MatrixExpressions, min(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

mean

public static Scalar mean(Mat src)

Calculates an average (mean) of array elements.

The function mean computes the mean value M of array elements, independently for each channel, and return it:

N = sum(by: I: mask(I) != 0) 1 M_c = (sum(by: I: mask(I) != 0)(mtx(I)_c))/N

When all the mask elements are 0's, the functions return Scalar.all(0).

Parameters:
src - Source array that should have from 1 to 4 channels so that the result can be stored in "Scalar_".
See Also:
org.opencv.core.Core.mean, countNonZero(org.opencv.core.Mat), meanStdDev(org.opencv.core.Mat, org.opencv.core.MatOfDouble, org.opencv.core.MatOfDouble, org.opencv.core.Mat), norm(org.opencv.core.Mat, int, org.opencv.core.Mat), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat)

mean

public static Scalar mean(Mat src,
                          Mat mask)

Calculates an average (mean) of array elements.

The function mean computes the mean value M of array elements, independently for each channel, and return it:

N = sum(by: I: mask(I) != 0) 1 M_c = (sum(by: I: mask(I) != 0)(mtx(I)_c))/N

When all the mask elements are 0's, the functions return Scalar.all(0).

Parameters:
src - Source array that should have from 1 to 4 channels so that the result can be stored in "Scalar_".
mask - Optional operation mask.
See Also:
org.opencv.core.Core.mean, countNonZero(org.opencv.core.Mat), meanStdDev(org.opencv.core.Mat, org.opencv.core.MatOfDouble, org.opencv.core.MatOfDouble, org.opencv.core.Mat), norm(org.opencv.core.Mat, int, org.opencv.core.Mat), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat)

meanStdDev

public static void meanStdDev(Mat src,
                              MatOfDouble mean,
                              MatOfDouble stddev)

Calculates a mean and standard deviation of array elements.

The function meanStdDev computes the mean and the standard deviation M of array elements independently for each channel and returns it via the output parameters:

N = sum(by: I, mask(I) != 0) 1 mean _c = (sum_(I: mask(I) != 0) src(I)_c)/(N) stddev _c = sqrt((sum_(I: mask(I) != 0)(src(I)_c - mean _c)^2)/(N))

When all the mask elements are 0's, the functions return mean=stddev=Scalar.all(0).

Note: The computed standard deviation is only the diagonal of the complete normalized covariance matrix. If the full matrix is needed, you can reshape the multi-channel array M x N to the single-channel array M*N x mtx.channels() (only possible when the matrix is continuous) and then pass the matrix to "calcCovarMatrix".

Parameters:
src - Source array that should have from 1 to 4 channels so that the results can be stored in "Scalar_" 's.
mean - Output parameter: computed mean value.
stddev - Output parameter: computed standard deviation.
See Also:
org.opencv.core.Core.meanStdDev, countNonZero(org.opencv.core.Mat), calcCovarMatrix(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, int), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat), norm(org.opencv.core.Mat, int, org.opencv.core.Mat), mean(org.opencv.core.Mat, org.opencv.core.Mat)

meanStdDev

public static void meanStdDev(Mat src,
                              MatOfDouble mean,
                              MatOfDouble stddev,
                              Mat mask)

Calculates a mean and standard deviation of array elements.

The function meanStdDev computes the mean and the standard deviation M of array elements independently for each channel and returns it via the output parameters:

N = sum(by: I, mask(I) != 0) 1 mean _c = (sum_(I: mask(I) != 0) src(I)_c)/(N) stddev _c = sqrt((sum_(I: mask(I) != 0)(src(I)_c - mean _c)^2)/(N))

When all the mask elements are 0's, the functions return mean=stddev=Scalar.all(0).

Note: The computed standard deviation is only the diagonal of the complete normalized covariance matrix. If the full matrix is needed, you can reshape the multi-channel array M x N to the single-channel array M*N x mtx.channels() (only possible when the matrix is continuous) and then pass the matrix to "calcCovarMatrix".

Parameters:
src - Source array that should have from 1 to 4 channels so that the results can be stored in "Scalar_" 's.
mean - Output parameter: computed mean value.
stddev - Output parameter: computed standard deviation.
mask - Optional operation mask.
See Also:
org.opencv.core.Core.meanStdDev, countNonZero(org.opencv.core.Mat), calcCovarMatrix(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, int), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat), norm(org.opencv.core.Mat, int, org.opencv.core.Mat), mean(org.opencv.core.Mat, org.opencv.core.Mat)

merge

public static void merge(java.util.List<Mat> mv,
                         Mat dst)

Composes a multi-channel array from several single-channel arrays.

The functions merge merge several arrays to make a single multi-channel array. That is, each element of the output array will be a concatenation of the elements of the input arrays, where elements of i-th input array are treated as mv[i].channels()-element vectors.

The function "split" does the reverse operation. If you need to shuffle channels in some other advanced way, use "mixChannels".

Parameters:
mv - Source array or vector of matrices to be merged. All the matrices in mv must have the same size and the same depth.
dst - Destination array of the same size and the same depth as mv[0]. The number of channels will be the total number of channels in the matrix array.
See Also:
org.opencv.core.Core.merge, Mat.reshape(int, int), mixChannels(java.util.List, java.util.List, org.opencv.core.MatOfInt), split(org.opencv.core.Mat, java.util.List)

min

public static void min(Mat src1,
                       Mat src2,
                       Mat dst)

Calculates per-element minimum of two arrays or array and a scalar.

The functions min compute the per-element minimum of two arrays:

dst(I)= min(src1(I), src2(I))

or array and a scalar:

dst(I)= min(src1(I), value)

In the second variant, when the source array is multi-channel, each channel is compared with value independently.

The first three variants of the function listed above are actually a part of "MatrixExpressions". They return the expression object that can be further either transformed/assigned to a matrix, or passed to a function, and so on.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src1.
See Also:
org.opencv.core.Core.min, max(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), compare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), inRange(org.opencv.core.Mat, org.opencv.core.Scalar, org.opencv.core.Scalar, org.opencv.core.Mat), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat), MatrixExpressions

min

public static void min(Mat src1,
                       Scalar src2,
                       Mat dst)

Calculates per-element minimum of two arrays or array and a scalar.

The functions min compute the per-element minimum of two arrays:

dst(I)= min(src1(I), src2(I))

or array and a scalar:

dst(I)= min(src1(I), value)

In the second variant, when the source array is multi-channel, each channel is compared with value independently.

The first three variants of the function listed above are actually a part of "MatrixExpressions". They return the expression object that can be further either transformed/assigned to a matrix, or passed to a function, and so on.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src1.
See Also:
org.opencv.core.Core.min, max(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), compare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), inRange(org.opencv.core.Mat, org.opencv.core.Scalar, org.opencv.core.Scalar, org.opencv.core.Mat), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat), MatrixExpressions

minMaxLoc

public static Core.MinMaxLocResult minMaxLoc(Mat src)

Finds the global minimum and maximum in an array.

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

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

Parameters:
src - Source single-channel array.
See Also:
org.opencv.core.Core.minMaxLoc, compare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), org.opencv.core.Core#extractImageCOI, min(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), mixChannels(java.util.List, java.util.List, org.opencv.core.MatOfInt), Mat.reshape(int, int), split(org.opencv.core.Mat, java.util.List), max(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), inRange(org.opencv.core.Mat, org.opencv.core.Scalar, org.opencv.core.Scalar, org.opencv.core.Mat)

minMaxLoc

public static Core.MinMaxLocResult minMaxLoc(Mat src,
                                             Mat mask)

Finds the global minimum and maximum in an array.

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

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

Parameters:
src - Source single-channel array.
mask - Optional mask used to select a sub-array.
See Also:
org.opencv.core.Core.minMaxLoc, compare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), org.opencv.core.Core#extractImageCOI, min(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), mixChannels(java.util.List, java.util.List, org.opencv.core.MatOfInt), Mat.reshape(int, int), split(org.opencv.core.Mat, java.util.List), max(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), inRange(org.opencv.core.Mat, org.opencv.core.Scalar, org.opencv.core.Scalar, org.opencv.core.Mat)

mixChannels

public static void mixChannels(java.util.List<Mat> src,
                               java.util.List<Mat> dst,
                               MatOfInt fromTo)

Copies specified channels from input arrays to the specified channels of output arrays.

The functions mixChannels provide an advanced mechanism for shuffling image channels.

"split" and "merge" and some forms of "cvtColor" are partial cases of mixChannels.

In the example below, the code splits a 4-channel RGBA image into a 3-channel BGR (with R and B channels swapped) and a separate alpha-channel image:

Note: Unlike many other new-style C++ functions in OpenCV (see the introduction section and "Mat.create"), mixChannels requires the destination arrays to be pre-allocated before calling the function.

Parameters:
src - Input array or vector of matrices. All the matrices must have the same size and the same depth.
dst - Output array or vector of matrices. All the matrices *must be allocated*. Their size and depth must be the same as in src[0].
fromTo - Array of index pairs specifying which channels are copied and where. fromTo[k*2] is a 0-based index of the input channel in src. fromTo[k*2+1] is an index of the output channel in dst. The continuous channel numbering is used: the first input image channels are indexed from 0 to src[0].channels()-1, the second input image channels are indexed from src[0].channels() to src[0].channels() + src[1].channels()-1, and so on. The same scheme is used for the output image channels. As a special case, when fromTo[k*2] is negative, the corresponding output channel is filled with zero.
See Also:
org.opencv.core.Core.mixChannels, merge(java.util.List, org.opencv.core.Mat), split(org.opencv.core.Mat, java.util.List), Imgproc.cvtColor(org.opencv.core.Mat, org.opencv.core.Mat, int, int)

mulSpectrums

public static void mulSpectrums(Mat a,
                                Mat b,
                                Mat c,
                                int flags)

Performs the per-element multiplication of two Fourier spectrums.

The function mulSpectrums performs the per-element multiplication of the two CCS-packed or complex matrices that are results of a real or complex Fourier transform.

The function, together with "dft" and "idft", may be used to calculate convolution (pass conjB=false) or correlation (pass conjB=true) of two arrays rapidly. When the arrays are complex, they are simply multiplied (per element) with an optional conjugation of the second-array elements. When the arrays are real, they are assumed to be CCS-packed (see "dft" for details).

Parameters:
a - a a
b - a b
c - a c
flags - Operation flags. Currently, the only supported flag is DFT_ROWS, which indicates that each row of src1 and src2 is an independent 1D Fourier spectrum.
See Also:
org.opencv.core.Core.mulSpectrums

mulSpectrums

public static void mulSpectrums(Mat a,
                                Mat b,
                                Mat c,
                                int flags,
                                boolean conjB)

Performs the per-element multiplication of two Fourier spectrums.

The function mulSpectrums performs the per-element multiplication of the two CCS-packed or complex matrices that are results of a real or complex Fourier transform.

The function, together with "dft" and "idft", may be used to calculate convolution (pass conjB=false) or correlation (pass conjB=true) of two arrays rapidly. When the arrays are complex, they are simply multiplied (per element) with an optional conjugation of the second-array elements. When the arrays are real, they are assumed to be CCS-packed (see "dft" for details).

Parameters:
a - a a
b - a b
c - a c
flags - Operation flags. Currently, the only supported flag is DFT_ROWS, which indicates that each row of src1 and src2 is an independent 1D Fourier spectrum.
conjB - Optional flag that conjugates the second source array before the multiplication (true) or not (false).
See Also:
org.opencv.core.Core.mulSpectrums

multiply

public static void multiply(Mat src1,
                            Mat src2,
                            Mat dst)

Calculates the per-element scaled product of two arrays.

The function multiply calculates the per-element product of two arrays:

dst(I)= saturate(scale * src1(I) * src2(I))

There is also a "MatrixExpressions" -friendly variant of the first function. See "Mat.mul".

For a not-per-element matrix product, see "gemm".

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
dst - Destination array of the same size and type as src1.
See Also:
org.opencv.core.Core.multiply, divide(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), Imgproc.accumulateSquare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), Imgproc.accumulate(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions, Imgproc.accumulateProduct(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

multiply

public static void multiply(Mat src1,
                            Mat src2,
                            Mat dst,
                            double scale)

Calculates the per-element scaled product of two arrays.

The function multiply calculates the per-element product of two arrays:

dst(I)= saturate(scale * src1(I) * src2(I))

There is also a "MatrixExpressions" -friendly variant of the first function. See "Mat.mul".

For a not-per-element matrix product, see "gemm".

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
dst - Destination array of the same size and type as src1.
scale - Optional scale factor.
See Also:
org.opencv.core.Core.multiply, divide(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), Imgproc.accumulateSquare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), Imgproc.accumulate(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions, Imgproc.accumulateProduct(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

multiply

public static void multiply(Mat src1,
                            Mat src2,
                            Mat dst,
                            double scale,
                            int dtype)

Calculates the per-element scaled product of two arrays.

The function multiply calculates the per-element product of two arrays:

dst(I)= saturate(scale * src1(I) * src2(I))

There is also a "MatrixExpressions" -friendly variant of the first function. See "Mat.mul".

For a not-per-element matrix product, see "gemm".

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
dst - Destination array of the same size and type as src1.
scale - Optional scale factor.
dtype - a dtype
See Also:
org.opencv.core.Core.multiply, divide(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), Imgproc.accumulateSquare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), Imgproc.accumulate(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions, Imgproc.accumulateProduct(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

multiply

public static void multiply(Mat src1,
                            Scalar src2,
                            Mat dst)

Calculates the per-element scaled product of two arrays.

The function multiply calculates the per-element product of two arrays:

dst(I)= saturate(scale * src1(I) * src2(I))

There is also a "MatrixExpressions" -friendly variant of the first function. See "Mat.mul".

For a not-per-element matrix product, see "gemm".

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
dst - Destination array of the same size and type as src1.
See Also:
org.opencv.core.Core.multiply, divide(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), Imgproc.accumulateSquare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), Imgproc.accumulate(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions, Imgproc.accumulateProduct(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

multiply

public static void multiply(Mat src1,
                            Scalar src2,
                            Mat dst,
                            double scale)

Calculates the per-element scaled product of two arrays.

The function multiply calculates the per-element product of two arrays:

dst(I)= saturate(scale * src1(I) * src2(I))

There is also a "MatrixExpressions" -friendly variant of the first function. See "Mat.mul".

For a not-per-element matrix product, see "gemm".

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
dst - Destination array of the same size and type as src1.
scale - Optional scale factor.
See Also:
org.opencv.core.Core.multiply, divide(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), Imgproc.accumulateSquare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), Imgproc.accumulate(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions, Imgproc.accumulateProduct(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

multiply

public static void multiply(Mat src1,
                            Scalar src2,
                            Mat dst,
                            double scale,
                            int dtype)

Calculates the per-element scaled product of two arrays.

The function multiply calculates the per-element product of two arrays:

dst(I)= saturate(scale * src1(I) * src2(I))

There is also a "MatrixExpressions" -friendly variant of the first function. See "Mat.mul".

For a not-per-element matrix product, see "gemm".

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
dst - Destination array of the same size and type as src1.
scale - Optional scale factor.
dtype - a dtype
See Also:
org.opencv.core.Core.multiply, divide(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int), Mat.convertTo(org.opencv.core.Mat, int, double, double), addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), Imgproc.accumulateSquare(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), Imgproc.accumulate(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions, Imgproc.accumulateProduct(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

mulTransposed

public static void mulTransposed(Mat src,
                                 Mat dst,
                                 boolean aTa)

Calculates the product of a matrix and its transposition.

The function mulTransposed calculates the product of src and its transposition:

dst = scale(src - delta)^T(src - delta)

if aTa=true, and

dst = scale(src - delta)(src - delta)^T

otherwise. The function is used to compute the covariance matrix. With zero delta, it can be used as a faster substitute for general matrix product A*B when B=A'

Parameters:
src - Source single-channel matrix. Note that unlike "gemm", the function can multiply not only floating-point matrices.
dst - Destination square matrix.
aTa - Flag specifying the multiplication ordering. See the description below.
See Also:
org.opencv.core.Core.mulTransposed, calcCovarMatrix(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, int), repeat(org.opencv.core.Mat, int, int, org.opencv.core.Mat), reduce(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int), gemm(org.opencv.core.Mat, org.opencv.core.Mat, double, org.opencv.core.Mat, double, org.opencv.core.Mat, int)

mulTransposed

public static void mulTransposed(Mat src,
                                 Mat dst,
                                 boolean aTa,
                                 Mat delta,
                                 double scale)

Calculates the product of a matrix and its transposition.

The function mulTransposed calculates the product of src and its transposition:

dst = scale(src - delta)^T(src - delta)

if aTa=true, and

dst = scale(src - delta)(src - delta)^T

otherwise. The function is used to compute the covariance matrix. With zero delta, it can be used as a faster substitute for general matrix product A*B when B=A'

Parameters:
src - Source single-channel matrix. Note that unlike "gemm", the function can multiply not only floating-point matrices.
dst - Destination square matrix.
aTa - Flag specifying the multiplication ordering. See the description below.
delta - Optional delta matrix subtracted from src before the multiplication. When the matrix is empty (delta=noArray()), it is assumed to be zero, that is, nothing is subtracted. If it has the same size as src, it is simply subtracted. Otherwise, it is "repeated" (see "repeat") to cover the full src and then subtracted. Type of the delta matrix, when it is not empty, must be the same as the type of created destination matrix. See the dtype parameter description below.
scale - Optional scale factor for the matrix product.
See Also:
org.opencv.core.Core.mulTransposed, calcCovarMatrix(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, int), repeat(org.opencv.core.Mat, int, int, org.opencv.core.Mat), reduce(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int), gemm(org.opencv.core.Mat, org.opencv.core.Mat, double, org.opencv.core.Mat, double, org.opencv.core.Mat, int)

mulTransposed

public static void mulTransposed(Mat src,
                                 Mat dst,
                                 boolean aTa,
                                 Mat delta,
                                 double scale,
                                 int dtype)

Calculates the product of a matrix and its transposition.

The function mulTransposed calculates the product of src and its transposition:

dst = scale(src - delta)^T(src - delta)

if aTa=true, and

dst = scale(src - delta)(src - delta)^T

otherwise. The function is used to compute the covariance matrix. With zero delta, it can be used as a faster substitute for general matrix product A*B when B=A'

Parameters:
src - Source single-channel matrix. Note that unlike "gemm", the function can multiply not only floating-point matrices.
dst - Destination square matrix.
aTa - Flag specifying the multiplication ordering. See the description below.
delta - Optional delta matrix subtracted from src before the multiplication. When the matrix is empty (delta=noArray()), it is assumed to be zero, that is, nothing is subtracted. If it has the same size as src, it is simply subtracted. Otherwise, it is "repeated" (see "repeat") to cover the full src and then subtracted. Type of the delta matrix, when it is not empty, must be the same as the type of created destination matrix. See the dtype parameter description below.
scale - Optional scale factor for the matrix product.
dtype - Optional type of the destination matrix. When it is negative, the destination matrix will have the same type as src. Otherwise, it will be type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F.
See Also:
org.opencv.core.Core.mulTransposed, calcCovarMatrix(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int, int), repeat(org.opencv.core.Mat, int, int, org.opencv.core.Mat), reduce(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int), gemm(org.opencv.core.Mat, org.opencv.core.Mat, double, org.opencv.core.Mat, double, org.opencv.core.Mat, int)

norm

public static double norm(Mat src1)

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

The functions norm calculate an absolute norm of src1 (when there is no src2):

norm = forkthree(|src1|_(L_(infty)) = max _I|src1(I)|)(if normType = NORM_INF) (|src1|_(L_1) = sum _I|src1(I)|)(if normType = NORM_L1) (|src1|_(L_2) = sqrt(sum_I src1(I)^2))(if normType = NORM_L2)

or an absolute or relative difference norm if src2 is there:

norm = forkthree(|src1-src2|_(L_(infty)) = max _I|src1(I) - src2(I)|)(if normType = NORM_INF) (|src1 - src2|_(L_1) = sum _I|src1(I) - src2(I)|)(if normType = NORM_L1) (|src1 - src2|_(L_2) = sqrt(sum_I(src1(I) - src2(I))^2))(if normType = NORM_L2)

or

norm = forkthree((|src1-src2|_(L_(infty)))/(|src2|_(L_(infty))))(if normType = NORM_RELATIVE_INF) ((|src1-src2|_(L_1))/(|src2|_(L_1)))(if normType = NORM_RELATIVE_L1) ((|src1-src2|_(L_2))/(|src2|_(L_2)))(if normType = NORM_RELATIVE_L2)

The functions norm return the calculated norm.

When the mask parameter is specified and it is not empty, the norm is computed only over the region specified by the mask.

A multi-channel source arrays are treated as a single-channel, that is, the results for all channels are combined.

Parameters:
src1 - First source array.
See Also:
org.opencv.core.Core.norm

norm

public static double norm(Mat src1,
                          int normType)

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

The functions norm calculate an absolute norm of src1 (when there is no src2):

norm = forkthree(|src1|_(L_(infty)) = max _I|src1(I)|)(if normType = NORM_INF) (|src1|_(L_1) = sum _I|src1(I)|)(if normType = NORM_L1) (|src1|_(L_2) = sqrt(sum_I src1(I)^2))(if normType = NORM_L2)

or an absolute or relative difference norm if src2 is there:

norm = forkthree(|src1-src2|_(L_(infty)) = max _I|src1(I) - src2(I)|)(if normType = NORM_INF) (|src1 - src2|_(L_1) = sum _I|src1(I) - src2(I)|)(if normType = NORM_L1) (|src1 - src2|_(L_2) = sqrt(sum_I(src1(I) - src2(I))^2))(if normType = NORM_L2)

or

norm = forkthree((|src1-src2|_(L_(infty)))/(|src2|_(L_(infty))))(if normType = NORM_RELATIVE_INF) ((|src1-src2|_(L_1))/(|src2|_(L_1)))(if normType = NORM_RELATIVE_L1) ((|src1-src2|_(L_2))/(|src2|_(L_2)))(if normType = NORM_RELATIVE_L2)

The functions norm return the calculated norm.

When the mask parameter is specified and it is not empty, the norm is computed only over the region specified by the mask.

A multi-channel source arrays are treated as a single-channel, that is, the results for all channels are combined.

Parameters:
src1 - First source array.
normType - Type of the norm. See the details below.
See Also:
org.opencv.core.Core.norm

norm

public static double norm(Mat src1,
                          int normType,
                          Mat mask)

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

The functions norm calculate an absolute norm of src1 (when there is no src2):

norm = forkthree(|src1|_(L_(infty)) = max _I|src1(I)|)(if normType = NORM_INF) (|src1|_(L_1) = sum _I|src1(I)|)(if normType = NORM_L1) (|src1|_(L_2) = sqrt(sum_I src1(I)^2))(if normType = NORM_L2)

or an absolute or relative difference norm if src2 is there:

norm = forkthree(|src1-src2|_(L_(infty)) = max _I|src1(I) - src2(I)|)(if normType = NORM_INF) (|src1 - src2|_(L_1) = sum _I|src1(I) - src2(I)|)(if normType = NORM_L1) (|src1 - src2|_(L_2) = sqrt(sum_I(src1(I) - src2(I))^2))(if normType = NORM_L2)

or

norm = forkthree((|src1-src2|_(L_(infty)))/(|src2|_(L_(infty))))(if normType = NORM_RELATIVE_INF) ((|src1-src2|_(L_1))/(|src2|_(L_1)))(if normType = NORM_RELATIVE_L1) ((|src1-src2|_(L_2))/(|src2|_(L_2)))(if normType = NORM_RELATIVE_L2)

The functions norm return the calculated norm.

When the mask parameter is specified and it is not empty, the norm is computed only over the region specified by the mask.

A multi-channel source arrays are treated as a single-channel, that is, the results for all channels are combined.

Parameters:
src1 - First source array.
normType - Type of the norm. See the details below.
mask - Optional operation mask. It must have the same size as src1 and CV_8UC1 type.
See Also:
org.opencv.core.Core.norm

norm

public static double norm(Mat src1,
                          Mat src2)

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

The functions norm calculate an absolute norm of src1 (when there is no src2):

norm = forkthree(|src1|_(L_(infty)) = max _I|src1(I)|)(if normType = NORM_INF) (|src1|_(L_1) = sum _I|src1(I)|)(if normType = NORM_L1) (|src1|_(L_2) = sqrt(sum_I src1(I)^2))(if normType = NORM_L2)

or an absolute or relative difference norm if src2 is there:

norm = forkthree(|src1-src2|_(L_(infty)) = max _I|src1(I) - src2(I)|)(if normType = NORM_INF) (|src1 - src2|_(L_1) = sum _I|src1(I) - src2(I)|)(if normType = NORM_L1) (|src1 - src2|_(L_2) = sqrt(sum_I(src1(I) - src2(I))^2))(if normType = NORM_L2)

or

norm = forkthree((|src1-src2|_(L_(infty)))/(|src2|_(L_(infty))))(if normType = NORM_RELATIVE_INF) ((|src1-src2|_(L_1))/(|src2|_(L_1)))(if normType = NORM_RELATIVE_L1) ((|src1-src2|_(L_2))/(|src2|_(L_2)))(if normType = NORM_RELATIVE_L2)

The functions norm return the calculated norm.

When the mask parameter is specified and it is not empty, the norm is computed only over the region specified by the mask.

A multi-channel source arrays are treated as a single-channel, that is, the results for all channels are combined.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
See Also:
org.opencv.core.Core.norm

norm

public static double norm(Mat src1,
                          Mat src2,
                          int normType)

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

The functions norm calculate an absolute norm of src1 (when there is no src2):

norm = forkthree(|src1|_(L_(infty)) = max _I|src1(I)|)(if normType = NORM_INF) (|src1|_(L_1) = sum _I|src1(I)|)(if normType = NORM_L1) (|src1|_(L_2) = sqrt(sum_I src1(I)^2))(if normType = NORM_L2)

or an absolute or relative difference norm if src2 is there:

norm = forkthree(|src1-src2|_(L_(infty)) = max _I|src1(I) - src2(I)|)(if normType = NORM_INF) (|src1 - src2|_(L_1) = sum _I|src1(I) - src2(I)|)(if normType = NORM_L1) (|src1 - src2|_(L_2) = sqrt(sum_I(src1(I) - src2(I))^2))(if normType = NORM_L2)

or

norm = forkthree((|src1-src2|_(L_(infty)))/(|src2|_(L_(infty))))(if normType = NORM_RELATIVE_INF) ((|src1-src2|_(L_1))/(|src2|_(L_1)))(if normType = NORM_RELATIVE_L1) ((|src1-src2|_(L_2))/(|src2|_(L_2)))(if normType = NORM_RELATIVE_L2)

The functions norm return the calculated norm.

When the mask parameter is specified and it is not empty, the norm is computed only over the region specified by the mask.

A multi-channel source arrays are treated as a single-channel, that is, the results for all channels are combined.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
normType - Type of the norm. See the details below.
See Also:
org.opencv.core.Core.norm

norm

public static double norm(Mat src1,
                          Mat src2,
                          int normType,
                          Mat mask)

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

The functions norm calculate an absolute norm of src1 (when there is no src2):

norm = forkthree(|src1|_(L_(infty)) = max _I|src1(I)|)(if normType = NORM_INF) (|src1|_(L_1) = sum _I|src1(I)|)(if normType = NORM_L1) (|src1|_(L_2) = sqrt(sum_I src1(I)^2))(if normType = NORM_L2)

or an absolute or relative difference norm if src2 is there:

norm = forkthree(|src1-src2|_(L_(infty)) = max _I|src1(I) - src2(I)|)(if normType = NORM_INF) (|src1 - src2|_(L_1) = sum _I|src1(I) - src2(I)|)(if normType = NORM_L1) (|src1 - src2|_(L_2) = sqrt(sum_I(src1(I) - src2(I))^2))(if normType = NORM_L2)

or

norm = forkthree((|src1-src2|_(L_(infty)))/(|src2|_(L_(infty))))(if normType = NORM_RELATIVE_INF) ((|src1-src2|_(L_1))/(|src2|_(L_1)))(if normType = NORM_RELATIVE_L1) ((|src1-src2|_(L_2))/(|src2|_(L_2)))(if normType = NORM_RELATIVE_L2)

The functions norm return the calculated norm.

When the mask parameter is specified and it is not empty, the norm is computed only over the region specified by the mask.

A multi-channel source arrays are treated as a single-channel, that is, the results for all channels are combined.

Parameters:
src1 - First source array.
src2 - Second source array of the same size and the same type as src1.
normType - Type of the norm. See the details below.
mask - Optional operation mask. It must have the same size as src1 and CV_8UC1 type.
See Also:
org.opencv.core.Core.norm

normalize

public static void normalize(Mat src,
                             Mat dst)

Normalizes the norm or value range of an array.

The functions normalize scale and shift the source array elements so that

| dst|_(L_p)= alpha

(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that

min _I dst(I)= alpha, max _I dst(I)= beta

when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are computed over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to compute the norm or min-max but modify the whole array, you can use "norm" and "Mat.convertTo".

In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level.

Parameters:
src - Source array.
dst - Destination array of the same size as src.
See Also:
org.opencv.core.Core.normalize, SparseMat.convertTo, Mat.convertTo(org.opencv.core.Mat, int, double, double), norm(org.opencv.core.Mat, int, org.opencv.core.Mat)

normalize

public static void normalize(Mat src,
                             Mat dst,
                             double alpha,
                             double beta,
                             int norm_type)

Normalizes the norm or value range of an array.

The functions normalize scale and shift the source array elements so that

| dst|_(L_p)= alpha

(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that

min _I dst(I)= alpha, max _I dst(I)= beta

when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are computed over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to compute the norm or min-max but modify the whole array, you can use "norm" and "Mat.convertTo".

In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level.

Parameters:
src - Source array.
dst - Destination array of the same size as src.
alpha - Norm value to normalize to or the lower range boundary in case of the range normalization.
beta - Upper range boundary in case of the range normalization. It is not used for the norm normalization.
norm_type - a norm_type
See Also:
org.opencv.core.Core.normalize, SparseMat.convertTo, Mat.convertTo(org.opencv.core.Mat, int, double, double), norm(org.opencv.core.Mat, int, org.opencv.core.Mat)

normalize

public static void normalize(Mat src,
                             Mat dst,
                             double alpha,
                             double beta,
                             int norm_type,
                             int dtype)

Normalizes the norm or value range of an array.

The functions normalize scale and shift the source array elements so that

| dst|_(L_p)= alpha

(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that

min _I dst(I)= alpha, max _I dst(I)= beta

when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are computed over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to compute the norm or min-max but modify the whole array, you can use "norm" and "Mat.convertTo".

In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level.

Parameters:
src - Source array.
dst - Destination array of the same size as src.
alpha - Norm value to normalize to or the lower range boundary in case of the range normalization.
beta - Upper range boundary in case of the range normalization. It is not used for the norm normalization.
norm_type - a norm_type
dtype - When the parameter is negative, the destination array has the same type as src. Otherwise, it has the same number of channels as src and the depth =CV_MAT_DEPTH(dtype).
See Also:
org.opencv.core.Core.normalize, SparseMat.convertTo, Mat.convertTo(org.opencv.core.Mat, int, double, double), norm(org.opencv.core.Mat, int, org.opencv.core.Mat)

normalize

public static void normalize(Mat src,
                             Mat dst,
                             double alpha,
                             double beta,
                             int norm_type,
                             int dtype,
                             Mat mask)

Normalizes the norm or value range of an array.

The functions normalize scale and shift the source array elements so that

| dst|_(L_p)= alpha

(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that

min _I dst(I)= alpha, max _I dst(I)= beta

when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are computed over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to compute the norm or min-max but modify the whole array, you can use "norm" and "Mat.convertTo".

In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level.

Parameters:
src - Source array.
dst - Destination array of the same size as src.
alpha - Norm value to normalize to or the lower range boundary in case of the range normalization.
beta - Upper range boundary in case of the range normalization. It is not used for the norm normalization.
norm_type - a norm_type
dtype - When the parameter is negative, the destination array has the same type as src. Otherwise, it has the same number of channels as src and the depth =CV_MAT_DEPTH(dtype).
mask - Optional operation mask.
See Also:
org.opencv.core.Core.normalize, SparseMat.convertTo, Mat.convertTo(org.opencv.core.Mat, int, double, double), norm(org.opencv.core.Mat, int, org.opencv.core.Mat)

patchNaNs

public static void patchNaNs(Mat a)

patchNaNs

public static void patchNaNs(Mat a,
                             double val)

PCABackProject

public static void PCABackProject(Mat data,
                                  Mat mean,
                                  Mat eigenvectors,
                                  Mat result)

PCACompute

public static void PCACompute(Mat data,
                              Mat mean,
                              Mat eigenvectors)

PCACompute

public static void PCACompute(Mat data,
                              Mat mean,
                              Mat eigenvectors,
                              int maxComponents)

PCAProject

public static void PCAProject(Mat data,
                              Mat mean,
                              Mat eigenvectors,
                              Mat result)

perspectiveTransform

public static void perspectiveTransform(Mat src,
                                        Mat dst,
                                        Mat m)

Performs the perspective matrix transformation of vectors.

The function perspectiveTransform transforms every element of src by treating it as a 2D or 3D vector, in the following way:

(x, y, z) -> (x'/w, y'/w, z'/w)

where

(x', y', z', w') = mat * x y z 1

and

w = w' if w' != 0; infty otherwise

Here a 3D vector transformation is shown. In case of a 2D vector transformation, the z component is omitted.

Note: The function transforms a sparse set of 2D or 3D vectors. If you want to transform an image using perspective transformation, use "warpPerspective". If you have an inverse problem, that is, you want to compute the most probable perspective transformation out of several pairs of corresponding points, you can use "getPerspectiveTransform" or "findHomography".

Parameters:
src - Source two-channel or three-channel floating-point array. Each element is a 2D/3D vector to be transformed.
dst - Destination array of the same size and type as src.
m - 3x3 or 4x4 floating-point transformation matrix.
See Also:
org.opencv.core.Core.perspectiveTransform, Calib3d.findHomography(org.opencv.core.MatOfPoint2f, org.opencv.core.MatOfPoint2f, int, double, org.opencv.core.Mat), Imgproc.warpPerspective(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Size, int, int, org.opencv.core.Scalar), transform(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), Imgproc.getPerspectiveTransform(org.opencv.core.Mat, org.opencv.core.Mat)

phase

public static void phase(Mat x,
                         Mat y,
                         Mat angle)

Calculates the rotation angle of 2D vectors.

The function phase computes the rotation angle of each 2D vector that is formed from the corresponding elements of x and y :

angle(I) = atan2(y(I), x(I))

The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0, the corresponding angle(I) is set to 0.

Parameters:
x - Source floating-point array of x-coordinates of 2D vectors.
y - Source array of y-coordinates of 2D vectors. It must have the same size and the same type as x.
angle - Destination array of vector angles. It has the same size and same type as x.
See Also:
org.opencv.core.Core.phase

phase

public static void phase(Mat x,
                         Mat y,
                         Mat angle,
                         boolean angleInDegrees)

Calculates the rotation angle of 2D vectors.

The function phase computes the rotation angle of each 2D vector that is formed from the corresponding elements of x and y :

angle(I) = atan2(y(I), x(I))

The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0, the corresponding angle(I) is set to 0.

Parameters:
x - Source floating-point array of x-coordinates of 2D vectors.
y - Source array of y-coordinates of 2D vectors. It must have the same size and the same type as x.
angle - Destination array of vector angles. It has the same size and same type as x.
angleInDegrees - When it is true, the function computes the angle in degrees. Otherwise, they are measured in radians.
See Also:
org.opencv.core.Core.phase

polarToCart

public static void polarToCart(Mat magnitude,
                               Mat angle,
                               Mat x,
                               Mat y)

Computes x and y coordinates of 2D vectors from their magnitude and angle.

The function polarToCart computes the Cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle :

x(I) = magnitude(I) cos(angle(I)) y(I) = magnitude(I) sin(angle(I))

The relative accuracy of the estimated coordinates is about 1e-6.

Parameters:
magnitude - Source floating-point array of magnitudes of 2D vectors. It can be an empty matrix (=Mat()). In this case, the function assumes that all the magnitudes are =1. If it is not empty, it must have the same size and type as angle.
angle - Source floating-point array of angles of 2D vectors.
x - Destination array of x-coordinates of 2D vectors. It has the same size and type as angle.
y - Destination array of y-coordinates of 2D vectors. It has the same size and type as angle.
See Also:
org.opencv.core.Core.polarToCart, log(org.opencv.core.Mat, org.opencv.core.Mat), cartToPolar(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), pow(org.opencv.core.Mat, double, org.opencv.core.Mat), sqrt(org.opencv.core.Mat, org.opencv.core.Mat), magnitude(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), exp(org.opencv.core.Mat, org.opencv.core.Mat), phase(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean)

polarToCart

public static void polarToCart(Mat magnitude,
                               Mat angle,
                               Mat x,
                               Mat y,
                               boolean angleInDegrees)

Computes x and y coordinates of 2D vectors from their magnitude and angle.

The function polarToCart computes the Cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle :

x(I) = magnitude(I) cos(angle(I)) y(I) = magnitude(I) sin(angle(I))

The relative accuracy of the estimated coordinates is about 1e-6.

Parameters:
magnitude - Source floating-point array of magnitudes of 2D vectors. It can be an empty matrix (=Mat()). In this case, the function assumes that all the magnitudes are =1. If it is not empty, it must have the same size and type as angle.
angle - Source floating-point array of angles of 2D vectors.
x - Destination array of x-coordinates of 2D vectors. It has the same size and type as angle.
y - Destination array of y-coordinates of 2D vectors. It has the same size and type as angle.
angleInDegrees - When it is true, the input angles are measured in degrees. Otherwise. they are measured in radians.
See Also:
org.opencv.core.Core.polarToCart, log(org.opencv.core.Mat, org.opencv.core.Mat), cartToPolar(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), pow(org.opencv.core.Mat, double, org.opencv.core.Mat), sqrt(org.opencv.core.Mat, org.opencv.core.Mat), magnitude(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), exp(org.opencv.core.Mat, org.opencv.core.Mat), phase(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean)

polylines

public static void polylines(Mat img,
                             java.util.List<MatOfPoint> pts,
                             boolean isClosed,
                             Scalar color)

Draws several polygonal curves.

The function polylines draws one or more polygonal curves.

Parameters:
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.
See Also:
org.opencv.core.Core.polylines

polylines

public static void polylines(Mat img,
                             java.util.List<MatOfPoint> pts,
                             boolean isClosed,
                             Scalar color,
                             int thickness)

Draws several polygonal curves.

The function polylines draws one or more polygonal curves.

Parameters:
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.
See Also:
org.opencv.core.Core.polylines

polylines

public static void polylines(Mat img,
                             java.util.List<MatOfPoint> pts,
                             boolean isClosed,
                             Scalar color,
                             int thickness,
                             int lineType,
                             int shift)

Draws several polygonal curves.

The function polylines draws one or more polygonal curves.

Parameters:
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 the "line" description.
shift - Number of fractional bits in the vertex coordinates.
See Also:
org.opencv.core.Core.polylines

pow

public static void pow(Mat src,
                       double power,
                       Mat dst)

Raises every array element to a power.

The function pow raises every element of the input array to power :

dst(I) = src(I)^power if power is integer; |src(I)|^power otherwise

So, for a non-integer power exponent, the absolute values of input array elements are used. However, it is possible to get true values for negative values using some extra operations. In the example below, computing the 5th root of array src shows:

For some values of power, such as integer values, 0.5 and -0.5, specialized faster algorithms are used.

Special values (NaN, Inf) are not handled.

Parameters:
src - Source array.
power - Exponent of power.
dst - Destination array of the same size and type as src.
See Also:
org.opencv.core.Core.pow, cartToPolar(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), polarToCart(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, boolean), exp(org.opencv.core.Mat, org.opencv.core.Mat), sqrt(org.opencv.core.Mat, org.opencv.core.Mat), log(org.opencv.core.Mat, org.opencv.core.Mat)

putText

public static void putText(Mat img,
                           java.lang.String text,
                           Point org,
                           int fontFace,
                           double fontScale,
                           Scalar color)

Draws a text string.

The function putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See "getTextSize" for a text rendering code example.

Parameters:
img - Image.
text - Text string to be drawn.
org - Bottom-left corner of the text string in the image.
fontFace - Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID's can be combined with FONT_HERSHEY_ITALIC to get the slanted letters.
fontScale - Font scale factor that is multiplied by the font-specific base size.
color - Text color.
See Also:
org.opencv.core.Core.putText

putText

public static void putText(Mat img,
                           java.lang.String text,
                           Point org,
                           int fontFace,
                           double fontScale,
                           Scalar color,
                           int thickness)

Draws a text string.

The function putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See "getTextSize" for a text rendering code example.

Parameters:
img - Image.
text - Text string to be drawn.
org - Bottom-left corner of the text string in the image.
fontFace - Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID's can be combined with FONT_HERSHEY_ITALIC to get the slanted letters.
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.
See Also:
org.opencv.core.Core.putText

putText

public static void putText(Mat img,
                           java.lang.String text,
                           Point org,
                           int fontFace,
                           double fontScale,
                           Scalar color,
                           int thickness,
                           int lineType,
                           boolean bottomLeftOrigin)

Draws a text string.

The function putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See "getTextSize" for a text rendering code example.

Parameters:
img - Image.
text - Text string to be drawn.
org - Bottom-left corner of the text string in the image.
fontFace - Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID's can be combined with FONT_HERSHEY_ITALIC to get the slanted letters.
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 the line for details.
bottomLeftOrigin - When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.
See Also:
org.opencv.core.Core.putText

randn

public static void randn(Mat dst,
                         double mean,
                         double stddev)

Fills the array with normally distributed random numbers.

The function randn fills the matrix dst with normally distributed random numbers with the specified mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the value range of the destination array data type.

Parameters:
dst - Output array of random numbers. The array must be pre-allocated and have 1 to 4 channels.
mean - Mean value (expectation) of the generated random numbers.
stddev - Standard deviation of the generated random numbers. It can be either a vector (in which case a diagonal standard deviation matrix is assumed) or a square matrix.
See Also:
org.opencv.core.Core.randn, org.opencv.core.RNG, randu(org.opencv.core.Mat, double, double)

randShuffle

public static void randShuffle(Mat dst)

randShuffle

public static void randShuffle(Mat dst,
                               double iterFactor)

randu

public static void randu(Mat dst,
                         double low,
                         double high)

Generates a single uniformly-distributed random number or an array of random numbers.

The template functions randu generate and return the next uniformly-distributed random value of the specified type. randu() is an equivalent to (int)theRNG();, and so on. See "RNG" description.

The second non-template variant of the function fills the matrix dst with uniformly-distributed random numbers from the specified range:

low _c <= dst(I)_c < high _c

Parameters:
dst - Output array of random numbers. The array must be pre-allocated.
low - Inclusive lower boundary of the generated random numbers.
high - Exclusive upper boundary of the generated random numbers.
See Also:
org.opencv.core.Core.randu, randn(org.opencv.core.Mat, double, double), org.opencv.core.RNG, org.opencv.core.Core#theRNG

rectangle

public static void rectangle(Mat img,
                             Point pt1,
                             Point pt2,
                             Scalar color)

Draws a simple, thick, or filled up-right rectangle.

The function rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2, or r.tl() and r.br()-Point(1,1).

Parameters:
img - Image.
pt1 - Vertex of the rectangle.
pt2 - Vertex of the rectangle opposite to pt1.
color - Rectangle color or brightness (grayscale image).
See Also:
org.opencv.core.Core.rectangle

rectangle

public static void rectangle(Mat img,
                             Point pt1,
                             Point pt2,
                             Scalar color,
                             int thickness)

Draws a simple, thick, or filled up-right rectangle.

The function rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2, or r.tl() and r.br()-Point(1,1).

Parameters:
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 CV_FILLED, mean that the function has to draw a filled rectangle.
See Also:
org.opencv.core.Core.rectangle

rectangle

public 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.

The function rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2, or r.tl() and r.br()-Point(1,1).

Parameters:
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 CV_FILLED, mean that the function has to draw a filled rectangle.
lineType - Type of the line. See the "line" description.
shift - Number of fractional bits in the point coordinates.
See Also:
org.opencv.core.Core.rectangle

reduce

public static void reduce(Mat src,
                          Mat dst,
                          int dim,
                          int rtype)

Reduces a matrix to a vector.

The function reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of CV_REDUCE_SUM and CV_REDUCE_AVG, the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes.

Parameters:
src - Source 2D matrix.
dst - Destination vector. Its size and type is defined by dim and dtype parameters.
dim - Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column.
rtype - Reduction operation that could be one of the following:
  • CV_REDUCE_SUM The output is the sum of all rows/columns of the matrix.
  • CV_REDUCE_AVG The output is the mean vector of all rows/columns of the matrix.
  • CV_REDUCE_MAX The output is the maximum (column/row-wise) of all rows/columns of the matrix.
  • CV_REDUCE_MIN The output is the minimum (column/row-wise) of all rows/columns of the matrix.
See Also:
org.opencv.core.Core.reduce, repeat(org.opencv.core.Mat, int, int, org.opencv.core.Mat)

reduce

public static void reduce(Mat src,
                          Mat dst,
                          int dim,
                          int rtype,
                          int dtype)

Reduces a matrix to a vector.

The function reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of CV_REDUCE_SUM and CV_REDUCE_AVG, the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes.

Parameters:
src - Source 2D matrix.
dst - Destination vector. Its size and type is defined by dim and dtype parameters.
dim - Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column.
rtype - Reduction operation that could be one of the following:
  • CV_REDUCE_SUM The output is the sum of all rows/columns of the matrix.
  • CV_REDUCE_AVG The output is the mean vector of all rows/columns of the matrix.
  • CV_REDUCE_MAX The output is the maximum (column/row-wise) of all rows/columns of the matrix.
  • CV_REDUCE_MIN The output is the minimum (column/row-wise) of all rows/columns of the matrix.
dtype - When it is negative, the destination vector will have the same type as the source matrix. Otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).
See Also:
org.opencv.core.Core.reduce, repeat(org.opencv.core.Mat, int, int, org.opencv.core.Mat)

repeat

public static void repeat(Mat src,
                          int ny,
                          int nx,
                          Mat dst)

Fills the destination array with repeated copies of the source array.

The functions "repeat" duplicate the source array one or more times along each of the two axes:

dst _(ij)= src _(i mod src.rows, j mod src.cols)

The second variant of the function is more convenient to use with "MatrixExpressions".

Parameters:
src - Source array to replicate.
ny - Flag to specify how many times the src is repeated along the vertical axis.
nx - Flag to specify how many times the src is repeated along the horizontal axis.
dst - Destination array of the same type as src.
See Also:
org.opencv.core.Core.repeat, reduce(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int), MatrixExpressions

scaleAdd

public static void scaleAdd(Mat src1,
                            double alpha,
                            Mat src2,
                            Mat dst)

Calculates the sum of a scaled array and another array.

The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY or SAXPY in BLAS (http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms). It calculates the sum of a scaled array and another array:

dst(I)= scale * src1(I) + src2(I)

The function can also be emulated with a matrix expression, for example:

Parameters:
src1 - First source array.
alpha - a alpha
src2 - Second source array of the same size and type as src1.
dst - Destination array of the same size and type as src1.
See Also:
org.opencv.core.Core.scaleAdd, Mat.dot(org.opencv.core.Mat), Mat.convertTo(org.opencv.core.Mat, int, double, double), addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), subtract(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), MatrixExpressions

setIdentity

public static void setIdentity(Mat mtx)

Initializes a scaled identity matrix.

The function "setIdentity" initializes a scaled identity matrix:

mtx(i,j)= value if i=j; 0 otherwise

The function can also be emulated using the matrix initializers and the matrix expressions:

Parameters:
mtx - Matrix to initialize (not necessarily square).
See Also:
org.opencv.core.Core.setIdentity, Mat.operator=, Mat.setTo(org.opencv.core.Scalar), Mat.ones(int, int, int), Mat.zeros(int, int, int), MatrixExpressions

setIdentity

public static void setIdentity(Mat mtx,
                               Scalar s)

Initializes a scaled identity matrix.

The function "setIdentity" initializes a scaled identity matrix:

mtx(i,j)= value if i=j; 0 otherwise

The function can also be emulated using the matrix initializers and the matrix expressions:

Parameters:
mtx - Matrix to initialize (not necessarily square).
s - a s
See Also:
org.opencv.core.Core.setIdentity, Mat.operator=, Mat.setTo(org.opencv.core.Scalar), Mat.ones(int, int, int), Mat.zeros(int, int, int), MatrixExpressions

solve

public static boolean solve(Mat src1,
                            Mat src2,
                            Mat dst)

Solves one or more linear systems or least-squares problems.

The function solve solves a linear system or least-squares problem (the latter is possible with SVD or QR methods, or by specifying the flag DECOMP_NORMAL):

dst = arg min _X|src1 * X - src2|

If DECOMP_LU or DECOMP_CHOLESKY method is used, the function returns 1 if src1 (or src1^Tsrc1) is non-singular. Otherwise, it returns 0. In the latter case, dst is not valid. Other methods find a pseudo-solution in case of a singular left-hand side part.

Note: If you want to find a unity-norm solution of an under-defined singular system src1*dst=0, the function solve will not do the work. Use "SVD.solveZ" instead.

Parameters:
src1 - Input matrix on the left-hand side of the system.
src2 - Input matrix on the right-hand side of the system.
dst - Output solution.
See Also:
org.opencv.core.Core.solve, invert(org.opencv.core.Mat, org.opencv.core.Mat, int), org.opencv.core.SVD, eigen(org.opencv.core.Mat, boolean, org.opencv.core.Mat, org.opencv.core.Mat)

solve

public static boolean solve(Mat src1,
                            Mat src2,
                            Mat dst,
                            int flags)

Solves one or more linear systems or least-squares problems.

The function solve solves a linear system or least-squares problem (the latter is possible with SVD or QR methods, or by specifying the flag DECOMP_NORMAL):

dst = arg min _X|src1 * X - src2|

If DECOMP_LU or DECOMP_CHOLESKY method is used, the function returns 1 if src1 (or src1^Tsrc1) is non-singular. Otherwise, it returns 0. In the latter case, dst is not valid. Other methods find a pseudo-solution in case of a singular left-hand side part.

Note: If you want to find a unity-norm solution of an under-defined singular system src1*dst=0, the function solve will not do the work. Use "SVD.solveZ" instead.

Parameters:
src1 - Input matrix on the left-hand side of the system.
src2 - Input matrix on the right-hand side of the system.
dst - Output solution.
flags - Solution (matrix inversion) method.
  • DECOMP_LU Gaussian elimination with optimal pivot element chosen.
  • DECOMP_CHOLESKY Cholesky LL^T factorization. The matrix src1 must be symmetrical and positively defined.
  • DECOMP_EIG Eigenvalue decomposition. The matrix src1 must be symmetrical.
  • DECOMP_SVD Singular value decomposition (SVD) method. The system can be over-defined and/or the matrix src1 can be singular.
  • DECOMP_QR QR factorization. The system can be over-defined and/or the matrix src1 can be singular.
  • DECOMP_NORMAL While all the previous flags are mutually exclusive, this flag can be used together with any of the previous. It means that the normal equations src1^T*src1*dst=src1^Tsrc2 are solved instead of the original system src1*dst=src2.
See Also:
org.opencv.core.Core.solve, invert(org.opencv.core.Mat, org.opencv.core.Mat, int), org.opencv.core.SVD, eigen(org.opencv.core.Mat, boolean, org.opencv.core.Mat, org.opencv.core.Mat)

solveCubic

public static int solveCubic(Mat coeffs,
                             Mat roots)

Finds the real roots of a cubic equation.

The function solveCubic finds the real roots of a cubic equation:

coeffs [0] x^3 + coeffs [1] x^2 + coeffs [2] x + coeffs [3] = 0

x^3 + coeffs [0] x^2 + coeffs [1] x + coeffs [2] = 0

The roots are stored in the roots array.

Parameters:
coeffs - Equation coefficients, an array of 3 or 4 elements.
roots - Destination array of real roots that has 1 or 3 elements.
See Also:
org.opencv.core.Core.solveCubic

solvePoly

public static double solvePoly(Mat coeffs,
                               Mat roots)

Finds the real or complex roots of a polynomial equation.

The function solvePoly finds real and complex roots of a polynomial equation:

coeffs [n] x^(n) + coeffs [n-1] x^(n-1) +... + coeffs [1] x + coeffs [0] = 0

Parameters:
coeffs - Array of polynomial coefficients.
roots - Destination (complex) array of roots.
See Also:
org.opencv.core.Core.solvePoly

solvePoly

public static double solvePoly(Mat coeffs,
                               Mat roots,
                               int maxIters)

Finds the real or complex roots of a polynomial equation.

The function solvePoly finds real and complex roots of a polynomial equation:

coeffs [n] x^(n) + coeffs [n-1] x^(n-1) +... + coeffs [1] x + coeffs [0] = 0

Parameters:
coeffs - Array of polynomial coefficients.
roots - Destination (complex) array of roots.
maxIters - Maximum number of iterations the algorithm does.
See Also:
org.opencv.core.Core.solvePoly

sort

public static void sort(Mat src,
                        Mat dst,
                        int flags)

Sorts each row or each column of a matrix.

The function sort sorts each matrix row or each matrix column in ascending or descending order. So you should pass two operation flags to get desired behaviour. If you want to sort matrix rows or columns lexicographically, you can use STL std.sort generic function with the proper comparison predicate.

Parameters:
src - Source single-channel array.
dst - Destination array of the same size and type as src.
flags - Operation flags, a combination of the following values:
  • CV_SORT_EVERY_ROW Each matrix row is sorted independently.
  • CV_SORT_EVERY_COLUMN Each matrix column is sorted independently. This flag and the previous one are mutually exclusive.
  • CV_SORT_ASCENDING Each matrix row is sorted in the ascending order.
  • CV_SORT_DESCENDING Each matrix row is sorted in the descending order. This flag and the previous one are also mutually exclusive.
See Also:
org.opencv.core.Core.sort, randShuffle(org.opencv.core.Mat, double), sortIdx(org.opencv.core.Mat, org.opencv.core.Mat, int)

sortIdx

public static void sortIdx(Mat src,
                           Mat dst,
                           int flags)

Sorts each row or each column of a matrix.

The function sortIdx sorts each matrix row or each matrix column in the ascending or descending order. So you should pass two operation flags to get desired behaviour. Instead of reordering the elements themselves, it stores the indices of sorted elements in the destination array. For example:

Parameters:
src - Source single-channel array.
dst - Destination integer array of the same size as src.
flags - Operation flags that could be a combination of the following values:
  • CV_SORT_EVERY_ROW Each matrix row is sorted independently.
  • CV_SORT_EVERY_COLUMN Each matrix column is sorted independently. This flag and the previous one are mutually exclusive.
  • CV_SORT_ASCENDING Each matrix row is sorted in the ascending order.
  • CV_SORT_DESCENDING Each matrix row is sorted in the descending order. This flag and the previous one are also mutually exclusive.
See Also:
org.opencv.core.Core.sortIdx, sort(org.opencv.core.Mat, org.opencv.core.Mat, int), randShuffle(org.opencv.core.Mat, double)

split

public static void split(Mat m,
                         java.util.List<Mat> mv)

Divides a multi-channel array into several single-channel arrays.

The functions split split a multi-channel array into separate single-channel arrays:

mv [c](I) = src(I)_c

If you need to extract a single channel or do some other sophisticated channel permutation, use "mixChannels".

Parameters:
m - a m
mv - Destination array or vector of arrays. In the first variant of the function the number of arrays must match src.channels(). The arrays themselves are reallocated, if needed.
See Also:
org.opencv.core.Core.split, merge(java.util.List, org.opencv.core.Mat), Imgproc.cvtColor(org.opencv.core.Mat, org.opencv.core.Mat, int, int), mixChannels(java.util.List, java.util.List, org.opencv.core.MatOfInt)

sqrt

public static void sqrt(Mat src,
                        Mat dst)

Calculates a square root of array elements.

The functions sqrt calculate a square root of each source array element. In case of multi-channel arrays, each channel is processed independently. The accuracy is approximately the same as of the built-in std.sqrt.

Parameters:
src - Source floating-point array.
dst - Destination array of the same size and type as src.
See Also:
org.opencv.core.Core.sqrt, pow(org.opencv.core.Mat, double, org.opencv.core.Mat), magnitude(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat)

subtract

public static void subtract(Mat src1,
                            Mat src2,
                            Mat dst)

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

The function subtract computes:

dst(I) = saturate(src1(I) - src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) - src2) if mask(I) != 0

dst(I) = saturate(src1 - src2(I)) if mask(I) != 0

dst(I) = saturate(src2 - src1(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array of the same size and the same number of channels as the input array.
See Also:
org.opencv.core.Core.subtract, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), Mat.convertTo(org.opencv.core.Mat, int, double, double), MatrixExpressions

subtract

public static void subtract(Mat src1,
                            Mat src2,
                            Mat dst,
                            Mat mask)

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

The function subtract computes:

dst(I) = saturate(src1(I) - src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) - src2) if mask(I) != 0

dst(I) = saturate(src1 - src2(I)) if mask(I) != 0

dst(I) = saturate(src2 - src1(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array of the same size and the same number of channels as the input array.
mask - Optional operation mask. This is an 8-bit single channel array that specifies elements of the destination array to be changed.
See Also:
org.opencv.core.Core.subtract, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), Mat.convertTo(org.opencv.core.Mat, int, double, double), MatrixExpressions

subtract

public static void subtract(Mat src1,
                            Mat src2,
                            Mat dst,
                            Mat mask,
                            int dtype)

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

The function subtract computes:

dst(I) = saturate(src1(I) - src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) - src2) if mask(I) != 0

dst(I) = saturate(src1 - src2(I)) if mask(I) != 0

dst(I) = saturate(src2 - src1(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array of the same size and the same number of channels as the input array.
mask - Optional operation mask. This is an 8-bit single channel array that specifies elements of the destination array to be changed.
dtype - Optional depth of the output array. See the details below.
See Also:
org.opencv.core.Core.subtract, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), Mat.convertTo(org.opencv.core.Mat, int, double, double), MatrixExpressions

subtract

public static void subtract(Mat src1,
                            Scalar src2,
                            Mat dst)

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

The function subtract computes:

dst(I) = saturate(src1(I) - src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) - src2) if mask(I) != 0

dst(I) = saturate(src1 - src2(I)) if mask(I) != 0

dst(I) = saturate(src2 - src1(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array of the same size and the same number of channels as the input array.
See Also:
org.opencv.core.Core.subtract, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), Mat.convertTo(org.opencv.core.Mat, int, double, double), MatrixExpressions

subtract

public static void subtract(Mat src1,
                            Scalar src2,
                            Mat dst,
                            Mat mask)

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

The function subtract computes:

dst(I) = saturate(src1(I) - src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) - src2) if mask(I) != 0

dst(I) = saturate(src1 - src2(I)) if mask(I) != 0

dst(I) = saturate(src2 - src1(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array of the same size and the same number of channels as the input array.
mask - Optional operation mask. This is an 8-bit single channel array that specifies elements of the destination array to be changed.
See Also:
org.opencv.core.Core.subtract, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), Mat.convertTo(org.opencv.core.Mat, int, double, double), MatrixExpressions

subtract

public static void subtract(Mat src1,
                            Scalar src2,
                            Mat dst,
                            Mat mask,
                            int dtype)

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

The function subtract computes:

dst(I) = saturate(src1(I) - src2(I)) if mask(I) != 0

dst(I) = saturate(src1(I) - src2) if mask(I) != 0

dst(I) = saturate(src1 - src2(I)) if mask(I) != 0

dst(I) = saturate(src2 - src1(I)) if mask(I) != 0

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

The first function in the list above can be replaced with matrix expressions:

The input arrays and the destination array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case the output array will have the same depth as the input array, be it src1, src2 or both.

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Parameters:
src1 - First source array or a scalar.
src2 - Second source array or a scalar.
dst - Destination array of the same size and the same number of channels as the input array.
mask - Optional operation mask. This is an 8-bit single channel array that specifies elements of the destination array to be changed.
dtype - Optional depth of the output array. See the details below.
See Also:
org.opencv.core.Core.subtract, addWeighted(org.opencv.core.Mat, double, org.opencv.core.Mat, double, double, org.opencv.core.Mat, int), add(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, int), scaleAdd(org.opencv.core.Mat, double, org.opencv.core.Mat, org.opencv.core.Mat), Mat.convertTo(org.opencv.core.Mat, int, double, double), MatrixExpressions

sumElems

public static Scalar sumElems(Mat src)

Calculates the sum of array elements.

The functions sum calculate and return the sum of array elements, independently for each channel.

Parameters:
src - a src
See Also:
org.opencv.core.Core.sum, meanStdDev(org.opencv.core.Mat, org.opencv.core.MatOfDouble, org.opencv.core.MatOfDouble, org.opencv.core.Mat), reduce(org.opencv.core.Mat, org.opencv.core.Mat, int, int, int), minMaxLoc(org.opencv.core.Mat, org.opencv.core.Mat), countNonZero(org.opencv.core.Mat), norm(org.opencv.core.Mat, int, org.opencv.core.Mat), mean(org.opencv.core.Mat, org.opencv.core.Mat)

SVBackSubst

public static void SVBackSubst(Mat w,
                               Mat u,
                               Mat vt,
                               Mat rhs,
                               Mat dst)

SVDecomp

public static void SVDecomp(Mat src,
                            Mat w,
                            Mat u,
                            Mat vt)

SVDecomp

public static void SVDecomp(Mat src,
                            Mat w,
                            Mat u,
                            Mat vt,
                            int flags)

trace

public static Scalar trace(Mat mtx)

Returns the trace of a matrix.

The function trace returns the sum of the diagonal elements of the matrix mtx.

tr(mtx) = sum _i mtx(i,i)

Parameters:
mtx - a mtx
See Also:
org.opencv.core.Core.trace

transform

public static void transform(Mat src,
                             Mat dst,
                             Mat m)

Performs the matrix transformation of every array element.

The function transform performs the matrix transformation of every element of the array src and stores the results in dst :

dst(I) = m * src(I)

(when m.cols=src.channels()), or

dst(I) = m * [ src(I); 1]

(when m.cols=src.channels()+1)

Every element of the N -channel array src is interpreted as N -element vector that is transformed using the M x N or M x (N+1) matrix m to M-element vector - the corresponding element of the destination array dst.

The function may be used for geometrical transformation of N -dimensional points, arbitrary linear color space transformation (such as various kinds of RGB to YUV transforms), shuffling the image channels, and so forth.

Parameters:
src - Source array that must have as many channels (1 to 4) as m.cols or m.cols-1.
dst - Destination array of the same size and depth as src. It has as many channels as m.rows.
m - Transformation 2x2 or 2x3 floating-point matrix.
See Also:
org.opencv.core.Core.transform, Imgproc.warpAffine(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Size, int, int, org.opencv.core.Scalar), perspectiveTransform(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat), Imgproc.warpPerspective(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Size, int, int, org.opencv.core.Scalar), Imgproc.getAffineTransform(org.opencv.core.MatOfPoint2f, org.opencv.core.MatOfPoint2f), Video.estimateRigidTransform(org.opencv.core.Mat, org.opencv.core.Mat, boolean)

transpose

public static void transpose(Mat src,
                             Mat dst)

Transposes a matrix.

The function "transpose" transposes the matrix src :

dst(i,j) = src(j,i)

Note: No complex conjugation is done in case of a complex matrix. It it should be done separately if needed.

Parameters:
src - Source array.
dst - Destination array of the same type as src.
See Also:
org.opencv.core.Core.transpose

vconcat

public static void vconcat(java.util.List<Mat> src,
                           Mat dst)

Official OpenCV 2.4 Documentation