001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.core;
005
006import java.util.ArrayList;
007import java.util.List;
008import org.opencv.core.Mat;
009import org.opencv.core.MatOfDouble;
010import org.opencv.core.MatOfInt;
011import org.opencv.core.Scalar;
012import org.opencv.core.TermCriteria;
013import org.opencv.utils.Converters;
014
015// C++: class Core
016
017public class Core {
018    // these constants are wrapped inside functions to prevent inlining
019    private static String getVersion() { return "4.6.0"; }
020    private static String getNativeLibraryName() { return "opencv_java460"; }
021    private static int getVersionMajorJ() { return 4; }
022    private static int getVersionMinorJ() { return 6; }
023    private static int getVersionRevisionJ() { return 0; }
024    private static String getVersionStatusJ() { return ""; }
025
026    public static final String VERSION = getVersion();
027    public static final String NATIVE_LIBRARY_NAME = getNativeLibraryName();
028    public static final int VERSION_MAJOR = getVersionMajorJ();
029    public static final int VERSION_MINOR = getVersionMinorJ();
030    public static final int VERSION_REVISION = getVersionRevisionJ();
031    public static final String VERSION_STATUS = getVersionStatusJ();
032
033    private static final int
034            CV_8U = 0,
035            CV_8S = 1,
036            CV_16U = 2,
037            CV_16S = 3,
038            CV_32S = 4,
039            CV_32F = 5,
040            CV_64F = 6,
041            CV_USRTYPE1 = 7;
042
043
044    // C++: enum <unnamed>
045    public static final int
046            SVD_MODIFY_A = 1,
047            SVD_NO_UV = 2,
048            SVD_FULL_UV = 4,
049            FILLED = -1,
050            REDUCE_SUM = 0,
051            REDUCE_AVG = 1,
052            REDUCE_MAX = 2,
053            REDUCE_MIN = 3,
054            RNG_UNIFORM = 0,
055            RNG_NORMAL = 1;
056
057
058    // C++: enum BorderTypes (cv.BorderTypes)
059    public static final int
060            BORDER_CONSTANT = 0,
061            BORDER_REPLICATE = 1,
062            BORDER_REFLECT = 2,
063            BORDER_WRAP = 3,
064            BORDER_REFLECT_101 = 4,
065            BORDER_TRANSPARENT = 5,
066            BORDER_REFLECT101 = BORDER_REFLECT_101,
067            BORDER_DEFAULT = BORDER_REFLECT_101,
068            BORDER_ISOLATED = 16;
069
070
071    // C++: enum CmpTypes (cv.CmpTypes)
072    public static final int
073            CMP_EQ = 0,
074            CMP_GT = 1,
075            CMP_GE = 2,
076            CMP_LT = 3,
077            CMP_LE = 4,
078            CMP_NE = 5;
079
080
081    // C++: enum CovarFlags (cv.CovarFlags)
082    public static final int
083            COVAR_SCRAMBLED = 0,
084            COVAR_NORMAL = 1,
085            COVAR_USE_AVG = 2,
086            COVAR_SCALE = 4,
087            COVAR_ROWS = 8,
088            COVAR_COLS = 16;
089
090
091    // C++: enum DecompTypes (cv.DecompTypes)
092    public static final int
093            DECOMP_LU = 0,
094            DECOMP_SVD = 1,
095            DECOMP_EIG = 2,
096            DECOMP_CHOLESKY = 3,
097            DECOMP_QR = 4,
098            DECOMP_NORMAL = 16;
099
100
101    // C++: enum DftFlags (cv.DftFlags)
102    public static final int
103            DFT_INVERSE = 1,
104            DFT_SCALE = 2,
105            DFT_ROWS = 4,
106            DFT_COMPLEX_OUTPUT = 16,
107            DFT_REAL_OUTPUT = 32,
108            DFT_COMPLEX_INPUT = 64,
109            DCT_INVERSE = DFT_INVERSE,
110            DCT_ROWS = DFT_ROWS;
111
112
113    // C++: enum Code (cv.Error.Code)
114    public static final int
115            StsOk = 0,
116            StsBackTrace = -1,
117            StsError = -2,
118            StsInternal = -3,
119            StsNoMem = -4,
120            StsBadArg = -5,
121            StsBadFunc = -6,
122            StsNoConv = -7,
123            StsAutoTrace = -8,
124            HeaderIsNull = -9,
125            BadImageSize = -10,
126            BadOffset = -11,
127            BadDataPtr = -12,
128            BadStep = -13,
129            BadModelOrChSeq = -14,
130            BadNumChannels = -15,
131            BadNumChannel1U = -16,
132            BadDepth = -17,
133            BadAlphaChannel = -18,
134            BadOrder = -19,
135            BadOrigin = -20,
136            BadAlign = -21,
137            BadCallBack = -22,
138            BadTileSize = -23,
139            BadCOI = -24,
140            BadROISize = -25,
141            MaskIsTiled = -26,
142            StsNullPtr = -27,
143            StsVecLengthErr = -28,
144            StsFilterStructContentErr = -29,
145            StsKernelStructContentErr = -30,
146            StsFilterOffsetErr = -31,
147            StsBadSize = -201,
148            StsDivByZero = -202,
149            StsInplaceNotSupported = -203,
150            StsObjectNotFound = -204,
151            StsUnmatchedFormats = -205,
152            StsBadFlag = -206,
153            StsBadPoint = -207,
154            StsBadMask = -208,
155            StsUnmatchedSizes = -209,
156            StsUnsupportedFormat = -210,
157            StsOutOfRange = -211,
158            StsParseError = -212,
159            StsNotImplemented = -213,
160            StsBadMemBlock = -214,
161            StsAssert = -215,
162            GpuNotSupported = -216,
163            GpuApiCallError = -217,
164            OpenGlNotSupported = -218,
165            OpenGlApiCallError = -219,
166            OpenCLApiCallError = -220,
167            OpenCLDoubleNotSupported = -221,
168            OpenCLInitError = -222,
169            OpenCLNoAMDBlasFft = -223;
170
171
172    // C++: enum FormatType (cv.Formatter.FormatType)
173    public static final int
174            Formatter_FMT_DEFAULT = 0,
175            Formatter_FMT_MATLAB = 1,
176            Formatter_FMT_CSV = 2,
177            Formatter_FMT_PYTHON = 3,
178            Formatter_FMT_NUMPY = 4,
179            Formatter_FMT_C = 5;
180
181
182    // C++: enum GemmFlags (cv.GemmFlags)
183    public static final int
184            GEMM_1_T = 1,
185            GEMM_2_T = 2,
186            GEMM_3_T = 4;
187
188
189    // C++: enum KmeansFlags (cv.KmeansFlags)
190    public static final int
191            KMEANS_RANDOM_CENTERS = 0,
192            KMEANS_PP_CENTERS = 2,
193            KMEANS_USE_INITIAL_LABELS = 1;
194
195
196    // C++: enum NormTypes (cv.NormTypes)
197    public static final int
198            NORM_INF = 1,
199            NORM_L1 = 2,
200            NORM_L2 = 4,
201            NORM_L2SQR = 5,
202            NORM_HAMMING = 6,
203            NORM_HAMMING2 = 7,
204            NORM_TYPE_MASK = 7,
205            NORM_RELATIVE = 8,
206            NORM_MINMAX = 32;
207
208
209    // C++: enum Flags (cv.PCA.Flags)
210    public static final int
211            PCA_DATA_AS_ROW = 0,
212            PCA_DATA_AS_COL = 1,
213            PCA_USE_AVG = 2;
214
215
216    // C++: enum Param (cv.Param)
217    public static final int
218            Param_INT = 0,
219            Param_BOOLEAN = 1,
220            Param_REAL = 2,
221            Param_STRING = 3,
222            Param_MAT = 4,
223            Param_MAT_VECTOR = 5,
224            Param_ALGORITHM = 6,
225            Param_FLOAT = 7,
226            Param_UNSIGNED_INT = 8,
227            Param_UINT64 = 9,
228            Param_UCHAR = 11,
229            Param_SCALAR = 12;
230
231
232    // C++: enum RotateFlags (cv.RotateFlags)
233    public static final int
234            ROTATE_90_CLOCKWISE = 0,
235            ROTATE_180 = 1,
236            ROTATE_90_COUNTERCLOCKWISE = 2;
237
238
239    // C++: enum SortFlags (cv.SortFlags)
240    public static final int
241            SORT_EVERY_ROW = 0,
242            SORT_EVERY_COLUMN = 1,
243            SORT_ASCENDING = 0,
244            SORT_DESCENDING = 16;
245
246
247    //
248    // C++:  float cv::cubeRoot(float val)
249    //
250
251    /**
252     * Computes the cube root of an argument.
253     *
254     *  The function cubeRoot computes \(\sqrt[3]{\texttt{val}}\). Negative arguments are handled correctly.
255     *  NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for
256     *  single-precision data.
257     *  @param val A function argument.
258     * @return automatically generated
259     */
260    public static float cubeRoot(float val) {
261        return cubeRoot_0(val);
262    }
263
264
265    //
266    // C++:  float cv::fastAtan2(float y, float x)
267    //
268
269    /**
270     * Calculates the angle of a 2D vector in degrees.
271     *
272     *  The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured
273     *  in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees.
274     *  @param x x-coordinate of the vector.
275     *  @param y y-coordinate of the vector.
276     * @return automatically generated
277     */
278    public static float fastAtan2(float y, float x) {
279        return fastAtan2_0(y, x);
280    }
281
282
283    //
284    // C++:  bool cv::ipp::useIPP()
285    //
286
287    /**
288     * proxy for hal::Cholesky
289     * @return automatically generated
290     */
291    public static boolean useIPP() {
292        return useIPP_0();
293    }
294
295
296    //
297    // C++:  void cv::ipp::setUseIPP(bool flag)
298    //
299
300    public static void setUseIPP(boolean flag) {
301        setUseIPP_0(flag);
302    }
303
304
305    //
306    // C++:  String cv::ipp::getIppVersion()
307    //
308
309    public static String getIppVersion() {
310        return getIppVersion_0();
311    }
312
313
314    //
315    // C++:  bool cv::ipp::useIPP_NotExact()
316    //
317
318    public static boolean useIPP_NotExact() {
319        return useIPP_NotExact_0();
320    }
321
322
323    //
324    // C++:  void cv::ipp::setUseIPP_NotExact(bool flag)
325    //
326
327    public static void setUseIPP_NotExact(boolean flag) {
328        setUseIPP_NotExact_0(flag);
329    }
330
331
332    //
333    // C++:  int cv::borderInterpolate(int p, int len, int borderType)
334    //
335
336    /**
337     * Computes the source location of an extrapolated pixel.
338     *
339     * The function computes and returns the coordinate of a donor pixel corresponding to the specified
340     * extrapolated pixel when using the specified extrapolation border mode. For example, if you use
341     * cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and
342     * want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img , it
343     * looks like:
344     * <code>
345     *     float val = img.at&lt;float&gt;(borderInterpolate(100, img.rows, cv::BORDER_REFLECT_101),
346     *                               borderInterpolate(-5, img.cols, cv::BORDER_WRAP));
347     * </code>
348     * Normally, the function is not called directly. It is used inside filtering functions and also in
349     * copyMakeBorder.
350     * @param p 0-based coordinate of the extrapolated pixel along one of the axes, likely &lt;0 or &gt;= len
351     * @param len Length of the array along the corresponding axis.
352     * @param borderType Border type, one of the #BorderTypes, except for #BORDER_TRANSPARENT and
353     * #BORDER_ISOLATED . When borderType==#BORDER_CONSTANT , the function always returns -1, regardless
354     * of p and len.
355     *
356     * SEE: copyMakeBorder
357     * @return automatically generated
358     */
359    public static int borderInterpolate(int p, int len, int borderType) {
360        return borderInterpolate_0(p, len, borderType);
361    }
362
363
364    //
365    // C++:  void cv::copyMakeBorder(Mat src, Mat& dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar())
366    //
367
368    /**
369     * Forms a border around an image.
370     *
371     * The function copies the source image into the middle of the destination image. The areas to the
372     * left, to the right, above and below the copied source image will be filled with extrapolated
373     * pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but
374     * what other more complex functions, including your own, may do to simplify image boundary handling.
375     *
376     * The function supports the mode when src is already in the middle of dst . In this case, the
377     * function does not copy src itself but simply constructs the border, for example:
378     *
379     * <code>
380     *     // let border be the same in all directions
381     *     int border=2;
382     *     // constructs a larger image to fit both the image and the border
383     *     Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth());
384     *     // select the middle part of it w/o copying data
385     *     Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
386     *     // convert image from RGB to grayscale
387     *     cvtColor(rgb, gray, COLOR_RGB2GRAY);
388     *     // form a border in-place
389     *     copyMakeBorder(gray, gray_buf, border, border,
390     *                    border, border, BORDER_REPLICATE);
391     *     // now do some custom filtering ...
392     *     ...
393     * </code>
394     * <b>Note:</b> When the source image is a part (ROI) of a bigger image, the function will try to use the
395     * pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as
396     * if src was not a ROI, use borderType | #BORDER_ISOLATED.
397     *
398     * @param src Source image.
399     * @param dst Destination image of the same type as src and the size Size(src.cols+left+right,
400     * src.rows+top+bottom) .
401     * @param top the top pixels
402     * @param bottom the bottom pixels
403     * @param left the left pixels
404     * @param right Parameter specifying how many pixels in each direction from the source image rectangle
405     * to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs
406     * to be built.
407     * @param borderType Border type. See borderInterpolate for details.
408     * @param value Border value if borderType==BORDER_CONSTANT .
409     *
410     * SEE:  borderInterpolate
411     */
412    public static void copyMakeBorder(Mat src, Mat dst, int top, int bottom, int left, int right, int borderType, Scalar value) {
413        copyMakeBorder_0(src.nativeObj, dst.nativeObj, top, bottom, left, right, borderType, value.val[0], value.val[1], value.val[2], value.val[3]);
414    }
415
416    /**
417     * Forms a border around an image.
418     *
419     * The function copies the source image into the middle of the destination image. The areas to the
420     * left, to the right, above and below the copied source image will be filled with extrapolated
421     * pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but
422     * what other more complex functions, including your own, may do to simplify image boundary handling.
423     *
424     * The function supports the mode when src is already in the middle of dst . In this case, the
425     * function does not copy src itself but simply constructs the border, for example:
426     *
427     * <code>
428     *     // let border be the same in all directions
429     *     int border=2;
430     *     // constructs a larger image to fit both the image and the border
431     *     Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth());
432     *     // select the middle part of it w/o copying data
433     *     Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
434     *     // convert image from RGB to grayscale
435     *     cvtColor(rgb, gray, COLOR_RGB2GRAY);
436     *     // form a border in-place
437     *     copyMakeBorder(gray, gray_buf, border, border,
438     *                    border, border, BORDER_REPLICATE);
439     *     // now do some custom filtering ...
440     *     ...
441     * </code>
442     * <b>Note:</b> When the source image is a part (ROI) of a bigger image, the function will try to use the
443     * pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as
444     * if src was not a ROI, use borderType | #BORDER_ISOLATED.
445     *
446     * @param src Source image.
447     * @param dst Destination image of the same type as src and the size Size(src.cols+left+right,
448     * src.rows+top+bottom) .
449     * @param top the top pixels
450     * @param bottom the bottom pixels
451     * @param left the left pixels
452     * @param right Parameter specifying how many pixels in each direction from the source image rectangle
453     * to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs
454     * to be built.
455     * @param borderType Border type. See borderInterpolate for details.
456     *
457     * SEE:  borderInterpolate
458     */
459    public static void copyMakeBorder(Mat src, Mat dst, int top, int bottom, int left, int right, int borderType) {
460        copyMakeBorder_1(src.nativeObj, dst.nativeObj, top, bottom, left, right, borderType);
461    }
462
463
464    //
465    // C++:  void cv::add(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
466    //
467
468    /**
469     * Calculates the per-element sum of two arrays or an array and a scalar.
470     *
471     * The function add calculates:
472     * <ul>
473     *   <li>
474     *  Sum of two arrays when both input arrays have the same size and the same number of channels:
475     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
476     *   </li>
477     *   <li>
478     *  Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of
479     * elements as {@code src1.channels()}:
480     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
481     *   </li>
482     *   <li>
483     *  Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of
484     * elements as {@code src2.channels()}:
485     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} +  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
486     * where {@code I} is a multi-dimensional index of array elements. In case of multi-channel arrays, each
487     * channel is processed independently.
488     *   </li>
489     * </ul>
490     *
491     * The first function in the list above can be replaced with matrix expressions:
492     * <code>
493     *     dst = src1 + src2;
494     *     dst += src1; // equivalent to add(dst, src1, dst);
495     * </code>
496     * The input arrays and the output array can all have the same or different depths. For example, you
497     * can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
498     * floating-point array. Depth of the output array is determined by the dtype parameter. In the second
499     * and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
500     * be set to the default -1. In this case, the output array will have the same depth as the input
501     * array, be it src1, src2 or both.
502     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
503     * result of an incorrect sign in the case of overflow.
504     * @param src1 first input array or a scalar.
505     * @param src2 second input array or a scalar.
506     * @param dst output array that has the same size and number of channels as the input array(s); the
507     * depth is defined by dtype or src1/src2.
508     * @param mask optional operation mask - 8-bit single channel array, that specifies elements of the
509     * output array to be changed.
510     * @param dtype optional depth of the output array (see the discussion below).
511     * SEE: subtract, addWeighted, scaleAdd, Mat::convertTo
512     */
513    public static void add(Mat src1, Mat src2, Mat dst, Mat mask, int dtype) {
514        add_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj, dtype);
515    }
516
517    /**
518     * Calculates the per-element sum of two arrays or an array and a scalar.
519     *
520     * The function add calculates:
521     * <ul>
522     *   <li>
523     *  Sum of two arrays when both input arrays have the same size and the same number of channels:
524     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
525     *   </li>
526     *   <li>
527     *  Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of
528     * elements as {@code src1.channels()}:
529     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
530     *   </li>
531     *   <li>
532     *  Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of
533     * elements as {@code src2.channels()}:
534     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} +  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
535     * where {@code I} is a multi-dimensional index of array elements. In case of multi-channel arrays, each
536     * channel is processed independently.
537     *   </li>
538     * </ul>
539     *
540     * The first function in the list above can be replaced with matrix expressions:
541     * <code>
542     *     dst = src1 + src2;
543     *     dst += src1; // equivalent to add(dst, src1, dst);
544     * </code>
545     * The input arrays and the output array can all have the same or different depths. For example, you
546     * can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
547     * floating-point array. Depth of the output array is determined by the dtype parameter. In the second
548     * and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
549     * be set to the default -1. In this case, the output array will have the same depth as the input
550     * array, be it src1, src2 or both.
551     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
552     * result of an incorrect sign in the case of overflow.
553     * @param src1 first input array or a scalar.
554     * @param src2 second input array or a scalar.
555     * @param dst output array that has the same size and number of channels as the input array(s); the
556     * depth is defined by dtype or src1/src2.
557     * @param mask optional operation mask - 8-bit single channel array, that specifies elements of the
558     * output array to be changed.
559     * SEE: subtract, addWeighted, scaleAdd, Mat::convertTo
560     */
561    public static void add(Mat src1, Mat src2, Mat dst, Mat mask) {
562        add_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
563    }
564
565    /**
566     * Calculates the per-element sum of two arrays or an array and a scalar.
567     *
568     * The function add calculates:
569     * <ul>
570     *   <li>
571     *  Sum of two arrays when both input arrays have the same size and the same number of channels:
572     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
573     *   </li>
574     *   <li>
575     *  Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of
576     * elements as {@code src1.channels()}:
577     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
578     *   </li>
579     *   <li>
580     *  Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of
581     * elements as {@code src2.channels()}:
582     * \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} +  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
583     * where {@code I} is a multi-dimensional index of array elements. In case of multi-channel arrays, each
584     * channel is processed independently.
585     *   </li>
586     * </ul>
587     *
588     * The first function in the list above can be replaced with matrix expressions:
589     * <code>
590     *     dst = src1 + src2;
591     *     dst += src1; // equivalent to add(dst, src1, dst);
592     * </code>
593     * The input arrays and the output array can all have the same or different depths. For example, you
594     * can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
595     * floating-point array. Depth of the output array is determined by the dtype parameter. In the second
596     * and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
597     * be set to the default -1. In this case, the output array will have the same depth as the input
598     * array, be it src1, src2 or both.
599     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
600     * result of an incorrect sign in the case of overflow.
601     * @param src1 first input array or a scalar.
602     * @param src2 second input array or a scalar.
603     * @param dst output array that has the same size and number of channels as the input array(s); the
604     * depth is defined by dtype or src1/src2.
605     * output array to be changed.
606     * SEE: subtract, addWeighted, scaleAdd, Mat::convertTo
607     */
608    public static void add(Mat src1, Mat src2, Mat dst) {
609        add_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
610    }
611
612
613    //
614    // C++:  void cv::subtract(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
615    //
616
617    /**
618     * Calculates the per-element difference between two arrays or array and a scalar.
619     *
620     * The function subtract calculates:
621     * <ul>
622     *   <li>
623     *  Difference between two arrays, when both input arrays have the same size and the same number of
624     * channels:
625     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
626     *   </li>
627     *   <li>
628     *  Difference between an array and a scalar, when src2 is constructed from Scalar or has the same
629     * number of elements as {@code src1.channels()}:
630     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
631     *   </li>
632     *   <li>
633     *  Difference between a scalar and an array, when src1 is constructed from Scalar or has the same
634     * number of elements as {@code src2.channels()}:
635     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} -  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
636     *   </li>
637     *   <li>
638     *  The reverse difference between a scalar and an array in the case of {@code SubRS}:
639     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src2} -  \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\)
640     * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
641     * channel is processed independently.
642     *   </li>
643     * </ul>
644     *
645     * The first function in the list above can be replaced with matrix expressions:
646     * <code>
647     *     dst = src1 - src2;
648     *     dst -= src1; // equivalent to subtract(dst, src1, dst);
649     * </code>
650     * The input arrays and the output array can all have the same or different depths. For example, you
651     * can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of
652     * the output array is determined by dtype parameter. In the second and third cases above, as well as
653     * in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this
654     * case the output array will have the same depth as the input array, be it src1, src2 or both.
655     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
656     * result of an incorrect sign in the case of overflow.
657     * @param src1 first input array or a scalar.
658     * @param src2 second input array or a scalar.
659     * @param dst output array of the same size and the same number of channels as the input array.
660     * @param mask optional operation mask; this is an 8-bit single channel array that specifies elements
661     * of the output array to be changed.
662     * @param dtype optional depth of the output array
663     * SEE:  add, addWeighted, scaleAdd, Mat::convertTo
664     */
665    public static void subtract(Mat src1, Mat src2, Mat dst, Mat mask, int dtype) {
666        subtract_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj, dtype);
667    }
668
669    /**
670     * Calculates the per-element difference between two arrays or array and a scalar.
671     *
672     * The function subtract calculates:
673     * <ul>
674     *   <li>
675     *  Difference between two arrays, when both input arrays have the same size and the same number of
676     * channels:
677     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
678     *   </li>
679     *   <li>
680     *  Difference between an array and a scalar, when src2 is constructed from Scalar or has the same
681     * number of elements as {@code src1.channels()}:
682     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
683     *   </li>
684     *   <li>
685     *  Difference between a scalar and an array, when src1 is constructed from Scalar or has the same
686     * number of elements as {@code src2.channels()}:
687     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} -  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
688     *   </li>
689     *   <li>
690     *  The reverse difference between a scalar and an array in the case of {@code SubRS}:
691     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src2} -  \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\)
692     * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
693     * channel is processed independently.
694     *   </li>
695     * </ul>
696     *
697     * The first function in the list above can be replaced with matrix expressions:
698     * <code>
699     *     dst = src1 - src2;
700     *     dst -= src1; // equivalent to subtract(dst, src1, dst);
701     * </code>
702     * The input arrays and the output array can all have the same or different depths. For example, you
703     * can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of
704     * the output array is determined by dtype parameter. In the second and third cases above, as well as
705     * in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this
706     * case the output array will have the same depth as the input array, be it src1, src2 or both.
707     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
708     * result of an incorrect sign in the case of overflow.
709     * @param src1 first input array or a scalar.
710     * @param src2 second input array or a scalar.
711     * @param dst output array of the same size and the same number of channels as the input array.
712     * @param mask optional operation mask; this is an 8-bit single channel array that specifies elements
713     * of the output array to be changed.
714     * SEE:  add, addWeighted, scaleAdd, Mat::convertTo
715     */
716    public static void subtract(Mat src1, Mat src2, Mat dst, Mat mask) {
717        subtract_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
718    }
719
720    /**
721     * Calculates the per-element difference between two arrays or array and a scalar.
722     *
723     * The function subtract calculates:
724     * <ul>
725     *   <li>
726     *  Difference between two arrays, when both input arrays have the same size and the same number of
727     * channels:
728     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
729     *   </li>
730     *   <li>
731     *  Difference between an array and a scalar, when src2 is constructed from Scalar or has the same
732     * number of elements as {@code src1.channels()}:
733     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
734     *   </li>
735     *   <li>
736     *  Difference between a scalar and an array, when src1 is constructed from Scalar or has the same
737     * number of elements as {@code src2.channels()}:
738     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} -  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
739     *   </li>
740     *   <li>
741     *  The reverse difference between a scalar and an array in the case of {@code SubRS}:
742     *     \(\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src2} -  \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\)
743     * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
744     * channel is processed independently.
745     *   </li>
746     * </ul>
747     *
748     * The first function in the list above can be replaced with matrix expressions:
749     * <code>
750     *     dst = src1 - src2;
751     *     dst -= src1; // equivalent to subtract(dst, src1, dst);
752     * </code>
753     * The input arrays and the output array can all have the same or different depths. For example, you
754     * can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of
755     * the output array is determined by dtype parameter. In the second and third cases above, as well as
756     * in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this
757     * case the output array will have the same depth as the input array, be it src1, src2 or both.
758     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
759     * result of an incorrect sign in the case of overflow.
760     * @param src1 first input array or a scalar.
761     * @param src2 second input array or a scalar.
762     * @param dst output array of the same size and the same number of channels as the input array.
763     * of the output array to be changed.
764     * SEE:  add, addWeighted, scaleAdd, Mat::convertTo
765     */
766    public static void subtract(Mat src1, Mat src2, Mat dst) {
767        subtract_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
768    }
769
770
771    //
772    // C++:  void cv::multiply(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
773    //
774
775    /**
776     * Calculates the per-element scaled product of two arrays.
777     *
778     * The function multiply calculates the per-element product of two arrays:
779     *
780     * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I)  \cdot \texttt{src2} (I))\)
781     *
782     * There is also a REF: MatrixExpressions -friendly variant of the first function. See Mat::mul .
783     *
784     * For a not-per-element matrix product, see gemm .
785     *
786     * <b>Note:</b> Saturation is not applied when the output array has the depth
787     * CV_32S. You may even get result of an incorrect sign in the case of
788     * overflow.
789     * @param src1 first input array.
790     * @param src2 second input array of the same size and the same type as src1.
791     * @param dst output array of the same size and type as src1.
792     * @param scale optional scale factor.
793     * @param dtype optional depth of the output array
794     * SEE: add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare,
795     * Mat::convertTo
796     */
797    public static void multiply(Mat src1, Mat src2, Mat dst, double scale, int dtype) {
798        multiply_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale, dtype);
799    }
800
801    /**
802     * Calculates the per-element scaled product of two arrays.
803     *
804     * The function multiply calculates the per-element product of two arrays:
805     *
806     * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I)  \cdot \texttt{src2} (I))\)
807     *
808     * There is also a REF: MatrixExpressions -friendly variant of the first function. See Mat::mul .
809     *
810     * For a not-per-element matrix product, see gemm .
811     *
812     * <b>Note:</b> Saturation is not applied when the output array has the depth
813     * CV_32S. You may even get result of an incorrect sign in the case of
814     * overflow.
815     * @param src1 first input array.
816     * @param src2 second input array of the same size and the same type as src1.
817     * @param dst output array of the same size and type as src1.
818     * @param scale optional scale factor.
819     * SEE: add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare,
820     * Mat::convertTo
821     */
822    public static void multiply(Mat src1, Mat src2, Mat dst, double scale) {
823        multiply_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale);
824    }
825
826    /**
827     * Calculates the per-element scaled product of two arrays.
828     *
829     * The function multiply calculates the per-element product of two arrays:
830     *
831     * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I)  \cdot \texttt{src2} (I))\)
832     *
833     * There is also a REF: MatrixExpressions -friendly variant of the first function. See Mat::mul .
834     *
835     * For a not-per-element matrix product, see gemm .
836     *
837     * <b>Note:</b> Saturation is not applied when the output array has the depth
838     * CV_32S. You may even get result of an incorrect sign in the case of
839     * overflow.
840     * @param src1 first input array.
841     * @param src2 second input array of the same size and the same type as src1.
842     * @param dst output array of the same size and type as src1.
843     * SEE: add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare,
844     * Mat::convertTo
845     */
846    public static void multiply(Mat src1, Mat src2, Mat dst) {
847        multiply_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
848    }
849
850
851    //
852    // C++:  void cv::divide(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
853    //
854
855    /**
856     * Performs per-element division of two arrays or a scalar by an array.
857     *
858     * The function cv::divide divides one array by another:
859     * \(\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\)
860     * or a scalar by an array when there is no src1 :
861     * \(\texttt{dst(I) = saturate(scale/src2(I))}\)
862     *
863     * Different channels of multi-channel arrays are processed independently.
864     *
865     * For integer types when src2(I) is zero, dst(I) will also be zero.
866     *
867     * <b>Note:</b> In case of floating point data there is no special defined behavior for zero src2(I) values.
868     * Regular floating-point division is used.
869     * Expect correct IEEE-754 behaviour for floating-point data (with NaN, Inf result values).
870     *
871     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
872     * result of an incorrect sign in the case of overflow.
873     * @param src1 first input array.
874     * @param src2 second input array of the same size and type as src1.
875     * @param scale scalar factor.
876     * @param dst output array of the same size and type as src2.
877     * @param dtype optional depth of the output array; if -1, dst will have depth src2.depth(), but in
878     * case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
879     * SEE:  multiply, add, subtract
880     */
881    public static void divide(Mat src1, Mat src2, Mat dst, double scale, int dtype) {
882        divide_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale, dtype);
883    }
884
885    /**
886     * Performs per-element division of two arrays or a scalar by an array.
887     *
888     * The function cv::divide divides one array by another:
889     * \(\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\)
890     * or a scalar by an array when there is no src1 :
891     * \(\texttt{dst(I) = saturate(scale/src2(I))}\)
892     *
893     * Different channels of multi-channel arrays are processed independently.
894     *
895     * For integer types when src2(I) is zero, dst(I) will also be zero.
896     *
897     * <b>Note:</b> In case of floating point data there is no special defined behavior for zero src2(I) values.
898     * Regular floating-point division is used.
899     * Expect correct IEEE-754 behaviour for floating-point data (with NaN, Inf result values).
900     *
901     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
902     * result of an incorrect sign in the case of overflow.
903     * @param src1 first input array.
904     * @param src2 second input array of the same size and type as src1.
905     * @param scale scalar factor.
906     * @param dst output array of the same size and type as src2.
907     * case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
908     * SEE:  multiply, add, subtract
909     */
910    public static void divide(Mat src1, Mat src2, Mat dst, double scale) {
911        divide_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale);
912    }
913
914    /**
915     * Performs per-element division of two arrays or a scalar by an array.
916     *
917     * The function cv::divide divides one array by another:
918     * \(\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\)
919     * or a scalar by an array when there is no src1 :
920     * \(\texttt{dst(I) = saturate(scale/src2(I))}\)
921     *
922     * Different channels of multi-channel arrays are processed independently.
923     *
924     * For integer types when src2(I) is zero, dst(I) will also be zero.
925     *
926     * <b>Note:</b> In case of floating point data there is no special defined behavior for zero src2(I) values.
927     * Regular floating-point division is used.
928     * Expect correct IEEE-754 behaviour for floating-point data (with NaN, Inf result values).
929     *
930     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
931     * result of an incorrect sign in the case of overflow.
932     * @param src1 first input array.
933     * @param src2 second input array of the same size and type as src1.
934     * @param dst output array of the same size and type as src2.
935     * case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
936     * SEE:  multiply, add, subtract
937     */
938    public static void divide(Mat src1, Mat src2, Mat dst) {
939        divide_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
940    }
941
942
943    //
944    // C++:  void cv::divide(double scale, Mat src2, Mat& dst, int dtype = -1)
945    //
946
947    public static void divide(double scale, Mat src2, Mat dst, int dtype) {
948        divide_3(scale, src2.nativeObj, dst.nativeObj, dtype);
949    }
950
951    public static void divide(double scale, Mat src2, Mat dst) {
952        divide_4(scale, src2.nativeObj, dst.nativeObj);
953    }
954
955
956    //
957    // C++:  void cv::scaleAdd(Mat src1, double alpha, Mat src2, Mat& dst)
958    //
959
960    /**
961     * Calculates the sum of a scaled array and another array.
962     *
963     * The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY
964     * or SAXPY in [BLAS](http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms). It calculates
965     * the sum of a scaled array and another array:
966     * \(\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) +  \texttt{src2} (I)\)
967     * The function can also be emulated with a matrix expression, for example:
968     * <code>
969     *     Mat A(3, 3, CV_64F);
970     *     ...
971     *     A.row(0) = A.row(1)*2 + A.row(2);
972     * </code>
973     * @param src1 first input array.
974     * @param alpha scale factor for the first array.
975     * @param src2 second input array of the same size and type as src1.
976     * @param dst output array of the same size and type as src1.
977     * SEE: add, addWeighted, subtract, Mat::dot, Mat::convertTo
978     */
979    public static void scaleAdd(Mat src1, double alpha, Mat src2, Mat dst) {
980        scaleAdd_0(src1.nativeObj, alpha, src2.nativeObj, dst.nativeObj);
981    }
982
983
984    //
985    // C++:  void cv::addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat& dst, int dtype = -1)
986    //
987
988    /**
989     * Calculates the weighted sum of two arrays.
990     *
991     * The function addWeighted calculates the weighted sum of two arrays as follows:
992     * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} +  \texttt{src2} (I)* \texttt{beta} +  \texttt{gamma} )\)
993     * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
994     * channel is processed independently.
995     * The function can be replaced with a matrix expression:
996     * <code>
997     *     dst = src1*alpha + src2*beta + gamma;
998     * </code>
999     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
1000     * result of an incorrect sign in the case of overflow.
1001     * @param src1 first input array.
1002     * @param alpha weight of the first array elements.
1003     * @param src2 second input array of the same size and channel number as src1.
1004     * @param beta weight of the second array elements.
1005     * @param gamma scalar added to each sum.
1006     * @param dst output array that has the same size and number of channels as the input arrays.
1007     * @param dtype optional depth of the output array; when both input arrays have the same depth, dtype
1008     * can be set to -1, which will be equivalent to src1.depth().
1009     * SEE:  add, subtract, scaleAdd, Mat::convertTo
1010     */
1011    public static void addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst, int dtype) {
1012        addWeighted_0(src1.nativeObj, alpha, src2.nativeObj, beta, gamma, dst.nativeObj, dtype);
1013    }
1014
1015    /**
1016     * Calculates the weighted sum of two arrays.
1017     *
1018     * The function addWeighted calculates the weighted sum of two arrays as follows:
1019     * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} +  \texttt{src2} (I)* \texttt{beta} +  \texttt{gamma} )\)
1020     * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
1021     * channel is processed independently.
1022     * The function can be replaced with a matrix expression:
1023     * <code>
1024     *     dst = src1*alpha + src2*beta + gamma;
1025     * </code>
1026     * <b>Note:</b> Saturation is not applied when the output array has the depth CV_32S. You may even get
1027     * result of an incorrect sign in the case of overflow.
1028     * @param src1 first input array.
1029     * @param alpha weight of the first array elements.
1030     * @param src2 second input array of the same size and channel number as src1.
1031     * @param beta weight of the second array elements.
1032     * @param gamma scalar added to each sum.
1033     * @param dst output array that has the same size and number of channels as the input arrays.
1034     * can be set to -1, which will be equivalent to src1.depth().
1035     * SEE:  add, subtract, scaleAdd, Mat::convertTo
1036     */
1037    public static void addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst) {
1038        addWeighted_1(src1.nativeObj, alpha, src2.nativeObj, beta, gamma, dst.nativeObj);
1039    }
1040
1041
1042    //
1043    // C++:  void cv::convertScaleAbs(Mat src, Mat& dst, double alpha = 1, double beta = 0)
1044    //
1045
1046    /**
1047     * Scales, calculates absolute values, and converts the result to 8-bit.
1048     *
1049     * On each element of the input array, the function convertScaleAbs
1050     * performs three operations sequentially: scaling, taking an absolute
1051     * value, conversion to an unsigned 8-bit type:
1052     * \(\texttt{dst} (I)= \texttt{saturate\_cast&lt;uchar&gt;} (| \texttt{src} (I)* \texttt{alpha} +  \texttt{beta} |)\)
1053     * In case of multi-channel arrays, the function processes each channel
1054     * independently. When the output is not 8-bit, the operation can be
1055     * emulated by calling the Mat::convertTo method (or by using matrix
1056     * expressions) and then by calculating an absolute value of the result.
1057     * For example:
1058     * <code>
1059     *     Mat_&lt;float&gt; A(30,30);
1060     *     randu(A, Scalar(-100), Scalar(100));
1061     *     Mat_&lt;float&gt; B = A*5 + 3;
1062     *     B = abs(B);
1063     *     // Mat_&lt;float&gt; B = abs(A*5+3) will also do the job,
1064     *     // but it will allocate a temporary matrix
1065     * </code>
1066     * @param src input array.
1067     * @param dst output array.
1068     * @param alpha optional scale factor.
1069     * @param beta optional delta added to the scaled values.
1070     * SEE:  Mat::convertTo, cv::abs(const Mat&amp;)
1071     */
1072    public static void convertScaleAbs(Mat src, Mat dst, double alpha, double beta) {
1073        convertScaleAbs_0(src.nativeObj, dst.nativeObj, alpha, beta);
1074    }
1075
1076    /**
1077     * Scales, calculates absolute values, and converts the result to 8-bit.
1078     *
1079     * On each element of the input array, the function convertScaleAbs
1080     * performs three operations sequentially: scaling, taking an absolute
1081     * value, conversion to an unsigned 8-bit type:
1082     * \(\texttt{dst} (I)= \texttt{saturate\_cast&lt;uchar&gt;} (| \texttt{src} (I)* \texttt{alpha} +  \texttt{beta} |)\)
1083     * In case of multi-channel arrays, the function processes each channel
1084     * independently. When the output is not 8-bit, the operation can be
1085     * emulated by calling the Mat::convertTo method (or by using matrix
1086     * expressions) and then by calculating an absolute value of the result.
1087     * For example:
1088     * <code>
1089     *     Mat_&lt;float&gt; A(30,30);
1090     *     randu(A, Scalar(-100), Scalar(100));
1091     *     Mat_&lt;float&gt; B = A*5 + 3;
1092     *     B = abs(B);
1093     *     // Mat_&lt;float&gt; B = abs(A*5+3) will also do the job,
1094     *     // but it will allocate a temporary matrix
1095     * </code>
1096     * @param src input array.
1097     * @param dst output array.
1098     * @param alpha optional scale factor.
1099     * SEE:  Mat::convertTo, cv::abs(const Mat&amp;)
1100     */
1101    public static void convertScaleAbs(Mat src, Mat dst, double alpha) {
1102        convertScaleAbs_1(src.nativeObj, dst.nativeObj, alpha);
1103    }
1104
1105    /**
1106     * Scales, calculates absolute values, and converts the result to 8-bit.
1107     *
1108     * On each element of the input array, the function convertScaleAbs
1109     * performs three operations sequentially: scaling, taking an absolute
1110     * value, conversion to an unsigned 8-bit type:
1111     * \(\texttt{dst} (I)= \texttt{saturate\_cast&lt;uchar&gt;} (| \texttt{src} (I)* \texttt{alpha} +  \texttt{beta} |)\)
1112     * In case of multi-channel arrays, the function processes each channel
1113     * independently. When the output is not 8-bit, the operation can be
1114     * emulated by calling the Mat::convertTo method (or by using matrix
1115     * expressions) and then by calculating an absolute value of the result.
1116     * For example:
1117     * <code>
1118     *     Mat_&lt;float&gt; A(30,30);
1119     *     randu(A, Scalar(-100), Scalar(100));
1120     *     Mat_&lt;float&gt; B = A*5 + 3;
1121     *     B = abs(B);
1122     *     // Mat_&lt;float&gt; B = abs(A*5+3) will also do the job,
1123     *     // but it will allocate a temporary matrix
1124     * </code>
1125     * @param src input array.
1126     * @param dst output array.
1127     * SEE:  Mat::convertTo, cv::abs(const Mat&amp;)
1128     */
1129    public static void convertScaleAbs(Mat src, Mat dst) {
1130        convertScaleAbs_2(src.nativeObj, dst.nativeObj);
1131    }
1132
1133
1134    //
1135    // C++:  void cv::convertFp16(Mat src, Mat& dst)
1136    //
1137
1138    /**
1139     * Converts an array to half precision floating number.
1140     *
1141     * This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data.
1142     * There are two use modes (src -&gt; dst): CV_32F -&gt; CV_16S and CV_16S -&gt; CV_32F. The input array has to have type of CV_32F or
1143     * CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error.
1144     * The format of half precision floating point is defined in IEEE 754-2008.
1145     *
1146     * @param src input array.
1147     * @param dst output array.
1148     */
1149    public static void convertFp16(Mat src, Mat dst) {
1150        convertFp16_0(src.nativeObj, dst.nativeObj);
1151    }
1152
1153
1154    //
1155    // C++:  void cv::LUT(Mat src, Mat lut, Mat& dst)
1156    //
1157
1158    /**
1159     * Performs a look-up table transform of an array.
1160     *
1161     * The function LUT fills the output array with values from the look-up table. Indices of the entries
1162     * are taken from the input array. That is, the function processes each element of src as follows:
1163     * \(\texttt{dst} (I)  \leftarrow \texttt{lut(src(I) + d)}\)
1164     * where
1165     * \(d =  \fork{0}{if \(\texttt{src}\) has depth \(\texttt{CV_8U}\)}{128}{if \(\texttt{src}\) has depth \(\texttt{CV_8S}\)}\)
1166     * @param src input array of 8-bit elements.
1167     * @param lut look-up table of 256 elements; in case of multi-channel input array, the table should
1168     * either have a single channel (in this case the same table is used for all channels) or the same
1169     * number of channels as in the input array.
1170     * @param dst output array of the same size and number of channels as src, and the same depth as lut.
1171     * SEE:  convertScaleAbs, Mat::convertTo
1172     */
1173    public static void LUT(Mat src, Mat lut, Mat dst) {
1174        LUT_0(src.nativeObj, lut.nativeObj, dst.nativeObj);
1175    }
1176
1177
1178    //
1179    // C++:  Scalar cv::sum(Mat src)
1180    //
1181
1182    /**
1183     * Calculates the sum of array elements.
1184     *
1185     * The function cv::sum calculates and returns the sum of array elements,
1186     * independently for each channel.
1187     * @param src input array that must have from 1 to 4 channels.
1188     * SEE:  countNonZero, mean, meanStdDev, norm, minMaxLoc, reduce
1189     * @return automatically generated
1190     */
1191    public static Scalar sumElems(Mat src) {
1192        return new Scalar(sumElems_0(src.nativeObj));
1193    }
1194
1195
1196    //
1197    // C++:  int cv::countNonZero(Mat src)
1198    //
1199
1200    /**
1201     * Counts non-zero array elements.
1202     *
1203     * The function returns the number of non-zero elements in src :
1204     * \(\sum _{I: \; \texttt{src} (I) \ne0 } 1\)
1205     * @param src single-channel array.
1206     * SEE:  mean, meanStdDev, norm, minMaxLoc, calcCovarMatrix
1207     * @return automatically generated
1208     */
1209    public static int countNonZero(Mat src) {
1210        return countNonZero_0(src.nativeObj);
1211    }
1212
1213
1214    //
1215    // C++:  void cv::findNonZero(Mat src, Mat& idx)
1216    //
1217
1218    /**
1219     * Returns the list of locations of non-zero pixels
1220     *
1221     * Given a binary matrix (likely returned from an operation such
1222     * as threshold(), compare(), &gt;, ==, etc, return all of
1223     * the non-zero indices as a cv::Mat or std::vector&lt;cv::Point&gt; (x,y)
1224     * For example:
1225     * <code>
1226     *     cv::Mat binaryImage; // input, binary image
1227     *     cv::Mat locations;   // output, locations of non-zero pixels
1228     *     cv::findNonZero(binaryImage, locations);
1229     *
1230     *     // access pixel coordinates
1231     *     Point pnt = locations.at&lt;Point&gt;(i);
1232     * </code>
1233     * or
1234     * <code>
1235     *     cv::Mat binaryImage; // input, binary image
1236     *     vector&lt;Point&gt; locations;   // output, locations of non-zero pixels
1237     *     cv::findNonZero(binaryImage, locations);
1238     *
1239     *     // access pixel coordinates
1240     *     Point pnt = locations[i];
1241     * </code>
1242     * @param src single-channel array
1243     * @param idx the output array, type of cv::Mat or std::vector&lt;Point&gt;, corresponding to non-zero indices in the input
1244     */
1245    public static void findNonZero(Mat src, Mat idx) {
1246        findNonZero_0(src.nativeObj, idx.nativeObj);
1247    }
1248
1249
1250    //
1251    // C++:  Scalar cv::mean(Mat src, Mat mask = Mat())
1252    //
1253
1254    /**
1255     * Calculates an average (mean) of array elements.
1256     *
1257     * The function cv::mean calculates the mean value M of array elements,
1258     * independently for each channel, and return it:
1259     * \(\begin{array}{l} N =  \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c =  \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\)
1260     * When all the mask elements are 0's, the function returns Scalar::all(0)
1261     * @param src input array that should have from 1 to 4 channels so that the result can be stored in
1262     * Scalar_ .
1263     * @param mask optional operation mask.
1264     * SEE:  countNonZero, meanStdDev, norm, minMaxLoc
1265     * @return automatically generated
1266     */
1267    public static Scalar mean(Mat src, Mat mask) {
1268        return new Scalar(mean_0(src.nativeObj, mask.nativeObj));
1269    }
1270
1271    /**
1272     * Calculates an average (mean) of array elements.
1273     *
1274     * The function cv::mean calculates the mean value M of array elements,
1275     * independently for each channel, and return it:
1276     * \(\begin{array}{l} N =  \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c =  \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\)
1277     * When all the mask elements are 0's, the function returns Scalar::all(0)
1278     * @param src input array that should have from 1 to 4 channels so that the result can be stored in
1279     * Scalar_ .
1280     * SEE:  countNonZero, meanStdDev, norm, minMaxLoc
1281     * @return automatically generated
1282     */
1283    public static Scalar mean(Mat src) {
1284        return new Scalar(mean_1(src.nativeObj));
1285    }
1286
1287
1288    //
1289    // C++:  void cv::meanStdDev(Mat src, vector_double& mean, vector_double& stddev, Mat mask = Mat())
1290    //
1291
1292    /**
1293     * Calculates a mean and standard deviation of array elements.
1294     *
1295     * The function cv::meanStdDev calculates the mean and the standard deviation M
1296     * of array elements independently for each channel and returns it via the
1297     * output parameters:
1298     * \(\begin{array}{l} N =  \sum _{I, \texttt{mask} (I)  \ne 0} 1 \\ \texttt{mean} _c =  \frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \texttt{src} (I)_c}{N} \\ \texttt{stddev} _c =  \sqrt{\frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \left ( \texttt{src} (I)_c -  \texttt{mean} _c \right )^2}{N}} \end{array}\)
1299     * When all the mask elements are 0's, the function returns
1300     * mean=stddev=Scalar::all(0).
1301     * <b>Note:</b> The calculated standard deviation is only the diagonal of the
1302     * complete normalized covariance matrix. If the full matrix is needed, you
1303     * can reshape the multi-channel array M x N to the single-channel array
1304     * M\*N x mtx.channels() (only possible when the matrix is continuous) and
1305     * then pass the matrix to calcCovarMatrix .
1306     * @param src input array that should have from 1 to 4 channels so that the results can be stored in
1307     * Scalar_ 's.
1308     * @param mean output parameter: calculated mean value.
1309     * @param stddev output parameter: calculated standard deviation.
1310     * @param mask optional operation mask.
1311     * SEE:  countNonZero, mean, norm, minMaxLoc, calcCovarMatrix
1312     */
1313    public static void meanStdDev(Mat src, MatOfDouble mean, MatOfDouble stddev, Mat mask) {
1314        Mat mean_mat = mean;
1315        Mat stddev_mat = stddev;
1316        meanStdDev_0(src.nativeObj, mean_mat.nativeObj, stddev_mat.nativeObj, mask.nativeObj);
1317    }
1318
1319    /**
1320     * Calculates a mean and standard deviation of array elements.
1321     *
1322     * The function cv::meanStdDev calculates the mean and the standard deviation M
1323     * of array elements independently for each channel and returns it via the
1324     * output parameters:
1325     * \(\begin{array}{l} N =  \sum _{I, \texttt{mask} (I)  \ne 0} 1 \\ \texttt{mean} _c =  \frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \texttt{src} (I)_c}{N} \\ \texttt{stddev} _c =  \sqrt{\frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \left ( \texttt{src} (I)_c -  \texttt{mean} _c \right )^2}{N}} \end{array}\)
1326     * When all the mask elements are 0's, the function returns
1327     * mean=stddev=Scalar::all(0).
1328     * <b>Note:</b> The calculated standard deviation is only the diagonal of the
1329     * complete normalized covariance matrix. If the full matrix is needed, you
1330     * can reshape the multi-channel array M x N to the single-channel array
1331     * M\*N x mtx.channels() (only possible when the matrix is continuous) and
1332     * then pass the matrix to calcCovarMatrix .
1333     * @param src input array that should have from 1 to 4 channels so that the results can be stored in
1334     * Scalar_ 's.
1335     * @param mean output parameter: calculated mean value.
1336     * @param stddev output parameter: calculated standard deviation.
1337     * SEE:  countNonZero, mean, norm, minMaxLoc, calcCovarMatrix
1338     */
1339    public static void meanStdDev(Mat src, MatOfDouble mean, MatOfDouble stddev) {
1340        Mat mean_mat = mean;
1341        Mat stddev_mat = stddev;
1342        meanStdDev_1(src.nativeObj, mean_mat.nativeObj, stddev_mat.nativeObj);
1343    }
1344
1345
1346    //
1347    // C++:  double cv::norm(Mat src1, int normType = NORM_L2, Mat mask = Mat())
1348    //
1349
1350    /**
1351     * Calculates the  absolute norm of an array.
1352     *
1353     * This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes.
1354     *
1355     * As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\).
1356     * The \( L_{1}, L_{2} \) and \( L_{\infty} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\)
1357     * is calculated as follows
1358     * \(align*}
1359     *     \| r(-1) \|_{L_1} &amp;= |-1| + |2| = 3 \\
1360     *     \| r(-1) \|_{L_2} &amp;= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\
1361     *     \| r(-1) \|_{L_\infty} &amp;= \max(|-1|,|2|) = 2
1362     * \)
1363     * and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
1364     * \(align*}
1365     *     \| r(0.5) \|_{L_1} &amp;= |0.5| + |0.5| = 1 \\
1366     *     \| r(0.5) \|_{L_2} &amp;= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\
1367     *     \| r(0.5) \|_{L_\infty} &amp;= \max(|0.5|,|0.5|) = 0.5.
1368     * \)
1369     * The following graphic shows all values for the three norm functions \(\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\) and \(\| r(x) \|_{L_\infty}\).
1370     * It is notable that the \( L_{1} \) norm forms the upper and the \( L_{\infty} \) norm forms the lower border for the example function \( r(x) \).
1371     * ![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png)
1372     *
1373     * When the mask parameter is specified and it is not empty, the norm is
1374     *
1375     * If normType is not specified, #NORM_L2 is used.
1376     * calculated only over the region specified by the mask.
1377     *
1378     * Multi-channel input arrays are treated as single-channel arrays, that is,
1379     * the results for all channels are combined.
1380     *
1381     * Hamming norms can only be calculated with CV_8U depth arrays.
1382     *
1383     * @param src1 first input array.
1384     * @param normType type of the norm (see #NormTypes).
1385     * @param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type.
1386     * @return automatically generated
1387     */
1388    public static double norm(Mat src1, int normType, Mat mask) {
1389        return norm_0(src1.nativeObj, normType, mask.nativeObj);
1390    }
1391
1392    /**
1393     * Calculates the  absolute norm of an array.
1394     *
1395     * This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes.
1396     *
1397     * As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\).
1398     * The \( L_{1}, L_{2} \) and \( L_{\infty} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\)
1399     * is calculated as follows
1400     * \(align*}
1401     *     \| r(-1) \|_{L_1} &amp;= |-1| + |2| = 3 \\
1402     *     \| r(-1) \|_{L_2} &amp;= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\
1403     *     \| r(-1) \|_{L_\infty} &amp;= \max(|-1|,|2|) = 2
1404     * \)
1405     * and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
1406     * \(align*}
1407     *     \| r(0.5) \|_{L_1} &amp;= |0.5| + |0.5| = 1 \\
1408     *     \| r(0.5) \|_{L_2} &amp;= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\
1409     *     \| r(0.5) \|_{L_\infty} &amp;= \max(|0.5|,|0.5|) = 0.5.
1410     * \)
1411     * The following graphic shows all values for the three norm functions \(\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\) and \(\| r(x) \|_{L_\infty}\).
1412     * It is notable that the \( L_{1} \) norm forms the upper and the \( L_{\infty} \) norm forms the lower border for the example function \( r(x) \).
1413     * ![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png)
1414     *
1415     * When the mask parameter is specified and it is not empty, the norm is
1416     *
1417     * If normType is not specified, #NORM_L2 is used.
1418     * calculated only over the region specified by the mask.
1419     *
1420     * Multi-channel input arrays are treated as single-channel arrays, that is,
1421     * the results for all channels are combined.
1422     *
1423     * Hamming norms can only be calculated with CV_8U depth arrays.
1424     *
1425     * @param src1 first input array.
1426     * @param normType type of the norm (see #NormTypes).
1427     * @return automatically generated
1428     */
1429    public static double norm(Mat src1, int normType) {
1430        return norm_1(src1.nativeObj, normType);
1431    }
1432
1433    /**
1434     * Calculates the  absolute norm of an array.
1435     *
1436     * This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes.
1437     *
1438     * As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\).
1439     * The \( L_{1}, L_{2} \) and \( L_{\infty} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\)
1440     * is calculated as follows
1441     * \(align*}
1442     *     \| r(-1) \|_{L_1} &amp;= |-1| + |2| = 3 \\
1443     *     \| r(-1) \|_{L_2} &amp;= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\
1444     *     \| r(-1) \|_{L_\infty} &amp;= \max(|-1|,|2|) = 2
1445     * \)
1446     * and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
1447     * \(align*}
1448     *     \| r(0.5) \|_{L_1} &amp;= |0.5| + |0.5| = 1 \\
1449     *     \| r(0.5) \|_{L_2} &amp;= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\
1450     *     \| r(0.5) \|_{L_\infty} &amp;= \max(|0.5|,|0.5|) = 0.5.
1451     * \)
1452     * The following graphic shows all values for the three norm functions \(\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\) and \(\| r(x) \|_{L_\infty}\).
1453     * It is notable that the \( L_{1} \) norm forms the upper and the \( L_{\infty} \) norm forms the lower border for the example function \( r(x) \).
1454     * ![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png)
1455     *
1456     * When the mask parameter is specified and it is not empty, the norm is
1457     *
1458     * If normType is not specified, #NORM_L2 is used.
1459     * calculated only over the region specified by the mask.
1460     *
1461     * Multi-channel input arrays are treated as single-channel arrays, that is,
1462     * the results for all channels are combined.
1463     *
1464     * Hamming norms can only be calculated with CV_8U depth arrays.
1465     *
1466     * @param src1 first input array.
1467     * @return automatically generated
1468     */
1469    public static double norm(Mat src1) {
1470        return norm_2(src1.nativeObj);
1471    }
1472
1473
1474    //
1475    // C++:  double cv::norm(Mat src1, Mat src2, int normType = NORM_L2, Mat mask = Mat())
1476    //
1477
1478    /**
1479     * Calculates an absolute difference norm or a relative difference norm.
1480     *
1481     * This version of cv::norm calculates the absolute difference norm
1482     * or the relative difference norm of arrays src1 and src2.
1483     * The type of norm to calculate is specified using #NormTypes.
1484     *
1485     * @param src1 first input array.
1486     * @param src2 second input array of the same size and the same type as src1.
1487     * @param normType type of the norm (see #NormTypes).
1488     * @param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type.
1489     * @return automatically generated
1490     */
1491    public static double norm(Mat src1, Mat src2, int normType, Mat mask) {
1492        return norm_3(src1.nativeObj, src2.nativeObj, normType, mask.nativeObj);
1493    }
1494
1495    /**
1496     * Calculates an absolute difference norm or a relative difference norm.
1497     *
1498     * This version of cv::norm calculates the absolute difference norm
1499     * or the relative difference norm of arrays src1 and src2.
1500     * The type of norm to calculate is specified using #NormTypes.
1501     *
1502     * @param src1 first input array.
1503     * @param src2 second input array of the same size and the same type as src1.
1504     * @param normType type of the norm (see #NormTypes).
1505     * @return automatically generated
1506     */
1507    public static double norm(Mat src1, Mat src2, int normType) {
1508        return norm_4(src1.nativeObj, src2.nativeObj, normType);
1509    }
1510
1511    /**
1512     * Calculates an absolute difference norm or a relative difference norm.
1513     *
1514     * This version of cv::norm calculates the absolute difference norm
1515     * or the relative difference norm of arrays src1 and src2.
1516     * The type of norm to calculate is specified using #NormTypes.
1517     *
1518     * @param src1 first input array.
1519     * @param src2 second input array of the same size and the same type as src1.
1520     * @return automatically generated
1521     */
1522    public static double norm(Mat src1, Mat src2) {
1523        return norm_5(src1.nativeObj, src2.nativeObj);
1524    }
1525
1526
1527    //
1528    // C++:  double cv::PSNR(Mat src1, Mat src2, double R = 255.)
1529    //
1530
1531    /**
1532     * Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric.
1533     *
1534     * This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB),
1535     * between two input arrays src1 and src2. The arrays must have the same type.
1536     *
1537     * The PSNR is calculated as follows:
1538     *
1539     * \(
1540     * \texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) }
1541     * \)
1542     *
1543     * where R is the maximum integer value of depth (e.g. 255 in the case of CV_8U data)
1544     * and MSE is the mean squared error between the two arrays.
1545     *
1546     * @param src1 first input array.
1547     * @param src2 second input array of the same size as src1.
1548     * @param R the maximum pixel value (255 by default)
1549     * @return automatically generated
1550     */
1551    public static double PSNR(Mat src1, Mat src2, double R) {
1552        return PSNR_0(src1.nativeObj, src2.nativeObj, R);
1553    }
1554
1555    /**
1556     * Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric.
1557     *
1558     * This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB),
1559     * between two input arrays src1 and src2. The arrays must have the same type.
1560     *
1561     * The PSNR is calculated as follows:
1562     *
1563     * \(
1564     * \texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) }
1565     * \)
1566     *
1567     * where R is the maximum integer value of depth (e.g. 255 in the case of CV_8U data)
1568     * and MSE is the mean squared error between the two arrays.
1569     *
1570     * @param src1 first input array.
1571     * @param src2 second input array of the same size as src1.
1572     * @return automatically generated
1573     */
1574    public static double PSNR(Mat src1, Mat src2) {
1575        return PSNR_1(src1.nativeObj, src2.nativeObj);
1576    }
1577
1578
1579    //
1580    // C++:  void cv::batchDistance(Mat src1, Mat src2, Mat& dist, int dtype, Mat& nidx, int normType = NORM_L2, int K = 0, Mat mask = Mat(), int update = 0, bool crosscheck = false)
1581    //
1582
1583    /**
1584     * naive nearest neighbor finder
1585     *
1586     * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
1587     * TODO: document
1588     * @param src1 automatically generated
1589     * @param src2 automatically generated
1590     * @param dist automatically generated
1591     * @param dtype automatically generated
1592     * @param nidx automatically generated
1593     * @param normType automatically generated
1594     * @param K automatically generated
1595     * @param mask automatically generated
1596     * @param update automatically generated
1597     * @param crosscheck automatically generated
1598     */
1599    public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask, int update, boolean crosscheck) {
1600        batchDistance_0(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj, update, crosscheck);
1601    }
1602
1603    /**
1604     * naive nearest neighbor finder
1605     *
1606     * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
1607     * TODO: document
1608     * @param src1 automatically generated
1609     * @param src2 automatically generated
1610     * @param dist automatically generated
1611     * @param dtype automatically generated
1612     * @param nidx automatically generated
1613     * @param normType automatically generated
1614     * @param K automatically generated
1615     * @param mask automatically generated
1616     * @param update automatically generated
1617     */
1618    public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask, int update) {
1619        batchDistance_1(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj, update);
1620    }
1621
1622    /**
1623     * naive nearest neighbor finder
1624     *
1625     * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
1626     * TODO: document
1627     * @param src1 automatically generated
1628     * @param src2 automatically generated
1629     * @param dist automatically generated
1630     * @param dtype automatically generated
1631     * @param nidx automatically generated
1632     * @param normType automatically generated
1633     * @param K automatically generated
1634     * @param mask automatically generated
1635     */
1636    public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask) {
1637        batchDistance_2(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj);
1638    }
1639
1640    /**
1641     * naive nearest neighbor finder
1642     *
1643     * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
1644     * TODO: document
1645     * @param src1 automatically generated
1646     * @param src2 automatically generated
1647     * @param dist automatically generated
1648     * @param dtype automatically generated
1649     * @param nidx automatically generated
1650     * @param normType automatically generated
1651     * @param K automatically generated
1652     */
1653    public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K) {
1654        batchDistance_3(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K);
1655    }
1656
1657    /**
1658     * naive nearest neighbor finder
1659     *
1660     * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
1661     * TODO: document
1662     * @param src1 automatically generated
1663     * @param src2 automatically generated
1664     * @param dist automatically generated
1665     * @param dtype automatically generated
1666     * @param nidx automatically generated
1667     * @param normType automatically generated
1668     */
1669    public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType) {
1670        batchDistance_4(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType);
1671    }
1672
1673    /**
1674     * naive nearest neighbor finder
1675     *
1676     * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
1677     * TODO: document
1678     * @param src1 automatically generated
1679     * @param src2 automatically generated
1680     * @param dist automatically generated
1681     * @param dtype automatically generated
1682     * @param nidx automatically generated
1683     */
1684    public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx) {
1685        batchDistance_5(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj);
1686    }
1687
1688
1689    //
1690    // C++:  void cv::normalize(Mat src, Mat& dst, double alpha = 1, double beta = 0, int norm_type = NORM_L2, int dtype = -1, Mat mask = Mat())
1691    //
1692
1693    /**
1694     * Normalizes the norm or value range of an array.
1695     *
1696     * The function cv::normalize normalizes scale and shift the input array elements so that
1697     * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
1698     * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
1699     * \(\min _I  \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I  \texttt{dst} (I)= \texttt{beta}\)
1700     *
1701     * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
1702     * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
1703     * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
1704     * min-max but modify the whole array, you can use norm and Mat::convertTo.
1705     *
1706     * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
1707     * the range transformation for sparse matrices is not allowed since it can shift the zero level.
1708     *
1709     * Possible usage with some positive example data:
1710     * <code>
1711     *     vector&lt;double&gt; positiveData = { 2.0, 8.0, 10.0 };
1712     *     vector&lt;double&gt; normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
1713     *
1714     *     // Norm to probability (total count)
1715     *     // sum(numbers) = 20.0
1716     *     // 2.0      0.1     (2.0/20.0)
1717     *     // 8.0      0.4     (8.0/20.0)
1718     *     // 10.0     0.5     (10.0/20.0)
1719     *     normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
1720     *
1721     *     // Norm to unit vector: ||positiveData|| = 1.0
1722     *     // 2.0      0.15
1723     *     // 8.0      0.62
1724     *     // 10.0     0.77
1725     *     normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
1726     *
1727     *     // Norm to max element
1728     *     // 2.0      0.2     (2.0/10.0)
1729     *     // 8.0      0.8     (8.0/10.0)
1730     *     // 10.0     1.0     (10.0/10.0)
1731     *     normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
1732     *
1733     *     // Norm to range [0.0;1.0]
1734     *     // 2.0      0.0     (shift to left border)
1735     *     // 8.0      0.75    (6.0/8.0)
1736     *     // 10.0     1.0     (shift to right border)
1737     *     normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
1738     * </code>
1739     *
1740     * @param src input array.
1741     * @param dst output array of the same size as src .
1742     * @param alpha norm value to normalize to or the lower range boundary in case of the range
1743     * normalization.
1744     * @param beta upper range boundary in case of the range normalization; it is not used for the norm
1745     * normalization.
1746     * @param norm_type normalization type (see cv::NormTypes).
1747     * @param dtype when negative, the output array has the same type as src; otherwise, it has the same
1748     * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
1749     * @param mask optional operation mask.
1750     * SEE: norm, Mat::convertTo, SparseMat::convertTo
1751     */
1752    public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type, int dtype, Mat mask) {
1753        normalize_0(src.nativeObj, dst.nativeObj, alpha, beta, norm_type, dtype, mask.nativeObj);
1754    }
1755
1756    /**
1757     * Normalizes the norm or value range of an array.
1758     *
1759     * The function cv::normalize normalizes scale and shift the input array elements so that
1760     * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
1761     * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
1762     * \(\min _I  \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I  \texttt{dst} (I)= \texttt{beta}\)
1763     *
1764     * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
1765     * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
1766     * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
1767     * min-max but modify the whole array, you can use norm and Mat::convertTo.
1768     *
1769     * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
1770     * the range transformation for sparse matrices is not allowed since it can shift the zero level.
1771     *
1772     * Possible usage with some positive example data:
1773     * <code>
1774     *     vector&lt;double&gt; positiveData = { 2.0, 8.0, 10.0 };
1775     *     vector&lt;double&gt; normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
1776     *
1777     *     // Norm to probability (total count)
1778     *     // sum(numbers) = 20.0
1779     *     // 2.0      0.1     (2.0/20.0)
1780     *     // 8.0      0.4     (8.0/20.0)
1781     *     // 10.0     0.5     (10.0/20.0)
1782     *     normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
1783     *
1784     *     // Norm to unit vector: ||positiveData|| = 1.0
1785     *     // 2.0      0.15
1786     *     // 8.0      0.62
1787     *     // 10.0     0.77
1788     *     normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
1789     *
1790     *     // Norm to max element
1791     *     // 2.0      0.2     (2.0/10.0)
1792     *     // 8.0      0.8     (8.0/10.0)
1793     *     // 10.0     1.0     (10.0/10.0)
1794     *     normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
1795     *
1796     *     // Norm to range [0.0;1.0]
1797     *     // 2.0      0.0     (shift to left border)
1798     *     // 8.0      0.75    (6.0/8.0)
1799     *     // 10.0     1.0     (shift to right border)
1800     *     normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
1801     * </code>
1802     *
1803     * @param src input array.
1804     * @param dst output array of the same size as src .
1805     * @param alpha norm value to normalize to or the lower range boundary in case of the range
1806     * normalization.
1807     * @param beta upper range boundary in case of the range normalization; it is not used for the norm
1808     * normalization.
1809     * @param norm_type normalization type (see cv::NormTypes).
1810     * @param dtype when negative, the output array has the same type as src; otherwise, it has the same
1811     * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
1812     * SEE: norm, Mat::convertTo, SparseMat::convertTo
1813     */
1814    public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type, int dtype) {
1815        normalize_1(src.nativeObj, dst.nativeObj, alpha, beta, norm_type, dtype);
1816    }
1817
1818    /**
1819     * Normalizes the norm or value range of an array.
1820     *
1821     * The function cv::normalize normalizes scale and shift the input array elements so that
1822     * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
1823     * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
1824     * \(\min _I  \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I  \texttt{dst} (I)= \texttt{beta}\)
1825     *
1826     * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
1827     * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
1828     * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
1829     * min-max but modify the whole array, you can use norm and Mat::convertTo.
1830     *
1831     * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
1832     * the range transformation for sparse matrices is not allowed since it can shift the zero level.
1833     *
1834     * Possible usage with some positive example data:
1835     * <code>
1836     *     vector&lt;double&gt; positiveData = { 2.0, 8.0, 10.0 };
1837     *     vector&lt;double&gt; normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
1838     *
1839     *     // Norm to probability (total count)
1840     *     // sum(numbers) = 20.0
1841     *     // 2.0      0.1     (2.0/20.0)
1842     *     // 8.0      0.4     (8.0/20.0)
1843     *     // 10.0     0.5     (10.0/20.0)
1844     *     normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
1845     *
1846     *     // Norm to unit vector: ||positiveData|| = 1.0
1847     *     // 2.0      0.15
1848     *     // 8.0      0.62
1849     *     // 10.0     0.77
1850     *     normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
1851     *
1852     *     // Norm to max element
1853     *     // 2.0      0.2     (2.0/10.0)
1854     *     // 8.0      0.8     (8.0/10.0)
1855     *     // 10.0     1.0     (10.0/10.0)
1856     *     normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
1857     *
1858     *     // Norm to range [0.0;1.0]
1859     *     // 2.0      0.0     (shift to left border)
1860     *     // 8.0      0.75    (6.0/8.0)
1861     *     // 10.0     1.0     (shift to right border)
1862     *     normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
1863     * </code>
1864     *
1865     * @param src input array.
1866     * @param dst output array of the same size as src .
1867     * @param alpha norm value to normalize to or the lower range boundary in case of the range
1868     * normalization.
1869     * @param beta upper range boundary in case of the range normalization; it is not used for the norm
1870     * normalization.
1871     * @param norm_type normalization type (see cv::NormTypes).
1872     * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
1873     * SEE: norm, Mat::convertTo, SparseMat::convertTo
1874     */
1875    public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type) {
1876        normalize_2(src.nativeObj, dst.nativeObj, alpha, beta, norm_type);
1877    }
1878
1879    /**
1880     * Normalizes the norm or value range of an array.
1881     *
1882     * The function cv::normalize normalizes scale and shift the input array elements so that
1883     * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
1884     * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
1885     * \(\min _I  \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I  \texttt{dst} (I)= \texttt{beta}\)
1886     *
1887     * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
1888     * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
1889     * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
1890     * min-max but modify the whole array, you can use norm and Mat::convertTo.
1891     *
1892     * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
1893     * the range transformation for sparse matrices is not allowed since it can shift the zero level.
1894     *
1895     * Possible usage with some positive example data:
1896     * <code>
1897     *     vector&lt;double&gt; positiveData = { 2.0, 8.0, 10.0 };
1898     *     vector&lt;double&gt; normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
1899     *
1900     *     // Norm to probability (total count)
1901     *     // sum(numbers) = 20.0
1902     *     // 2.0      0.1     (2.0/20.0)
1903     *     // 8.0      0.4     (8.0/20.0)
1904     *     // 10.0     0.5     (10.0/20.0)
1905     *     normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
1906     *
1907     *     // Norm to unit vector: ||positiveData|| = 1.0
1908     *     // 2.0      0.15
1909     *     // 8.0      0.62
1910     *     // 10.0     0.77
1911     *     normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
1912     *
1913     *     // Norm to max element
1914     *     // 2.0      0.2     (2.0/10.0)
1915     *     // 8.0      0.8     (8.0/10.0)
1916     *     // 10.0     1.0     (10.0/10.0)
1917     *     normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
1918     *
1919     *     // Norm to range [0.0;1.0]
1920     *     // 2.0      0.0     (shift to left border)
1921     *     // 8.0      0.75    (6.0/8.0)
1922     *     // 10.0     1.0     (shift to right border)
1923     *     normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
1924     * </code>
1925     *
1926     * @param src input array.
1927     * @param dst output array of the same size as src .
1928     * @param alpha norm value to normalize to or the lower range boundary in case of the range
1929     * normalization.
1930     * @param beta upper range boundary in case of the range normalization; it is not used for the norm
1931     * normalization.
1932     * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
1933     * SEE: norm, Mat::convertTo, SparseMat::convertTo
1934     */
1935    public static void normalize(Mat src, Mat dst, double alpha, double beta) {
1936        normalize_3(src.nativeObj, dst.nativeObj, alpha, beta);
1937    }
1938
1939    /**
1940     * Normalizes the norm or value range of an array.
1941     *
1942     * The function cv::normalize normalizes scale and shift the input array elements so that
1943     * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
1944     * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
1945     * \(\min _I  \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I  \texttt{dst} (I)= \texttt{beta}\)
1946     *
1947     * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
1948     * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
1949     * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
1950     * min-max but modify the whole array, you can use norm and Mat::convertTo.
1951     *
1952     * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
1953     * the range transformation for sparse matrices is not allowed since it can shift the zero level.
1954     *
1955     * Possible usage with some positive example data:
1956     * <code>
1957     *     vector&lt;double&gt; positiveData = { 2.0, 8.0, 10.0 };
1958     *     vector&lt;double&gt; normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
1959     *
1960     *     // Norm to probability (total count)
1961     *     // sum(numbers) = 20.0
1962     *     // 2.0      0.1     (2.0/20.0)
1963     *     // 8.0      0.4     (8.0/20.0)
1964     *     // 10.0     0.5     (10.0/20.0)
1965     *     normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
1966     *
1967     *     // Norm to unit vector: ||positiveData|| = 1.0
1968     *     // 2.0      0.15
1969     *     // 8.0      0.62
1970     *     // 10.0     0.77
1971     *     normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
1972     *
1973     *     // Norm to max element
1974     *     // 2.0      0.2     (2.0/10.0)
1975     *     // 8.0      0.8     (8.0/10.0)
1976     *     // 10.0     1.0     (10.0/10.0)
1977     *     normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
1978     *
1979     *     // Norm to range [0.0;1.0]
1980     *     // 2.0      0.0     (shift to left border)
1981     *     // 8.0      0.75    (6.0/8.0)
1982     *     // 10.0     1.0     (shift to right border)
1983     *     normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
1984     * </code>
1985     *
1986     * @param src input array.
1987     * @param dst output array of the same size as src .
1988     * @param alpha norm value to normalize to or the lower range boundary in case of the range
1989     * normalization.
1990     * normalization.
1991     * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
1992     * SEE: norm, Mat::convertTo, SparseMat::convertTo
1993     */
1994    public static void normalize(Mat src, Mat dst, double alpha) {
1995        normalize_4(src.nativeObj, dst.nativeObj, alpha);
1996    }
1997
1998    /**
1999     * Normalizes the norm or value range of an array.
2000     *
2001     * The function cv::normalize normalizes scale and shift the input array elements so that
2002     * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
2003     * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
2004     * \(\min _I  \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I  \texttt{dst} (I)= \texttt{beta}\)
2005     *
2006     * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
2007     * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
2008     * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
2009     * min-max but modify the whole array, you can use norm and Mat::convertTo.
2010     *
2011     * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
2012     * the range transformation for sparse matrices is not allowed since it can shift the zero level.
2013     *
2014     * Possible usage with some positive example data:
2015     * <code>
2016     *     vector&lt;double&gt; positiveData = { 2.0, 8.0, 10.0 };
2017     *     vector&lt;double&gt; normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
2018     *
2019     *     // Norm to probability (total count)
2020     *     // sum(numbers) = 20.0
2021     *     // 2.0      0.1     (2.0/20.0)
2022     *     // 8.0      0.4     (8.0/20.0)
2023     *     // 10.0     0.5     (10.0/20.0)
2024     *     normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
2025     *
2026     *     // Norm to unit vector: ||positiveData|| = 1.0
2027     *     // 2.0      0.15
2028     *     // 8.0      0.62
2029     *     // 10.0     0.77
2030     *     normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
2031     *
2032     *     // Norm to max element
2033     *     // 2.0      0.2     (2.0/10.0)
2034     *     // 8.0      0.8     (8.0/10.0)
2035     *     // 10.0     1.0     (10.0/10.0)
2036     *     normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
2037     *
2038     *     // Norm to range [0.0;1.0]
2039     *     // 2.0      0.0     (shift to left border)
2040     *     // 8.0      0.75    (6.0/8.0)
2041     *     // 10.0     1.0     (shift to right border)
2042     *     normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
2043     * </code>
2044     *
2045     * @param src input array.
2046     * @param dst output array of the same size as src .
2047     * normalization.
2048     * normalization.
2049     * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
2050     * SEE: norm, Mat::convertTo, SparseMat::convertTo
2051     */
2052    public static void normalize(Mat src, Mat dst) {
2053        normalize_5(src.nativeObj, dst.nativeObj);
2054    }
2055
2056
2057    //
2058    // C++:  void cv::reduceArgMin(Mat src, Mat& dst, int axis, bool lastIndex = false)
2059    //
2060
2061    /**
2062     * Finds indices of min elements along provided axis
2063     *
2064     * <b>Note:</b>
2065     * - If input or output array is not continuous, this function will create an internal copy.
2066     * - NaN handling is left unspecified, see patchNaNs().
2067     * - The returned index is always in bounds of input matrix.
2068     *
2069     * @param src input single-channel array.
2070     * @param dst output array of type CV_32SC1 with the same dimensionality as src,
2071     * except for axis being reduced - it should be set to 1.
2072     * @param lastIndex whether to get the index of first or last occurrence of min.
2073     * @param axis axis to reduce along.
2074     * SEE: reduceArgMax, minMaxLoc, min, max, compare, reduce
2075     */
2076    public static void reduceArgMin(Mat src, Mat dst, int axis, boolean lastIndex) {
2077        reduceArgMin_0(src.nativeObj, dst.nativeObj, axis, lastIndex);
2078    }
2079
2080    /**
2081     * Finds indices of min elements along provided axis
2082     *
2083     * <b>Note:</b>
2084     * - If input or output array is not continuous, this function will create an internal copy.
2085     * - NaN handling is left unspecified, see patchNaNs().
2086     * - The returned index is always in bounds of input matrix.
2087     *
2088     * @param src input single-channel array.
2089     * @param dst output array of type CV_32SC1 with the same dimensionality as src,
2090     * except for axis being reduced - it should be set to 1.
2091     * @param axis axis to reduce along.
2092     * SEE: reduceArgMax, minMaxLoc, min, max, compare, reduce
2093     */
2094    public static void reduceArgMin(Mat src, Mat dst, int axis) {
2095        reduceArgMin_1(src.nativeObj, dst.nativeObj, axis);
2096    }
2097
2098
2099    //
2100    // C++:  void cv::reduceArgMax(Mat src, Mat& dst, int axis, bool lastIndex = false)
2101    //
2102
2103    /**
2104     * Finds indices of max elements along provided axis
2105     *
2106     * <b>Note:</b>
2107     * - If input or output array is not continuous, this function will create an internal copy.
2108     * - NaN handling is left unspecified, see patchNaNs().
2109     * - The returned index is always in bounds of input matrix.
2110     *
2111     * @param src input single-channel array.
2112     * @param dst output array of type CV_32SC1 with the same dimensionality as src,
2113     * except for axis being reduced - it should be set to 1.
2114     * @param lastIndex whether to get the index of first or last occurrence of max.
2115     * @param axis axis to reduce along.
2116     * SEE: reduceArgMin, minMaxLoc, min, max, compare, reduce
2117     */
2118    public static void reduceArgMax(Mat src, Mat dst, int axis, boolean lastIndex) {
2119        reduceArgMax_0(src.nativeObj, dst.nativeObj, axis, lastIndex);
2120    }
2121
2122    /**
2123     * Finds indices of max elements along provided axis
2124     *
2125     * <b>Note:</b>
2126     * - If input or output array is not continuous, this function will create an internal copy.
2127     * - NaN handling is left unspecified, see patchNaNs().
2128     * - The returned index is always in bounds of input matrix.
2129     *
2130     * @param src input single-channel array.
2131     * @param dst output array of type CV_32SC1 with the same dimensionality as src,
2132     * except for axis being reduced - it should be set to 1.
2133     * @param axis axis to reduce along.
2134     * SEE: reduceArgMin, minMaxLoc, min, max, compare, reduce
2135     */
2136    public static void reduceArgMax(Mat src, Mat dst, int axis) {
2137        reduceArgMax_1(src.nativeObj, dst.nativeObj, axis);
2138    }
2139
2140
2141    //
2142    // C++:  void cv::reduce(Mat src, Mat& dst, int dim, int rtype, int dtype = -1)
2143    //
2144
2145    /**
2146     * Reduces a matrix to a vector.
2147     *
2148     * The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of
2149     * 1D vectors and performing the specified operation on the vectors until a single row/column is
2150     * obtained. For example, the function can be used to compute horizontal and vertical projections of a
2151     * raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one.
2152     * In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy.
2153     * And multi-channel arrays are also supported in these two reduction modes.
2154     *
2155     * The following code demonstrates its usage for a single channel matrix.
2156     * SNIPPET: snippets/core_reduce.cpp example
2157     *
2158     * And the following code demonstrates its usage for a two-channel matrix.
2159     * SNIPPET: snippets/core_reduce.cpp example2
2160     *
2161     * @param src input 2D matrix.
2162     * @param dst output vector. Its size and type is defined by dim and dtype parameters.
2163     * @param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to
2164     * a single row. 1 means that the matrix is reduced to a single column.
2165     * @param rtype reduction operation that could be one of #ReduceTypes
2166     * @param dtype when negative, the output vector will have the same type as the input matrix,
2167     * otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).
2168     * SEE: repeat, reduceArgMin, reduceArgMax
2169     */
2170    public static void reduce(Mat src, Mat dst, int dim, int rtype, int dtype) {
2171        reduce_0(src.nativeObj, dst.nativeObj, dim, rtype, dtype);
2172    }
2173
2174    /**
2175     * Reduces a matrix to a vector.
2176     *
2177     * The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of
2178     * 1D vectors and performing the specified operation on the vectors until a single row/column is
2179     * obtained. For example, the function can be used to compute horizontal and vertical projections of a
2180     * raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one.
2181     * In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy.
2182     * And multi-channel arrays are also supported in these two reduction modes.
2183     *
2184     * The following code demonstrates its usage for a single channel matrix.
2185     * SNIPPET: snippets/core_reduce.cpp example
2186     *
2187     * And the following code demonstrates its usage for a two-channel matrix.
2188     * SNIPPET: snippets/core_reduce.cpp example2
2189     *
2190     * @param src input 2D matrix.
2191     * @param dst output vector. Its size and type is defined by dim and dtype parameters.
2192     * @param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to
2193     * a single row. 1 means that the matrix is reduced to a single column.
2194     * @param rtype reduction operation that could be one of #ReduceTypes
2195     * otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).
2196     * SEE: repeat, reduceArgMin, reduceArgMax
2197     */
2198    public static void reduce(Mat src, Mat dst, int dim, int rtype) {
2199        reduce_1(src.nativeObj, dst.nativeObj, dim, rtype);
2200    }
2201
2202
2203    //
2204    // C++:  void cv::merge(vector_Mat mv, Mat& dst)
2205    //
2206
2207    /**
2208     *
2209     * @param mv input vector of matrices to be merged; all the matrices in mv must have the same
2210     * size and the same depth.
2211     * @param dst output array of the same size and the same depth as mv[0]; The number of channels will
2212     * be the total number of channels in the matrix array.
2213     */
2214    public static void merge(List<Mat> mv, Mat dst) {
2215        Mat mv_mat = Converters.vector_Mat_to_Mat(mv);
2216        merge_0(mv_mat.nativeObj, dst.nativeObj);
2217    }
2218
2219
2220    //
2221    // C++:  void cv::split(Mat m, vector_Mat& mv)
2222    //
2223
2224    /**
2225     *
2226     * @param m input multi-channel array.
2227     * @param mv output vector of arrays; the arrays themselves are reallocated, if needed.
2228     */
2229    public static void split(Mat m, List<Mat> mv) {
2230        Mat mv_mat = new Mat();
2231        split_0(m.nativeObj, mv_mat.nativeObj);
2232        Converters.Mat_to_vector_Mat(mv_mat, mv);
2233        mv_mat.release();
2234    }
2235
2236
2237    //
2238    // C++:  void cv::mixChannels(vector_Mat src, vector_Mat dst, vector_int fromTo)
2239    //
2240
2241    /**
2242     *
2243     * @param src input array or vector of matrices; all of the matrices must have the same size and the
2244     * same depth.
2245     * @param dst output array or vector of matrices; all the matrices <b>must be allocated</b>; their size and
2246     * depth must be the same as in src[0].
2247     * @param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is
2248     * a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
2249     * dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
2250     * src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
2251     * src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
2252     * channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
2253     * filled with zero .
2254     */
2255    public static void mixChannels(List<Mat> src, List<Mat> dst, MatOfInt fromTo) {
2256        Mat src_mat = Converters.vector_Mat_to_Mat(src);
2257        Mat dst_mat = Converters.vector_Mat_to_Mat(dst);
2258        Mat fromTo_mat = fromTo;
2259        mixChannels_0(src_mat.nativeObj, dst_mat.nativeObj, fromTo_mat.nativeObj);
2260    }
2261
2262
2263    //
2264    // C++:  void cv::extractChannel(Mat src, Mat& dst, int coi)
2265    //
2266
2267    /**
2268     * Extracts a single channel from src (coi is 0-based index)
2269     * @param src input array
2270     * @param dst output array
2271     * @param coi index of channel to extract
2272     * SEE: mixChannels, split
2273     */
2274    public static void extractChannel(Mat src, Mat dst, int coi) {
2275        extractChannel_0(src.nativeObj, dst.nativeObj, coi);
2276    }
2277
2278
2279    //
2280    // C++:  void cv::insertChannel(Mat src, Mat& dst, int coi)
2281    //
2282
2283    /**
2284     * Inserts a single channel to dst (coi is 0-based index)
2285     * @param src input array
2286     * @param dst output array
2287     * @param coi index of channel for insertion
2288     * SEE: mixChannels, merge
2289     */
2290    public static void insertChannel(Mat src, Mat dst, int coi) {
2291        insertChannel_0(src.nativeObj, dst.nativeObj, coi);
2292    }
2293
2294
2295    //
2296    // C++:  void cv::flip(Mat src, Mat& dst, int flipCode)
2297    //
2298
2299    /**
2300     * Flips a 2D array around vertical, horizontal, or both axes.
2301     *
2302     * The function cv::flip flips the array in one of three different ways (row
2303     * and column indices are 0-based):
2304     * \(\texttt{dst} _{ij} =
2305     * \left\{
2306     * \begin{array}{l l}
2307     * \texttt{src} _{\texttt{src.rows}-i-1,j} &amp; if\;  \texttt{flipCode} = 0 \\
2308     * \texttt{src} _{i, \texttt{src.cols} -j-1} &amp; if\;  \texttt{flipCode} &gt; 0 \\
2309     * \texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} &amp; if\; \texttt{flipCode} &lt; 0 \\
2310     * \end{array}
2311     * \right.\)
2312     * The example scenarios of using the function are the following:
2313     * Vertical flipping of the image (flipCode == 0) to switch between
2314     *     top-left and bottom-left image origin. This is a typical operation
2315     *     in video processing on Microsoft Windows\* OS.
2316     * Horizontal flipping of the image with the subsequent horizontal
2317     *     shift and absolute difference calculation to check for a
2318     *     vertical-axis symmetry (flipCode &gt; 0).
2319     * Simultaneous horizontal and vertical flipping of the image with
2320     *     the subsequent shift and absolute difference calculation to check
2321     *     for a central symmetry (flipCode &lt; 0).
2322     * Reversing the order of point arrays (flipCode &gt; 0 or
2323     *     flipCode == 0).
2324     * @param src input array.
2325     * @param dst output array of the same size and type as src.
2326     * @param flipCode a flag to specify how to flip the array; 0 means
2327     * flipping around the x-axis and positive value (for example, 1) means
2328     * flipping around y-axis. Negative value (for example, -1) means flipping
2329     * around both axes.
2330     * SEE: transpose , repeat , completeSymm
2331     */
2332    public static void flip(Mat src, Mat dst, int flipCode) {
2333        flip_0(src.nativeObj, dst.nativeObj, flipCode);
2334    }
2335
2336
2337    //
2338    // C++:  void cv::rotate(Mat src, Mat& dst, int rotateCode)
2339    //
2340
2341    /**
2342     * Rotates a 2D array in multiples of 90 degrees.
2343     * The function cv::rotate rotates the array in one of three different ways:
2344     * Rotate by 90 degrees clockwise (rotateCode = ROTATE_90_CLOCKWISE).
2345     * Rotate by 180 degrees clockwise (rotateCode = ROTATE_180).
2346     * Rotate by 270 degrees clockwise (rotateCode = ROTATE_90_COUNTERCLOCKWISE).
2347     * @param src input array.
2348     * @param dst output array of the same type as src.  The size is the same with ROTATE_180,
2349     * and the rows and cols are switched for ROTATE_90_CLOCKWISE and ROTATE_90_COUNTERCLOCKWISE.
2350     * @param rotateCode an enum to specify how to rotate the array; see the enum #RotateFlags
2351     * SEE: transpose , repeat , completeSymm, flip, RotateFlags
2352     */
2353    public static void rotate(Mat src, Mat dst, int rotateCode) {
2354        rotate_0(src.nativeObj, dst.nativeObj, rotateCode);
2355    }
2356
2357
2358    //
2359    // C++:  void cv::repeat(Mat src, int ny, int nx, Mat& dst)
2360    //
2361
2362    /**
2363     * Fills the output array with repeated copies of the input array.
2364     *
2365     * The function cv::repeat duplicates the input array one or more times along each of the two axes:
2366     * \(\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }\)
2367     * The second variant of the function is more convenient to use with REF: MatrixExpressions.
2368     * @param src input array to replicate.
2369     * @param ny Flag to specify how many times the {@code src} is repeated along the
2370     * vertical axis.
2371     * @param nx Flag to specify how many times the {@code src} is repeated along the
2372     * horizontal axis.
2373     * @param dst output array of the same type as {@code src}.
2374     * SEE: cv::reduce
2375     */
2376    public static void repeat(Mat src, int ny, int nx, Mat dst) {
2377        repeat_0(src.nativeObj, ny, nx, dst.nativeObj);
2378    }
2379
2380
2381    //
2382    // C++:  void cv::hconcat(vector_Mat src, Mat& dst)
2383    //
2384
2385    /**
2386     *
2387     *  <code>
2388     *     std::vector&lt;cv::Mat&gt; matrices = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
2389     *                                       cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
2390     *                                       cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
2391     *
2392     *     cv::Mat out;
2393     *     cv::hconcat( matrices, out );
2394     *     //out:
2395     *     //[1, 2, 3;
2396     *     // 1, 2, 3;
2397     *     // 1, 2, 3;
2398     *     // 1, 2, 3]
2399     *  </code>
2400     *  @param src input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.
2401     *  @param dst output array. It has the same number of rows and depth as the src, and the sum of cols of the src.
2402     * same depth.
2403     */
2404    public static void hconcat(List<Mat> src, Mat dst) {
2405        Mat src_mat = Converters.vector_Mat_to_Mat(src);
2406        hconcat_0(src_mat.nativeObj, dst.nativeObj);
2407    }
2408
2409
2410    //
2411    // C++:  void cv::vconcat(vector_Mat src, Mat& dst)
2412    //
2413
2414    /**
2415     *
2416     *  <code>
2417     *     std::vector&lt;cv::Mat&gt; matrices = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)),
2418     *                                       cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)),
2419     *                                       cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),};
2420     *
2421     *     cv::Mat out;
2422     *     cv::vconcat( matrices, out );
2423     *     //out:
2424     *     //[1,   1,   1,   1;
2425     *     // 2,   2,   2,   2;
2426     *     // 3,   3,   3,   3]
2427     *  </code>
2428     *  @param src input array or vector of matrices. all of the matrices must have the same number of cols and the same depth
2429     *  @param dst output array. It has the same number of cols and depth as the src, and the sum of rows of the src.
2430     * same depth.
2431     */
2432    public static void vconcat(List<Mat> src, Mat dst) {
2433        Mat src_mat = Converters.vector_Mat_to_Mat(src);
2434        vconcat_0(src_mat.nativeObj, dst.nativeObj);
2435    }
2436
2437
2438    //
2439    // C++:  void cv::bitwise_and(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
2440    //
2441
2442    /**
2443     * computes bitwise conjunction of the two arrays (dst = src1 &amp; src2)
2444     * Calculates the per-element bit-wise conjunction of two arrays or an
2445     * array and a scalar.
2446     *
2447     * The function cv::bitwise_and calculates the per-element bit-wise logical conjunction for:
2448     * Two arrays when src1 and src2 have the same size:
2449     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2450     * An array and a scalar when src2 is constructed from Scalar or has
2451     *     the same number of elements as {@code src1.channels()}:
2452     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \wedge \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
2453     * A scalar and an array when src1 is constructed from Scalar or has
2454     *     the same number of elements as {@code src2.channels()}:
2455     *     \(\texttt{dst} (I) =  \texttt{src1}  \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2456     * In case of floating-point arrays, their machine-specific bit
2457     * representations (usually IEEE754-compliant) are used for the operation.
2458     * In case of multi-channel arrays, each channel is processed
2459     * independently. In the second and third cases above, the scalar is first
2460     * converted to the array type.
2461     * @param src1 first input array or a scalar.
2462     * @param src2 second input array or a scalar.
2463     * @param dst output array that has the same size and type as the input
2464     * arrays.
2465     * @param mask optional operation mask, 8-bit single channel array, that
2466     * specifies elements of the output array to be changed.
2467     */
2468    public static void bitwise_and(Mat src1, Mat src2, Mat dst, Mat mask) {
2469        bitwise_and_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
2470    }
2471
2472    /**
2473     * computes bitwise conjunction of the two arrays (dst = src1 &amp; src2)
2474     * Calculates the per-element bit-wise conjunction of two arrays or an
2475     * array and a scalar.
2476     *
2477     * The function cv::bitwise_and calculates the per-element bit-wise logical conjunction for:
2478     * Two arrays when src1 and src2 have the same size:
2479     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2480     * An array and a scalar when src2 is constructed from Scalar or has
2481     *     the same number of elements as {@code src1.channels()}:
2482     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \wedge \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
2483     * A scalar and an array when src1 is constructed from Scalar or has
2484     *     the same number of elements as {@code src2.channels()}:
2485     *     \(\texttt{dst} (I) =  \texttt{src1}  \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2486     * In case of floating-point arrays, their machine-specific bit
2487     * representations (usually IEEE754-compliant) are used for the operation.
2488     * In case of multi-channel arrays, each channel is processed
2489     * independently. In the second and third cases above, the scalar is first
2490     * converted to the array type.
2491     * @param src1 first input array or a scalar.
2492     * @param src2 second input array or a scalar.
2493     * @param dst output array that has the same size and type as the input
2494     * arrays.
2495     * specifies elements of the output array to be changed.
2496     */
2497    public static void bitwise_and(Mat src1, Mat src2, Mat dst) {
2498        bitwise_and_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
2499    }
2500
2501
2502    //
2503    // C++:  void cv::bitwise_or(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
2504    //
2505
2506    /**
2507     * Calculates the per-element bit-wise disjunction of two arrays or an
2508     * array and a scalar.
2509     *
2510     * The function cv::bitwise_or calculates the per-element bit-wise logical disjunction for:
2511     * Two arrays when src1 and src2 have the same size:
2512     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2513     * An array and a scalar when src2 is constructed from Scalar or has
2514     *     the same number of elements as {@code src1.channels()}:
2515     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \vee \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
2516     * A scalar and an array when src1 is constructed from Scalar or has
2517     *     the same number of elements as {@code src2.channels()}:
2518     *     \(\texttt{dst} (I) =  \texttt{src1}  \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2519     * In case of floating-point arrays, their machine-specific bit
2520     * representations (usually IEEE754-compliant) are used for the operation.
2521     * In case of multi-channel arrays, each channel is processed
2522     * independently. In the second and third cases above, the scalar is first
2523     * converted to the array type.
2524     * @param src1 first input array or a scalar.
2525     * @param src2 second input array or a scalar.
2526     * @param dst output array that has the same size and type as the input
2527     * arrays.
2528     * @param mask optional operation mask, 8-bit single channel array, that
2529     * specifies elements of the output array to be changed.
2530     */
2531    public static void bitwise_or(Mat src1, Mat src2, Mat dst, Mat mask) {
2532        bitwise_or_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
2533    }
2534
2535    /**
2536     * Calculates the per-element bit-wise disjunction of two arrays or an
2537     * array and a scalar.
2538     *
2539     * The function cv::bitwise_or calculates the per-element bit-wise logical disjunction for:
2540     * Two arrays when src1 and src2 have the same size:
2541     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2542     * An array and a scalar when src2 is constructed from Scalar or has
2543     *     the same number of elements as {@code src1.channels()}:
2544     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \vee \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
2545     * A scalar and an array when src1 is constructed from Scalar or has
2546     *     the same number of elements as {@code src2.channels()}:
2547     *     \(\texttt{dst} (I) =  \texttt{src1}  \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2548     * In case of floating-point arrays, their machine-specific bit
2549     * representations (usually IEEE754-compliant) are used for the operation.
2550     * In case of multi-channel arrays, each channel is processed
2551     * independently. In the second and third cases above, the scalar is first
2552     * converted to the array type.
2553     * @param src1 first input array or a scalar.
2554     * @param src2 second input array or a scalar.
2555     * @param dst output array that has the same size and type as the input
2556     * arrays.
2557     * specifies elements of the output array to be changed.
2558     */
2559    public static void bitwise_or(Mat src1, Mat src2, Mat dst) {
2560        bitwise_or_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
2561    }
2562
2563
2564    //
2565    // C++:  void cv::bitwise_xor(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
2566    //
2567
2568    /**
2569     * Calculates the per-element bit-wise "exclusive or" operation on two
2570     * arrays or an array and a scalar.
2571     *
2572     * The function cv::bitwise_xor calculates the per-element bit-wise logical "exclusive-or"
2573     * operation for:
2574     * Two arrays when src1 and src2 have the same size:
2575     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2576     * An array and a scalar when src2 is constructed from Scalar or has
2577     *     the same number of elements as {@code src1.channels()}:
2578     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \oplus \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
2579     * A scalar and an array when src1 is constructed from Scalar or has
2580     *     the same number of elements as {@code src2.channels()}:
2581     *     \(\texttt{dst} (I) =  \texttt{src1}  \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2582     * In case of floating-point arrays, their machine-specific bit
2583     * representations (usually IEEE754-compliant) are used for the operation.
2584     * In case of multi-channel arrays, each channel is processed
2585     * independently. In the 2nd and 3rd cases above, the scalar is first
2586     * converted to the array type.
2587     * @param src1 first input array or a scalar.
2588     * @param src2 second input array or a scalar.
2589     * @param dst output array that has the same size and type as the input
2590     * arrays.
2591     * @param mask optional operation mask, 8-bit single channel array, that
2592     * specifies elements of the output array to be changed.
2593     */
2594    public static void bitwise_xor(Mat src1, Mat src2, Mat dst, Mat mask) {
2595        bitwise_xor_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
2596    }
2597
2598    /**
2599     * Calculates the per-element bit-wise "exclusive or" operation on two
2600     * arrays or an array and a scalar.
2601     *
2602     * The function cv::bitwise_xor calculates the per-element bit-wise logical "exclusive-or"
2603     * operation for:
2604     * Two arrays when src1 and src2 have the same size:
2605     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2606     * An array and a scalar when src2 is constructed from Scalar or has
2607     *     the same number of elements as {@code src1.channels()}:
2608     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \oplus \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
2609     * A scalar and an array when src1 is constructed from Scalar or has
2610     *     the same number of elements as {@code src2.channels()}:
2611     *     \(\texttt{dst} (I) =  \texttt{src1}  \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
2612     * In case of floating-point arrays, their machine-specific bit
2613     * representations (usually IEEE754-compliant) are used for the operation.
2614     * In case of multi-channel arrays, each channel is processed
2615     * independently. In the 2nd and 3rd cases above, the scalar is first
2616     * converted to the array type.
2617     * @param src1 first input array or a scalar.
2618     * @param src2 second input array or a scalar.
2619     * @param dst output array that has the same size and type as the input
2620     * arrays.
2621     * specifies elements of the output array to be changed.
2622     */
2623    public static void bitwise_xor(Mat src1, Mat src2, Mat dst) {
2624        bitwise_xor_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
2625    }
2626
2627
2628    //
2629    // C++:  void cv::bitwise_not(Mat src, Mat& dst, Mat mask = Mat())
2630    //
2631
2632    /**
2633     *  Inverts every bit of an array.
2634     *
2635     * The function cv::bitwise_not calculates per-element bit-wise inversion of the input
2636     * array:
2637     * \(\texttt{dst} (I) =  \neg \texttt{src} (I)\)
2638     * In case of a floating-point input array, its machine-specific bit
2639     * representation (usually IEEE754-compliant) is used for the operation. In
2640     * case of multi-channel arrays, each channel is processed independently.
2641     * @param src input array.
2642     * @param dst output array that has the same size and type as the input
2643     * array.
2644     * @param mask optional operation mask, 8-bit single channel array, that
2645     * specifies elements of the output array to be changed.
2646     */
2647    public static void bitwise_not(Mat src, Mat dst, Mat mask) {
2648        bitwise_not_0(src.nativeObj, dst.nativeObj, mask.nativeObj);
2649    }
2650
2651    /**
2652     *  Inverts every bit of an array.
2653     *
2654     * The function cv::bitwise_not calculates per-element bit-wise inversion of the input
2655     * array:
2656     * \(\texttt{dst} (I) =  \neg \texttt{src} (I)\)
2657     * In case of a floating-point input array, its machine-specific bit
2658     * representation (usually IEEE754-compliant) is used for the operation. In
2659     * case of multi-channel arrays, each channel is processed independently.
2660     * @param src input array.
2661     * @param dst output array that has the same size and type as the input
2662     * array.
2663     * specifies elements of the output array to be changed.
2664     */
2665    public static void bitwise_not(Mat src, Mat dst) {
2666        bitwise_not_1(src.nativeObj, dst.nativeObj);
2667    }
2668
2669
2670    //
2671    // C++:  void cv::absdiff(Mat src1, Mat src2, Mat& dst)
2672    //
2673
2674    /**
2675     * Calculates the per-element absolute difference between two arrays or between an array and a scalar.
2676     *
2677     * The function cv::absdiff calculates:
2678     * Absolute difference between two arrays when they have the same
2679     *     size and type:
2680     *     \(\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1}(I) -  \texttt{src2}(I)|)\)
2681     * Absolute difference between an array and a scalar when the second
2682     *     array is constructed from Scalar or has as many elements as the
2683     *     number of channels in {@code src1}:
2684     *     \(\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1}(I) -  \texttt{src2} |)\)
2685     * Absolute difference between a scalar and an array when the first
2686     *     array is constructed from Scalar or has as many elements as the
2687     *     number of channels in {@code src2}:
2688     *     \(\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1} -  \texttt{src2}(I) |)\)
2689     *     where I is a multi-dimensional index of array elements. In case of
2690     *     multi-channel arrays, each channel is processed independently.
2691     * <b>Note:</b> Saturation is not applied when the arrays have the depth CV_32S.
2692     * You may even get a negative value in the case of overflow.
2693     * @param src1 first input array or a scalar.
2694     * @param src2 second input array or a scalar.
2695     * @param dst output array that has the same size and type as input arrays.
2696     * SEE: cv::abs(const Mat&amp;)
2697     */
2698    public static void absdiff(Mat src1, Mat src2, Mat dst) {
2699        absdiff_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
2700    }
2701
2702
2703    //
2704    // C++:  void cv::copyTo(Mat src, Mat& dst, Mat mask)
2705    //
2706
2707    /**
2708     *  This is an overloaded member function, provided for convenience (python)
2709     * Copies the matrix to another one.
2710     * When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.
2711     * @param src source matrix.
2712     * @param dst Destination matrix. If it does not have a proper size or type before the operation, it is
2713     * reallocated.
2714     * @param mask Operation mask of the same size as \*this. Its non-zero elements indicate which matrix
2715     * elements need to be copied. The mask has to be of type CV_8U and can have 1 or multiple channels.
2716     */
2717    public static void copyTo(Mat src, Mat dst, Mat mask) {
2718        copyTo_0(src.nativeObj, dst.nativeObj, mask.nativeObj);
2719    }
2720
2721
2722    //
2723    // C++:  void cv::inRange(Mat src, Scalar lowerb, Scalar upperb, Mat& dst)
2724    //
2725
2726    /**
2727     *  Checks if array elements lie between the elements of two other arrays.
2728     *
2729     * The function checks the range as follows:
2730     * <ul>
2731     *   <li>
2732     *    For every element of a single-channel input array:
2733     *     \(\texttt{dst} (I)= \texttt{lowerb} (I)_0  \leq \texttt{src} (I)_0 \leq  \texttt{upperb} (I)_0\)
2734     *   </li>
2735     *   <li>
2736     *    For two-channel arrays:
2737     *     \(\texttt{dst} (I)= \texttt{lowerb} (I)_0  \leq \texttt{src} (I)_0 \leq  \texttt{upperb} (I)_0  \land \texttt{lowerb} (I)_1  \leq \texttt{src} (I)_1 \leq  \texttt{upperb} (I)_1\)
2738     *   </li>
2739     *   <li>
2740     *    and so forth.
2741     *   </li>
2742     * </ul>
2743     *
2744     * That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the
2745     * specified 1D, 2D, 3D, ... box and 0 otherwise.
2746     *
2747     * When the lower and/or upper boundary parameters are scalars, the indexes
2748     * (I) at lowerb and upperb in the above formulas should be omitted.
2749     * @param src first input array.
2750     * @param lowerb inclusive lower boundary array or a scalar.
2751     * @param upperb inclusive upper boundary array or a scalar.
2752     * @param dst output array of the same size as src and CV_8U type.
2753     */
2754    public static void inRange(Mat src, Scalar lowerb, Scalar upperb, Mat dst) {
2755        inRange_0(src.nativeObj, lowerb.val[0], lowerb.val[1], lowerb.val[2], lowerb.val[3], upperb.val[0], upperb.val[1], upperb.val[2], upperb.val[3], dst.nativeObj);
2756    }
2757
2758
2759    //
2760    // C++:  void cv::compare(Mat src1, Mat src2, Mat& dst, int cmpop)
2761    //
2762
2763    /**
2764     * Performs the per-element comparison of two arrays or an array and scalar value.
2765     *
2766     * The function compares:
2767     * Elements of two arrays when src1 and src2 have the same size:
2768     *     \(\texttt{dst} (I) =  \texttt{src1} (I)  \,\texttt{cmpop}\, \texttt{src2} (I)\)
2769     * Elements of src1 with a scalar src2 when src2 is constructed from
2770     *     Scalar or has a single element:
2771     *     \(\texttt{dst} (I) =  \texttt{src1}(I) \,\texttt{cmpop}\,  \texttt{src2}\)
2772     * src1 with elements of src2 when src1 is constructed from Scalar or
2773     *     has a single element:
2774     *     \(\texttt{dst} (I) =  \texttt{src1}  \,\texttt{cmpop}\, \texttt{src2} (I)\)
2775     * When the comparison result is true, the corresponding element of output
2776     * array is set to 255. The comparison operations can be replaced with the
2777     * equivalent matrix expressions:
2778     * <code>
2779     *     Mat dst1 = src1 &gt;= src2;
2780     *     Mat dst2 = src1 &lt; 8;
2781     *     ...
2782     * </code>
2783     * @param src1 first input array or a scalar; when it is an array, it must have a single channel.
2784     * @param src2 second input array or a scalar; when it is an array, it must have a single channel.
2785     * @param dst output array of type ref CV_8U that has the same size and the same number of channels as
2786     *     the input arrays.
2787     * @param cmpop a flag, that specifies correspondence between the arrays (cv::CmpTypes)
2788     * SEE: checkRange, min, max, threshold
2789     */
2790    public static void compare(Mat src1, Mat src2, Mat dst, int cmpop) {
2791        compare_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, cmpop);
2792    }
2793
2794
2795    //
2796    // C++:  void cv::min(Mat src1, Mat src2, Mat& dst)
2797    //
2798
2799    /**
2800     * Calculates per-element minimum of two arrays or an array and a scalar.
2801     *
2802     * The function cv::min calculates the per-element minimum of two arrays:
2803     * \(\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\)
2804     * or array and a scalar:
2805     * \(\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\)
2806     * @param src1 first input array.
2807     * @param src2 second input array of the same size and type as src1.
2808     * @param dst output array of the same size and type as src1.
2809     * SEE: max, compare, inRange, minMaxLoc
2810     */
2811    public static void min(Mat src1, Mat src2, Mat dst) {
2812        min_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
2813    }
2814
2815
2816    //
2817    // C++:  void cv::max(Mat src1, Mat src2, Mat& dst)
2818    //
2819
2820    /**
2821     * Calculates per-element maximum of two arrays or an array and a scalar.
2822     *
2823     * The function cv::max calculates the per-element maximum of two arrays:
2824     * \(\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\)
2825     * or array and a scalar:
2826     * \(\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\)
2827     * @param src1 first input array.
2828     * @param src2 second input array of the same size and type as src1 .
2829     * @param dst output array of the same size and type as src1.
2830     * SEE:  min, compare, inRange, minMaxLoc, REF: MatrixExpressions
2831     */
2832    public static void max(Mat src1, Mat src2, Mat dst) {
2833        max_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
2834    }
2835
2836
2837    //
2838    // C++:  void cv::sqrt(Mat src, Mat& dst)
2839    //
2840
2841    /**
2842     * Calculates a square root of array elements.
2843     *
2844     * The function cv::sqrt calculates a square root of each input array element.
2845     * In case of multi-channel arrays, each channel is processed
2846     * independently. The accuracy is approximately the same as of the built-in
2847     * std::sqrt .
2848     * @param src input floating-point array.
2849     * @param dst output array of the same size and type as src.
2850     */
2851    public static void sqrt(Mat src, Mat dst) {
2852        sqrt_0(src.nativeObj, dst.nativeObj);
2853    }
2854
2855
2856    //
2857    // C++:  void cv::pow(Mat src, double power, Mat& dst)
2858    //
2859
2860    /**
2861     * Raises every array element to a power.
2862     *
2863     * The function cv::pow raises every element of the input array to power :
2864     * \(\texttt{dst} (I) =  \fork{\texttt{src}(I)^{power}}{if \(\texttt{power}\) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\)
2865     *
2866     * So, for a non-integer power exponent, the absolute values of input array
2867     * elements are used. However, it is possible to get true values for
2868     * negative values using some extra operations. In the example below,
2869     * computing the 5th root of array src shows:
2870     * <code>
2871     *     Mat mask = src &lt; 0;
2872     *     pow(src, 1./5, dst);
2873     *     subtract(Scalar::all(0), dst, dst, mask);
2874     * </code>
2875     * For some values of power, such as integer values, 0.5 and -0.5,
2876     * specialized faster algorithms are used.
2877     *
2878     * Special values (NaN, Inf) are not handled.
2879     * @param src input array.
2880     * @param power exponent of power.
2881     * @param dst output array of the same size and type as src.
2882     * SEE: sqrt, exp, log, cartToPolar, polarToCart
2883     */
2884    public static void pow(Mat src, double power, Mat dst) {
2885        pow_0(src.nativeObj, power, dst.nativeObj);
2886    }
2887
2888
2889    //
2890    // C++:  void cv::exp(Mat src, Mat& dst)
2891    //
2892
2893    /**
2894     * Calculates the exponent of every array element.
2895     *
2896     * The function cv::exp calculates the exponent of every element of the input
2897     * array:
2898     * \(\texttt{dst} [I] = e^{ src(I) }\)
2899     *
2900     * The maximum relative error is about 7e-6 for single-precision input and
2901     * less than 1e-10 for double-precision input. Currently, the function
2902     * converts denormalized values to zeros on output. Special values (NaN,
2903     * Inf) are not handled.
2904     * @param src input array.
2905     * @param dst output array of the same size and type as src.
2906     * SEE: log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude
2907     */
2908    public static void exp(Mat src, Mat dst) {
2909        exp_0(src.nativeObj, dst.nativeObj);
2910    }
2911
2912
2913    //
2914    // C++:  void cv::log(Mat src, Mat& dst)
2915    //
2916
2917    /**
2918     * Calculates the natural logarithm of every array element.
2919     *
2920     * The function cv::log calculates the natural logarithm of every element of the input array:
2921     * \(\texttt{dst} (I) =  \log (\texttt{src}(I)) \)
2922     *
2923     * Output on zero, negative and special (NaN, Inf) values is undefined.
2924     *
2925     * @param src input array.
2926     * @param dst output array of the same size and type as src .
2927     * SEE: exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude
2928     */
2929    public static void log(Mat src, Mat dst) {
2930        log_0(src.nativeObj, dst.nativeObj);
2931    }
2932
2933
2934    //
2935    // C++:  void cv::polarToCart(Mat magnitude, Mat angle, Mat& x, Mat& y, bool angleInDegrees = false)
2936    //
2937
2938    /**
2939     * Calculates x and y coordinates of 2D vectors from their magnitude and angle.
2940     *
2941     * The function cv::polarToCart calculates the Cartesian coordinates of each 2D
2942     * vector represented by the corresponding elements of magnitude and angle:
2943     * \(\begin{array}{l} \texttt{x} (I) =  \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) =  \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\)
2944     *
2945     * The relative accuracy of the estimated coordinates is about 1e-6.
2946     * @param magnitude input floating-point array of magnitudes of 2D vectors;
2947     * it can be an empty matrix (=Mat()), in this case, the function assumes
2948     * that all the magnitudes are =1; if it is not empty, it must have the
2949     * same size and type as angle.
2950     * @param angle input floating-point array of angles of 2D vectors.
2951     * @param x output array of x-coordinates of 2D vectors; it has the same
2952     * size and type as angle.
2953     * @param y output array of y-coordinates of 2D vectors; it has the same
2954     * size and type as angle.
2955     * @param angleInDegrees when true, the input angles are measured in
2956     * degrees, otherwise, they are measured in radians.
2957     * SEE: cartToPolar, magnitude, phase, exp, log, pow, sqrt
2958     */
2959    public static void polarToCart(Mat magnitude, Mat angle, Mat x, Mat y, boolean angleInDegrees) {
2960        polarToCart_0(magnitude.nativeObj, angle.nativeObj, x.nativeObj, y.nativeObj, angleInDegrees);
2961    }
2962
2963    /**
2964     * Calculates x and y coordinates of 2D vectors from their magnitude and angle.
2965     *
2966     * The function cv::polarToCart calculates the Cartesian coordinates of each 2D
2967     * vector represented by the corresponding elements of magnitude and angle:
2968     * \(\begin{array}{l} \texttt{x} (I) =  \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) =  \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\)
2969     *
2970     * The relative accuracy of the estimated coordinates is about 1e-6.
2971     * @param magnitude input floating-point array of magnitudes of 2D vectors;
2972     * it can be an empty matrix (=Mat()), in this case, the function assumes
2973     * that all the magnitudes are =1; if it is not empty, it must have the
2974     * same size and type as angle.
2975     * @param angle input floating-point array of angles of 2D vectors.
2976     * @param x output array of x-coordinates of 2D vectors; it has the same
2977     * size and type as angle.
2978     * @param y output array of y-coordinates of 2D vectors; it has the same
2979     * size and type as angle.
2980     * degrees, otherwise, they are measured in radians.
2981     * SEE: cartToPolar, magnitude, phase, exp, log, pow, sqrt
2982     */
2983    public static void polarToCart(Mat magnitude, Mat angle, Mat x, Mat y) {
2984        polarToCart_1(magnitude.nativeObj, angle.nativeObj, x.nativeObj, y.nativeObj);
2985    }
2986
2987
2988    //
2989    // C++:  void cv::cartToPolar(Mat x, Mat y, Mat& magnitude, Mat& angle, bool angleInDegrees = false)
2990    //
2991
2992    /**
2993     * Calculates the magnitude and angle of 2D vectors.
2994     *
2995     * The function cv::cartToPolar calculates either the magnitude, angle, or both
2996     * for every 2D vector (x(I),y(I)):
2997     * \(\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\)
2998     *
2999     * The angles are calculated with accuracy about 0.3 degrees. For the point
3000     * (0,0), the angle is set to 0.
3001     * @param x array of x-coordinates; this must be a single-precision or
3002     * double-precision floating-point array.
3003     * @param y array of y-coordinates, that must have the same size and same type as x.
3004     * @param magnitude output array of magnitudes of the same size and type as x.
3005     * @param angle output array of angles that has the same size and type as
3006     * x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees).
3007     * @param angleInDegrees a flag, indicating whether the angles are measured
3008     * in radians (which is by default), or in degrees.
3009     * SEE: Sobel, Scharr
3010     */
3011    public static void cartToPolar(Mat x, Mat y, Mat magnitude, Mat angle, boolean angleInDegrees) {
3012        cartToPolar_0(x.nativeObj, y.nativeObj, magnitude.nativeObj, angle.nativeObj, angleInDegrees);
3013    }
3014
3015    /**
3016     * Calculates the magnitude and angle of 2D vectors.
3017     *
3018     * The function cv::cartToPolar calculates either the magnitude, angle, or both
3019     * for every 2D vector (x(I),y(I)):
3020     * \(\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\)
3021     *
3022     * The angles are calculated with accuracy about 0.3 degrees. For the point
3023     * (0,0), the angle is set to 0.
3024     * @param x array of x-coordinates; this must be a single-precision or
3025     * double-precision floating-point array.
3026     * @param y array of y-coordinates, that must have the same size and same type as x.
3027     * @param magnitude output array of magnitudes of the same size and type as x.
3028     * @param angle output array of angles that has the same size and type as
3029     * x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees).
3030     * in radians (which is by default), or in degrees.
3031     * SEE: Sobel, Scharr
3032     */
3033    public static void cartToPolar(Mat x, Mat y, Mat magnitude, Mat angle) {
3034        cartToPolar_1(x.nativeObj, y.nativeObj, magnitude.nativeObj, angle.nativeObj);
3035    }
3036
3037
3038    //
3039    // C++:  void cv::phase(Mat x, Mat y, Mat& angle, bool angleInDegrees = false)
3040    //
3041
3042    /**
3043     * Calculates the rotation angle of 2D vectors.
3044     *
3045     * The function cv::phase calculates the rotation angle of each 2D vector that
3046     * is formed from the corresponding elements of x and y :
3047     * \(\texttt{angle} (I) =  \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\)
3048     *
3049     * The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 ,
3050     * the corresponding angle(I) is set to 0.
3051     * @param x input floating-point array of x-coordinates of 2D vectors.
3052     * @param y input array of y-coordinates of 2D vectors; it must have the
3053     * same size and the same type as x.
3054     * @param angle output array of vector angles; it has the same size and
3055     * same type as x .
3056     * @param angleInDegrees when true, the function calculates the angle in
3057     * degrees, otherwise, they are measured in radians.
3058     */
3059    public static void phase(Mat x, Mat y, Mat angle, boolean angleInDegrees) {
3060        phase_0(x.nativeObj, y.nativeObj, angle.nativeObj, angleInDegrees);
3061    }
3062
3063    /**
3064     * Calculates the rotation angle of 2D vectors.
3065     *
3066     * The function cv::phase calculates the rotation angle of each 2D vector that
3067     * is formed from the corresponding elements of x and y :
3068     * \(\texttt{angle} (I) =  \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\)
3069     *
3070     * The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 ,
3071     * the corresponding angle(I) is set to 0.
3072     * @param x input floating-point array of x-coordinates of 2D vectors.
3073     * @param y input array of y-coordinates of 2D vectors; it must have the
3074     * same size and the same type as x.
3075     * @param angle output array of vector angles; it has the same size and
3076     * same type as x .
3077     * degrees, otherwise, they are measured in radians.
3078     */
3079    public static void phase(Mat x, Mat y, Mat angle) {
3080        phase_1(x.nativeObj, y.nativeObj, angle.nativeObj);
3081    }
3082
3083
3084    //
3085    // C++:  void cv::magnitude(Mat x, Mat y, Mat& magnitude)
3086    //
3087
3088    /**
3089     * Calculates the magnitude of 2D vectors.
3090     *
3091     * The function cv::magnitude calculates the magnitude of 2D vectors formed
3092     * from the corresponding elements of x and y arrays:
3093     * \(\texttt{dst} (I) =  \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\)
3094     * @param x floating-point array of x-coordinates of the vectors.
3095     * @param y floating-point array of y-coordinates of the vectors; it must
3096     * have the same size as x.
3097     * @param magnitude output array of the same size and type as x.
3098     * SEE: cartToPolar, polarToCart, phase, sqrt
3099     */
3100    public static void magnitude(Mat x, Mat y, Mat magnitude) {
3101        magnitude_0(x.nativeObj, y.nativeObj, magnitude.nativeObj);
3102    }
3103
3104
3105    //
3106    // C++:  bool cv::checkRange(Mat a, bool quiet = true,  _hidden_ * pos = 0, double minVal = -DBL_MAX, double maxVal = DBL_MAX)
3107    //
3108
3109    /**
3110     * Checks every element of an input array for invalid values.
3111     *
3112     * The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal &gt;
3113     * <ul>
3114     *   <li>
3115     * DBL_MAX and maxVal &lt; DBL_MAX, the function also checks that each value is between minVal and
3116     * maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
3117     * are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
3118     * function either returns false (when quiet=true) or throws an exception.
3119     *   </li>
3120     * </ul>
3121     * @param a input array.
3122     * @param quiet a flag, indicating whether the functions quietly return false when the array elements
3123     * are out of range or they throw an exception.
3124     * elements.
3125     * @param minVal inclusive lower boundary of valid values range.
3126     * @param maxVal exclusive upper boundary of valid values range.
3127     * @return automatically generated
3128     */
3129    public static boolean checkRange(Mat a, boolean quiet, double minVal, double maxVal) {
3130        return checkRange_0(a.nativeObj, quiet, minVal, maxVal);
3131    }
3132
3133    /**
3134     * Checks every element of an input array for invalid values.
3135     *
3136     * The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal &gt;
3137     * <ul>
3138     *   <li>
3139     * DBL_MAX and maxVal &lt; DBL_MAX, the function also checks that each value is between minVal and
3140     * maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
3141     * are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
3142     * function either returns false (when quiet=true) or throws an exception.
3143     *   </li>
3144     * </ul>
3145     * @param a input array.
3146     * @param quiet a flag, indicating whether the functions quietly return false when the array elements
3147     * are out of range or they throw an exception.
3148     * elements.
3149     * @param minVal inclusive lower boundary of valid values range.
3150     * @return automatically generated
3151     */
3152    public static boolean checkRange(Mat a, boolean quiet, double minVal) {
3153        return checkRange_1(a.nativeObj, quiet, minVal);
3154    }
3155
3156    /**
3157     * Checks every element of an input array for invalid values.
3158     *
3159     * The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal &gt;
3160     * <ul>
3161     *   <li>
3162     * DBL_MAX and maxVal &lt; DBL_MAX, the function also checks that each value is between minVal and
3163     * maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
3164     * are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
3165     * function either returns false (when quiet=true) or throws an exception.
3166     *   </li>
3167     * </ul>
3168     * @param a input array.
3169     * @param quiet a flag, indicating whether the functions quietly return false when the array elements
3170     * are out of range or they throw an exception.
3171     * elements.
3172     * @return automatically generated
3173     */
3174    public static boolean checkRange(Mat a, boolean quiet) {
3175        return checkRange_2(a.nativeObj, quiet);
3176    }
3177
3178    /**
3179     * Checks every element of an input array for invalid values.
3180     *
3181     * The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal &gt;
3182     * <ul>
3183     *   <li>
3184     * DBL_MAX and maxVal &lt; DBL_MAX, the function also checks that each value is between minVal and
3185     * maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
3186     * are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
3187     * function either returns false (when quiet=true) or throws an exception.
3188     *   </li>
3189     * </ul>
3190     * @param a input array.
3191     * are out of range or they throw an exception.
3192     * elements.
3193     * @return automatically generated
3194     */
3195    public static boolean checkRange(Mat a) {
3196        return checkRange_4(a.nativeObj);
3197    }
3198
3199
3200    //
3201    // C++:  void cv::patchNaNs(Mat& a, double val = 0)
3202    //
3203
3204    /**
3205     * converts NaNs to the given number
3206     * @param a input/output matrix (CV_32F type).
3207     * @param val value to convert the NaNs
3208     */
3209    public static void patchNaNs(Mat a, double val) {
3210        patchNaNs_0(a.nativeObj, val);
3211    }
3212
3213    /**
3214     * converts NaNs to the given number
3215     * @param a input/output matrix (CV_32F type).
3216     */
3217    public static void patchNaNs(Mat a) {
3218        patchNaNs_1(a.nativeObj);
3219    }
3220
3221
3222    //
3223    // C++:  void cv::gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat& dst, int flags = 0)
3224    //
3225
3226    /**
3227     * Performs generalized matrix multiplication.
3228     *
3229     * The function cv::gemm performs generalized matrix multiplication similar to the
3230     * gemm functions in BLAS level 3. For example,
3231     * {@code gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)}
3232     * corresponds to
3233     * \(\texttt{dst} =  \texttt{alpha} \cdot \texttt{src1} ^T  \cdot \texttt{src2} +  \texttt{beta} \cdot \texttt{src3} ^T\)
3234     *
3235     * In case of complex (two-channel) data, performed a complex matrix
3236     * multiplication.
3237     *
3238     * The function can be replaced with a matrix expression. For example, the
3239     * above call can be replaced with:
3240     * <code>
3241     *     dst = alpha*src1.t()*src2 + beta*src3.t();
3242     * </code>
3243     * @param src1 first multiplied input matrix that could be real(CV_32FC1,
3244     * CV_64FC1) or complex(CV_32FC2, CV_64FC2).
3245     * @param src2 second multiplied input matrix of the same type as src1.
3246     * @param alpha weight of the matrix product.
3247     * @param src3 third optional delta matrix added to the matrix product; it
3248     * should have the same type as src1 and src2.
3249     * @param beta weight of src3.
3250     * @param dst output matrix; it has the proper size and the same type as
3251     * input matrices.
3252     * @param flags operation flags (cv::GemmFlags)
3253     * SEE: mulTransposed , transform
3254     */
3255    public static void gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst, int flags) {
3256        gemm_0(src1.nativeObj, src2.nativeObj, alpha, src3.nativeObj, beta, dst.nativeObj, flags);
3257    }
3258
3259    /**
3260     * Performs generalized matrix multiplication.
3261     *
3262     * The function cv::gemm performs generalized matrix multiplication similar to the
3263     * gemm functions in BLAS level 3. For example,
3264     * {@code gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)}
3265     * corresponds to
3266     * \(\texttt{dst} =  \texttt{alpha} \cdot \texttt{src1} ^T  \cdot \texttt{src2} +  \texttt{beta} \cdot \texttt{src3} ^T\)
3267     *
3268     * In case of complex (two-channel) data, performed a complex matrix
3269     * multiplication.
3270     *
3271     * The function can be replaced with a matrix expression. For example, the
3272     * above call can be replaced with:
3273     * <code>
3274     *     dst = alpha*src1.t()*src2 + beta*src3.t();
3275     * </code>
3276     * @param src1 first multiplied input matrix that could be real(CV_32FC1,
3277     * CV_64FC1) or complex(CV_32FC2, CV_64FC2).
3278     * @param src2 second multiplied input matrix of the same type as src1.
3279     * @param alpha weight of the matrix product.
3280     * @param src3 third optional delta matrix added to the matrix product; it
3281     * should have the same type as src1 and src2.
3282     * @param beta weight of src3.
3283     * @param dst output matrix; it has the proper size and the same type as
3284     * input matrices.
3285     * SEE: mulTransposed , transform
3286     */
3287    public static void gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst) {
3288        gemm_1(src1.nativeObj, src2.nativeObj, alpha, src3.nativeObj, beta, dst.nativeObj);
3289    }
3290
3291
3292    //
3293    // C++:  void cv::mulTransposed(Mat src, Mat& dst, bool aTa, Mat delta = Mat(), double scale = 1, int dtype = -1)
3294    //
3295
3296    /**
3297     * Calculates the product of a matrix and its transposition.
3298     *
3299     * The function cv::mulTransposed calculates the product of src and its
3300     * transposition:
3301     * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\)
3302     * if aTa=true , and
3303     * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\)
3304     * otherwise. The function is used to calculate the covariance matrix. With
3305     * zero delta, it can be used as a faster substitute for general matrix
3306     * product A\*B when B=A'
3307     * @param src input single-channel matrix. Note that unlike gemm, the
3308     * function can multiply not only floating-point matrices.
3309     * @param dst output square matrix.
3310     * @param aTa Flag specifying the multiplication ordering. See the
3311     * description below.
3312     * @param delta Optional delta matrix subtracted from src before the
3313     * multiplication. When the matrix is empty ( delta=noArray() ), it is
3314     * assumed to be zero, that is, nothing is subtracted. If it has the same
3315     * size as src , it is simply subtracted. Otherwise, it is "repeated" (see
3316     * repeat ) to cover the full src and then subtracted. Type of the delta
3317     * matrix, when it is not empty, must be the same as the type of created
3318     * output matrix. See the dtype parameter description below.
3319     * @param scale Optional scale factor for the matrix product.
3320     * @param dtype Optional type of the output matrix. When it is negative,
3321     * the output matrix will have the same type as src . Otherwise, it will be
3322     * type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
3323     * SEE: calcCovarMatrix, gemm, repeat, reduce
3324     */
3325    public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta, double scale, int dtype) {
3326        mulTransposed_0(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj, scale, dtype);
3327    }
3328
3329    /**
3330     * Calculates the product of a matrix and its transposition.
3331     *
3332     * The function cv::mulTransposed calculates the product of src and its
3333     * transposition:
3334     * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\)
3335     * if aTa=true , and
3336     * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\)
3337     * otherwise. The function is used to calculate the covariance matrix. With
3338     * zero delta, it can be used as a faster substitute for general matrix
3339     * product A\*B when B=A'
3340     * @param src input single-channel matrix. Note that unlike gemm, the
3341     * function can multiply not only floating-point matrices.
3342     * @param dst output square matrix.
3343     * @param aTa Flag specifying the multiplication ordering. See the
3344     * description below.
3345     * @param delta Optional delta matrix subtracted from src before the
3346     * multiplication. When the matrix is empty ( delta=noArray() ), it is
3347     * assumed to be zero, that is, nothing is subtracted. If it has the same
3348     * size as src , it is simply subtracted. Otherwise, it is "repeated" (see
3349     * repeat ) to cover the full src and then subtracted. Type of the delta
3350     * matrix, when it is not empty, must be the same as the type of created
3351     * output matrix. See the dtype parameter description below.
3352     * @param scale Optional scale factor for the matrix product.
3353     * the output matrix will have the same type as src . Otherwise, it will be
3354     * type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
3355     * SEE: calcCovarMatrix, gemm, repeat, reduce
3356     */
3357    public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta, double scale) {
3358        mulTransposed_1(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj, scale);
3359    }
3360
3361    /**
3362     * Calculates the product of a matrix and its transposition.
3363     *
3364     * The function cv::mulTransposed calculates the product of src and its
3365     * transposition:
3366     * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\)
3367     * if aTa=true , and
3368     * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\)
3369     * otherwise. The function is used to calculate the covariance matrix. With
3370     * zero delta, it can be used as a faster substitute for general matrix
3371     * product A\*B when B=A'
3372     * @param src input single-channel matrix. Note that unlike gemm, the
3373     * function can multiply not only floating-point matrices.
3374     * @param dst output square matrix.
3375     * @param aTa Flag specifying the multiplication ordering. See the
3376     * description below.
3377     * @param delta Optional delta matrix subtracted from src before the
3378     * multiplication. When the matrix is empty ( delta=noArray() ), it is
3379     * assumed to be zero, that is, nothing is subtracted. If it has the same
3380     * size as src , it is simply subtracted. Otherwise, it is "repeated" (see
3381     * repeat ) to cover the full src and then subtracted. Type of the delta
3382     * matrix, when it is not empty, must be the same as the type of created
3383     * output matrix. See the dtype parameter description below.
3384     * the output matrix will have the same type as src . Otherwise, it will be
3385     * type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
3386     * SEE: calcCovarMatrix, gemm, repeat, reduce
3387     */
3388    public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta) {
3389        mulTransposed_2(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj);
3390    }
3391
3392    /**
3393     * Calculates the product of a matrix and its transposition.
3394     *
3395     * The function cv::mulTransposed calculates the product of src and its
3396     * transposition:
3397     * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\)
3398     * if aTa=true , and
3399     * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\)
3400     * otherwise. The function is used to calculate the covariance matrix. With
3401     * zero delta, it can be used as a faster substitute for general matrix
3402     * product A\*B when B=A'
3403     * @param src input single-channel matrix. Note that unlike gemm, the
3404     * function can multiply not only floating-point matrices.
3405     * @param dst output square matrix.
3406     * @param aTa Flag specifying the multiplication ordering. See the
3407     * description below.
3408     * multiplication. When the matrix is empty ( delta=noArray() ), it is
3409     * assumed to be zero, that is, nothing is subtracted. If it has the same
3410     * size as src , it is simply subtracted. Otherwise, it is "repeated" (see
3411     * repeat ) to cover the full src and then subtracted. Type of the delta
3412     * matrix, when it is not empty, must be the same as the type of created
3413     * output matrix. See the dtype parameter description below.
3414     * the output matrix will have the same type as src . Otherwise, it will be
3415     * type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
3416     * SEE: calcCovarMatrix, gemm, repeat, reduce
3417     */
3418    public static void mulTransposed(Mat src, Mat dst, boolean aTa) {
3419        mulTransposed_3(src.nativeObj, dst.nativeObj, aTa);
3420    }
3421
3422
3423    //
3424    // C++:  void cv::transpose(Mat src, Mat& dst)
3425    //
3426
3427    /**
3428     * Transposes a matrix.
3429     *
3430     * The function cv::transpose transposes the matrix src :
3431     * \(\texttt{dst} (i,j) =  \texttt{src} (j,i)\)
3432     * <b>Note:</b> No complex conjugation is done in case of a complex matrix. It
3433     * should be done separately if needed.
3434     * @param src input array.
3435     * @param dst output array of the same type as src.
3436     */
3437    public static void transpose(Mat src, Mat dst) {
3438        transpose_0(src.nativeObj, dst.nativeObj);
3439    }
3440
3441
3442    //
3443    // C++:  void cv::transposeND(Mat src, vector_int order, Mat& dst)
3444    //
3445
3446    /**
3447     * Transpose for n-dimensional matrices.
3448     *
3449     * <b>Note:</b> Input should be continuous single-channel matrix.
3450     * @param src input array.
3451     * @param order a permutation of [0,1,..,N-1] where N is the number of axes of src.
3452     * The i’th axis of dst will correspond to the axis numbered order[i] of the input.
3453     * @param dst output array of the same type as src.
3454     */
3455    public static void transposeND(Mat src, MatOfInt order, Mat dst) {
3456        Mat order_mat = order;
3457        transposeND_0(src.nativeObj, order_mat.nativeObj, dst.nativeObj);
3458    }
3459
3460
3461    //
3462    // C++:  void cv::transform(Mat src, Mat& dst, Mat m)
3463    //
3464
3465    /**
3466     * Performs the matrix transformation of every array element.
3467     *
3468     * The function cv::transform performs the matrix transformation of every
3469     * element of the array src and stores the results in dst :
3470     * \(\texttt{dst} (I) =  \texttt{m} \cdot \texttt{src} (I)\)
3471     * (when m.cols=src.channels() ), or
3472     * \(\texttt{dst} (I) =  \texttt{m} \cdot [ \texttt{src} (I); 1]\)
3473     * (when m.cols=src.channels()+1 )
3474     *
3475     * Every element of the N -channel array src is interpreted as N -element
3476     * vector that is transformed using the M x N or M x (N+1) matrix m to
3477     * M-element vector - the corresponding element of the output array dst .
3478     *
3479     * The function may be used for geometrical transformation of
3480     * N -dimensional points, arbitrary linear color space transformation (such
3481     * as various kinds of RGB to YUV transforms), shuffling the image
3482     * channels, and so forth.
3483     * @param src input array that must have as many channels (1 to 4) as
3484     * m.cols or m.cols-1.
3485     * @param dst output array of the same size and depth as src; it has as
3486     * many channels as m.rows.
3487     * @param m transformation 2x2 or 2x3 floating-point matrix.
3488     * SEE: perspectiveTransform, getAffineTransform, estimateAffine2D, warpAffine, warpPerspective
3489     */
3490    public static void transform(Mat src, Mat dst, Mat m) {
3491        transform_0(src.nativeObj, dst.nativeObj, m.nativeObj);
3492    }
3493
3494
3495    //
3496    // C++:  void cv::perspectiveTransform(Mat src, Mat& dst, Mat m)
3497    //
3498
3499    /**
3500     * Performs the perspective matrix transformation of vectors.
3501     *
3502     * The function cv::perspectiveTransform transforms every element of src by
3503     * treating it as a 2D or 3D vector, in the following way:
3504     * \((x, y, z)  \rightarrow (x'/w, y'/w, z'/w)\)
3505     * where
3506     * \((x', y', z', w') =  \texttt{mat} \cdot \begin{bmatrix} x &amp; y &amp; z &amp; 1  \end{bmatrix}\)
3507     * and
3508     * \(w =  \fork{w'}{if \(w' \ne 0\)}{\infty}{otherwise}\)
3509     *
3510     * Here a 3D vector transformation is shown. In case of a 2D vector
3511     * transformation, the z component is omitted.
3512     *
3513     * <b>Note:</b> The function transforms a sparse set of 2D or 3D vectors. If you
3514     * want to transform an image using perspective transformation, use
3515     * warpPerspective . If you have an inverse problem, that is, you want to
3516     * compute the most probable perspective transformation out of several
3517     * pairs of corresponding points, you can use getPerspectiveTransform or
3518     * findHomography .
3519     * @param src input two-channel or three-channel floating-point array; each
3520     * element is a 2D/3D vector to be transformed.
3521     * @param dst output array of the same size and type as src.
3522     * @param m 3x3 or 4x4 floating-point transformation matrix.
3523     * SEE:  transform, warpPerspective, getPerspectiveTransform, findHomography
3524     */
3525    public static void perspectiveTransform(Mat src, Mat dst, Mat m) {
3526        perspectiveTransform_0(src.nativeObj, dst.nativeObj, m.nativeObj);
3527    }
3528
3529
3530    //
3531    // C++:  void cv::completeSymm(Mat& m, bool lowerToUpper = false)
3532    //
3533
3534    /**
3535     * Copies the lower or the upper half of a square matrix to its another half.
3536     *
3537     * The function cv::completeSymm copies the lower or the upper half of a square matrix to
3538     * its another half. The matrix diagonal remains unchanged:
3539     * <ul>
3540     *   <li>
3541     *   \(\texttt{m}_{ij}=\texttt{m}_{ji}\) for \(i &gt; j\) if
3542     *     lowerToUpper=false
3543     *   </li>
3544     *   <li>
3545     *   \(\texttt{m}_{ij}=\texttt{m}_{ji}\) for \(i &lt; j\) if
3546     *     lowerToUpper=true
3547     *   </li>
3548     * </ul>
3549     *
3550     * @param m input-output floating-point square matrix.
3551     * @param lowerToUpper operation flag; if true, the lower half is copied to
3552     * the upper half. Otherwise, the upper half is copied to the lower half.
3553     * SEE: flip, transpose
3554     */
3555    public static void completeSymm(Mat m, boolean lowerToUpper) {
3556        completeSymm_0(m.nativeObj, lowerToUpper);
3557    }
3558
3559    /**
3560     * Copies the lower or the upper half of a square matrix to its another half.
3561     *
3562     * The function cv::completeSymm copies the lower or the upper half of a square matrix to
3563     * its another half. The matrix diagonal remains unchanged:
3564     * <ul>
3565     *   <li>
3566     *   \(\texttt{m}_{ij}=\texttt{m}_{ji}\) for \(i &gt; j\) if
3567     *     lowerToUpper=false
3568     *   </li>
3569     *   <li>
3570     *   \(\texttt{m}_{ij}=\texttt{m}_{ji}\) for \(i &lt; j\) if
3571     *     lowerToUpper=true
3572     *   </li>
3573     * </ul>
3574     *
3575     * @param m input-output floating-point square matrix.
3576     * the upper half. Otherwise, the upper half is copied to the lower half.
3577     * SEE: flip, transpose
3578     */
3579    public static void completeSymm(Mat m) {
3580        completeSymm_1(m.nativeObj);
3581    }
3582
3583
3584    //
3585    // C++:  void cv::setIdentity(Mat& mtx, Scalar s = Scalar(1))
3586    //
3587
3588    /**
3589     * Initializes a scaled identity matrix.
3590     *
3591     * The function cv::setIdentity initializes a scaled identity matrix:
3592     * \(\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if \(i=j\)}{0}{otherwise}\)
3593     *
3594     * The function can also be emulated using the matrix initializers and the
3595     * matrix expressions:
3596     * <code>
3597     *     Mat A = Mat::eye(4, 3, CV_32F)*5;
3598     *     // A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]
3599     * </code>
3600     * @param mtx matrix to initialize (not necessarily square).
3601     * @param s value to assign to diagonal elements.
3602     * SEE: Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=
3603     */
3604    public static void setIdentity(Mat mtx, Scalar s) {
3605        setIdentity_0(mtx.nativeObj, s.val[0], s.val[1], s.val[2], s.val[3]);
3606    }
3607
3608    /**
3609     * Initializes a scaled identity matrix.
3610     *
3611     * The function cv::setIdentity initializes a scaled identity matrix:
3612     * \(\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if \(i=j\)}{0}{otherwise}\)
3613     *
3614     * The function can also be emulated using the matrix initializers and the
3615     * matrix expressions:
3616     * <code>
3617     *     Mat A = Mat::eye(4, 3, CV_32F)*5;
3618     *     // A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]
3619     * </code>
3620     * @param mtx matrix to initialize (not necessarily square).
3621     * SEE: Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=
3622     */
3623    public static void setIdentity(Mat mtx) {
3624        setIdentity_1(mtx.nativeObj);
3625    }
3626
3627
3628    //
3629    // C++:  double cv::determinant(Mat mtx)
3630    //
3631
3632    /**
3633     * Returns the determinant of a square floating-point matrix.
3634     *
3635     * The function cv::determinant calculates and returns the determinant of the
3636     * specified matrix. For small matrices ( mtx.cols=mtx.rows&lt;=3 ), the
3637     * direct method is used. For larger matrices, the function uses LU
3638     * factorization with partial pivoting.
3639     *
3640     * For symmetric positively-determined matrices, it is also possible to use
3641     * eigen decomposition to calculate the determinant.
3642     * @param mtx input matrix that must have CV_32FC1 or CV_64FC1 type and
3643     * square size.
3644     * SEE: trace, invert, solve, eigen, REF: MatrixExpressions
3645     * @return automatically generated
3646     */
3647    public static double determinant(Mat mtx) {
3648        return determinant_0(mtx.nativeObj);
3649    }
3650
3651
3652    //
3653    // C++:  Scalar cv::trace(Mat mtx)
3654    //
3655
3656    /**
3657     * Returns the trace of a matrix.
3658     *
3659     * The function cv::trace returns the sum of the diagonal elements of the
3660     * matrix mtx .
3661     * \(\mathrm{tr} ( \texttt{mtx} ) =  \sum _i  \texttt{mtx} (i,i)\)
3662     * @param mtx input matrix.
3663     * @return automatically generated
3664     */
3665    public static Scalar trace(Mat mtx) {
3666        return new Scalar(trace_0(mtx.nativeObj));
3667    }
3668
3669
3670    //
3671    // C++:  double cv::invert(Mat src, Mat& dst, int flags = DECOMP_LU)
3672    //
3673
3674    /**
3675     * Finds the inverse or pseudo-inverse of a matrix.
3676     *
3677     * The function cv::invert inverts the matrix src and stores the result in dst
3678     * . When the matrix src is singular or non-square, the function calculates
3679     * the pseudo-inverse matrix (the dst matrix) so that norm(src\*dst - I) is
3680     * minimal, where I is an identity matrix.
3681     *
3682     * In case of the #DECOMP_LU method, the function returns non-zero value if
3683     * the inverse has been successfully calculated and 0 if src is singular.
3684     *
3685     * In case of the #DECOMP_SVD method, the function returns the inverse
3686     * condition number of src (the ratio of the smallest singular value to the
3687     * largest singular value) and 0 if src is singular. The SVD method
3688     * calculates a pseudo-inverse matrix if src is singular.
3689     *
3690     * Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with
3691     * non-singular square matrices that should also be symmetrical and
3692     * positively defined. In this case, the function stores the inverted
3693     * matrix in dst and returns non-zero. Otherwise, it returns 0.
3694     *
3695     * @param src input floating-point M x N matrix.
3696     * @param dst output matrix of N x M size and the same type as src.
3697     * @param flags inversion method (cv::DecompTypes)
3698     * SEE: solve, SVD
3699     * @return automatically generated
3700     */
3701    public static double invert(Mat src, Mat dst, int flags) {
3702        return invert_0(src.nativeObj, dst.nativeObj, flags);
3703    }
3704
3705    /**
3706     * Finds the inverse or pseudo-inverse of a matrix.
3707     *
3708     * The function cv::invert inverts the matrix src and stores the result in dst
3709     * . When the matrix src is singular or non-square, the function calculates
3710     * the pseudo-inverse matrix (the dst matrix) so that norm(src\*dst - I) is
3711     * minimal, where I is an identity matrix.
3712     *
3713     * In case of the #DECOMP_LU method, the function returns non-zero value if
3714     * the inverse has been successfully calculated and 0 if src is singular.
3715     *
3716     * In case of the #DECOMP_SVD method, the function returns the inverse
3717     * condition number of src (the ratio of the smallest singular value to the
3718     * largest singular value) and 0 if src is singular. The SVD method
3719     * calculates a pseudo-inverse matrix if src is singular.
3720     *
3721     * Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with
3722     * non-singular square matrices that should also be symmetrical and
3723     * positively defined. In this case, the function stores the inverted
3724     * matrix in dst and returns non-zero. Otherwise, it returns 0.
3725     *
3726     * @param src input floating-point M x N matrix.
3727     * @param dst output matrix of N x M size and the same type as src.
3728     * SEE: solve, SVD
3729     * @return automatically generated
3730     */
3731    public static double invert(Mat src, Mat dst) {
3732        return invert_1(src.nativeObj, dst.nativeObj);
3733    }
3734
3735
3736    //
3737    // C++:  bool cv::solve(Mat src1, Mat src2, Mat& dst, int flags = DECOMP_LU)
3738    //
3739
3740    /**
3741     * Solves one or more linear systems or least-squares problems.
3742     *
3743     * The function cv::solve solves a linear system or least-squares problem (the
3744     * latter is possible with SVD or QR methods, or by specifying the flag
3745     * #DECOMP_NORMAL ):
3746     * \(\texttt{dst} =  \arg \min _X \| \texttt{src1} \cdot \texttt{X} -  \texttt{src2} \|\)
3747     *
3748     * If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1
3749     * if src1 (or \(\texttt{src1}^T\texttt{src1}\) ) is non-singular. Otherwise,
3750     * it returns 0. In the latter case, dst is not valid. Other methods find a
3751     * pseudo-solution in case of a singular left-hand side part.
3752     *
3753     * <b>Note:</b> If you want to find a unity-norm solution of an under-defined
3754     * singular system \(\texttt{src1}\cdot\texttt{dst}=0\) , the function solve
3755     * will not do the work. Use SVD::solveZ instead.
3756     *
3757     * @param src1 input matrix on the left-hand side of the system.
3758     * @param src2 input matrix on the right-hand side of the system.
3759     * @param dst output solution.
3760     * @param flags solution (matrix inversion) method (#DecompTypes)
3761     * SEE: invert, SVD, eigen
3762     * @return automatically generated
3763     */
3764    public static boolean solve(Mat src1, Mat src2, Mat dst, int flags) {
3765        return solve_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, flags);
3766    }
3767
3768    /**
3769     * Solves one or more linear systems or least-squares problems.
3770     *
3771     * The function cv::solve solves a linear system or least-squares problem (the
3772     * latter is possible with SVD or QR methods, or by specifying the flag
3773     * #DECOMP_NORMAL ):
3774     * \(\texttt{dst} =  \arg \min _X \| \texttt{src1} \cdot \texttt{X} -  \texttt{src2} \|\)
3775     *
3776     * If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1
3777     * if src1 (or \(\texttt{src1}^T\texttt{src1}\) ) is non-singular. Otherwise,
3778     * it returns 0. In the latter case, dst is not valid. Other methods find a
3779     * pseudo-solution in case of a singular left-hand side part.
3780     *
3781     * <b>Note:</b> If you want to find a unity-norm solution of an under-defined
3782     * singular system \(\texttt{src1}\cdot\texttt{dst}=0\) , the function solve
3783     * will not do the work. Use SVD::solveZ instead.
3784     *
3785     * @param src1 input matrix on the left-hand side of the system.
3786     * @param src2 input matrix on the right-hand side of the system.
3787     * @param dst output solution.
3788     * SEE: invert, SVD, eigen
3789     * @return automatically generated
3790     */
3791    public static boolean solve(Mat src1, Mat src2, Mat dst) {
3792        return solve_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
3793    }
3794
3795
3796    //
3797    // C++:  void cv::sort(Mat src, Mat& dst, int flags)
3798    //
3799
3800    /**
3801     * Sorts each row or each column of a matrix.
3802     *
3803     * The function cv::sort sorts each matrix row or each matrix column in
3804     * ascending or descending order. So you should pass two operation flags to
3805     * get desired behaviour. If you want to sort matrix rows or columns
3806     * lexicographically, you can use STL std::sort generic function with the
3807     * proper comparison predicate.
3808     *
3809     * @param src input single-channel array.
3810     * @param dst output array of the same size and type as src.
3811     * @param flags operation flags, a combination of #SortFlags
3812     * SEE: sortIdx, randShuffle
3813     */
3814    public static void sort(Mat src, Mat dst, int flags) {
3815        sort_0(src.nativeObj, dst.nativeObj, flags);
3816    }
3817
3818
3819    //
3820    // C++:  void cv::sortIdx(Mat src, Mat& dst, int flags)
3821    //
3822
3823    /**
3824     * Sorts each row or each column of a matrix.
3825     *
3826     * The function cv::sortIdx sorts each matrix row or each matrix column in the
3827     * ascending or descending order. So you should pass two operation flags to
3828     * get desired behaviour. Instead of reordering the elements themselves, it
3829     * stores the indices of sorted elements in the output array. For example:
3830     * <code>
3831     *     Mat A = Mat::eye(3,3,CV_32F), B;
3832     *     sortIdx(A, B, SORT_EVERY_ROW + SORT_ASCENDING);
3833     *     // B will probably contain
3834     *     // (because of equal elements in A some permutations are possible):
3835     *     // [[1, 2, 0], [0, 2, 1], [0, 1, 2]]
3836     * </code>
3837     * @param src input single-channel array.
3838     * @param dst output integer array of the same size as src.
3839     * @param flags operation flags that could be a combination of cv::SortFlags
3840     * SEE: sort, randShuffle
3841     */
3842    public static void sortIdx(Mat src, Mat dst, int flags) {
3843        sortIdx_0(src.nativeObj, dst.nativeObj, flags);
3844    }
3845
3846
3847    //
3848    // C++:  int cv::solveCubic(Mat coeffs, Mat& roots)
3849    //
3850
3851    /**
3852     * Finds the real roots of a cubic equation.
3853     *
3854     * The function solveCubic finds the real roots of a cubic equation:
3855     * <ul>
3856     *   <li>
3857     *    if coeffs is a 4-element vector:
3858     * \(\texttt{coeffs} [0] x^3 +  \texttt{coeffs} [1] x^2 +  \texttt{coeffs} [2] x +  \texttt{coeffs} [3] = 0\)
3859     *   </li>
3860     *   <li>
3861     *    if coeffs is a 3-element vector:
3862     * \(x^3 +  \texttt{coeffs} [0] x^2 +  \texttt{coeffs} [1] x +  \texttt{coeffs} [2] = 0\)
3863     *   </li>
3864     * </ul>
3865     *
3866     * The roots are stored in the roots array.
3867     * @param coeffs equation coefficients, an array of 3 or 4 elements.
3868     * @param roots output array of real roots that has 1 or 3 elements.
3869     * @return number of real roots. It can be 0, 1 or 2.
3870     */
3871    public static int solveCubic(Mat coeffs, Mat roots) {
3872        return solveCubic_0(coeffs.nativeObj, roots.nativeObj);
3873    }
3874
3875
3876    //
3877    // C++:  double cv::solvePoly(Mat coeffs, Mat& roots, int maxIters = 300)
3878    //
3879
3880    /**
3881     * Finds the real or complex roots of a polynomial equation.
3882     *
3883     * The function cv::solvePoly finds real and complex roots of a polynomial equation:
3884     * \(\texttt{coeffs} [n] x^{n} +  \texttt{coeffs} [n-1] x^{n-1} + ... +  \texttt{coeffs} [1] x +  \texttt{coeffs} [0] = 0\)
3885     * @param coeffs array of polynomial coefficients.
3886     * @param roots output (complex) array of roots.
3887     * @param maxIters maximum number of iterations the algorithm does.
3888     * @return automatically generated
3889     */
3890    public static double solvePoly(Mat coeffs, Mat roots, int maxIters) {
3891        return solvePoly_0(coeffs.nativeObj, roots.nativeObj, maxIters);
3892    }
3893
3894    /**
3895     * Finds the real or complex roots of a polynomial equation.
3896     *
3897     * The function cv::solvePoly finds real and complex roots of a polynomial equation:
3898     * \(\texttt{coeffs} [n] x^{n} +  \texttt{coeffs} [n-1] x^{n-1} + ... +  \texttt{coeffs} [1] x +  \texttt{coeffs} [0] = 0\)
3899     * @param coeffs array of polynomial coefficients.
3900     * @param roots output (complex) array of roots.
3901     * @return automatically generated
3902     */
3903    public static double solvePoly(Mat coeffs, Mat roots) {
3904        return solvePoly_1(coeffs.nativeObj, roots.nativeObj);
3905    }
3906
3907
3908    //
3909    // C++:  bool cv::eigen(Mat src, Mat& eigenvalues, Mat& eigenvectors = Mat())
3910    //
3911
3912    /**
3913     * Calculates eigenvalues and eigenvectors of a symmetric matrix.
3914     *
3915     * The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric
3916     * matrix src:
3917     * <code>
3918     *     src*eigenvectors.row(i).t() = eigenvalues.at&lt;srcType&gt;(i)*eigenvectors.row(i).t()
3919     * </code>
3920     *
3921     * <b>Note:</b> Use cv::eigenNonSymmetric for calculation of real eigenvalues and eigenvectors of non-symmetric matrix.
3922     *
3923     * @param src input matrix that must have CV_32FC1 or CV_64FC1 type, square size and be symmetrical
3924     * (src ^T^ == src).
3925     * @param eigenvalues output vector of eigenvalues of the same type as src; the eigenvalues are stored
3926     * in the descending order.
3927     * @param eigenvectors output matrix of eigenvectors; it has the same size and type as src; the
3928     * eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding
3929     * eigenvalues.
3930     * SEE: eigenNonSymmetric, completeSymm , PCA
3931     * @return automatically generated
3932     */
3933    public static boolean eigen(Mat src, Mat eigenvalues, Mat eigenvectors) {
3934        return eigen_0(src.nativeObj, eigenvalues.nativeObj, eigenvectors.nativeObj);
3935    }
3936
3937    /**
3938     * Calculates eigenvalues and eigenvectors of a symmetric matrix.
3939     *
3940     * The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric
3941     * matrix src:
3942     * <code>
3943     *     src*eigenvectors.row(i).t() = eigenvalues.at&lt;srcType&gt;(i)*eigenvectors.row(i).t()
3944     * </code>
3945     *
3946     * <b>Note:</b> Use cv::eigenNonSymmetric for calculation of real eigenvalues and eigenvectors of non-symmetric matrix.
3947     *
3948     * @param src input matrix that must have CV_32FC1 or CV_64FC1 type, square size and be symmetrical
3949     * (src ^T^ == src).
3950     * @param eigenvalues output vector of eigenvalues of the same type as src; the eigenvalues are stored
3951     * in the descending order.
3952     * eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding
3953     * eigenvalues.
3954     * SEE: eigenNonSymmetric, completeSymm , PCA
3955     * @return automatically generated
3956     */
3957    public static boolean eigen(Mat src, Mat eigenvalues) {
3958        return eigen_1(src.nativeObj, eigenvalues.nativeObj);
3959    }
3960
3961
3962    //
3963    // C++:  void cv::eigenNonSymmetric(Mat src, Mat& eigenvalues, Mat& eigenvectors)
3964    //
3965
3966    /**
3967     * Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only).
3968     *
3969     * <b>Note:</b> Assumes real eigenvalues.
3970     *
3971     * The function calculates eigenvalues and eigenvectors (optional) of the square matrix src:
3972     * <code>
3973     *     src*eigenvectors.row(i).t() = eigenvalues.at&lt;srcType&gt;(i)*eigenvectors.row(i).t()
3974     * </code>
3975     *
3976     * @param src input matrix (CV_32FC1 or CV_64FC1 type).
3977     * @param eigenvalues output vector of eigenvalues (type is the same type as src).
3978     * @param eigenvectors output matrix of eigenvectors (type is the same type as src). The eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding eigenvalues.
3979     * SEE: eigen
3980     */
3981    public static void eigenNonSymmetric(Mat src, Mat eigenvalues, Mat eigenvectors) {
3982        eigenNonSymmetric_0(src.nativeObj, eigenvalues.nativeObj, eigenvectors.nativeObj);
3983    }
3984
3985
3986    //
3987    // C++:  void cv::calcCovarMatrix(Mat samples, Mat& covar, Mat& mean, int flags, int ctype = CV_64F)
3988    //
3989
3990    /**
3991     *
3992     * <b>Note:</b> use #COVAR_ROWS or #COVAR_COLS flag
3993     * @param samples samples stored as rows/columns of a single matrix.
3994     * @param covar output covariance matrix of the type ctype and square size.
3995     * @param mean input or output (depending on the flags) array as the average value of the input vectors.
3996     * @param flags operation flags as a combination of #CovarFlags
3997     * @param ctype type of the matrixl; it equals 'CV_64F' by default.
3998     */
3999    public static void calcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags, int ctype) {
4000        calcCovarMatrix_0(samples.nativeObj, covar.nativeObj, mean.nativeObj, flags, ctype);
4001    }
4002
4003    /**
4004     *
4005     * <b>Note:</b> use #COVAR_ROWS or #COVAR_COLS flag
4006     * @param samples samples stored as rows/columns of a single matrix.
4007     * @param covar output covariance matrix of the type ctype and square size.
4008     * @param mean input or output (depending on the flags) array as the average value of the input vectors.
4009     * @param flags operation flags as a combination of #CovarFlags
4010     */
4011    public static void calcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags) {
4012        calcCovarMatrix_1(samples.nativeObj, covar.nativeObj, mean.nativeObj, flags);
4013    }
4014
4015
4016    //
4017    // C++:  void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, int maxComponents = 0)
4018    //
4019
4020    /**
4021     * wrap PCA::operator()
4022     * @param data automatically generated
4023     * @param mean automatically generated
4024     * @param eigenvectors automatically generated
4025     * @param maxComponents automatically generated
4026     */
4027    public static void PCACompute(Mat data, Mat mean, Mat eigenvectors, int maxComponents) {
4028        PCACompute_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, maxComponents);
4029    }
4030
4031    /**
4032     * wrap PCA::operator()
4033     * @param data automatically generated
4034     * @param mean automatically generated
4035     * @param eigenvectors automatically generated
4036     */
4037    public static void PCACompute(Mat data, Mat mean, Mat eigenvectors) {
4038        PCACompute_1(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj);
4039    }
4040
4041
4042    //
4043    // C++:  void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, int maxComponents = 0)
4044    //
4045
4046    /**
4047     * wrap PCA::operator() and add eigenvalues output parameter
4048     * @param data automatically generated
4049     * @param mean automatically generated
4050     * @param eigenvectors automatically generated
4051     * @param eigenvalues automatically generated
4052     * @param maxComponents automatically generated
4053     */
4054    public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues, int maxComponents) {
4055        PCACompute2_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj, maxComponents);
4056    }
4057
4058    /**
4059     * wrap PCA::operator() and add eigenvalues output parameter
4060     * @param data automatically generated
4061     * @param mean automatically generated
4062     * @param eigenvectors automatically generated
4063     * @param eigenvalues automatically generated
4064     */
4065    public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues) {
4066        PCACompute2_1(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj);
4067    }
4068
4069
4070    //
4071    // C++:  void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, double retainedVariance)
4072    //
4073
4074    /**
4075     * wrap PCA::operator()
4076     * @param data automatically generated
4077     * @param mean automatically generated
4078     * @param eigenvectors automatically generated
4079     * @param retainedVariance automatically generated
4080     */
4081    public static void PCACompute(Mat data, Mat mean, Mat eigenvectors, double retainedVariance) {
4082        PCACompute_2(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, retainedVariance);
4083    }
4084
4085
4086    //
4087    // C++:  void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, double retainedVariance)
4088    //
4089
4090    /**
4091     * wrap PCA::operator() and add eigenvalues output parameter
4092     * @param data automatically generated
4093     * @param mean automatically generated
4094     * @param eigenvectors automatically generated
4095     * @param eigenvalues automatically generated
4096     * @param retainedVariance automatically generated
4097     */
4098    public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues, double retainedVariance) {
4099        PCACompute2_2(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj, retainedVariance);
4100    }
4101
4102
4103    //
4104    // C++:  void cv::PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
4105    //
4106
4107    /**
4108     * wrap PCA::project
4109     * @param data automatically generated
4110     * @param mean automatically generated
4111     * @param eigenvectors automatically generated
4112     * @param result automatically generated
4113     */
4114    public static void PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat result) {
4115        PCAProject_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, result.nativeObj);
4116    }
4117
4118
4119    //
4120    // C++:  void cv::PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
4121    //
4122
4123    /**
4124     * wrap PCA::backProject
4125     * @param data automatically generated
4126     * @param mean automatically generated
4127     * @param eigenvectors automatically generated
4128     * @param result automatically generated
4129     */
4130    public static void PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat result) {
4131        PCABackProject_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, result.nativeObj);
4132    }
4133
4134
4135    //
4136    // C++:  void cv::SVDecomp(Mat src, Mat& w, Mat& u, Mat& vt, int flags = 0)
4137    //
4138
4139    /**
4140     * wrap SVD::compute
4141     * @param src automatically generated
4142     * @param w automatically generated
4143     * @param u automatically generated
4144     * @param vt automatically generated
4145     * @param flags automatically generated
4146     */
4147    public static void SVDecomp(Mat src, Mat w, Mat u, Mat vt, int flags) {
4148        SVDecomp_0(src.nativeObj, w.nativeObj, u.nativeObj, vt.nativeObj, flags);
4149    }
4150
4151    /**
4152     * wrap SVD::compute
4153     * @param src automatically generated
4154     * @param w automatically generated
4155     * @param u automatically generated
4156     * @param vt automatically generated
4157     */
4158    public static void SVDecomp(Mat src, Mat w, Mat u, Mat vt) {
4159        SVDecomp_1(src.nativeObj, w.nativeObj, u.nativeObj, vt.nativeObj);
4160    }
4161
4162
4163    //
4164    // C++:  void cv::SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat& dst)
4165    //
4166
4167    /**
4168     * wrap SVD::backSubst
4169     * @param w automatically generated
4170     * @param u automatically generated
4171     * @param vt automatically generated
4172     * @param rhs automatically generated
4173     * @param dst automatically generated
4174     */
4175    public static void SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat dst) {
4176        SVBackSubst_0(w.nativeObj, u.nativeObj, vt.nativeObj, rhs.nativeObj, dst.nativeObj);
4177    }
4178
4179
4180    //
4181    // C++:  double cv::Mahalanobis(Mat v1, Mat v2, Mat icovar)
4182    //
4183
4184    /**
4185     * Calculates the Mahalanobis distance between two vectors.
4186     *
4187     * The function cv::Mahalanobis calculates and returns the weighted distance between two vectors:
4188     * \(d( \texttt{vec1} , \texttt{vec2} )= \sqrt{\sum_{i,j}{\texttt{icovar(i,j)}\cdot(\texttt{vec1}(I)-\texttt{vec2}(I))\cdot(\texttt{vec1(j)}-\texttt{vec2(j)})} }\)
4189     * The covariance matrix may be calculated using the #calcCovarMatrix function and then inverted using
4190     * the invert function (preferably using the #DECOMP_SVD method, as the most accurate).
4191     * @param v1 first 1D input vector.
4192     * @param v2 second 1D input vector.
4193     * @param icovar inverse covariance matrix.
4194     * @return automatically generated
4195     */
4196    public static double Mahalanobis(Mat v1, Mat v2, Mat icovar) {
4197        return Mahalanobis_0(v1.nativeObj, v2.nativeObj, icovar.nativeObj);
4198    }
4199
4200
4201    //
4202    // C++:  void cv::dft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
4203    //
4204
4205    /**
4206     * Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
4207     *
4208     * The function cv::dft performs one of the following:
4209     * <ul>
4210     *   <li>
4211     *    Forward the Fourier transform of a 1D vector of N elements:
4212     *     \(Y = F^{(N)}  \cdot X,\)
4213     *     where \(F^{(N)}_{jk}=\exp(-2\pi i j k/N)\) and \(i=\sqrt{-1}\)
4214     *   </li>
4215     *   <li>
4216     *    Inverse the Fourier transform of a 1D vector of N elements:
4217     *     \(\begin{array}{l} X'=  \left (F^{(N)} \right )^{-1}  \cdot Y =  \left (F^{(N)} \right )^*  \cdot y  \\ X = (1/N)  \cdot X, \end{array}\)
4218     *     where \(F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\)
4219     *   </li>
4220     *   <li>
4221     *    Forward the 2D Fourier transform of a M x N matrix:
4222     *     \(Y = F^{(M)}  \cdot X  \cdot F^{(N)}\)
4223     *   </li>
4224     *   <li>
4225     *    Inverse the 2D Fourier transform of a M x N matrix:
4226     *     \(\begin{array}{l} X'=  \left (F^{(M)} \right )^*  \cdot Y  \cdot \left (F^{(N)} \right )^* \\ X =  \frac{1}{M \cdot N} \cdot X' \end{array}\)
4227     *   </li>
4228     * </ul>
4229     *
4230     * In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input
4231     * spectrum of the inverse Fourier transform can be represented in a packed format called *CCS*
4232     * (complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here
4233     * is how 2D *CCS* spectrum looks:
4234     * \(\begin{bmatrix} Re Y_{0,0} &amp; Re Y_{0,1} &amp; Im Y_{0,1} &amp; Re Y_{0,2} &amp; Im Y_{0,2} &amp;  \cdots &amp; Re Y_{0,N/2-1} &amp; Im Y_{0,N/2-1} &amp; Re Y_{0,N/2}  \\ Re Y_{1,0} &amp; Re Y_{1,1} &amp; Im Y_{1,1} &amp; Re Y_{1,2} &amp; Im Y_{1,2} &amp;  \cdots &amp; Re Y_{1,N/2-1} &amp; Im Y_{1,N/2-1} &amp; Re Y_{1,N/2}  \\ Im Y_{1,0} &amp; Re Y_{2,1} &amp; Im Y_{2,1} &amp; Re Y_{2,2} &amp; Im Y_{2,2} &amp;  \cdots &amp; Re Y_{2,N/2-1} &amp; Im Y_{2,N/2-1} &amp; Im Y_{1,N/2}  \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} &amp;  Re Y_{M-3,1}  &amp; Im Y_{M-3,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-3,N/2-1} &amp; Im Y_{M-3,N/2-1}&amp; Re Y_{M/2-1,N/2}  \\ Im Y_{M/2-1,0} &amp;  Re Y_{M-2,1}  &amp; Im Y_{M-2,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-2,N/2-1} &amp; Im Y_{M-2,N/2-1}&amp; Im Y_{M/2-1,N/2}  \\ Re Y_{M/2,0}  &amp;  Re Y_{M-1,1} &amp;  Im Y_{M-1,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-1,N/2-1} &amp; Im Y_{M-1,N/2-1}&amp; Re Y_{M/2,N/2} \end{bmatrix}\)
4235     *
4236     * In case of 1D transform of a real vector, the output looks like the first row of the matrix above.
4237     *
4238     * So, the function chooses an operation mode depending on the flags and size of the input array:
4239     * <ul>
4240     *   <li>
4241     *    If #DFT_ROWS is set or the input array has a single row or single column, the function
4242     *     performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set.
4243     *     Otherwise, it performs a 2D transform.
4244     *   </li>
4245     *   <li>
4246     *    If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or
4247     *     2D transform:
4248     *   <ul>
4249     *     <li>
4250     *        When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as
4251     *         input.
4252     *     </li>
4253     *     <li>
4254     *        When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as
4255     *         input. In case of 2D transform, it uses the packed format as shown above. In case of a
4256     *         single 1D transform, it looks like the first row of the matrix above. In case of
4257     *         multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix
4258     *         looks like the first row of the matrix above.
4259     *     </li>
4260     *   </ul>
4261     *   <li>
4262     *    If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the
4263     *     output is a complex array of the same size as input. The function performs a forward or
4264     *     inverse 1D or 2D transform of the whole input array or each row of the input array
4265     *     independently, depending on the flags DFT_INVERSE and DFT_ROWS.
4266     *   </li>
4267     *   <li>
4268     *    When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT
4269     *     is set, the output is a real array of the same size as input. The function performs a 1D or 2D
4270     *     inverse transformation of the whole input array or each individual row, depending on the flags
4271     *     #DFT_INVERSE and #DFT_ROWS.
4272     *   </li>
4273     * </ul>
4274     *
4275     * If #DFT_SCALE is set, the scaling is done after the transformation.
4276     *
4277     * Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed
4278     * efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the
4279     * current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize
4280     * method.
4281     *
4282     * The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
4283     * <code>
4284     *     void convolveDFT(InputArray A, InputArray B, OutputArray C)
4285     *     {
4286     *         // reallocate the output array if needed
4287     *         C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
4288     *         Size dftSize;
4289     *         // calculate the size of DFT transform
4290     *         dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
4291     *         dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
4292     *
4293     *         // allocate temporary buffers and initialize them with 0's
4294     *         Mat tempA(dftSize, A.type(), Scalar::all(0));
4295     *         Mat tempB(dftSize, B.type(), Scalar::all(0));
4296     *
4297     *         // copy A and B to the top-left corners of tempA and tempB, respectively
4298     *         Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
4299     *         A.copyTo(roiA);
4300     *         Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
4301     *         B.copyTo(roiB);
4302     *
4303     *         // now transform the padded A &amp; B in-place;
4304     *         // use "nonzeroRows" hint for faster processing
4305     *         dft(tempA, tempA, 0, A.rows);
4306     *         dft(tempB, tempB, 0, B.rows);
4307     *
4308     *         // multiply the spectrums;
4309     *         // the function handles packed spectrum representations well
4310     *         mulSpectrums(tempA, tempB, tempA);
4311     *
4312     *         // transform the product back from the frequency domain.
4313     *         // Even though all the result rows will be non-zero,
4314     *         // you need only the first C.rows of them, and thus you
4315     *         // pass nonzeroRows == C.rows
4316     *         dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
4317     *
4318     *         // now copy the result back to C.
4319     *         tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
4320     *
4321     *         // all the temporary buffers will be deallocated automatically
4322     *     }
4323     * </code>
4324     * To optimize this sample, consider the following approaches:
4325     * <ul>
4326     *   <li>
4327     *    Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to
4328     *     the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole
4329     *     tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols)
4330     *     rightmost columns of the matrices.
4331     *   </li>
4332     *   <li>
4333     *    This DFT-based convolution does not have to be applied to the whole big arrays, especially if B
4334     *     is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts.
4335     *     To do this, you need to split the output array C into multiple tiles. For each tile, estimate
4336     *     which parts of A and B are required to calculate convolution in this tile. If the tiles in C are
4337     *     too small, the speed will decrease a lot because of repeated work. In the ultimate case, when
4338     *     each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution
4339     *     algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and
4340     *     there is also a slowdown because of bad cache locality. So, there is an optimal tile size
4341     *     somewhere in the middle.
4342     *   </li>
4343     *   <li>
4344     *    If different tiles in C can be calculated in parallel and, thus, the convolution is done by
4345     *     parts, the loop can be threaded.
4346     *   </li>
4347     * </ul>
4348     *
4349     * All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by
4350     * using them, you can get the performance even better than with the above theoretically optimal
4351     * implementation. Though, those two functions actually calculate cross-correlation, not convolution,
4352     * so you need to "flip" the second convolution operand B vertically and horizontally using flip .
4353     * <b>Note:</b>
4354     * <ul>
4355     *   <li>
4356     *    An example using the discrete fourier transform can be found at
4357     *     opencv_source_code/samples/cpp/dft.cpp
4358     *   </li>
4359     *   <li>
4360     *    (Python) An example using the dft functionality to perform Wiener deconvolution can be found
4361     *     at opencv_source/samples/python/deconvolution.py
4362     *   </li>
4363     *   <li>
4364     *    (Python) An example rearranging the quadrants of a Fourier image can be found at
4365     *     opencv_source/samples/python/dft.py
4366     *   </li>
4367     * </ul>
4368     * @param src input array that could be real or complex.
4369     * @param dst output array whose size and type depends on the flags .
4370     * @param flags transformation flags, representing a combination of the #DftFlags
4371     * @param nonzeroRows when the parameter is not zero, the function assumes that only the first
4372     * nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the
4373     * output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the
4374     * rows more efficiently and save some time; this technique is very useful for calculating array
4375     * cross-correlation or convolution using DFT.
4376     * SEE: dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar ,
4377     * magnitude , phase
4378     */
4379    public static void dft(Mat src, Mat dst, int flags, int nonzeroRows) {
4380        dft_0(src.nativeObj, dst.nativeObj, flags, nonzeroRows);
4381    }
4382
4383    /**
4384     * Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
4385     *
4386     * The function cv::dft performs one of the following:
4387     * <ul>
4388     *   <li>
4389     *    Forward the Fourier transform of a 1D vector of N elements:
4390     *     \(Y = F^{(N)}  \cdot X,\)
4391     *     where \(F^{(N)}_{jk}=\exp(-2\pi i j k/N)\) and \(i=\sqrt{-1}\)
4392     *   </li>
4393     *   <li>
4394     *    Inverse the Fourier transform of a 1D vector of N elements:
4395     *     \(\begin{array}{l} X'=  \left (F^{(N)} \right )^{-1}  \cdot Y =  \left (F^{(N)} \right )^*  \cdot y  \\ X = (1/N)  \cdot X, \end{array}\)
4396     *     where \(F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\)
4397     *   </li>
4398     *   <li>
4399     *    Forward the 2D Fourier transform of a M x N matrix:
4400     *     \(Y = F^{(M)}  \cdot X  \cdot F^{(N)}\)
4401     *   </li>
4402     *   <li>
4403     *    Inverse the 2D Fourier transform of a M x N matrix:
4404     *     \(\begin{array}{l} X'=  \left (F^{(M)} \right )^*  \cdot Y  \cdot \left (F^{(N)} \right )^* \\ X =  \frac{1}{M \cdot N} \cdot X' \end{array}\)
4405     *   </li>
4406     * </ul>
4407     *
4408     * In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input
4409     * spectrum of the inverse Fourier transform can be represented in a packed format called *CCS*
4410     * (complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here
4411     * is how 2D *CCS* spectrum looks:
4412     * \(\begin{bmatrix} Re Y_{0,0} &amp; Re Y_{0,1} &amp; Im Y_{0,1} &amp; Re Y_{0,2} &amp; Im Y_{0,2} &amp;  \cdots &amp; Re Y_{0,N/2-1} &amp; Im Y_{0,N/2-1} &amp; Re Y_{0,N/2}  \\ Re Y_{1,0} &amp; Re Y_{1,1} &amp; Im Y_{1,1} &amp; Re Y_{1,2} &amp; Im Y_{1,2} &amp;  \cdots &amp; Re Y_{1,N/2-1} &amp; Im Y_{1,N/2-1} &amp; Re Y_{1,N/2}  \\ Im Y_{1,0} &amp; Re Y_{2,1} &amp; Im Y_{2,1} &amp; Re Y_{2,2} &amp; Im Y_{2,2} &amp;  \cdots &amp; Re Y_{2,N/2-1} &amp; Im Y_{2,N/2-1} &amp; Im Y_{1,N/2}  \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} &amp;  Re Y_{M-3,1}  &amp; Im Y_{M-3,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-3,N/2-1} &amp; Im Y_{M-3,N/2-1}&amp; Re Y_{M/2-1,N/2}  \\ Im Y_{M/2-1,0} &amp;  Re Y_{M-2,1}  &amp; Im Y_{M-2,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-2,N/2-1} &amp; Im Y_{M-2,N/2-1}&amp; Im Y_{M/2-1,N/2}  \\ Re Y_{M/2,0}  &amp;  Re Y_{M-1,1} &amp;  Im Y_{M-1,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-1,N/2-1} &amp; Im Y_{M-1,N/2-1}&amp; Re Y_{M/2,N/2} \end{bmatrix}\)
4413     *
4414     * In case of 1D transform of a real vector, the output looks like the first row of the matrix above.
4415     *
4416     * So, the function chooses an operation mode depending on the flags and size of the input array:
4417     * <ul>
4418     *   <li>
4419     *    If #DFT_ROWS is set or the input array has a single row or single column, the function
4420     *     performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set.
4421     *     Otherwise, it performs a 2D transform.
4422     *   </li>
4423     *   <li>
4424     *    If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or
4425     *     2D transform:
4426     *   <ul>
4427     *     <li>
4428     *        When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as
4429     *         input.
4430     *     </li>
4431     *     <li>
4432     *        When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as
4433     *         input. In case of 2D transform, it uses the packed format as shown above. In case of a
4434     *         single 1D transform, it looks like the first row of the matrix above. In case of
4435     *         multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix
4436     *         looks like the first row of the matrix above.
4437     *     </li>
4438     *   </ul>
4439     *   <li>
4440     *    If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the
4441     *     output is a complex array of the same size as input. The function performs a forward or
4442     *     inverse 1D or 2D transform of the whole input array or each row of the input array
4443     *     independently, depending on the flags DFT_INVERSE and DFT_ROWS.
4444     *   </li>
4445     *   <li>
4446     *    When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT
4447     *     is set, the output is a real array of the same size as input. The function performs a 1D or 2D
4448     *     inverse transformation of the whole input array or each individual row, depending on the flags
4449     *     #DFT_INVERSE and #DFT_ROWS.
4450     *   </li>
4451     * </ul>
4452     *
4453     * If #DFT_SCALE is set, the scaling is done after the transformation.
4454     *
4455     * Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed
4456     * efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the
4457     * current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize
4458     * method.
4459     *
4460     * The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
4461     * <code>
4462     *     void convolveDFT(InputArray A, InputArray B, OutputArray C)
4463     *     {
4464     *         // reallocate the output array if needed
4465     *         C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
4466     *         Size dftSize;
4467     *         // calculate the size of DFT transform
4468     *         dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
4469     *         dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
4470     *
4471     *         // allocate temporary buffers and initialize them with 0's
4472     *         Mat tempA(dftSize, A.type(), Scalar::all(0));
4473     *         Mat tempB(dftSize, B.type(), Scalar::all(0));
4474     *
4475     *         // copy A and B to the top-left corners of tempA and tempB, respectively
4476     *         Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
4477     *         A.copyTo(roiA);
4478     *         Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
4479     *         B.copyTo(roiB);
4480     *
4481     *         // now transform the padded A &amp; B in-place;
4482     *         // use "nonzeroRows" hint for faster processing
4483     *         dft(tempA, tempA, 0, A.rows);
4484     *         dft(tempB, tempB, 0, B.rows);
4485     *
4486     *         // multiply the spectrums;
4487     *         // the function handles packed spectrum representations well
4488     *         mulSpectrums(tempA, tempB, tempA);
4489     *
4490     *         // transform the product back from the frequency domain.
4491     *         // Even though all the result rows will be non-zero,
4492     *         // you need only the first C.rows of them, and thus you
4493     *         // pass nonzeroRows == C.rows
4494     *         dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
4495     *
4496     *         // now copy the result back to C.
4497     *         tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
4498     *
4499     *         // all the temporary buffers will be deallocated automatically
4500     *     }
4501     * </code>
4502     * To optimize this sample, consider the following approaches:
4503     * <ul>
4504     *   <li>
4505     *    Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to
4506     *     the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole
4507     *     tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols)
4508     *     rightmost columns of the matrices.
4509     *   </li>
4510     *   <li>
4511     *    This DFT-based convolution does not have to be applied to the whole big arrays, especially if B
4512     *     is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts.
4513     *     To do this, you need to split the output array C into multiple tiles. For each tile, estimate
4514     *     which parts of A and B are required to calculate convolution in this tile. If the tiles in C are
4515     *     too small, the speed will decrease a lot because of repeated work. In the ultimate case, when
4516     *     each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution
4517     *     algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and
4518     *     there is also a slowdown because of bad cache locality. So, there is an optimal tile size
4519     *     somewhere in the middle.
4520     *   </li>
4521     *   <li>
4522     *    If different tiles in C can be calculated in parallel and, thus, the convolution is done by
4523     *     parts, the loop can be threaded.
4524     *   </li>
4525     * </ul>
4526     *
4527     * All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by
4528     * using them, you can get the performance even better than with the above theoretically optimal
4529     * implementation. Though, those two functions actually calculate cross-correlation, not convolution,
4530     * so you need to "flip" the second convolution operand B vertically and horizontally using flip .
4531     * <b>Note:</b>
4532     * <ul>
4533     *   <li>
4534     *    An example using the discrete fourier transform can be found at
4535     *     opencv_source_code/samples/cpp/dft.cpp
4536     *   </li>
4537     *   <li>
4538     *    (Python) An example using the dft functionality to perform Wiener deconvolution can be found
4539     *     at opencv_source/samples/python/deconvolution.py
4540     *   </li>
4541     *   <li>
4542     *    (Python) An example rearranging the quadrants of a Fourier image can be found at
4543     *     opencv_source/samples/python/dft.py
4544     *   </li>
4545     * </ul>
4546     * @param src input array that could be real or complex.
4547     * @param dst output array whose size and type depends on the flags .
4548     * @param flags transformation flags, representing a combination of the #DftFlags
4549     * nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the
4550     * output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the
4551     * rows more efficiently and save some time; this technique is very useful for calculating array
4552     * cross-correlation or convolution using DFT.
4553     * SEE: dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar ,
4554     * magnitude , phase
4555     */
4556    public static void dft(Mat src, Mat dst, int flags) {
4557        dft_1(src.nativeObj, dst.nativeObj, flags);
4558    }
4559
4560    /**
4561     * Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
4562     *
4563     * The function cv::dft performs one of the following:
4564     * <ul>
4565     *   <li>
4566     *    Forward the Fourier transform of a 1D vector of N elements:
4567     *     \(Y = F^{(N)}  \cdot X,\)
4568     *     where \(F^{(N)}_{jk}=\exp(-2\pi i j k/N)\) and \(i=\sqrt{-1}\)
4569     *   </li>
4570     *   <li>
4571     *    Inverse the Fourier transform of a 1D vector of N elements:
4572     *     \(\begin{array}{l} X'=  \left (F^{(N)} \right )^{-1}  \cdot Y =  \left (F^{(N)} \right )^*  \cdot y  \\ X = (1/N)  \cdot X, \end{array}\)
4573     *     where \(F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\)
4574     *   </li>
4575     *   <li>
4576     *    Forward the 2D Fourier transform of a M x N matrix:
4577     *     \(Y = F^{(M)}  \cdot X  \cdot F^{(N)}\)
4578     *   </li>
4579     *   <li>
4580     *    Inverse the 2D Fourier transform of a M x N matrix:
4581     *     \(\begin{array}{l} X'=  \left (F^{(M)} \right )^*  \cdot Y  \cdot \left (F^{(N)} \right )^* \\ X =  \frac{1}{M \cdot N} \cdot X' \end{array}\)
4582     *   </li>
4583     * </ul>
4584     *
4585     * In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input
4586     * spectrum of the inverse Fourier transform can be represented in a packed format called *CCS*
4587     * (complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here
4588     * is how 2D *CCS* spectrum looks:
4589     * \(\begin{bmatrix} Re Y_{0,0} &amp; Re Y_{0,1} &amp; Im Y_{0,1} &amp; Re Y_{0,2} &amp; Im Y_{0,2} &amp;  \cdots &amp; Re Y_{0,N/2-1} &amp; Im Y_{0,N/2-1} &amp; Re Y_{0,N/2}  \\ Re Y_{1,0} &amp; Re Y_{1,1} &amp; Im Y_{1,1} &amp; Re Y_{1,2} &amp; Im Y_{1,2} &amp;  \cdots &amp; Re Y_{1,N/2-1} &amp; Im Y_{1,N/2-1} &amp; Re Y_{1,N/2}  \\ Im Y_{1,0} &amp; Re Y_{2,1} &amp; Im Y_{2,1} &amp; Re Y_{2,2} &amp; Im Y_{2,2} &amp;  \cdots &amp; Re Y_{2,N/2-1} &amp; Im Y_{2,N/2-1} &amp; Im Y_{1,N/2}  \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} &amp;  Re Y_{M-3,1}  &amp; Im Y_{M-3,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-3,N/2-1} &amp; Im Y_{M-3,N/2-1}&amp; Re Y_{M/2-1,N/2}  \\ Im Y_{M/2-1,0} &amp;  Re Y_{M-2,1}  &amp; Im Y_{M-2,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-2,N/2-1} &amp; Im Y_{M-2,N/2-1}&amp; Im Y_{M/2-1,N/2}  \\ Re Y_{M/2,0}  &amp;  Re Y_{M-1,1} &amp;  Im Y_{M-1,1} &amp;  \hdotsfor{3} &amp; Re Y_{M-1,N/2-1} &amp; Im Y_{M-1,N/2-1}&amp; Re Y_{M/2,N/2} \end{bmatrix}\)
4590     *
4591     * In case of 1D transform of a real vector, the output looks like the first row of the matrix above.
4592     *
4593     * So, the function chooses an operation mode depending on the flags and size of the input array:
4594     * <ul>
4595     *   <li>
4596     *    If #DFT_ROWS is set or the input array has a single row or single column, the function
4597     *     performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set.
4598     *     Otherwise, it performs a 2D transform.
4599     *   </li>
4600     *   <li>
4601     *    If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or
4602     *     2D transform:
4603     *   <ul>
4604     *     <li>
4605     *        When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as
4606     *         input.
4607     *     </li>
4608     *     <li>
4609     *        When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as
4610     *         input. In case of 2D transform, it uses the packed format as shown above. In case of a
4611     *         single 1D transform, it looks like the first row of the matrix above. In case of
4612     *         multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix
4613     *         looks like the first row of the matrix above.
4614     *     </li>
4615     *   </ul>
4616     *   <li>
4617     *    If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the
4618     *     output is a complex array of the same size as input. The function performs a forward or
4619     *     inverse 1D or 2D transform of the whole input array or each row of the input array
4620     *     independently, depending on the flags DFT_INVERSE and DFT_ROWS.
4621     *   </li>
4622     *   <li>
4623     *    When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT
4624     *     is set, the output is a real array of the same size as input. The function performs a 1D or 2D
4625     *     inverse transformation of the whole input array or each individual row, depending on the flags
4626     *     #DFT_INVERSE and #DFT_ROWS.
4627     *   </li>
4628     * </ul>
4629     *
4630     * If #DFT_SCALE is set, the scaling is done after the transformation.
4631     *
4632     * Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed
4633     * efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the
4634     * current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize
4635     * method.
4636     *
4637     * The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
4638     * <code>
4639     *     void convolveDFT(InputArray A, InputArray B, OutputArray C)
4640     *     {
4641     *         // reallocate the output array if needed
4642     *         C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
4643     *         Size dftSize;
4644     *         // calculate the size of DFT transform
4645     *         dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
4646     *         dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
4647     *
4648     *         // allocate temporary buffers and initialize them with 0's
4649     *         Mat tempA(dftSize, A.type(), Scalar::all(0));
4650     *         Mat tempB(dftSize, B.type(), Scalar::all(0));
4651     *
4652     *         // copy A and B to the top-left corners of tempA and tempB, respectively
4653     *         Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
4654     *         A.copyTo(roiA);
4655     *         Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
4656     *         B.copyTo(roiB);
4657     *
4658     *         // now transform the padded A &amp; B in-place;
4659     *         // use "nonzeroRows" hint for faster processing
4660     *         dft(tempA, tempA, 0, A.rows);
4661     *         dft(tempB, tempB, 0, B.rows);
4662     *
4663     *         // multiply the spectrums;
4664     *         // the function handles packed spectrum representations well
4665     *         mulSpectrums(tempA, tempB, tempA);
4666     *
4667     *         // transform the product back from the frequency domain.
4668     *         // Even though all the result rows will be non-zero,
4669     *         // you need only the first C.rows of them, and thus you
4670     *         // pass nonzeroRows == C.rows
4671     *         dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
4672     *
4673     *         // now copy the result back to C.
4674     *         tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
4675     *
4676     *         // all the temporary buffers will be deallocated automatically
4677     *     }
4678     * </code>
4679     * To optimize this sample, consider the following approaches:
4680     * <ul>
4681     *   <li>
4682     *    Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to
4683     *     the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole
4684     *     tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols)
4685     *     rightmost columns of the matrices.
4686     *   </li>
4687     *   <li>
4688     *    This DFT-based convolution does not have to be applied to the whole big arrays, especially if B
4689     *     is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts.
4690     *     To do this, you need to split the output array C into multiple tiles. For each tile, estimate
4691     *     which parts of A and B are required to calculate convolution in this tile. If the tiles in C are
4692     *     too small, the speed will decrease a lot because of repeated work. In the ultimate case, when
4693     *     each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution
4694     *     algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and
4695     *     there is also a slowdown because of bad cache locality. So, there is an optimal tile size
4696     *     somewhere in the middle.
4697     *   </li>
4698     *   <li>
4699     *    If different tiles in C can be calculated in parallel and, thus, the convolution is done by
4700     *     parts, the loop can be threaded.
4701     *   </li>
4702     * </ul>
4703     *
4704     * All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by
4705     * using them, you can get the performance even better than with the above theoretically optimal
4706     * implementation. Though, those two functions actually calculate cross-correlation, not convolution,
4707     * so you need to "flip" the second convolution operand B vertically and horizontally using flip .
4708     * <b>Note:</b>
4709     * <ul>
4710     *   <li>
4711     *    An example using the discrete fourier transform can be found at
4712     *     opencv_source_code/samples/cpp/dft.cpp
4713     *   </li>
4714     *   <li>
4715     *    (Python) An example using the dft functionality to perform Wiener deconvolution can be found
4716     *     at opencv_source/samples/python/deconvolution.py
4717     *   </li>
4718     *   <li>
4719     *    (Python) An example rearranging the quadrants of a Fourier image can be found at
4720     *     opencv_source/samples/python/dft.py
4721     *   </li>
4722     * </ul>
4723     * @param src input array that could be real or complex.
4724     * @param dst output array whose size and type depends on the flags .
4725     * nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the
4726     * output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the
4727     * rows more efficiently and save some time; this technique is very useful for calculating array
4728     * cross-correlation or convolution using DFT.
4729     * SEE: dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar ,
4730     * magnitude , phase
4731     */
4732    public static void dft(Mat src, Mat dst) {
4733        dft_2(src.nativeObj, dst.nativeObj);
4734    }
4735
4736
4737    //
4738    // C++:  void cv::idft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
4739    //
4740
4741    /**
4742     * Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
4743     *
4744     * idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) .
4745     * <b>Note:</b> None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of
4746     * dft or idft explicitly to make these transforms mutually inverse.
4747     * SEE: dft, dct, idct, mulSpectrums, getOptimalDFTSize
4748     * @param src input floating-point real or complex array.
4749     * @param dst output array whose size and type depend on the flags.
4750     * @param flags operation flags (see dft and #DftFlags).
4751     * @param nonzeroRows number of dst rows to process; the rest of the rows have undefined content (see
4752     * the convolution sample in dft description.
4753     */
4754    public static void idft(Mat src, Mat dst, int flags, int nonzeroRows) {
4755        idft_0(src.nativeObj, dst.nativeObj, flags, nonzeroRows);
4756    }
4757
4758    /**
4759     * Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
4760     *
4761     * idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) .
4762     * <b>Note:</b> None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of
4763     * dft or idft explicitly to make these transforms mutually inverse.
4764     * SEE: dft, dct, idct, mulSpectrums, getOptimalDFTSize
4765     * @param src input floating-point real or complex array.
4766     * @param dst output array whose size and type depend on the flags.
4767     * @param flags operation flags (see dft and #DftFlags).
4768     * the convolution sample in dft description.
4769     */
4770    public static void idft(Mat src, Mat dst, int flags) {
4771        idft_1(src.nativeObj, dst.nativeObj, flags);
4772    }
4773
4774    /**
4775     * Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
4776     *
4777     * idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) .
4778     * <b>Note:</b> None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of
4779     * dft or idft explicitly to make these transforms mutually inverse.
4780     * SEE: dft, dct, idct, mulSpectrums, getOptimalDFTSize
4781     * @param src input floating-point real or complex array.
4782     * @param dst output array whose size and type depend on the flags.
4783     * the convolution sample in dft description.
4784     */
4785    public static void idft(Mat src, Mat dst) {
4786        idft_2(src.nativeObj, dst.nativeObj);
4787    }
4788
4789
4790    //
4791    // C++:  void cv::dct(Mat src, Mat& dst, int flags = 0)
4792    //
4793
4794    /**
4795     * Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
4796     *
4797     * The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D
4798     * floating-point array:
4799     * <ul>
4800     *   <li>
4801     *    Forward Cosine transform of a 1D vector of N elements:
4802     *     \(Y = C^{(N)}  \cdot X\)
4803     *     where
4804     *     \(C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\)
4805     *     and
4806     *     \(\alpha_0=1\), \(\alpha_j=2\) for *j &gt; 0*.
4807     *   </li>
4808     *   <li>
4809     *    Inverse Cosine transform of a 1D vector of N elements:
4810     *     \(X =  \left (C^{(N)} \right )^{-1}  \cdot Y =  \left (C^{(N)} \right )^T  \cdot Y\)
4811     *     (since \(C^{(N)}\) is an orthogonal matrix, \(C^{(N)} \cdot \left(C^{(N)}\right)^T = I\) )
4812     *   </li>
4813     *   <li>
4814     *    Forward 2D Cosine transform of M x N matrix:
4815     *     \(Y = C^{(N)}  \cdot X  \cdot \left (C^{(N)} \right )^T\)
4816     *   </li>
4817     *   <li>
4818     *    Inverse 2D Cosine transform of M x N matrix:
4819     *     \(X =  \left (C^{(N)} \right )^T  \cdot X  \cdot C^{(N)}\)
4820     *   </li>
4821     * </ul>
4822     *
4823     * The function chooses the mode of operation by looking at the flags and size of the input array:
4824     * <ul>
4825     *   <li>
4826     *    If (flags &amp; #DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it
4827     *     is an inverse 1D or 2D transform.
4828     *   </li>
4829     *   <li>
4830     *    If (flags &amp; #DCT_ROWS) != 0 , the function performs a 1D transform of each row.
4831     *   </li>
4832     *   <li>
4833     *    If the array is a single column or a single row, the function performs a 1D transform.
4834     *   </li>
4835     *   <li>
4836     *    If none of the above is true, the function performs a 2D transform.
4837     *   </li>
4838     * </ul>
4839     *
4840     * <b>Note:</b> Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you
4841     * can pad the array when necessary.
4842     * Also, the function performance depends very much, and not monotonically, on the array size (see
4843     * getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT
4844     * of a vector of size N/2 . Thus, the optimal DCT size N1 &gt;= N can be calculated as:
4845     * <code>
4846     *     size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); }
4847     *     N1 = getOptimalDCTSize(N);
4848     * </code>
4849     * @param src input floating-point array.
4850     * @param dst output array of the same size and type as src .
4851     * @param flags transformation flags as a combination of cv::DftFlags (DCT_*)
4852     * SEE: dft , getOptimalDFTSize , idct
4853     */
4854    public static void dct(Mat src, Mat dst, int flags) {
4855        dct_0(src.nativeObj, dst.nativeObj, flags);
4856    }
4857
4858    /**
4859     * Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
4860     *
4861     * The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D
4862     * floating-point array:
4863     * <ul>
4864     *   <li>
4865     *    Forward Cosine transform of a 1D vector of N elements:
4866     *     \(Y = C^{(N)}  \cdot X\)
4867     *     where
4868     *     \(C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\)
4869     *     and
4870     *     \(\alpha_0=1\), \(\alpha_j=2\) for *j &gt; 0*.
4871     *   </li>
4872     *   <li>
4873     *    Inverse Cosine transform of a 1D vector of N elements:
4874     *     \(X =  \left (C^{(N)} \right )^{-1}  \cdot Y =  \left (C^{(N)} \right )^T  \cdot Y\)
4875     *     (since \(C^{(N)}\) is an orthogonal matrix, \(C^{(N)} \cdot \left(C^{(N)}\right)^T = I\) )
4876     *   </li>
4877     *   <li>
4878     *    Forward 2D Cosine transform of M x N matrix:
4879     *     \(Y = C^{(N)}  \cdot X  \cdot \left (C^{(N)} \right )^T\)
4880     *   </li>
4881     *   <li>
4882     *    Inverse 2D Cosine transform of M x N matrix:
4883     *     \(X =  \left (C^{(N)} \right )^T  \cdot X  \cdot C^{(N)}\)
4884     *   </li>
4885     * </ul>
4886     *
4887     * The function chooses the mode of operation by looking at the flags and size of the input array:
4888     * <ul>
4889     *   <li>
4890     *    If (flags &amp; #DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it
4891     *     is an inverse 1D or 2D transform.
4892     *   </li>
4893     *   <li>
4894     *    If (flags &amp; #DCT_ROWS) != 0 , the function performs a 1D transform of each row.
4895     *   </li>
4896     *   <li>
4897     *    If the array is a single column or a single row, the function performs a 1D transform.
4898     *   </li>
4899     *   <li>
4900     *    If none of the above is true, the function performs a 2D transform.
4901     *   </li>
4902     * </ul>
4903     *
4904     * <b>Note:</b> Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you
4905     * can pad the array when necessary.
4906     * Also, the function performance depends very much, and not monotonically, on the array size (see
4907     * getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT
4908     * of a vector of size N/2 . Thus, the optimal DCT size N1 &gt;= N can be calculated as:
4909     * <code>
4910     *     size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); }
4911     *     N1 = getOptimalDCTSize(N);
4912     * </code>
4913     * @param src input floating-point array.
4914     * @param dst output array of the same size and type as src .
4915     * SEE: dft , getOptimalDFTSize , idct
4916     */
4917    public static void dct(Mat src, Mat dst) {
4918        dct_1(src.nativeObj, dst.nativeObj);
4919    }
4920
4921
4922    //
4923    // C++:  void cv::idct(Mat src, Mat& dst, int flags = 0)
4924    //
4925
4926    /**
4927     * Calculates the inverse Discrete Cosine Transform of a 1D or 2D array.
4928     *
4929     * idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE).
4930     * @param src input floating-point single-channel array.
4931     * @param dst output array of the same size and type as src.
4932     * @param flags operation flags.
4933     * SEE:  dct, dft, idft, getOptimalDFTSize
4934     */
4935    public static void idct(Mat src, Mat dst, int flags) {
4936        idct_0(src.nativeObj, dst.nativeObj, flags);
4937    }
4938
4939    /**
4940     * Calculates the inverse Discrete Cosine Transform of a 1D or 2D array.
4941     *
4942     * idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE).
4943     * @param src input floating-point single-channel array.
4944     * @param dst output array of the same size and type as src.
4945     * SEE:  dct, dft, idft, getOptimalDFTSize
4946     */
4947    public static void idct(Mat src, Mat dst) {
4948        idct_1(src.nativeObj, dst.nativeObj);
4949    }
4950
4951
4952    //
4953    // C++:  void cv::mulSpectrums(Mat a, Mat b, Mat& c, int flags, bool conjB = false)
4954    //
4955
4956    /**
4957     * Performs the per-element multiplication of two Fourier spectrums.
4958     *
4959     * The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex
4960     * matrices that are results of a real or complex Fourier transform.
4961     *
4962     * The function, together with dft and idft , may be used to calculate convolution (pass conjB=false )
4963     * or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are
4964     * simply multiplied (per element) with an optional conjugation of the second-array elements. When the
4965     * arrays are real, they are assumed to be CCS-packed (see dft for details).
4966     * @param a first input array.
4967     * @param b second input array of the same size and type as src1 .
4968     * @param c output array of the same size and type as src1 .
4969     * @param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that
4970     * each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a {@code 0} as value.
4971     * @param conjB optional flag that conjugates the second input array before the multiplication (true)
4972     * or not (false).
4973     */
4974    public static void mulSpectrums(Mat a, Mat b, Mat c, int flags, boolean conjB) {
4975        mulSpectrums_0(a.nativeObj, b.nativeObj, c.nativeObj, flags, conjB);
4976    }
4977
4978    /**
4979     * Performs the per-element multiplication of two Fourier spectrums.
4980     *
4981     * The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex
4982     * matrices that are results of a real or complex Fourier transform.
4983     *
4984     * The function, together with dft and idft , may be used to calculate convolution (pass conjB=false )
4985     * or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are
4986     * simply multiplied (per element) with an optional conjugation of the second-array elements. When the
4987     * arrays are real, they are assumed to be CCS-packed (see dft for details).
4988     * @param a first input array.
4989     * @param b second input array of the same size and type as src1 .
4990     * @param c output array of the same size and type as src1 .
4991     * @param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that
4992     * each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a {@code 0} as value.
4993     * or not (false).
4994     */
4995    public static void mulSpectrums(Mat a, Mat b, Mat c, int flags) {
4996        mulSpectrums_1(a.nativeObj, b.nativeObj, c.nativeObj, flags);
4997    }
4998
4999
5000    //
5001    // C++:  int cv::getOptimalDFTSize(int vecsize)
5002    //
5003
5004    /**
5005     * Returns the optimal DFT size for a given vector size.
5006     *
5007     * DFT performance is not a monotonic function of a vector size. Therefore, when you calculate
5008     * convolution of two arrays or perform the spectral analysis of an array, it usually makes sense to
5009     * pad the input data with zeros to get a bit larger array that can be transformed much faster than the
5010     * original one. Arrays whose size is a power-of-two (2, 4, 8, 16, 32, ...) are the fastest to process.
5011     * Though, the arrays whose size is a product of 2's, 3's, and 5's (for example, 300 = 5\*5\*3\*2\*2)
5012     * are also processed quite efficiently.
5013     *
5014     * The function cv::getOptimalDFTSize returns the minimum number N that is greater than or equal to vecsize
5015     * so that the DFT of a vector of size N can be processed efficiently. In the current implementation N
5016     * = 2 ^p^ \* 3 ^q^ \* 5 ^r^ for some integer p, q, r.
5017     *
5018     * The function returns a negative number if vecsize is too large (very close to INT_MAX ).
5019     *
5020     * While the function cannot be used directly to estimate the optimal vector size for DCT transform
5021     * (since the current DCT implementation supports only even-size vectors), it can be easily processed
5022     * as getOptimalDFTSize((vecsize+1)/2)\*2.
5023     * @param vecsize vector size.
5024     * SEE: dft , dct , idft , idct , mulSpectrums
5025     * @return automatically generated
5026     */
5027    public static int getOptimalDFTSize(int vecsize) {
5028        return getOptimalDFTSize_0(vecsize);
5029    }
5030
5031
5032    //
5033    // C++:  void cv::setRNGSeed(int seed)
5034    //
5035
5036    /**
5037     * Sets state of default random number generator.
5038     *
5039     * The function cv::setRNGSeed sets state of default random number generator to custom value.
5040     * @param seed new state for default random number generator
5041     * SEE: RNG, randu, randn
5042     */
5043    public static void setRNGSeed(int seed) {
5044        setRNGSeed_0(seed);
5045    }
5046
5047
5048    //
5049    // C++:  void cv::randu(Mat& dst, double low, double high)
5050    //
5051
5052    /**
5053     * Generates a single uniformly-distributed random number or an array of random numbers.
5054     *
5055     * Non-template variant of the function fills the matrix dst with uniformly-distributed
5056     * random numbers from the specified range:
5057     * \(\texttt{low} _c  \leq \texttt{dst} (I)_c &lt;  \texttt{high} _c\)
5058     * @param dst output array of random numbers; the array must be pre-allocated.
5059     * @param low inclusive lower boundary of the generated random numbers.
5060     * @param high exclusive upper boundary of the generated random numbers.
5061     * SEE: RNG, randn, theRNG
5062     */
5063    public static void randu(Mat dst, double low, double high) {
5064        randu_0(dst.nativeObj, low, high);
5065    }
5066
5067
5068    //
5069    // C++:  void cv::randn(Mat& dst, double mean, double stddev)
5070    //
5071
5072    /**
5073     * Fills the array with normally distributed random numbers.
5074     *
5075     * The function cv::randn fills the matrix dst with normally distributed random numbers with the specified
5076     * mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the
5077     * value range of the output array data type.
5078     * @param dst output array of random numbers; the array must be pre-allocated and have 1 to 4 channels.
5079     * @param mean mean value (expectation) of the generated random numbers.
5080     * @param stddev standard deviation of the generated random numbers; it can be either a vector (in
5081     * which case a diagonal standard deviation matrix is assumed) or a square matrix.
5082     * SEE: RNG, randu
5083     */
5084    public static void randn(Mat dst, double mean, double stddev) {
5085        randn_0(dst.nativeObj, mean, stddev);
5086    }
5087
5088
5089    //
5090    // C++:  void cv::randShuffle(Mat& dst, double iterFactor = 1., RNG* rng = 0)
5091    //
5092
5093    /**
5094     * Shuffles the array elements randomly.
5095     *
5096     * The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and
5097     * swapping them. The number of such swap operations will be dst.rows\*dst.cols\*iterFactor .
5098     * @param dst input/output numerical 1D array.
5099     * @param iterFactor scale factor that determines the number of random swap operations (see the details
5100     * below).
5101     * instead.
5102     * SEE: RNG, sort
5103     */
5104    public static void randShuffle(Mat dst, double iterFactor) {
5105        randShuffle_0(dst.nativeObj, iterFactor);
5106    }
5107
5108    /**
5109     * Shuffles the array elements randomly.
5110     *
5111     * The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and
5112     * swapping them. The number of such swap operations will be dst.rows\*dst.cols\*iterFactor .
5113     * @param dst input/output numerical 1D array.
5114     * below).
5115     * instead.
5116     * SEE: RNG, sort
5117     */
5118    public static void randShuffle(Mat dst) {
5119        randShuffle_2(dst.nativeObj);
5120    }
5121
5122
5123    //
5124    // C++:  double cv::kmeans(Mat data, int K, Mat& bestLabels, TermCriteria criteria, int attempts, int flags, Mat& centers = Mat())
5125    //
5126
5127    /**
5128     * Finds centers of clusters and groups input samples around the clusters.
5129     *
5130     * The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
5131     * and groups the input samples around the clusters. As an output, \(\texttt{bestLabels}_i\) contains a
5132     * 0-based cluster index for the sample stored in the \(i^{th}\) row of the samples matrix.
5133     *
5134     * <b>Note:</b>
5135     * <ul>
5136     *   <li>
5137     *    (Python) An example on K-means clustering can be found at
5138     *     opencv_source_code/samples/python/kmeans.py
5139     *   </li>
5140     * </ul>
5141     * @param data Data for clustering. An array of N-Dimensional points with float coordinates is needed.
5142     * Examples of this array can be:
5143     * <ul>
5144     *   <li>
5145     *    Mat points(count, 2, CV_32F);
5146     *   </li>
5147     *   <li>
5148     *    Mat points(count, 1, CV_32FC2);
5149     *   </li>
5150     *   <li>
5151     *    Mat points(1, count, CV_32FC2);
5152     *   </li>
5153     *   <li>
5154     *    std::vector&lt;cv::Point2f&gt; points(sampleCount);
5155     *   </li>
5156     * </ul>
5157     * @param K Number of clusters to split the set by.
5158     * @param bestLabels Input/output integer array that stores the cluster indices for every sample.
5159     * @param criteria The algorithm termination criteria, that is, the maximum number of iterations and/or
5160     * the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster
5161     * centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
5162     * @param attempts Flag to specify the number of times the algorithm is executed using different
5163     * initial labellings. The algorithm returns the labels that yield the best compactness (see the last
5164     * function parameter).
5165     * @param flags Flag that can take values of cv::KmeansFlags
5166     * @param centers Output matrix of the cluster centers, one row per each cluster center.
5167     * @return The function returns the compactness measure that is computed as
5168     * \(\sum _i  \| \texttt{samples} _i -  \texttt{centers} _{ \texttt{labels} _i} \| ^2\)
5169     * after every attempt. The best (minimum) value is chosen and the corresponding labels and the
5170     * compactness value are returned by the function. Basically, you can use only the core of the
5171     * function, set the number of attempts to 1, initialize labels each time using a custom algorithm,
5172     * pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best
5173     * (most-compact) clustering.
5174     */
5175    public static double kmeans(Mat data, int K, Mat bestLabels, TermCriteria criteria, int attempts, int flags, Mat centers) {
5176        return kmeans_0(data.nativeObj, K, bestLabels.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon, attempts, flags, centers.nativeObj);
5177    }
5178
5179    /**
5180     * Finds centers of clusters and groups input samples around the clusters.
5181     *
5182     * The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
5183     * and groups the input samples around the clusters. As an output, \(\texttt{bestLabels}_i\) contains a
5184     * 0-based cluster index for the sample stored in the \(i^{th}\) row of the samples matrix.
5185     *
5186     * <b>Note:</b>
5187     * <ul>
5188     *   <li>
5189     *    (Python) An example on K-means clustering can be found at
5190     *     opencv_source_code/samples/python/kmeans.py
5191     *   </li>
5192     * </ul>
5193     * @param data Data for clustering. An array of N-Dimensional points with float coordinates is needed.
5194     * Examples of this array can be:
5195     * <ul>
5196     *   <li>
5197     *    Mat points(count, 2, CV_32F);
5198     *   </li>
5199     *   <li>
5200     *    Mat points(count, 1, CV_32FC2);
5201     *   </li>
5202     *   <li>
5203     *    Mat points(1, count, CV_32FC2);
5204     *   </li>
5205     *   <li>
5206     *    std::vector&lt;cv::Point2f&gt; points(sampleCount);
5207     *   </li>
5208     * </ul>
5209     * @param K Number of clusters to split the set by.
5210     * @param bestLabels Input/output integer array that stores the cluster indices for every sample.
5211     * @param criteria The algorithm termination criteria, that is, the maximum number of iterations and/or
5212     * the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster
5213     * centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
5214     * @param attempts Flag to specify the number of times the algorithm is executed using different
5215     * initial labellings. The algorithm returns the labels that yield the best compactness (see the last
5216     * function parameter).
5217     * @param flags Flag that can take values of cv::KmeansFlags
5218     * @return The function returns the compactness measure that is computed as
5219     * \(\sum _i  \| \texttt{samples} _i -  \texttt{centers} _{ \texttt{labels} _i} \| ^2\)
5220     * after every attempt. The best (minimum) value is chosen and the corresponding labels and the
5221     * compactness value are returned by the function. Basically, you can use only the core of the
5222     * function, set the number of attempts to 1, initialize labels each time using a custom algorithm,
5223     * pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best
5224     * (most-compact) clustering.
5225     */
5226    public static double kmeans(Mat data, int K, Mat bestLabels, TermCriteria criteria, int attempts, int flags) {
5227        return kmeans_1(data.nativeObj, K, bestLabels.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon, attempts, flags);
5228    }
5229
5230
5231    //
5232    // C++:  void cv::setNumThreads(int nthreads)
5233    //
5234
5235    /**
5236     * OpenCV will try to set the number of threads for the next parallel region.
5237     *
5238     * If threads == 0, OpenCV will disable threading optimizations and run all it's functions
5239     * sequentially. Passing threads &lt; 0 will reset threads number to system default. This function must
5240     * be called outside of parallel region.
5241     *
5242     * OpenCV will try to run its functions with specified threads number, but some behaviour differs from
5243     * framework:
5244     * <ul>
5245     *   <li>
5246     *    {@code TBB} - User-defined parallel constructions will run with the same threads number, if
5247     *     another is not specified. If later on user creates his own scheduler, OpenCV will use it.
5248     *   </li>
5249     *   <li>
5250     *    {@code OpenMP} - No special defined behaviour.
5251     *   </li>
5252     *   <li>
5253     *    {@code Concurrency} - If threads == 1, OpenCV will disable threading optimizations and run its
5254     *     functions sequentially.
5255     *   </li>
5256     *   <li>
5257     *    {@code GCD} - Supports only values &lt;= 0.
5258     *   </li>
5259     *   <li>
5260     *    {@code C=} - No special defined behaviour.
5261     *   </li>
5262     * </ul>
5263     * @param nthreads Number of threads used by OpenCV.
5264     * SEE: getNumThreads, getThreadNum
5265     */
5266    public static void setNumThreads(int nthreads) {
5267        setNumThreads_0(nthreads);
5268    }
5269
5270
5271    //
5272    // C++:  int cv::getNumThreads()
5273    //
5274
5275    /**
5276     * Returns the number of threads used by OpenCV for parallel regions.
5277     *
5278     * Always returns 1 if OpenCV is built without threading support.
5279     *
5280     * The exact meaning of return value depends on the threading framework used by OpenCV library:
5281     * <ul>
5282     *   <li>
5283     *  {@code TBB} - The number of threads, that OpenCV will try to use for parallel regions. If there is
5284     *   any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns
5285     *   default number of threads used by TBB library.
5286     *   </li>
5287     *   <li>
5288     *  {@code OpenMP} - An upper bound on the number of threads that could be used to form a new team.
5289     *   </li>
5290     *   <li>
5291     *  {@code Concurrency} - The number of threads, that OpenCV will try to use for parallel regions.
5292     *   </li>
5293     *   <li>
5294     *  {@code GCD} - Unsupported; returns the GCD thread pool limit (512) for compatibility.
5295     *   </li>
5296     *   <li>
5297     *  {@code C=} - The number of threads, that OpenCV will try to use for parallel regions, if before
5298     *   called setNumThreads with threads &gt; 0, otherwise returns the number of logical CPUs,
5299     *   available for the process.
5300     * SEE: setNumThreads, getThreadNum
5301     *   </li>
5302     * </ul>
5303     * @return automatically generated
5304     */
5305    public static int getNumThreads() {
5306        return getNumThreads_0();
5307    }
5308
5309
5310    //
5311    // C++:  int cv::getThreadNum()
5312    //
5313
5314    /**
5315     * Returns the index of the currently executed thread within the current parallel region. Always
5316     * returns 0 if called outside of parallel region.
5317     *
5318     * @deprecated Current implementation doesn't corresponding to this documentation.
5319     *
5320     * The exact meaning of the return value depends on the threading framework used by OpenCV library:
5321     * <ul>
5322     *   <li>
5323     *  {@code TBB} - Unsupported with current 4.1 TBB release. Maybe will be supported in future.
5324     *   </li>
5325     *   <li>
5326     *  {@code OpenMP} - The thread number, within the current team, of the calling thread.
5327     *   </li>
5328     *   <li>
5329     *  {@code Concurrency} - An ID for the virtual processor that the current context is executing on (0
5330     *   for master thread and unique number for others, but not necessary 1,2,3,...).
5331     *   </li>
5332     *   <li>
5333     *  {@code GCD} - System calling thread's ID. Never returns 0 inside parallel region.
5334     *   </li>
5335     *   <li>
5336     *  {@code C=} - The index of the current parallel task.
5337     * SEE: setNumThreads, getNumThreads
5338     *   </li>
5339     * </ul>
5340     * @return automatically generated
5341     */
5342    @Deprecated
5343    public static int getThreadNum() {
5344        return getThreadNum_0();
5345    }
5346
5347
5348    //
5349    // C++:  String cv::getBuildInformation()
5350    //
5351
5352    /**
5353     * Returns full configuration time cmake output.
5354     *
5355     * Returned value is raw cmake output including version control system revision, compiler version,
5356     * compiler flags, enabled modules and third party libraries, etc. Output format depends on target
5357     * architecture.
5358     * @return automatically generated
5359     */
5360    public static String getBuildInformation() {
5361        return getBuildInformation_0();
5362    }
5363
5364
5365    //
5366    // C++:  String cv::getVersionString()
5367    //
5368
5369    /**
5370     * Returns library version string
5371     *
5372     * For example "3.4.1-dev".
5373     *
5374     * SEE: getMajorVersion, getMinorVersion, getRevisionVersion
5375     * @return automatically generated
5376     */
5377    public static String getVersionString() {
5378        return getVersionString_0();
5379    }
5380
5381
5382    //
5383    // C++:  int cv::getVersionMajor()
5384    //
5385
5386    /**
5387     * Returns major library version
5388     * @return automatically generated
5389     */
5390    public static int getVersionMajor() {
5391        return getVersionMajor_0();
5392    }
5393
5394
5395    //
5396    // C++:  int cv::getVersionMinor()
5397    //
5398
5399    /**
5400     * Returns minor library version
5401     * @return automatically generated
5402     */
5403    public static int getVersionMinor() {
5404        return getVersionMinor_0();
5405    }
5406
5407
5408    //
5409    // C++:  int cv::getVersionRevision()
5410    //
5411
5412    /**
5413     * Returns revision field of the library version
5414     * @return automatically generated
5415     */
5416    public static int getVersionRevision() {
5417        return getVersionRevision_0();
5418    }
5419
5420
5421    //
5422    // C++:  int64 cv::getTickCount()
5423    //
5424
5425    /**
5426     * Returns the number of ticks.
5427     *
5428     * The function returns the number of ticks after the certain event (for example, when the machine was
5429     * turned on). It can be used to initialize RNG or to measure a function execution time by reading the
5430     * tick count before and after the function call.
5431     * SEE: getTickFrequency, TickMeter
5432     * @return automatically generated
5433     */
5434    public static long getTickCount() {
5435        return getTickCount_0();
5436    }
5437
5438
5439    //
5440    // C++:  double cv::getTickFrequency()
5441    //
5442
5443    /**
5444     * Returns the number of ticks per second.
5445     *
5446     * The function returns the number of ticks per second. That is, the following code computes the
5447     * execution time in seconds:
5448     * <code>
5449     *     double t = (double)getTickCount();
5450     *     // do something ...
5451     *     t = ((double)getTickCount() - t)/getTickFrequency();
5452     * </code>
5453     * SEE: getTickCount, TickMeter
5454     * @return automatically generated
5455     */
5456    public static double getTickFrequency() {
5457        return getTickFrequency_0();
5458    }
5459
5460
5461    //
5462    // C++:  int64 cv::getCPUTickCount()
5463    //
5464
5465    /**
5466     * Returns the number of CPU ticks.
5467     *
5468     * The function returns the current number of CPU ticks on some architectures (such as x86, x64,
5469     * PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for
5470     * very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU
5471     * systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU
5472     * with its own counter. So, theoretically (and practically) the subsequent calls to the function do
5473     * not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU
5474     * frequency depending on the load, the number of CPU clocks spent in some code cannot be directly
5475     * converted to time units. Therefore, getTickCount is generally a preferable solution for measuring
5476     * execution time.
5477     * @return automatically generated
5478     */
5479    public static long getCPUTickCount() {
5480        return getCPUTickCount_0();
5481    }
5482
5483
5484    //
5485    // C++:  String cv::getHardwareFeatureName(int feature)
5486    //
5487
5488    /**
5489     * Returns feature name by ID
5490     *
5491     * Returns empty string if feature is not defined
5492     * @param feature automatically generated
5493     * @return automatically generated
5494     */
5495    public static String getHardwareFeatureName(int feature) {
5496        return getHardwareFeatureName_0(feature);
5497    }
5498
5499
5500    //
5501    // C++:  string cv::getCPUFeaturesLine()
5502    //
5503
5504    /**
5505     * Returns list of CPU features enabled during compilation.
5506     *
5507     * Returned value is a string containing space separated list of CPU features with following markers:
5508     *
5509     * <ul>
5510     *   <li>
5511     *  no markers - baseline features
5512     *   </li>
5513     *   <li>
5514     *  prefix {@code *} - features enabled in dispatcher
5515     *   </li>
5516     *   <li>
5517     *  suffix {@code ?} - features enabled but not available in HW
5518     *   </li>
5519     * </ul>
5520     *
5521     * Example: {@code SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16 *AVX *AVX2 *AVX512-SKX?}
5522     * @return automatically generated
5523     */
5524    public static String getCPUFeaturesLine() {
5525        return getCPUFeaturesLine_0();
5526    }
5527
5528
5529    //
5530    // C++:  int cv::getNumberOfCPUs()
5531    //
5532
5533    /**
5534     * Returns the number of logical CPUs available for the process.
5535     * @return automatically generated
5536     */
5537    public static int getNumberOfCPUs() {
5538        return getNumberOfCPUs_0();
5539    }
5540
5541
5542    //
5543    // C++:  String cv::samples::findFile(String relative_path, bool required = true, bool silentMode = false)
5544    //
5545
5546    /**
5547     * Try to find requested data file
5548     *
5549     * Search directories:
5550     *
5551     * 1. Directories passed via {@code addSamplesDataSearchPath()}
5552     * 2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
5553     * 3. OPENCV_SAMPLES_DATA_PATH environment variable
5554     *    If parameter value is not empty and nothing is found then stop searching.
5555     * 4. Detects build/install path based on:
5556     *    a. current working directory (CWD)
5557     *    b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
5558     * 5. Scan {@code &lt;source&gt;/{,data,samples/data}} directories if build directory is detected or the current directory is in source tree.
5559     * 6. Scan {@code &lt;install&gt;/share/OpenCV} directory if install directory is detected.
5560     *
5561     * SEE: cv::utils::findDataFile
5562     *
5563     * @param relative_path Relative path to data file
5564     * @param required Specify "file not found" handling.
5565     *        If true, function prints information message and raises cv::Exception.
5566     *        If false, function returns empty result
5567     * @param silentMode Disables messages
5568     * @return Returns path (absolute or relative to the current directory) or empty string if file is not found
5569     */
5570    public static String findFile(String relative_path, boolean required, boolean silentMode) {
5571        return findFile_0(relative_path, required, silentMode);
5572    }
5573
5574    /**
5575     * Try to find requested data file
5576     *
5577     * Search directories:
5578     *
5579     * 1. Directories passed via {@code addSamplesDataSearchPath()}
5580     * 2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
5581     * 3. OPENCV_SAMPLES_DATA_PATH environment variable
5582     *    If parameter value is not empty and nothing is found then stop searching.
5583     * 4. Detects build/install path based on:
5584     *    a. current working directory (CWD)
5585     *    b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
5586     * 5. Scan {@code &lt;source&gt;/{,data,samples/data}} directories if build directory is detected or the current directory is in source tree.
5587     * 6. Scan {@code &lt;install&gt;/share/OpenCV} directory if install directory is detected.
5588     *
5589     * SEE: cv::utils::findDataFile
5590     *
5591     * @param relative_path Relative path to data file
5592     * @param required Specify "file not found" handling.
5593     *        If true, function prints information message and raises cv::Exception.
5594     *        If false, function returns empty result
5595     * @return Returns path (absolute or relative to the current directory) or empty string if file is not found
5596     */
5597    public static String findFile(String relative_path, boolean required) {
5598        return findFile_1(relative_path, required);
5599    }
5600
5601    /**
5602     * Try to find requested data file
5603     *
5604     * Search directories:
5605     *
5606     * 1. Directories passed via {@code addSamplesDataSearchPath()}
5607     * 2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
5608     * 3. OPENCV_SAMPLES_DATA_PATH environment variable
5609     *    If parameter value is not empty and nothing is found then stop searching.
5610     * 4. Detects build/install path based on:
5611     *    a. current working directory (CWD)
5612     *    b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
5613     * 5. Scan {@code &lt;source&gt;/{,data,samples/data}} directories if build directory is detected or the current directory is in source tree.
5614     * 6. Scan {@code &lt;install&gt;/share/OpenCV} directory if install directory is detected.
5615     *
5616     * SEE: cv::utils::findDataFile
5617     *
5618     * @param relative_path Relative path to data file
5619     *        If true, function prints information message and raises cv::Exception.
5620     *        If false, function returns empty result
5621     * @return Returns path (absolute or relative to the current directory) or empty string if file is not found
5622     */
5623    public static String findFile(String relative_path) {
5624        return findFile_2(relative_path);
5625    }
5626
5627
5628    //
5629    // C++:  String cv::samples::findFileOrKeep(String relative_path, bool silentMode = false)
5630    //
5631
5632    public static String findFileOrKeep(String relative_path, boolean silentMode) {
5633        return findFileOrKeep_0(relative_path, silentMode);
5634    }
5635
5636    public static String findFileOrKeep(String relative_path) {
5637        return findFileOrKeep_1(relative_path);
5638    }
5639
5640
5641    //
5642    // C++:  void cv::samples::addSamplesDataSearchPath(String path)
5643    //
5644
5645    /**
5646     * Override search data path by adding new search location
5647     *
5648     * Use this only to override default behavior
5649     * Passed paths are used in LIFO order.
5650     *
5651     * @param path Path to used samples data
5652     */
5653    public static void addSamplesDataSearchPath(String path) {
5654        addSamplesDataSearchPath_0(path);
5655    }
5656
5657
5658    //
5659    // C++:  void cv::samples::addSamplesDataSearchSubDirectory(String subdir)
5660    //
5661
5662    /**
5663     * Append samples search data sub directory
5664     *
5665     * General usage is to add OpenCV modules name ({@code &lt;opencv_contrib&gt;/modules/&lt;name&gt;/samples/data} -&gt; {@code &lt;name&gt;/samples/data} + {@code modules/&lt;name&gt;/samples/data}).
5666     * Passed subdirectories are used in LIFO order.
5667     *
5668     * @param subdir samples data sub directory
5669     */
5670    public static void addSamplesDataSearchSubDirectory(String subdir) {
5671        addSamplesDataSearchSubDirectory_0(subdir);
5672    }
5673
5674
5675    //
5676    // C++:  void cv::setErrorVerbosity(bool verbose)
5677    //
5678
5679    public static void setErrorVerbosity(boolean verbose) {
5680        setErrorVerbosity_0(verbose);
5681    }
5682
5683
5684    //
5685    // C++:  void cv::add(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
5686    //
5687
5688    public static void add(Mat src1, Scalar src2, Mat dst, Mat mask, int dtype) {
5689        add_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj, dtype);
5690    }
5691
5692    public static void add(Mat src1, Scalar src2, Mat dst, Mat mask) {
5693        add_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj);
5694    }
5695
5696    public static void add(Mat src1, Scalar src2, Mat dst) {
5697        add_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
5698    }
5699
5700
5701    //
5702    // C++:  void cv::subtract(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
5703    //
5704
5705    public static void subtract(Mat src1, Scalar src2, Mat dst, Mat mask, int dtype) {
5706        subtract_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj, dtype);
5707    }
5708
5709    public static void subtract(Mat src1, Scalar src2, Mat dst, Mat mask) {
5710        subtract_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj);
5711    }
5712
5713    public static void subtract(Mat src1, Scalar src2, Mat dst) {
5714        subtract_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
5715    }
5716
5717
5718    //
5719    // C++:  void cv::multiply(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
5720    //
5721
5722    public static void multiply(Mat src1, Scalar src2, Mat dst, double scale, int dtype) {
5723        multiply_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale, dtype);
5724    }
5725
5726    public static void multiply(Mat src1, Scalar src2, Mat dst, double scale) {
5727        multiply_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale);
5728    }
5729
5730    public static void multiply(Mat src1, Scalar src2, Mat dst) {
5731        multiply_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
5732    }
5733
5734
5735    //
5736    // C++:  void cv::divide(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
5737    //
5738
5739    public static void divide(Mat src1, Scalar src2, Mat dst, double scale, int dtype) {
5740        divide_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale, dtype);
5741    }
5742
5743    public static void divide(Mat src1, Scalar src2, Mat dst, double scale) {
5744        divide_6(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale);
5745    }
5746
5747    public static void divide(Mat src1, Scalar src2, Mat dst) {
5748        divide_7(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
5749    }
5750
5751
5752    //
5753    // C++:  void cv::absdiff(Mat src1, Scalar src2, Mat& dst)
5754    //
5755
5756    public static void absdiff(Mat src1, Scalar src2, Mat dst) {
5757        absdiff_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
5758    }
5759
5760
5761    //
5762    // C++:  void cv::compare(Mat src1, Scalar src2, Mat& dst, int cmpop)
5763    //
5764
5765    public static void compare(Mat src1, Scalar src2, Mat dst, int cmpop) {
5766        compare_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, cmpop);
5767    }
5768
5769
5770    //
5771    // C++:  void cv::min(Mat src1, Scalar src2, Mat& dst)
5772    //
5773
5774    public static void min(Mat src1, Scalar src2, Mat dst) {
5775        min_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
5776    }
5777
5778
5779    //
5780    // C++:  void cv::max(Mat src1, Scalar src2, Mat& dst)
5781    //
5782
5783    public static void max(Mat src1, Scalar src2, Mat dst) {
5784        max_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
5785    }
5786
5787// manual port
5788public static class MinMaxLocResult {
5789    public double minVal;
5790    public double maxVal;
5791    public Point minLoc;
5792    public Point maxLoc;
5793
5794
5795    public MinMaxLocResult() {
5796        minVal=0; maxVal=0;
5797        minLoc=new Point();
5798        maxLoc=new Point();
5799    }
5800}
5801
5802
5803// C++: minMaxLoc(Mat src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray())
5804
5805
5806//javadoc: minMaxLoc(src, mask)
5807public static MinMaxLocResult minMaxLoc(Mat src, Mat mask) {
5808    MinMaxLocResult res = new MinMaxLocResult();
5809    long maskNativeObj=0;
5810    if (mask != null) {
5811        maskNativeObj=mask.nativeObj;
5812    }
5813    double resarr[] = n_minMaxLocManual(src.nativeObj, maskNativeObj);
5814    res.minVal=resarr[0];
5815    res.maxVal=resarr[1];
5816    res.minLoc.x=resarr[2];
5817    res.minLoc.y=resarr[3];
5818    res.maxLoc.x=resarr[4];
5819    res.maxLoc.y=resarr[5];
5820    return res;
5821}
5822
5823
5824//javadoc: minMaxLoc(src)
5825public static MinMaxLocResult minMaxLoc(Mat src) {
5826    return minMaxLoc(src, null);
5827}
5828
5829
5830    // C++:  float cv::cubeRoot(float val)
5831    private static native float cubeRoot_0(float val);
5832
5833    // C++:  float cv::fastAtan2(float y, float x)
5834    private static native float fastAtan2_0(float y, float x);
5835
5836    // C++:  bool cv::ipp::useIPP()
5837    private static native boolean useIPP_0();
5838
5839    // C++:  void cv::ipp::setUseIPP(bool flag)
5840    private static native void setUseIPP_0(boolean flag);
5841
5842    // C++:  String cv::ipp::getIppVersion()
5843    private static native String getIppVersion_0();
5844
5845    // C++:  bool cv::ipp::useIPP_NotExact()
5846    private static native boolean useIPP_NotExact_0();
5847
5848    // C++:  void cv::ipp::setUseIPP_NotExact(bool flag)
5849    private static native void setUseIPP_NotExact_0(boolean flag);
5850
5851    // C++:  int cv::borderInterpolate(int p, int len, int borderType)
5852    private static native int borderInterpolate_0(int p, int len, int borderType);
5853
5854    // C++:  void cv::copyMakeBorder(Mat src, Mat& dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar())
5855    private static native void copyMakeBorder_0(long src_nativeObj, long dst_nativeObj, int top, int bottom, int left, int right, int borderType, double value_val0, double value_val1, double value_val2, double value_val3);
5856    private static native void copyMakeBorder_1(long src_nativeObj, long dst_nativeObj, int top, int bottom, int left, int right, int borderType);
5857
5858    // C++:  void cv::add(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
5859    private static native void add_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj, int dtype);
5860    private static native void add_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
5861    private static native void add_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
5862
5863    // C++:  void cv::subtract(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
5864    private static native void subtract_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj, int dtype);
5865    private static native void subtract_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
5866    private static native void subtract_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
5867
5868    // C++:  void cv::multiply(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
5869    private static native void multiply_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale, int dtype);
5870    private static native void multiply_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale);
5871    private static native void multiply_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
5872
5873    // C++:  void cv::divide(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
5874    private static native void divide_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale, int dtype);
5875    private static native void divide_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale);
5876    private static native void divide_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
5877
5878    // C++:  void cv::divide(double scale, Mat src2, Mat& dst, int dtype = -1)
5879    private static native void divide_3(double scale, long src2_nativeObj, long dst_nativeObj, int dtype);
5880    private static native void divide_4(double scale, long src2_nativeObj, long dst_nativeObj);
5881
5882    // C++:  void cv::scaleAdd(Mat src1, double alpha, Mat src2, Mat& dst)
5883    private static native void scaleAdd_0(long src1_nativeObj, double alpha, long src2_nativeObj, long dst_nativeObj);
5884
5885    // C++:  void cv::addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat& dst, int dtype = -1)
5886    private static native void addWeighted_0(long src1_nativeObj, double alpha, long src2_nativeObj, double beta, double gamma, long dst_nativeObj, int dtype);
5887    private static native void addWeighted_1(long src1_nativeObj, double alpha, long src2_nativeObj, double beta, double gamma, long dst_nativeObj);
5888
5889    // C++:  void cv::convertScaleAbs(Mat src, Mat& dst, double alpha = 1, double beta = 0)
5890    private static native void convertScaleAbs_0(long src_nativeObj, long dst_nativeObj, double alpha, double beta);
5891    private static native void convertScaleAbs_1(long src_nativeObj, long dst_nativeObj, double alpha);
5892    private static native void convertScaleAbs_2(long src_nativeObj, long dst_nativeObj);
5893
5894    // C++:  void cv::convertFp16(Mat src, Mat& dst)
5895    private static native void convertFp16_0(long src_nativeObj, long dst_nativeObj);
5896
5897    // C++:  void cv::LUT(Mat src, Mat lut, Mat& dst)
5898    private static native void LUT_0(long src_nativeObj, long lut_nativeObj, long dst_nativeObj);
5899
5900    // C++:  Scalar cv::sum(Mat src)
5901    private static native double[] sumElems_0(long src_nativeObj);
5902
5903    // C++:  int cv::countNonZero(Mat src)
5904    private static native int countNonZero_0(long src_nativeObj);
5905
5906    // C++:  void cv::findNonZero(Mat src, Mat& idx)
5907    private static native void findNonZero_0(long src_nativeObj, long idx_nativeObj);
5908
5909    // C++:  Scalar cv::mean(Mat src, Mat mask = Mat())
5910    private static native double[] mean_0(long src_nativeObj, long mask_nativeObj);
5911    private static native double[] mean_1(long src_nativeObj);
5912
5913    // C++:  void cv::meanStdDev(Mat src, vector_double& mean, vector_double& stddev, Mat mask = Mat())
5914    private static native void meanStdDev_0(long src_nativeObj, long mean_mat_nativeObj, long stddev_mat_nativeObj, long mask_nativeObj);
5915    private static native void meanStdDev_1(long src_nativeObj, long mean_mat_nativeObj, long stddev_mat_nativeObj);
5916
5917    // C++:  double cv::norm(Mat src1, int normType = NORM_L2, Mat mask = Mat())
5918    private static native double norm_0(long src1_nativeObj, int normType, long mask_nativeObj);
5919    private static native double norm_1(long src1_nativeObj, int normType);
5920    private static native double norm_2(long src1_nativeObj);
5921
5922    // C++:  double cv::norm(Mat src1, Mat src2, int normType = NORM_L2, Mat mask = Mat())
5923    private static native double norm_3(long src1_nativeObj, long src2_nativeObj, int normType, long mask_nativeObj);
5924    private static native double norm_4(long src1_nativeObj, long src2_nativeObj, int normType);
5925    private static native double norm_5(long src1_nativeObj, long src2_nativeObj);
5926
5927    // C++:  double cv::PSNR(Mat src1, Mat src2, double R = 255.)
5928    private static native double PSNR_0(long src1_nativeObj, long src2_nativeObj, double R);
5929    private static native double PSNR_1(long src1_nativeObj, long src2_nativeObj);
5930
5931    // C++:  void cv::batchDistance(Mat src1, Mat src2, Mat& dist, int dtype, Mat& nidx, int normType = NORM_L2, int K = 0, Mat mask = Mat(), int update = 0, bool crosscheck = false)
5932    private static native void batchDistance_0(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K, long mask_nativeObj, int update, boolean crosscheck);
5933    private static native void batchDistance_1(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K, long mask_nativeObj, int update);
5934    private static native void batchDistance_2(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K, long mask_nativeObj);
5935    private static native void batchDistance_3(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K);
5936    private static native void batchDistance_4(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType);
5937    private static native void batchDistance_5(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj);
5938
5939    // C++:  void cv::normalize(Mat src, Mat& dst, double alpha = 1, double beta = 0, int norm_type = NORM_L2, int dtype = -1, Mat mask = Mat())
5940    private static native void normalize_0(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type, int dtype, long mask_nativeObj);
5941    private static native void normalize_1(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type, int dtype);
5942    private static native void normalize_2(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type);
5943    private static native void normalize_3(long src_nativeObj, long dst_nativeObj, double alpha, double beta);
5944    private static native void normalize_4(long src_nativeObj, long dst_nativeObj, double alpha);
5945    private static native void normalize_5(long src_nativeObj, long dst_nativeObj);
5946
5947    // C++:  void cv::reduceArgMin(Mat src, Mat& dst, int axis, bool lastIndex = false)
5948    private static native void reduceArgMin_0(long src_nativeObj, long dst_nativeObj, int axis, boolean lastIndex);
5949    private static native void reduceArgMin_1(long src_nativeObj, long dst_nativeObj, int axis);
5950
5951    // C++:  void cv::reduceArgMax(Mat src, Mat& dst, int axis, bool lastIndex = false)
5952    private static native void reduceArgMax_0(long src_nativeObj, long dst_nativeObj, int axis, boolean lastIndex);
5953    private static native void reduceArgMax_1(long src_nativeObj, long dst_nativeObj, int axis);
5954
5955    // C++:  void cv::reduce(Mat src, Mat& dst, int dim, int rtype, int dtype = -1)
5956    private static native void reduce_0(long src_nativeObj, long dst_nativeObj, int dim, int rtype, int dtype);
5957    private static native void reduce_1(long src_nativeObj, long dst_nativeObj, int dim, int rtype);
5958
5959    // C++:  void cv::merge(vector_Mat mv, Mat& dst)
5960    private static native void merge_0(long mv_mat_nativeObj, long dst_nativeObj);
5961
5962    // C++:  void cv::split(Mat m, vector_Mat& mv)
5963    private static native void split_0(long m_nativeObj, long mv_mat_nativeObj);
5964
5965    // C++:  void cv::mixChannels(vector_Mat src, vector_Mat dst, vector_int fromTo)
5966    private static native void mixChannels_0(long src_mat_nativeObj, long dst_mat_nativeObj, long fromTo_mat_nativeObj);
5967
5968    // C++:  void cv::extractChannel(Mat src, Mat& dst, int coi)
5969    private static native void extractChannel_0(long src_nativeObj, long dst_nativeObj, int coi);
5970
5971    // C++:  void cv::insertChannel(Mat src, Mat& dst, int coi)
5972    private static native void insertChannel_0(long src_nativeObj, long dst_nativeObj, int coi);
5973
5974    // C++:  void cv::flip(Mat src, Mat& dst, int flipCode)
5975    private static native void flip_0(long src_nativeObj, long dst_nativeObj, int flipCode);
5976
5977    // C++:  void cv::rotate(Mat src, Mat& dst, int rotateCode)
5978    private static native void rotate_0(long src_nativeObj, long dst_nativeObj, int rotateCode);
5979
5980    // C++:  void cv::repeat(Mat src, int ny, int nx, Mat& dst)
5981    private static native void repeat_0(long src_nativeObj, int ny, int nx, long dst_nativeObj);
5982
5983    // C++:  void cv::hconcat(vector_Mat src, Mat& dst)
5984    private static native void hconcat_0(long src_mat_nativeObj, long dst_nativeObj);
5985
5986    // C++:  void cv::vconcat(vector_Mat src, Mat& dst)
5987    private static native void vconcat_0(long src_mat_nativeObj, long dst_nativeObj);
5988
5989    // C++:  void cv::bitwise_and(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
5990    private static native void bitwise_and_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
5991    private static native void bitwise_and_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
5992
5993    // C++:  void cv::bitwise_or(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
5994    private static native void bitwise_or_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
5995    private static native void bitwise_or_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
5996
5997    // C++:  void cv::bitwise_xor(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
5998    private static native void bitwise_xor_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
5999    private static native void bitwise_xor_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
6000
6001    // C++:  void cv::bitwise_not(Mat src, Mat& dst, Mat mask = Mat())
6002    private static native void bitwise_not_0(long src_nativeObj, long dst_nativeObj, long mask_nativeObj);
6003    private static native void bitwise_not_1(long src_nativeObj, long dst_nativeObj);
6004
6005    // C++:  void cv::absdiff(Mat src1, Mat src2, Mat& dst)
6006    private static native void absdiff_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
6007
6008    // C++:  void cv::copyTo(Mat src, Mat& dst, Mat mask)
6009    private static native void copyTo_0(long src_nativeObj, long dst_nativeObj, long mask_nativeObj);
6010
6011    // C++:  void cv::inRange(Mat src, Scalar lowerb, Scalar upperb, Mat& dst)
6012    private static native void inRange_0(long src_nativeObj, double lowerb_val0, double lowerb_val1, double lowerb_val2, double lowerb_val3, double upperb_val0, double upperb_val1, double upperb_val2, double upperb_val3, long dst_nativeObj);
6013
6014    // C++:  void cv::compare(Mat src1, Mat src2, Mat& dst, int cmpop)
6015    private static native void compare_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, int cmpop);
6016
6017    // C++:  void cv::min(Mat src1, Mat src2, Mat& dst)
6018    private static native void min_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
6019
6020    // C++:  void cv::max(Mat src1, Mat src2, Mat& dst)
6021    private static native void max_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
6022
6023    // C++:  void cv::sqrt(Mat src, Mat& dst)
6024    private static native void sqrt_0(long src_nativeObj, long dst_nativeObj);
6025
6026    // C++:  void cv::pow(Mat src, double power, Mat& dst)
6027    private static native void pow_0(long src_nativeObj, double power, long dst_nativeObj);
6028
6029    // C++:  void cv::exp(Mat src, Mat& dst)
6030    private static native void exp_0(long src_nativeObj, long dst_nativeObj);
6031
6032    // C++:  void cv::log(Mat src, Mat& dst)
6033    private static native void log_0(long src_nativeObj, long dst_nativeObj);
6034
6035    // C++:  void cv::polarToCart(Mat magnitude, Mat angle, Mat& x, Mat& y, bool angleInDegrees = false)
6036    private static native void polarToCart_0(long magnitude_nativeObj, long angle_nativeObj, long x_nativeObj, long y_nativeObj, boolean angleInDegrees);
6037    private static native void polarToCart_1(long magnitude_nativeObj, long angle_nativeObj, long x_nativeObj, long y_nativeObj);
6038
6039    // C++:  void cv::cartToPolar(Mat x, Mat y, Mat& magnitude, Mat& angle, bool angleInDegrees = false)
6040    private static native void cartToPolar_0(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj, long angle_nativeObj, boolean angleInDegrees);
6041    private static native void cartToPolar_1(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj, long angle_nativeObj);
6042
6043    // C++:  void cv::phase(Mat x, Mat y, Mat& angle, bool angleInDegrees = false)
6044    private static native void phase_0(long x_nativeObj, long y_nativeObj, long angle_nativeObj, boolean angleInDegrees);
6045    private static native void phase_1(long x_nativeObj, long y_nativeObj, long angle_nativeObj);
6046
6047    // C++:  void cv::magnitude(Mat x, Mat y, Mat& magnitude)
6048    private static native void magnitude_0(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj);
6049
6050    // C++:  bool cv::checkRange(Mat a, bool quiet = true,  _hidden_ * pos = 0, double minVal = -DBL_MAX, double maxVal = DBL_MAX)
6051    private static native boolean checkRange_0(long a_nativeObj, boolean quiet, double minVal, double maxVal);
6052    private static native boolean checkRange_1(long a_nativeObj, boolean quiet, double minVal);
6053    private static native boolean checkRange_2(long a_nativeObj, boolean quiet);
6054    private static native boolean checkRange_4(long a_nativeObj);
6055
6056    // C++:  void cv::patchNaNs(Mat& a, double val = 0)
6057    private static native void patchNaNs_0(long a_nativeObj, double val);
6058    private static native void patchNaNs_1(long a_nativeObj);
6059
6060    // C++:  void cv::gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat& dst, int flags = 0)
6061    private static native void gemm_0(long src1_nativeObj, long src2_nativeObj, double alpha, long src3_nativeObj, double beta, long dst_nativeObj, int flags);
6062    private static native void gemm_1(long src1_nativeObj, long src2_nativeObj, double alpha, long src3_nativeObj, double beta, long dst_nativeObj);
6063
6064    // C++:  void cv::mulTransposed(Mat src, Mat& dst, bool aTa, Mat delta = Mat(), double scale = 1, int dtype = -1)
6065    private static native void mulTransposed_0(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj, double scale, int dtype);
6066    private static native void mulTransposed_1(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj, double scale);
6067    private static native void mulTransposed_2(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj);
6068    private static native void mulTransposed_3(long src_nativeObj, long dst_nativeObj, boolean aTa);
6069
6070    // C++:  void cv::transpose(Mat src, Mat& dst)
6071    private static native void transpose_0(long src_nativeObj, long dst_nativeObj);
6072
6073    // C++:  void cv::transposeND(Mat src, vector_int order, Mat& dst)
6074    private static native void transposeND_0(long src_nativeObj, long order_mat_nativeObj, long dst_nativeObj);
6075
6076    // C++:  void cv::transform(Mat src, Mat& dst, Mat m)
6077    private static native void transform_0(long src_nativeObj, long dst_nativeObj, long m_nativeObj);
6078
6079    // C++:  void cv::perspectiveTransform(Mat src, Mat& dst, Mat m)
6080    private static native void perspectiveTransform_0(long src_nativeObj, long dst_nativeObj, long m_nativeObj);
6081
6082    // C++:  void cv::completeSymm(Mat& m, bool lowerToUpper = false)
6083    private static native void completeSymm_0(long m_nativeObj, boolean lowerToUpper);
6084    private static native void completeSymm_1(long m_nativeObj);
6085
6086    // C++:  void cv::setIdentity(Mat& mtx, Scalar s = Scalar(1))
6087    private static native void setIdentity_0(long mtx_nativeObj, double s_val0, double s_val1, double s_val2, double s_val3);
6088    private static native void setIdentity_1(long mtx_nativeObj);
6089
6090    // C++:  double cv::determinant(Mat mtx)
6091    private static native double determinant_0(long mtx_nativeObj);
6092
6093    // C++:  Scalar cv::trace(Mat mtx)
6094    private static native double[] trace_0(long mtx_nativeObj);
6095
6096    // C++:  double cv::invert(Mat src, Mat& dst, int flags = DECOMP_LU)
6097    private static native double invert_0(long src_nativeObj, long dst_nativeObj, int flags);
6098    private static native double invert_1(long src_nativeObj, long dst_nativeObj);
6099
6100    // C++:  bool cv::solve(Mat src1, Mat src2, Mat& dst, int flags = DECOMP_LU)
6101    private static native boolean solve_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, int flags);
6102    private static native boolean solve_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
6103
6104    // C++:  void cv::sort(Mat src, Mat& dst, int flags)
6105    private static native void sort_0(long src_nativeObj, long dst_nativeObj, int flags);
6106
6107    // C++:  void cv::sortIdx(Mat src, Mat& dst, int flags)
6108    private static native void sortIdx_0(long src_nativeObj, long dst_nativeObj, int flags);
6109
6110    // C++:  int cv::solveCubic(Mat coeffs, Mat& roots)
6111    private static native int solveCubic_0(long coeffs_nativeObj, long roots_nativeObj);
6112
6113    // C++:  double cv::solvePoly(Mat coeffs, Mat& roots, int maxIters = 300)
6114    private static native double solvePoly_0(long coeffs_nativeObj, long roots_nativeObj, int maxIters);
6115    private static native double solvePoly_1(long coeffs_nativeObj, long roots_nativeObj);
6116
6117    // C++:  bool cv::eigen(Mat src, Mat& eigenvalues, Mat& eigenvectors = Mat())
6118    private static native boolean eigen_0(long src_nativeObj, long eigenvalues_nativeObj, long eigenvectors_nativeObj);
6119    private static native boolean eigen_1(long src_nativeObj, long eigenvalues_nativeObj);
6120
6121    // C++:  void cv::eigenNonSymmetric(Mat src, Mat& eigenvalues, Mat& eigenvectors)
6122    private static native void eigenNonSymmetric_0(long src_nativeObj, long eigenvalues_nativeObj, long eigenvectors_nativeObj);
6123
6124    // C++:  void cv::calcCovarMatrix(Mat samples, Mat& covar, Mat& mean, int flags, int ctype = CV_64F)
6125    private static native void calcCovarMatrix_0(long samples_nativeObj, long covar_nativeObj, long mean_nativeObj, int flags, int ctype);
6126    private static native void calcCovarMatrix_1(long samples_nativeObj, long covar_nativeObj, long mean_nativeObj, int flags);
6127
6128    // C++:  void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, int maxComponents = 0)
6129    private static native void PCACompute_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, int maxComponents);
6130    private static native void PCACompute_1(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj);
6131
6132    // C++:  void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, int maxComponents = 0)
6133    private static native void PCACompute2_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj, int maxComponents);
6134    private static native void PCACompute2_1(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj);
6135
6136    // C++:  void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, double retainedVariance)
6137    private static native void PCACompute_2(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, double retainedVariance);
6138
6139    // C++:  void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, double retainedVariance)
6140    private static native void PCACompute2_2(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj, double retainedVariance);
6141
6142    // C++:  void cv::PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
6143    private static native void PCAProject_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long result_nativeObj);
6144
6145    // C++:  void cv::PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
6146    private static native void PCABackProject_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long result_nativeObj);
6147
6148    // C++:  void cv::SVDecomp(Mat src, Mat& w, Mat& u, Mat& vt, int flags = 0)
6149    private static native void SVDecomp_0(long src_nativeObj, long w_nativeObj, long u_nativeObj, long vt_nativeObj, int flags);
6150    private static native void SVDecomp_1(long src_nativeObj, long w_nativeObj, long u_nativeObj, long vt_nativeObj);
6151
6152    // C++:  void cv::SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat& dst)
6153    private static native void SVBackSubst_0(long w_nativeObj, long u_nativeObj, long vt_nativeObj, long rhs_nativeObj, long dst_nativeObj);
6154
6155    // C++:  double cv::Mahalanobis(Mat v1, Mat v2, Mat icovar)
6156    private static native double Mahalanobis_0(long v1_nativeObj, long v2_nativeObj, long icovar_nativeObj);
6157
6158    // C++:  void cv::dft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
6159    private static native void dft_0(long src_nativeObj, long dst_nativeObj, int flags, int nonzeroRows);
6160    private static native void dft_1(long src_nativeObj, long dst_nativeObj, int flags);
6161    private static native void dft_2(long src_nativeObj, long dst_nativeObj);
6162
6163    // C++:  void cv::idft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
6164    private static native void idft_0(long src_nativeObj, long dst_nativeObj, int flags, int nonzeroRows);
6165    private static native void idft_1(long src_nativeObj, long dst_nativeObj, int flags);
6166    private static native void idft_2(long src_nativeObj, long dst_nativeObj);
6167
6168    // C++:  void cv::dct(Mat src, Mat& dst, int flags = 0)
6169    private static native void dct_0(long src_nativeObj, long dst_nativeObj, int flags);
6170    private static native void dct_1(long src_nativeObj, long dst_nativeObj);
6171
6172    // C++:  void cv::idct(Mat src, Mat& dst, int flags = 0)
6173    private static native void idct_0(long src_nativeObj, long dst_nativeObj, int flags);
6174    private static native void idct_1(long src_nativeObj, long dst_nativeObj);
6175
6176    // C++:  void cv::mulSpectrums(Mat a, Mat b, Mat& c, int flags, bool conjB = false)
6177    private static native void mulSpectrums_0(long a_nativeObj, long b_nativeObj, long c_nativeObj, int flags, boolean conjB);
6178    private static native void mulSpectrums_1(long a_nativeObj, long b_nativeObj, long c_nativeObj, int flags);
6179
6180    // C++:  int cv::getOptimalDFTSize(int vecsize)
6181    private static native int getOptimalDFTSize_0(int vecsize);
6182
6183    // C++:  void cv::setRNGSeed(int seed)
6184    private static native void setRNGSeed_0(int seed);
6185
6186    // C++:  void cv::randu(Mat& dst, double low, double high)
6187    private static native void randu_0(long dst_nativeObj, double low, double high);
6188
6189    // C++:  void cv::randn(Mat& dst, double mean, double stddev)
6190    private static native void randn_0(long dst_nativeObj, double mean, double stddev);
6191
6192    // C++:  void cv::randShuffle(Mat& dst, double iterFactor = 1., RNG* rng = 0)
6193    private static native void randShuffle_0(long dst_nativeObj, double iterFactor);
6194    private static native void randShuffle_2(long dst_nativeObj);
6195
6196    // C++:  double cv::kmeans(Mat data, int K, Mat& bestLabels, TermCriteria criteria, int attempts, int flags, Mat& centers = Mat())
6197    private static native double kmeans_0(long data_nativeObj, int K, long bestLabels_nativeObj, int criteria_type, int criteria_maxCount, double criteria_epsilon, int attempts, int flags, long centers_nativeObj);
6198    private static native double kmeans_1(long data_nativeObj, int K, long bestLabels_nativeObj, int criteria_type, int criteria_maxCount, double criteria_epsilon, int attempts, int flags);
6199
6200    // C++:  void cv::setNumThreads(int nthreads)
6201    private static native void setNumThreads_0(int nthreads);
6202
6203    // C++:  int cv::getNumThreads()
6204    private static native int getNumThreads_0();
6205
6206    // C++:  int cv::getThreadNum()
6207    private static native int getThreadNum_0();
6208
6209    // C++:  String cv::getBuildInformation()
6210    private static native String getBuildInformation_0();
6211
6212    // C++:  String cv::getVersionString()
6213    private static native String getVersionString_0();
6214
6215    // C++:  int cv::getVersionMajor()
6216    private static native int getVersionMajor_0();
6217
6218    // C++:  int cv::getVersionMinor()
6219    private static native int getVersionMinor_0();
6220
6221    // C++:  int cv::getVersionRevision()
6222    private static native int getVersionRevision_0();
6223
6224    // C++:  int64 cv::getTickCount()
6225    private static native long getTickCount_0();
6226
6227    // C++:  double cv::getTickFrequency()
6228    private static native double getTickFrequency_0();
6229
6230    // C++:  int64 cv::getCPUTickCount()
6231    private static native long getCPUTickCount_0();
6232
6233    // C++:  String cv::getHardwareFeatureName(int feature)
6234    private static native String getHardwareFeatureName_0(int feature);
6235
6236    // C++:  string cv::getCPUFeaturesLine()
6237    private static native String getCPUFeaturesLine_0();
6238
6239    // C++:  int cv::getNumberOfCPUs()
6240    private static native int getNumberOfCPUs_0();
6241
6242    // C++:  String cv::samples::findFile(String relative_path, bool required = true, bool silentMode = false)
6243    private static native String findFile_0(String relative_path, boolean required, boolean silentMode);
6244    private static native String findFile_1(String relative_path, boolean required);
6245    private static native String findFile_2(String relative_path);
6246
6247    // C++:  String cv::samples::findFileOrKeep(String relative_path, bool silentMode = false)
6248    private static native String findFileOrKeep_0(String relative_path, boolean silentMode);
6249    private static native String findFileOrKeep_1(String relative_path);
6250
6251    // C++:  void cv::samples::addSamplesDataSearchPath(String path)
6252    private static native void addSamplesDataSearchPath_0(String path);
6253
6254    // C++:  void cv::samples::addSamplesDataSearchSubDirectory(String subdir)
6255    private static native void addSamplesDataSearchSubDirectory_0(String subdir);
6256
6257    // C++:  void cv::setErrorVerbosity(bool verbose)
6258    private static native void setErrorVerbosity_0(boolean verbose);
6259
6260    // C++:  void cv::add(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
6261    private static native void add_3(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, long mask_nativeObj, int dtype);
6262    private static native void add_4(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, long mask_nativeObj);
6263    private static native void add_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
6264
6265    // C++:  void cv::subtract(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
6266    private static native void subtract_3(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, long mask_nativeObj, int dtype);
6267    private static native void subtract_4(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, long mask_nativeObj);
6268    private static native void subtract_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
6269
6270    // C++:  void cv::multiply(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
6271    private static native void multiply_3(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, double scale, int dtype);
6272    private static native void multiply_4(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, double scale);
6273    private static native void multiply_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
6274
6275    // C++:  void cv::divide(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
6276    private static native void divide_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, double scale, int dtype);
6277    private static native void divide_6(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, double scale);
6278    private static native void divide_7(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
6279
6280    // C++:  void cv::absdiff(Mat src1, Scalar src2, Mat& dst)
6281    private static native void absdiff_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
6282
6283    // C++:  void cv::compare(Mat src1, Scalar src2, Mat& dst, int cmpop)
6284    private static native void compare_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, int cmpop);
6285
6286    // C++:  void cv::min(Mat src1, Scalar src2, Mat& dst)
6287    private static native void min_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
6288
6289    // C++:  void cv::max(Mat src1, Scalar src2, Mat& dst)
6290    private static native void max_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
6291private static native double[] n_minMaxLocManual(long src_nativeObj, long mask_nativeObj);
6292
6293}