FocusModes = params.getSupportedFocusModes();
+ if (FocusModes != null && FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO))
+ {
+ params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
+ }
+
+ mCamera.setParameters(params);
+ params = mCamera.getParameters();
+
+ mFrameWidth = params.getPreviewSize().width;
+ mFrameHeight = params.getPreviewSize().height;
+
+ if ((getLayoutParams().width == LayoutParams.MATCH_PARENT) && (getLayoutParams().height == LayoutParams.MATCH_PARENT))
+ mScale = Math.min(((float)height)/mFrameHeight, ((float)width)/mFrameWidth);
+ else
+ mScale = 0;
+
+ if (mFpsMeter != null) {
+ mFpsMeter.setResolution(mFrameWidth, mFrameHeight);
+ }
+
+ int size = mFrameWidth * mFrameHeight;
+ size = size * ImageFormat.getBitsPerPixel(params.getPreviewFormat()) / 8;
+ mBuffer = new byte[size];
+
+ mCamera.addCallbackBuffer(mBuffer);
+ mCamera.setPreviewCallbackWithBuffer(this);
+
+ mFrameChain = new Mat[2];
+ mFrameChain[0] = new Mat(mFrameHeight + (mFrameHeight/2), mFrameWidth, CvType.CV_8UC1);
+ mFrameChain[1] = new Mat(mFrameHeight + (mFrameHeight/2), mFrameWidth, CvType.CV_8UC1);
+
+ AllocateCache();
+
+ mCameraFrame = new JavaCameraFrame[2];
+ mCameraFrame[0] = new JavaCameraFrame(mFrameChain[0], mFrameWidth, mFrameHeight);
+ mCameraFrame[1] = new JavaCameraFrame(mFrameChain[1], mFrameWidth, mFrameHeight);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ mSurfaceTexture = new SurfaceTexture(MAGIC_TEXTURE_ID);
+ mCamera.setPreviewTexture(mSurfaceTexture);
+ } else
+ mCamera.setPreviewDisplay(null);
+
+ /* Finally we are ready to start the preview */
+ Log.d(TAG, "startPreview");
+ mCamera.startPreview();
+ }
+ else
+ result = false;
+ } catch (Exception e) {
+ result = false;
+ e.printStackTrace();
+ }
+ }
+
+ return result;
+ }
+
+ protected void releaseCamera() {
+ synchronized (this) {
+ if (mCamera != null) {
+ mCamera.stopPreview();
+ mCamera.setPreviewCallback(null);
+
+ mCamera.release();
+ }
+ mCamera = null;
+ if (mFrameChain != null) {
+ mFrameChain[0].release();
+ mFrameChain[1].release();
+ }
+ if (mCameraFrame != null) {
+ mCameraFrame[0].release();
+ mCameraFrame[1].release();
+ }
+ }
+ }
+
+ private boolean mCameraFrameReady = false;
+
+ @Override
+ protected boolean connectCamera(int width, int height) {
+
+ /* 1. We need to instantiate camera
+ * 2. We need to start thread which will be getting frames
+ */
+ /* First step - initialize camera connection */
+ Log.d(TAG, "Connecting to camera");
+ if (!initializeCamera(width, height))
+ return false;
+
+ mCameraFrameReady = false;
+
+ /* now we can start update thread */
+ Log.d(TAG, "Starting processing thread");
+ mStopThread = false;
+ mThread = new Thread(new CameraWorker());
+ mThread.start();
+
+ return true;
+ }
+
+ @Override
+ protected void disconnectCamera() {
+ /* 1. We need to stop thread which updating the frames
+ * 2. Stop camera and release it
+ */
+ Log.d(TAG, "Disconnecting from camera");
+ try {
+ mStopThread = true;
+ Log.d(TAG, "Notify thread");
+ synchronized (this) {
+ this.notify();
+ }
+ Log.d(TAG, "Waiting for thread");
+ if (mThread != null)
+ mThread.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } finally {
+ mThread = null;
+ }
+
+ /* Now release camera */
+ releaseCamera();
+
+ mCameraFrameReady = false;
+ }
+
+ @Override
+ public void onPreviewFrame(byte[] frame, Camera arg1) {
+ if (BuildConfig.DEBUG)
+ Log.d(TAG, "Preview Frame received. Frame size: " + frame.length);
+ synchronized (this) {
+ mFrameChain[mChainIdx].put(0, 0, frame);
+ mCameraFrameReady = true;
+ this.notify();
+ }
+ if (mCamera != null)
+ mCamera.addCallbackBuffer(mBuffer);
+ }
+
+ private class JavaCameraFrame implements CvCameraViewFrame {
+ @Override
+ public Mat gray() {
+ return mYuvFrameData.submat(0, mHeight, 0, mWidth);
+ }
+
+ @Override
+ public Mat rgba() {
+ if (mPreviewFormat == ImageFormat.NV21)
+ Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGBA_NV21, 4);
+ else if (mPreviewFormat == ImageFormat.YV12)
+ Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGB_I420, 4); // COLOR_YUV2RGBA_YV12 produces inverted colors
+ else
+ throw new IllegalArgumentException("Preview Format can be NV21 or YV12");
+
+ return mRgba;
+ }
+
+ public JavaCameraFrame(Mat Yuv420sp, int width, int height) {
+ super();
+ mWidth = width;
+ mHeight = height;
+ mYuvFrameData = Yuv420sp;
+ mRgba = new Mat();
+ }
+
+ public void release() {
+ mRgba.release();
+ }
+
+ private Mat mYuvFrameData;
+ private Mat mRgba;
+ private int mWidth;
+ private int mHeight;
+ };
+
+ private class CameraWorker implements Runnable {
+
+ @Override
+ public void run() {
+ do {
+ boolean hasFrame = false;
+ synchronized (JavaCameraView.this) {
+ try {
+ while (!mCameraFrameReady && !mStopThread) {
+ JavaCameraView.this.wait();
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ if (mCameraFrameReady)
+ {
+ mChainIdx = 1 - mChainIdx;
+ mCameraFrameReady = false;
+ hasFrame = true;
+ }
+ }
+
+ if (!mStopThread && hasFrame) {
+ if (!mFrameChain[1 - mChainIdx].empty())
+ deliverAndDrawFrame(mCameraFrame[1 - mChainIdx]);
+ }
+ } while (!mStopThread);
+ Log.d(TAG, "Finish processing thread");
+ }
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/android/LoaderCallbackInterface.java b/openCVLibrary3413/src/main/java/org/opencv/android/LoaderCallbackInterface.java
new file mode 100644
index 0000000..a941e83
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/android/LoaderCallbackInterface.java
@@ -0,0 +1,40 @@
+package org.opencv.android;
+
+/**
+ * Interface for callback object in case of asynchronous initialization of OpenCV.
+ */
+public interface LoaderCallbackInterface
+{
+ /**
+ * OpenCV initialization finished successfully.
+ */
+ static final int SUCCESS = 0;
+ /**
+ * Google Play Market cannot be invoked.
+ */
+ static final int MARKET_ERROR = 2;
+ /**
+ * OpenCV library installation has been canceled by the user.
+ */
+ static final int INSTALL_CANCELED = 3;
+ /**
+ * This version of OpenCV Manager Service is incompatible with the app. Possibly, a service update is required.
+ */
+ static final int INCOMPATIBLE_MANAGER_VERSION = 4;
+ /**
+ * OpenCV library initialization has failed.
+ */
+ static final int INIT_FAILED = 0xff;
+
+ /**
+ * Callback method, called after OpenCV library initialization.
+ * @param status status of initialization (see initialization status constants).
+ */
+ public void onManagerConnected(int status);
+
+ /**
+ * Callback method, called in case the package installation is needed.
+ * @param callback answer object with approve and cancel methods and the package description.
+ */
+ public void onPackageInstall(final int operation, InstallCallbackInterface callback);
+};
diff --git a/openCVLibrary3413/src/main/java/org/opencv/android/OpenCVLoader.java b/openCVLibrary3413/src/main/java/org/opencv/android/OpenCVLoader.java
new file mode 100644
index 0000000..47b19a8
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/android/OpenCVLoader.java
@@ -0,0 +1,132 @@
+package org.opencv.android;
+
+import android.content.Context;
+
+/**
+ * Helper class provides common initialization methods for OpenCV library.
+ */
+public class OpenCVLoader
+{
+ /**
+ * OpenCV Library version 2.4.2.
+ */
+ public static final String OPENCV_VERSION_2_4_2 = "2.4.2";
+
+ /**
+ * OpenCV Library version 2.4.3.
+ */
+ public static final String OPENCV_VERSION_2_4_3 = "2.4.3";
+
+ /**
+ * OpenCV Library version 2.4.4.
+ */
+ public static final String OPENCV_VERSION_2_4_4 = "2.4.4";
+
+ /**
+ * OpenCV Library version 2.4.5.
+ */
+ public static final String OPENCV_VERSION_2_4_5 = "2.4.5";
+
+ /**
+ * OpenCV Library version 2.4.6.
+ */
+ public static final String OPENCV_VERSION_2_4_6 = "2.4.6";
+
+ /**
+ * OpenCV Library version 2.4.7.
+ */
+ public static final String OPENCV_VERSION_2_4_7 = "2.4.7";
+
+ /**
+ * OpenCV Library version 2.4.8.
+ */
+ public static final String OPENCV_VERSION_2_4_8 = "2.4.8";
+
+ /**
+ * OpenCV Library version 2.4.9.
+ */
+ public static final String OPENCV_VERSION_2_4_9 = "2.4.9";
+
+ /**
+ * OpenCV Library version 2.4.10.
+ */
+ public static final String OPENCV_VERSION_2_4_10 = "2.4.10";
+
+ /**
+ * OpenCV Library version 2.4.11.
+ */
+ public static final String OPENCV_VERSION_2_4_11 = "2.4.11";
+
+ /**
+ * OpenCV Library version 2.4.12.
+ */
+ public static final String OPENCV_VERSION_2_4_12 = "2.4.12";
+
+ /**
+ * OpenCV Library version 2.4.13.
+ */
+ public static final String OPENCV_VERSION_2_4_13 = "2.4.13";
+
+ /**
+ * OpenCV Library version 3.0.0.
+ */
+ public static final String OPENCV_VERSION_3_0_0 = "3.0.0";
+
+ /**
+ * OpenCV Library version 3.1.0.
+ */
+ public static final String OPENCV_VERSION_3_1_0 = "3.1.0";
+
+ /**
+ * OpenCV Library version 3.2.0.
+ */
+ public static final String OPENCV_VERSION_3_2_0 = "3.2.0";
+
+ /**
+ * OpenCV Library version 3.3.0.
+ */
+ public static final String OPENCV_VERSION_3_3_0 = "3.3.0";
+
+ /**
+ * OpenCV Library version 3.4.0.
+ */
+ public static final String OPENCV_VERSION_3_4_0 = "3.4.0";
+
+ /**
+ * Current OpenCV Library version
+ */
+ public static final String OPENCV_VERSION = "3.4.13";
+
+
+ /**
+ * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
+ * @return Returns true is initialization of OpenCV was successful.
+ */
+ public static boolean initDebug()
+ {
+ return StaticHelper.initOpenCV(false);
+ }
+
+ /**
+ * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
+ * @param InitCuda load and initialize CUDA runtime libraries.
+ * @return Returns true is initialization of OpenCV was successful.
+ */
+ public static boolean initDebug(boolean InitCuda)
+ {
+ return StaticHelper.initOpenCV(InitCuda);
+ }
+
+ /**
+ * Loads and initializes OpenCV library using OpenCV Engine service.
+ * @param Version OpenCV library version.
+ * @param AppContext application context for connecting to the service.
+ * @param Callback object, that implements LoaderCallbackInterface for handling the connection status.
+ * @return Returns true if initialization of OpenCV is successful.
+ */
+ public static boolean initAsync(String Version, Context AppContext,
+ LoaderCallbackInterface Callback)
+ {
+ return AsyncServiceHelper.initOpenCV(Version, AppContext, Callback);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/android/StaticHelper.java b/openCVLibrary3413/src/main/java/org/opencv/android/StaticHelper.java
new file mode 100644
index 0000000..f670d93
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/android/StaticHelper.java
@@ -0,0 +1,104 @@
+package org.opencv.android;
+
+import org.opencv.core.Core;
+
+import java.util.StringTokenizer;
+import android.util.Log;
+
+class StaticHelper {
+
+ public static boolean initOpenCV(boolean InitCuda)
+ {
+ boolean result;
+ String libs = "";
+
+ if(InitCuda)
+ {
+ loadLibrary("cudart");
+ loadLibrary("nppc");
+ loadLibrary("nppi");
+ loadLibrary("npps");
+ loadLibrary("cufft");
+ loadLibrary("cublas");
+ }
+
+ Log.d(TAG, "Trying to get library list");
+
+ try
+ {
+ System.loadLibrary("opencv_info");
+ libs = getLibraryList();
+ }
+ catch(UnsatisfiedLinkError e)
+ {
+ Log.e(TAG, "OpenCV error: Cannot load info library for OpenCV");
+ }
+
+ Log.d(TAG, "Library list: \"" + libs + "\"");
+ Log.d(TAG, "First attempt to load libs");
+ if (initOpenCVLibs(libs))
+ {
+ Log.d(TAG, "First attempt to load libs is OK");
+ String eol = System.getProperty("line.separator");
+ for (String str : Core.getBuildInformation().split(eol))
+ Log.i(TAG, str);
+
+ result = true;
+ }
+ else
+ {
+ Log.d(TAG, "First attempt to load libs fails");
+ result = false;
+ }
+
+ return result;
+ }
+
+ private static boolean loadLibrary(String Name)
+ {
+ boolean result = true;
+
+ Log.d(TAG, "Trying to load library " + Name);
+ try
+ {
+ System.loadLibrary(Name);
+ Log.d(TAG, "Library " + Name + " loaded");
+ }
+ catch(UnsatisfiedLinkError e)
+ {
+ Log.d(TAG, "Cannot load library \"" + Name + "\"");
+ e.printStackTrace();
+ result = false;
+ }
+
+ return result;
+ }
+
+ private static boolean initOpenCVLibs(String Libs)
+ {
+ Log.d(TAG, "Trying to init OpenCV libs");
+
+ boolean result = true;
+
+ if ((null != Libs) && (Libs.length() != 0))
+ {
+ Log.d(TAG, "Trying to load libs by dependency list");
+ StringTokenizer splitter = new StringTokenizer(Libs, ";");
+ while(splitter.hasMoreTokens())
+ {
+ result &= loadLibrary(splitter.nextToken());
+ }
+ }
+ else
+ {
+ // If dependencies list is not defined or empty.
+ result = loadLibrary("opencv_java3");
+ }
+
+ return result;
+ }
+
+ private static final String TAG = "OpenCV/StaticHelper";
+
+ private static native String getLibraryList();
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/android/Utils.java b/openCVLibrary3413/src/main/java/org/opencv/android/Utils.java
new file mode 100644
index 0000000..eef4c45
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/android/Utils.java
@@ -0,0 +1,139 @@
+package org.opencv.android;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+
+import org.opencv.core.CvException;
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+import org.opencv.imgcodecs.Imgcodecs;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class Utils {
+
+ public static String exportResource(Context context, int resourceId) {
+ return exportResource(context, resourceId, "OpenCV_data");
+ }
+
+ public static String exportResource(Context context, int resourceId, String dirname) {
+ String fullname = context.getResources().getString(resourceId);
+ String resName = fullname.substring(fullname.lastIndexOf("/") + 1);
+ try {
+ InputStream is = context.getResources().openRawResource(resourceId);
+ File resDir = context.getDir(dirname, Context.MODE_PRIVATE);
+ File resFile = new File(resDir, resName);
+
+ FileOutputStream os = new FileOutputStream(resFile);
+
+ byte[] buffer = new byte[4096];
+ int bytesRead;
+ while ((bytesRead = is.read(buffer)) != -1) {
+ os.write(buffer, 0, bytesRead);
+ }
+ is.close();
+ os.close();
+
+ return resFile.getAbsolutePath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new CvException("Failed to export resource " + resName
+ + ". Exception thrown: " + e);
+ }
+ }
+
+ public static Mat loadResource(Context context, int resourceId) throws IOException
+ {
+ return loadResource(context, resourceId, -1);
+ }
+
+ public static Mat loadResource(Context context, int resourceId, int flags) throws IOException
+ {
+ InputStream is = context.getResources().openRawResource(resourceId);
+ ByteArrayOutputStream os = new ByteArrayOutputStream(is.available());
+
+ byte[] buffer = new byte[4096];
+ int bytesRead;
+ while ((bytesRead = is.read(buffer)) != -1) {
+ os.write(buffer, 0, bytesRead);
+ }
+ is.close();
+
+ Mat encoded = new Mat(1, os.size(), CvType.CV_8U);
+ encoded.put(0, 0, os.toByteArray());
+ os.close();
+
+ Mat decoded = Imgcodecs.imdecode(encoded, flags);
+ encoded.release();
+
+ return decoded;
+ }
+
+ /**
+ * Converts Android Bitmap to OpenCV Mat.
+ *
+ * This function converts an Android Bitmap image to the OpenCV Mat.
+ *
'ARGB_8888' and 'RGB_565' input Bitmap formats are supported.
+ *
The output Mat is always created of the same size as the input Bitmap and of the 'CV_8UC4' type,
+ * it keeps the image in RGBA format.
+ *
This function throws an exception if the conversion fails.
+ * @param bmp is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.
+ * @param mat is a valid output Mat object, it will be reallocated if needed, so it may be empty.
+ * @param unPremultiplyAlpha is a flag, that determines, whether the bitmap needs to be converted from alpha premultiplied format (like Android keeps 'ARGB_8888' ones) to regular one; this flag is ignored for 'RGB_565' bitmaps.
+ */
+ public static void bitmapToMat(Bitmap bmp, Mat mat, boolean unPremultiplyAlpha) {
+ if (bmp == null)
+ throw new IllegalArgumentException("bmp == null");
+ if (mat == null)
+ throw new IllegalArgumentException("mat == null");
+ nBitmapToMat2(bmp, mat.nativeObj, unPremultiplyAlpha);
+ }
+
+ /**
+ * Short form of the bitmapToMat(bmp, mat, unPremultiplyAlpha=false).
+ * @param bmp is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.
+ * @param mat is a valid output Mat object, it will be reallocated if needed, so Mat may be empty.
+ */
+ public static void bitmapToMat(Bitmap bmp, Mat mat) {
+ bitmapToMat(bmp, mat, false);
+ }
+
+
+ /**
+ * Converts OpenCV Mat to Android Bitmap.
+ *
+ *
This function converts an image in the OpenCV Mat representation to the Android Bitmap.
+ *
The input Mat object has to be of the types 'CV_8UC1' (gray-scale), 'CV_8UC3' (RGB) or 'CV_8UC4' (RGBA).
+ *
The output Bitmap object has to be of the same size as the input Mat and of the types 'ARGB_8888' or 'RGB_565'.
+ *
This function throws an exception if the conversion fails.
+ *
+ * @param mat is a valid input Mat object of types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.
+ * @param bmp is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.
+ * @param premultiplyAlpha is a flag, that determines, whether the Mat needs to be converted to alpha premultiplied format (like Android keeps 'ARGB_8888' bitmaps); the flag is ignored for 'RGB_565' bitmaps.
+ */
+ public static void matToBitmap(Mat mat, Bitmap bmp, boolean premultiplyAlpha) {
+ if (mat == null)
+ throw new IllegalArgumentException("mat == null");
+ if (bmp == null)
+ throw new IllegalArgumentException("bmp == null");
+ nMatToBitmap2(mat.nativeObj, bmp, premultiplyAlpha);
+ }
+
+ /**
+ * Short form of the matToBitmap(mat, bmp, premultiplyAlpha=false)
+ * @param mat is a valid input Mat object of the types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.
+ * @param bmp is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.
+ */
+ public static void matToBitmap(Mat mat, Bitmap bmp) {
+ matToBitmap(mat, bmp, false);
+ }
+
+
+ private static native void nBitmapToMat2(Bitmap b, long m_addr, boolean unPremultiplyAlpha);
+
+ private static native void nMatToBitmap2(long m_addr, Bitmap b, boolean premultiplyAlpha);
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/calib3d/Calib3d.java b/openCVLibrary3413/src/main/java/org/opencv/calib3d/Calib3d.java
new file mode 100644
index 0000000..0bbe299
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/calib3d/Calib3d.java
@@ -0,0 +1,10778 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.calib3d;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfDouble;
+import org.opencv.core.MatOfPoint2f;
+import org.opencv.core.MatOfPoint3f;
+import org.opencv.core.Point;
+import org.opencv.core.Rect;
+import org.opencv.core.Size;
+import org.opencv.core.TermCriteria;
+import org.opencv.utils.Converters;
+
+// C++: class Calib3d
+
+public class Calib3d {
+
+ // C++: enum
+ public static final int
+ CV_ITERATIVE = 0,
+ CV_EPNP = 1,
+ CV_P3P = 2,
+ CV_DLS = 3,
+ CvLevMarq_DONE = 0,
+ CvLevMarq_STARTED = 1,
+ CvLevMarq_CALC_J = 2,
+ CvLevMarq_CHECK_ERR = 3,
+ LMEDS = 4,
+ RANSAC = 8,
+ RHO = 16,
+ CALIB_CB_ADAPTIVE_THRESH = 1,
+ CALIB_CB_NORMALIZE_IMAGE = 2,
+ CALIB_CB_FILTER_QUADS = 4,
+ CALIB_CB_FAST_CHECK = 8,
+ CALIB_CB_SYMMETRIC_GRID = 1,
+ CALIB_CB_ASYMMETRIC_GRID = 2,
+ CALIB_CB_CLUSTERING = 4,
+ CALIB_USE_INTRINSIC_GUESS = 0x00001,
+ CALIB_FIX_ASPECT_RATIO = 0x00002,
+ CALIB_FIX_PRINCIPAL_POINT = 0x00004,
+ CALIB_ZERO_TANGENT_DIST = 0x00008,
+ CALIB_FIX_FOCAL_LENGTH = 0x00010,
+ CALIB_FIX_K1 = 0x00020,
+ CALIB_FIX_K2 = 0x00040,
+ CALIB_FIX_K3 = 0x00080,
+ CALIB_FIX_K4 = 0x00800,
+ CALIB_FIX_K5 = 0x01000,
+ CALIB_FIX_K6 = 0x02000,
+ CALIB_RATIONAL_MODEL = 0x04000,
+ CALIB_THIN_PRISM_MODEL = 0x08000,
+ CALIB_FIX_S1_S2_S3_S4 = 0x10000,
+ CALIB_TILTED_MODEL = 0x40000,
+ CALIB_FIX_TAUX_TAUY = 0x80000,
+ CALIB_USE_QR = 0x100000,
+ CALIB_FIX_TANGENT_DIST = 0x200000,
+ CALIB_FIX_INTRINSIC = 0x00100,
+ CALIB_SAME_FOCAL_LENGTH = 0x00200,
+ CALIB_ZERO_DISPARITY = 0x00400,
+ CALIB_USE_LU = (1 << 17),
+ CALIB_USE_EXTRINSIC_GUESS = (1 << 22),
+ FM_7POINT = 1,
+ FM_8POINT = 2,
+ FM_LMEDS = 4,
+ FM_RANSAC = 8,
+ fisheye_CALIB_USE_INTRINSIC_GUESS = 1 << 0,
+ fisheye_CALIB_RECOMPUTE_EXTRINSIC = 1 << 1,
+ fisheye_CALIB_CHECK_COND = 1 << 2,
+ fisheye_CALIB_FIX_SKEW = 1 << 3,
+ fisheye_CALIB_FIX_K1 = 1 << 4,
+ fisheye_CALIB_FIX_K2 = 1 << 5,
+ fisheye_CALIB_FIX_K3 = 1 << 6,
+ fisheye_CALIB_FIX_K4 = 1 << 7,
+ fisheye_CALIB_FIX_INTRINSIC = 1 << 8,
+ fisheye_CALIB_FIX_PRINCIPAL_POINT = 1 << 9,
+ fisheye_CALIB_ZERO_DISPARITY = 1 << 10;
+
+
+ // C++: enum GridType (cv.CirclesGridFinderParameters.GridType)
+ public static final int
+ CirclesGridFinderParameters_SYMMETRIC_GRID = 0,
+ CirclesGridFinderParameters_ASYMMETRIC_GRID = 1;
+
+
+ // C++: enum HandEyeCalibrationMethod (cv.HandEyeCalibrationMethod)
+ public static final int
+ CALIB_HAND_EYE_TSAI = 0,
+ CALIB_HAND_EYE_PARK = 1,
+ CALIB_HAND_EYE_HORAUD = 2,
+ CALIB_HAND_EYE_ANDREFF = 3,
+ CALIB_HAND_EYE_DANIILIDIS = 4;
+
+
+ // C++: enum SolvePnPMethod (cv.SolvePnPMethod)
+ public static final int
+ SOLVEPNP_ITERATIVE = 0,
+ SOLVEPNP_EPNP = 1,
+ SOLVEPNP_P3P = 2,
+ SOLVEPNP_DLS = 3,
+ SOLVEPNP_UPNP = 4,
+ SOLVEPNP_AP3P = 5,
+ SOLVEPNP_IPPE = 6,
+ SOLVEPNP_IPPE_SQUARE = 7,
+ SOLVEPNP_SQPNP = 8,
+ SOLVEPNP_MAX_COUNT = 8+1;
+
+
+ //
+ // C++: void cv::Rodrigues(Mat src, Mat& dst, Mat& jacobian = Mat())
+ //
+
+ /**
+ * Converts a rotation matrix to a rotation vector or vice versa.
+ *
+ * @param src Input rotation vector (3x1 or 1x3) or rotation matrix (3x3).
+ * @param dst Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.
+ * @param jacobian Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial
+ * derivatives of the output array components with respect to the input array components.
+ *
+ * \(\begin{array}{l} \theta \leftarrow norm(r) \\ r \leftarrow r/ \theta \\ R = \cos(\theta) I + (1- \cos{\theta} ) r r^T + \sin(\theta) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}\)
+ *
+ * Inverse transformation can be also done easily, since
+ *
+ * \(\sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}\)
+ *
+ * A rotation vector is a convenient and most compact representation of a rotation matrix (since any
+ * rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry
+ * optimization procedures like REF: calibrateCamera, REF: stereoCalibrate, or REF: solvePnP .
+ *
+ * Note: More information about the computation of the derivative of a 3D rotation matrix with respect to its exponential coordinate
+ * can be found in:
+ *
+ * -
+ * A Compact Formula for the Derivative of a 3-D Rotation in Exponential Coordinates, Guillermo Gallego, Anthony J. Yezzi CITE: Gallego2014ACF
+ *
+ *
+ *
+ * Note: Useful information on SE(3) and Lie Groups can be found in:
+ *
+ * -
+ * A tutorial on SE(3) transformation parameterizations and on-manifold optimization, Jose-Luis Blanco CITE: blanco2010tutorial
+ *
+ * -
+ * Lie Groups for 2D and 3D Transformation, Ethan Eade CITE: Eade17
+ *
+ * -
+ * A micro Lie theory for state estimation in robotics, Joan Solà , Jérémie Deray, Dinesh Atchuthan CITE: Sol2018AML
+ *
+ *
+ */
+ public static void Rodrigues(Mat src, Mat dst, Mat jacobian) {
+ Rodrigues_0(src.nativeObj, dst.nativeObj, jacobian.nativeObj);
+ }
+
+ /**
+ * Converts a rotation matrix to a rotation vector or vice versa.
+ *
+ * @param src Input rotation vector (3x1 or 1x3) or rotation matrix (3x3).
+ * @param dst Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.
+ * derivatives of the output array components with respect to the input array components.
+ *
+ * \(\begin{array}{l} \theta \leftarrow norm(r) \\ r \leftarrow r/ \theta \\ R = \cos(\theta) I + (1- \cos{\theta} ) r r^T + \sin(\theta) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}\)
+ *
+ * Inverse transformation can be also done easily, since
+ *
+ * \(\sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}\)
+ *
+ * A rotation vector is a convenient and most compact representation of a rotation matrix (since any
+ * rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry
+ * optimization procedures like REF: calibrateCamera, REF: stereoCalibrate, or REF: solvePnP .
+ *
+ * Note: More information about the computation of the derivative of a 3D rotation matrix with respect to its exponential coordinate
+ * can be found in:
+ *
+ * -
+ * A Compact Formula for the Derivative of a 3-D Rotation in Exponential Coordinates, Guillermo Gallego, Anthony J. Yezzi CITE: Gallego2014ACF
+ *
+ *
+ *
+ * Note: Useful information on SE(3) and Lie Groups can be found in:
+ *
+ * -
+ * A tutorial on SE(3) transformation parameterizations and on-manifold optimization, Jose-Luis Blanco CITE: blanco2010tutorial
+ *
+ * -
+ * Lie Groups for 2D and 3D Transformation, Ethan Eade CITE: Eade17
+ *
+ * -
+ * A micro Lie theory for state estimation in robotics, Joan Solà , Jérémie Deray, Dinesh Atchuthan CITE: Sol2018AML
+ *
+ *
+ */
+ public static void Rodrigues(Mat src, Mat dst) {
+ Rodrigues_1(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: Mat cv::findHomography(vector_Point2f srcPoints, vector_Point2f dstPoints, int method = 0, double ransacReprojThreshold = 3, Mat& mask = Mat(), int maxIters = 2000, double confidence = 0.995)
+ //
+
+ /**
+ * Finds a perspective transformation between two planes.
+ *
+ * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
+ * or vector<Point2f> .
+ * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
+ * a vector<Point2f> .
+ * @param method Method used to compute a homography matrix. The following methods are possible:
+ *
+ * -
+ * 0 - a regular method using all the points, i.e., the least squares method
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ *
+ * -
+ * REF: RHO - PROSAC-based robust method
+ * @param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
+ * (used in the RANSAC and RHO methods only). That is, if
+ * \(\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}\)
+ * then the point \(i\) is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
+ * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
+ * @param mask Optional output mask set by a robust method ( RANSAC or LMeDS ). Note that the input
+ * mask values are ignored.
+ * @param maxIters The maximum number of RANSAC iterations.
+ * @param confidence Confidence level, between 0 and 1.
+ *
+ *
+ *
+ * The function finds and returns the perspective transformation \(H\) between the source and the
+ * destination planes:
+ *
+ * \(s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\)
+ *
+ * so that the back-projection error
+ *
+ * \(\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\)
+ *
+ * is minimized. If the parameter method is set to the default value 0, the function uses all the point
+ * pairs to compute an initial homography estimate with a simple least-squares scheme.
+ *
+ * However, if not all of the point pairs ( \(srcPoints_i\), \(dstPoints_i\) ) fit the rigid perspective
+ * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
+ * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
+ * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
+ * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
+ * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
+ * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
+ * the mask of inliers/outliers.
+ *
+ * Regardless of the method, robust or not, the computed homography matrix is refined further (using
+ * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
+ * re-projection error even more.
+ *
+ * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
+ * noise is rather small, use the default method (method=0).
+ *
+ * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
+ * determined up to a scale. Thus, it is normalized so that \(h_{33}=1\). Note that whenever an \(H\) matrix
+ * cannot be estimated, an empty one will be returned.
+ *
+ * SEE:
+ * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
+ * perspectiveTransform
+ * @return automatically generated
+ */
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold, Mat mask, int maxIters, double confidence) {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ return new Mat(findHomography_0(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold, mask.nativeObj, maxIters, confidence));
+ }
+
+ /**
+ * Finds a perspective transformation between two planes.
+ *
+ * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
+ * or vector<Point2f> .
+ * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
+ * a vector<Point2f> .
+ * @param method Method used to compute a homography matrix. The following methods are possible:
+ *
+ * -
+ * 0 - a regular method using all the points, i.e., the least squares method
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ *
+ * -
+ * REF: RHO - PROSAC-based robust method
+ * @param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
+ * (used in the RANSAC and RHO methods only). That is, if
+ * \(\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}\)
+ * then the point \(i\) is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
+ * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
+ * @param mask Optional output mask set by a robust method ( RANSAC or LMeDS ). Note that the input
+ * mask values are ignored.
+ * @param maxIters The maximum number of RANSAC iterations.
+ *
+ *
+ *
+ * The function finds and returns the perspective transformation \(H\) between the source and the
+ * destination planes:
+ *
+ * \(s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\)
+ *
+ * so that the back-projection error
+ *
+ * \(\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\)
+ *
+ * is minimized. If the parameter method is set to the default value 0, the function uses all the point
+ * pairs to compute an initial homography estimate with a simple least-squares scheme.
+ *
+ * However, if not all of the point pairs ( \(srcPoints_i\), \(dstPoints_i\) ) fit the rigid perspective
+ * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
+ * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
+ * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
+ * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
+ * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
+ * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
+ * the mask of inliers/outliers.
+ *
+ * Regardless of the method, robust or not, the computed homography matrix is refined further (using
+ * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
+ * re-projection error even more.
+ *
+ * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
+ * noise is rather small, use the default method (method=0).
+ *
+ * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
+ * determined up to a scale. Thus, it is normalized so that \(h_{33}=1\). Note that whenever an \(H\) matrix
+ * cannot be estimated, an empty one will be returned.
+ *
+ * SEE:
+ * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
+ * perspectiveTransform
+ * @return automatically generated
+ */
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold, Mat mask, int maxIters) {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ return new Mat(findHomography_1(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold, mask.nativeObj, maxIters));
+ }
+
+ /**
+ * Finds a perspective transformation between two planes.
+ *
+ * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
+ * or vector<Point2f> .
+ * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
+ * a vector<Point2f> .
+ * @param method Method used to compute a homography matrix. The following methods are possible:
+ *
+ * -
+ * 0 - a regular method using all the points, i.e., the least squares method
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ *
+ * -
+ * REF: RHO - PROSAC-based robust method
+ * @param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
+ * (used in the RANSAC and RHO methods only). That is, if
+ * \(\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}\)
+ * then the point \(i\) is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
+ * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
+ * @param mask Optional output mask set by a robust method ( RANSAC or LMeDS ). Note that the input
+ * mask values are ignored.
+ *
+ *
+ *
+ * The function finds and returns the perspective transformation \(H\) between the source and the
+ * destination planes:
+ *
+ * \(s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\)
+ *
+ * so that the back-projection error
+ *
+ * \(\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\)
+ *
+ * is minimized. If the parameter method is set to the default value 0, the function uses all the point
+ * pairs to compute an initial homography estimate with a simple least-squares scheme.
+ *
+ * However, if not all of the point pairs ( \(srcPoints_i\), \(dstPoints_i\) ) fit the rigid perspective
+ * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
+ * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
+ * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
+ * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
+ * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
+ * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
+ * the mask of inliers/outliers.
+ *
+ * Regardless of the method, robust or not, the computed homography matrix is refined further (using
+ * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
+ * re-projection error even more.
+ *
+ * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
+ * noise is rather small, use the default method (method=0).
+ *
+ * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
+ * determined up to a scale. Thus, it is normalized so that \(h_{33}=1\). Note that whenever an \(H\) matrix
+ * cannot be estimated, an empty one will be returned.
+ *
+ * SEE:
+ * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
+ * perspectiveTransform
+ * @return automatically generated
+ */
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold, Mat mask) {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ return new Mat(findHomography_2(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold, mask.nativeObj));
+ }
+
+ /**
+ * Finds a perspective transformation between two planes.
+ *
+ * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
+ * or vector<Point2f> .
+ * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
+ * a vector<Point2f> .
+ * @param method Method used to compute a homography matrix. The following methods are possible:
+ *
+ * -
+ * 0 - a regular method using all the points, i.e., the least squares method
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ *
+ * -
+ * REF: RHO - PROSAC-based robust method
+ * @param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
+ * (used in the RANSAC and RHO methods only). That is, if
+ * \(\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}\)
+ * then the point \(i\) is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
+ * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
+ * mask values are ignored.
+ *
+ *
+ *
+ * The function finds and returns the perspective transformation \(H\) between the source and the
+ * destination planes:
+ *
+ * \(s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\)
+ *
+ * so that the back-projection error
+ *
+ * \(\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\)
+ *
+ * is minimized. If the parameter method is set to the default value 0, the function uses all the point
+ * pairs to compute an initial homography estimate with a simple least-squares scheme.
+ *
+ * However, if not all of the point pairs ( \(srcPoints_i\), \(dstPoints_i\) ) fit the rigid perspective
+ * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
+ * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
+ * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
+ * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
+ * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
+ * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
+ * the mask of inliers/outliers.
+ *
+ * Regardless of the method, robust or not, the computed homography matrix is refined further (using
+ * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
+ * re-projection error even more.
+ *
+ * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
+ * noise is rather small, use the default method (method=0).
+ *
+ * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
+ * determined up to a scale. Thus, it is normalized so that \(h_{33}=1\). Note that whenever an \(H\) matrix
+ * cannot be estimated, an empty one will be returned.
+ *
+ * SEE:
+ * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
+ * perspectiveTransform
+ * @return automatically generated
+ */
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold) {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ return new Mat(findHomography_3(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold));
+ }
+
+ /**
+ * Finds a perspective transformation between two planes.
+ *
+ * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
+ * or vector<Point2f> .
+ * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
+ * a vector<Point2f> .
+ * @param method Method used to compute a homography matrix. The following methods are possible:
+ *
+ * -
+ * 0 - a regular method using all the points, i.e., the least squares method
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ *
+ * -
+ * REF: RHO - PROSAC-based robust method
+ * (used in the RANSAC and RHO methods only). That is, if
+ * \(\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}\)
+ * then the point \(i\) is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
+ * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
+ * mask values are ignored.
+ *
+ *
+ *
+ * The function finds and returns the perspective transformation \(H\) between the source and the
+ * destination planes:
+ *
+ * \(s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\)
+ *
+ * so that the back-projection error
+ *
+ * \(\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\)
+ *
+ * is minimized. If the parameter method is set to the default value 0, the function uses all the point
+ * pairs to compute an initial homography estimate with a simple least-squares scheme.
+ *
+ * However, if not all of the point pairs ( \(srcPoints_i\), \(dstPoints_i\) ) fit the rigid perspective
+ * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
+ * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
+ * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
+ * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
+ * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
+ * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
+ * the mask of inliers/outliers.
+ *
+ * Regardless of the method, robust or not, the computed homography matrix is refined further (using
+ * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
+ * re-projection error even more.
+ *
+ * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
+ * noise is rather small, use the default method (method=0).
+ *
+ * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
+ * determined up to a scale. Thus, it is normalized so that \(h_{33}=1\). Note that whenever an \(H\) matrix
+ * cannot be estimated, an empty one will be returned.
+ *
+ * SEE:
+ * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
+ * perspectiveTransform
+ * @return automatically generated
+ */
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method) {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ return new Mat(findHomography_4(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method));
+ }
+
+ /**
+ * Finds a perspective transformation between two planes.
+ *
+ * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
+ * or vector<Point2f> .
+ * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
+ * a vector<Point2f> .
+ *
+ * -
+ * 0 - a regular method using all the points, i.e., the least squares method
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ *
+ * -
+ * REF: RHO - PROSAC-based robust method
+ * (used in the RANSAC and RHO methods only). That is, if
+ * \(\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}\)
+ * then the point \(i\) is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
+ * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
+ * mask values are ignored.
+ *
+ *
+ *
+ * The function finds and returns the perspective transformation \(H\) between the source and the
+ * destination planes:
+ *
+ * \(s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\)
+ *
+ * so that the back-projection error
+ *
+ * \(\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\)
+ *
+ * is minimized. If the parameter method is set to the default value 0, the function uses all the point
+ * pairs to compute an initial homography estimate with a simple least-squares scheme.
+ *
+ * However, if not all of the point pairs ( \(srcPoints_i\), \(dstPoints_i\) ) fit the rigid perspective
+ * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
+ * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
+ * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
+ * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
+ * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
+ * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
+ * the mask of inliers/outliers.
+ *
+ * Regardless of the method, robust or not, the computed homography matrix is refined further (using
+ * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
+ * re-projection error even more.
+ *
+ * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
+ * noise is rather small, use the default method (method=0).
+ *
+ * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
+ * determined up to a scale. Thus, it is normalized so that \(h_{33}=1\). Note that whenever an \(H\) matrix
+ * cannot be estimated, an empty one will be returned.
+ *
+ * SEE:
+ * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
+ * perspectiveTransform
+ * @return automatically generated
+ */
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints) {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ return new Mat(findHomography_5(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj));
+ }
+
+
+ //
+ // C++: Vec3d cv::RQDecomp3x3(Mat src, Mat& mtxR, Mat& mtxQ, Mat& Qx = Mat(), Mat& Qy = Mat(), Mat& Qz = Mat())
+ //
+
+ /**
+ * Computes an RQ decomposition of 3x3 matrices.
+ *
+ * @param src 3x3 input matrix.
+ * @param mtxR Output 3x3 upper-triangular matrix.
+ * @param mtxQ Output 3x3 orthogonal matrix.
+ * @param Qx Optional output 3x3 rotation matrix around x-axis.
+ * @param Qy Optional output 3x3 rotation matrix around y-axis.
+ * @param Qz Optional output 3x3 rotation matrix around z-axis.
+ *
+ * The function computes a RQ decomposition using the given rotations. This function is used in
+ * decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
+ * and a rotation matrix.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
+ * degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
+ * sequence of rotations about the three principal axes that results in the same orientation of an
+ * object, e.g. see CITE: Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
+ * are only one of the possible solutions.
+ * @return automatically generated
+ */
+ public static double[] RQDecomp3x3(Mat src, Mat mtxR, Mat mtxQ, Mat Qx, Mat Qy, Mat Qz) {
+ return RQDecomp3x3_0(src.nativeObj, mtxR.nativeObj, mtxQ.nativeObj, Qx.nativeObj, Qy.nativeObj, Qz.nativeObj);
+ }
+
+ /**
+ * Computes an RQ decomposition of 3x3 matrices.
+ *
+ * @param src 3x3 input matrix.
+ * @param mtxR Output 3x3 upper-triangular matrix.
+ * @param mtxQ Output 3x3 orthogonal matrix.
+ * @param Qx Optional output 3x3 rotation matrix around x-axis.
+ * @param Qy Optional output 3x3 rotation matrix around y-axis.
+ *
+ * The function computes a RQ decomposition using the given rotations. This function is used in
+ * decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
+ * and a rotation matrix.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
+ * degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
+ * sequence of rotations about the three principal axes that results in the same orientation of an
+ * object, e.g. see CITE: Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
+ * are only one of the possible solutions.
+ * @return automatically generated
+ */
+ public static double[] RQDecomp3x3(Mat src, Mat mtxR, Mat mtxQ, Mat Qx, Mat Qy) {
+ return RQDecomp3x3_1(src.nativeObj, mtxR.nativeObj, mtxQ.nativeObj, Qx.nativeObj, Qy.nativeObj);
+ }
+
+ /**
+ * Computes an RQ decomposition of 3x3 matrices.
+ *
+ * @param src 3x3 input matrix.
+ * @param mtxR Output 3x3 upper-triangular matrix.
+ * @param mtxQ Output 3x3 orthogonal matrix.
+ * @param Qx Optional output 3x3 rotation matrix around x-axis.
+ *
+ * The function computes a RQ decomposition using the given rotations. This function is used in
+ * decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
+ * and a rotation matrix.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
+ * degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
+ * sequence of rotations about the three principal axes that results in the same orientation of an
+ * object, e.g. see CITE: Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
+ * are only one of the possible solutions.
+ * @return automatically generated
+ */
+ public static double[] RQDecomp3x3(Mat src, Mat mtxR, Mat mtxQ, Mat Qx) {
+ return RQDecomp3x3_2(src.nativeObj, mtxR.nativeObj, mtxQ.nativeObj, Qx.nativeObj);
+ }
+
+ /**
+ * Computes an RQ decomposition of 3x3 matrices.
+ *
+ * @param src 3x3 input matrix.
+ * @param mtxR Output 3x3 upper-triangular matrix.
+ * @param mtxQ Output 3x3 orthogonal matrix.
+ *
+ * The function computes a RQ decomposition using the given rotations. This function is used in
+ * decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
+ * and a rotation matrix.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
+ * degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
+ * sequence of rotations about the three principal axes that results in the same orientation of an
+ * object, e.g. see CITE: Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
+ * are only one of the possible solutions.
+ * @return automatically generated
+ */
+ public static double[] RQDecomp3x3(Mat src, Mat mtxR, Mat mtxQ) {
+ return RQDecomp3x3_3(src.nativeObj, mtxR.nativeObj, mtxQ.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::decomposeProjectionMatrix(Mat projMatrix, Mat& cameraMatrix, Mat& rotMatrix, Mat& transVect, Mat& rotMatrixX = Mat(), Mat& rotMatrixY = Mat(), Mat& rotMatrixZ = Mat(), Mat& eulerAngles = Mat())
+ //
+
+ /**
+ * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
+ *
+ * @param projMatrix 3x4 input projection matrix P.
+ * @param cameraMatrix Output 3x3 camera intrinsic matrix \(\cameramatrix{A}\).
+ * @param rotMatrix Output 3x3 external rotation matrix R.
+ * @param transVect Output 4x1 translation vector T.
+ * @param rotMatrixX Optional 3x3 rotation matrix around x-axis.
+ * @param rotMatrixY Optional 3x3 rotation matrix around y-axis.
+ * @param rotMatrixZ Optional 3x3 rotation matrix around z-axis.
+ * @param eulerAngles Optional three-element vector containing three Euler angles of rotation in
+ * degrees.
+ *
+ * The function computes a decomposition of a projection matrix into a calibration and a rotation
+ * matrix and the position of a camera.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
+ * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
+ * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
+ * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
+ *
+ * The function is based on RQDecomp3x3 .
+ */
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect, Mat rotMatrixX, Mat rotMatrixY, Mat rotMatrixZ, Mat eulerAngles) {
+ decomposeProjectionMatrix_0(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj, rotMatrixX.nativeObj, rotMatrixY.nativeObj, rotMatrixZ.nativeObj, eulerAngles.nativeObj);
+ }
+
+ /**
+ * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
+ *
+ * @param projMatrix 3x4 input projection matrix P.
+ * @param cameraMatrix Output 3x3 camera intrinsic matrix \(\cameramatrix{A}\).
+ * @param rotMatrix Output 3x3 external rotation matrix R.
+ * @param transVect Output 4x1 translation vector T.
+ * @param rotMatrixX Optional 3x3 rotation matrix around x-axis.
+ * @param rotMatrixY Optional 3x3 rotation matrix around y-axis.
+ * @param rotMatrixZ Optional 3x3 rotation matrix around z-axis.
+ * degrees.
+ *
+ * The function computes a decomposition of a projection matrix into a calibration and a rotation
+ * matrix and the position of a camera.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
+ * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
+ * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
+ * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
+ *
+ * The function is based on RQDecomp3x3 .
+ */
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect, Mat rotMatrixX, Mat rotMatrixY, Mat rotMatrixZ) {
+ decomposeProjectionMatrix_1(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj, rotMatrixX.nativeObj, rotMatrixY.nativeObj, rotMatrixZ.nativeObj);
+ }
+
+ /**
+ * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
+ *
+ * @param projMatrix 3x4 input projection matrix P.
+ * @param cameraMatrix Output 3x3 camera intrinsic matrix \(\cameramatrix{A}\).
+ * @param rotMatrix Output 3x3 external rotation matrix R.
+ * @param transVect Output 4x1 translation vector T.
+ * @param rotMatrixX Optional 3x3 rotation matrix around x-axis.
+ * @param rotMatrixY Optional 3x3 rotation matrix around y-axis.
+ * degrees.
+ *
+ * The function computes a decomposition of a projection matrix into a calibration and a rotation
+ * matrix and the position of a camera.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
+ * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
+ * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
+ * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
+ *
+ * The function is based on RQDecomp3x3 .
+ */
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect, Mat rotMatrixX, Mat rotMatrixY) {
+ decomposeProjectionMatrix_2(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj, rotMatrixX.nativeObj, rotMatrixY.nativeObj);
+ }
+
+ /**
+ * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
+ *
+ * @param projMatrix 3x4 input projection matrix P.
+ * @param cameraMatrix Output 3x3 camera intrinsic matrix \(\cameramatrix{A}\).
+ * @param rotMatrix Output 3x3 external rotation matrix R.
+ * @param transVect Output 4x1 translation vector T.
+ * @param rotMatrixX Optional 3x3 rotation matrix around x-axis.
+ * degrees.
+ *
+ * The function computes a decomposition of a projection matrix into a calibration and a rotation
+ * matrix and the position of a camera.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
+ * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
+ * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
+ * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
+ *
+ * The function is based on RQDecomp3x3 .
+ */
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect, Mat rotMatrixX) {
+ decomposeProjectionMatrix_3(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj, rotMatrixX.nativeObj);
+ }
+
+ /**
+ * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
+ *
+ * @param projMatrix 3x4 input projection matrix P.
+ * @param cameraMatrix Output 3x3 camera intrinsic matrix \(\cameramatrix{A}\).
+ * @param rotMatrix Output 3x3 external rotation matrix R.
+ * @param transVect Output 4x1 translation vector T.
+ * degrees.
+ *
+ * The function computes a decomposition of a projection matrix into a calibration and a rotation
+ * matrix and the position of a camera.
+ *
+ * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
+ * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
+ * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
+ * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
+ *
+ * The function is based on RQDecomp3x3 .
+ */
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect) {
+ decomposeProjectionMatrix_4(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::matMulDeriv(Mat A, Mat B, Mat& dABdA, Mat& dABdB)
+ //
+
+ /**
+ * Computes partial derivatives of the matrix product for each multiplied matrix.
+ *
+ * @param A First multiplied matrix.
+ * @param B Second multiplied matrix.
+ * @param dABdA First output derivative matrix d(A\*B)/dA of size
+ * \(\texttt{A.rows*B.cols} \times {A.rows*A.cols}\) .
+ * @param dABdB Second output derivative matrix d(A\*B)/dB of size
+ * \(\texttt{A.rows*B.cols} \times {B.rows*B.cols}\) .
+ *
+ * The function computes partial derivatives of the elements of the matrix product \(A*B\) with regard to
+ * the elements of each of the two input matrices. The function is used to compute the Jacobian
+ * matrices in stereoCalibrate but can also be used in any other similar optimization function.
+ */
+ public static void matMulDeriv(Mat A, Mat B, Mat dABdA, Mat dABdB) {
+ matMulDeriv_0(A.nativeObj, B.nativeObj, dABdA.nativeObj, dABdB.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat& rvec3, Mat& tvec3, Mat& dr3dr1 = Mat(), Mat& dr3dt1 = Mat(), Mat& dr3dr2 = Mat(), Mat& dr3dt2 = Mat(), Mat& dt3dr1 = Mat(), Mat& dt3dt1 = Mat(), Mat& dt3dr2 = Mat(), Mat& dt3dt2 = Mat())
+ //
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
+ * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
+ * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
+ * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
+ * @param dt3dr1 Optional output derivative of tvec3 with regard to rvec1
+ * @param dt3dt1 Optional output derivative of tvec3 with regard to tvec1
+ * @param dt3dr2 Optional output derivative of tvec3 with regard to rvec2
+ * @param dt3dt2 Optional output derivative of tvec3 with regard to tvec2
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2, Mat dt3dr1, Mat dt3dt1, Mat dt3dr2, Mat dt3dt2) {
+ composeRT_0(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj, dt3dr1.nativeObj, dt3dt1.nativeObj, dt3dr2.nativeObj, dt3dt2.nativeObj);
+ }
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
+ * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
+ * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
+ * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
+ * @param dt3dr1 Optional output derivative of tvec3 with regard to rvec1
+ * @param dt3dt1 Optional output derivative of tvec3 with regard to tvec1
+ * @param dt3dr2 Optional output derivative of tvec3 with regard to rvec2
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2, Mat dt3dr1, Mat dt3dt1, Mat dt3dr2) {
+ composeRT_1(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj, dt3dr1.nativeObj, dt3dt1.nativeObj, dt3dr2.nativeObj);
+ }
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
+ * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
+ * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
+ * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
+ * @param dt3dr1 Optional output derivative of tvec3 with regard to rvec1
+ * @param dt3dt1 Optional output derivative of tvec3 with regard to tvec1
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2, Mat dt3dr1, Mat dt3dt1) {
+ composeRT_2(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj, dt3dr1.nativeObj, dt3dt1.nativeObj);
+ }
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
+ * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
+ * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
+ * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
+ * @param dt3dr1 Optional output derivative of tvec3 with regard to rvec1
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2, Mat dt3dr1) {
+ composeRT_3(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj, dt3dr1.nativeObj);
+ }
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
+ * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
+ * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
+ * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2) {
+ composeRT_4(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj);
+ }
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
+ * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
+ * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2) {
+ composeRT_5(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj);
+ }
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
+ * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1) {
+ composeRT_6(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj);
+ }
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1) {
+ composeRT_7(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj);
+ }
+
+ /**
+ * Combines two rotation-and-shift transformations.
+ *
+ * @param rvec1 First rotation vector.
+ * @param tvec1 First translation vector.
+ * @param rvec2 Second rotation vector.
+ * @param tvec2 Second translation vector.
+ * @param rvec3 Output rotation vector of the superposition.
+ * @param tvec3 Output translation vector of the superposition.
+ *
+ * The functions compute:
+ *
+ * \(\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\)
+ *
+ * where \(\mathrm{rodrigues}\) denotes a rotation vector to a rotation matrix transformation, and
+ * \(\mathrm{rodrigues}^{-1}\) denotes the inverse transformation. See Rodrigues for details.
+ *
+ * Also, the functions can compute the derivatives of the output vectors with regards to the input
+ * vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+ * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+ * function that contains a matrix multiplication.
+ */
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3) {
+ composeRT_8(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::projectPoints(vector_Point3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, vector_double distCoeffs, vector_Point2f& imagePoints, Mat& jacobian = Mat(), double aspectRatio = 0)
+ //
+
+ /**
+ * Projects 3D points to an image plane.
+ *
+ * @param objectPoints Array of object points expressed wrt. the world coordinate frame. A 3xN/Nx3
+ * 1-channel or 1xN/Nx1 3-channel (or vector<Point3f> ), where N is the number of points in the view.
+ * @param rvec The rotation vector (REF: Rodrigues) that, together with tvec, performs a change of
+ * basis from world to camera coordinate system, see REF: calibrateCamera for details.
+ * @param tvec The translation vector, see parameter description above.
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\) . If the vector is empty, the zero distortion coefficients are assumed.
+ * @param imagePoints Output array of image points, 1xN/Nx1 2-channel, or
+ * vector<Point2f> .
+ * @param jacobian Optional output 2Nx(10+<numDistCoeffs>) jacobian matrix of derivatives of image
+ * points with respect to components of the rotation vector, translation vector, focal lengths,
+ * coordinates of the principal point and the distortion coefficients. In the old interface different
+ * components of the jacobian are returned via different output parameters.
+ * @param aspectRatio Optional "fixed aspect ratio" parameter. If the parameter is not 0, the
+ * function assumes that the aspect ratio (\(f_x / f_y\)) is fixed and correspondingly adjusts the
+ * jacobian matrix.
+ *
+ * The function computes the 2D projections of 3D points to the image plane, given intrinsic and
+ * extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial
+ * derivatives of image points coordinates (as functions of all the input parameters) with respect to
+ * the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global
+ * optimization in REF: calibrateCamera, REF: solvePnP, and REF: stereoCalibrate. The function itself
+ * can also be used to compute a re-projection error, given the current intrinsic and extrinsic
+ * parameters.
+ *
+ * Note: By setting rvec = tvec = \([0, 0, 0]\), or by setting cameraMatrix to a 3x3 identity matrix,
+ * or by passing zero distortion coefficients, one can get various useful partial cases of the
+ * function. This means, one can compute the distorted coordinates for a sparse set of points or apply
+ * a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.
+ */
+ public static void projectPoints(MatOfPoint3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, MatOfDouble distCoeffs, MatOfPoint2f imagePoints, Mat jacobian, double aspectRatio) {
+ Mat objectPoints_mat = objectPoints;
+ Mat distCoeffs_mat = distCoeffs;
+ Mat imagePoints_mat = imagePoints;
+ projectPoints_0(objectPoints_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, imagePoints_mat.nativeObj, jacobian.nativeObj, aspectRatio);
+ }
+
+ /**
+ * Projects 3D points to an image plane.
+ *
+ * @param objectPoints Array of object points expressed wrt. the world coordinate frame. A 3xN/Nx3
+ * 1-channel or 1xN/Nx1 3-channel (or vector<Point3f> ), where N is the number of points in the view.
+ * @param rvec The rotation vector (REF: Rodrigues) that, together with tvec, performs a change of
+ * basis from world to camera coordinate system, see REF: calibrateCamera for details.
+ * @param tvec The translation vector, see parameter description above.
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\) . If the vector is empty, the zero distortion coefficients are assumed.
+ * @param imagePoints Output array of image points, 1xN/Nx1 2-channel, or
+ * vector<Point2f> .
+ * @param jacobian Optional output 2Nx(10+<numDistCoeffs>) jacobian matrix of derivatives of image
+ * points with respect to components of the rotation vector, translation vector, focal lengths,
+ * coordinates of the principal point and the distortion coefficients. In the old interface different
+ * components of the jacobian are returned via different output parameters.
+ * function assumes that the aspect ratio (\(f_x / f_y\)) is fixed and correspondingly adjusts the
+ * jacobian matrix.
+ *
+ * The function computes the 2D projections of 3D points to the image plane, given intrinsic and
+ * extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial
+ * derivatives of image points coordinates (as functions of all the input parameters) with respect to
+ * the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global
+ * optimization in REF: calibrateCamera, REF: solvePnP, and REF: stereoCalibrate. The function itself
+ * can also be used to compute a re-projection error, given the current intrinsic and extrinsic
+ * parameters.
+ *
+ * Note: By setting rvec = tvec = \([0, 0, 0]\), or by setting cameraMatrix to a 3x3 identity matrix,
+ * or by passing zero distortion coefficients, one can get various useful partial cases of the
+ * function. This means, one can compute the distorted coordinates for a sparse set of points or apply
+ * a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.
+ */
+ public static void projectPoints(MatOfPoint3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, MatOfDouble distCoeffs, MatOfPoint2f imagePoints, Mat jacobian) {
+ Mat objectPoints_mat = objectPoints;
+ Mat distCoeffs_mat = distCoeffs;
+ Mat imagePoints_mat = imagePoints;
+ projectPoints_1(objectPoints_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, imagePoints_mat.nativeObj, jacobian.nativeObj);
+ }
+
+ /**
+ * Projects 3D points to an image plane.
+ *
+ * @param objectPoints Array of object points expressed wrt. the world coordinate frame. A 3xN/Nx3
+ * 1-channel or 1xN/Nx1 3-channel (or vector<Point3f> ), where N is the number of points in the view.
+ * @param rvec The rotation vector (REF: Rodrigues) that, together with tvec, performs a change of
+ * basis from world to camera coordinate system, see REF: calibrateCamera for details.
+ * @param tvec The translation vector, see parameter description above.
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\) . If the vector is empty, the zero distortion coefficients are assumed.
+ * @param imagePoints Output array of image points, 1xN/Nx1 2-channel, or
+ * vector<Point2f> .
+ * points with respect to components of the rotation vector, translation vector, focal lengths,
+ * coordinates of the principal point and the distortion coefficients. In the old interface different
+ * components of the jacobian are returned via different output parameters.
+ * function assumes that the aspect ratio (\(f_x / f_y\)) is fixed and correspondingly adjusts the
+ * jacobian matrix.
+ *
+ * The function computes the 2D projections of 3D points to the image plane, given intrinsic and
+ * extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial
+ * derivatives of image points coordinates (as functions of all the input parameters) with respect to
+ * the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global
+ * optimization in REF: calibrateCamera, REF: solvePnP, and REF: stereoCalibrate. The function itself
+ * can also be used to compute a re-projection error, given the current intrinsic and extrinsic
+ * parameters.
+ *
+ * Note: By setting rvec = tvec = \([0, 0, 0]\), or by setting cameraMatrix to a 3x3 identity matrix,
+ * or by passing zero distortion coefficients, one can get various useful partial cases of the
+ * function. This means, one can compute the distorted coordinates for a sparse set of points or apply
+ * a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.
+ */
+ public static void projectPoints(MatOfPoint3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, MatOfDouble distCoeffs, MatOfPoint2f imagePoints) {
+ Mat objectPoints_mat = objectPoints;
+ Mat distCoeffs_mat = distCoeffs;
+ Mat imagePoints_mat = imagePoints;
+ projectPoints_2(objectPoints_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, imagePoints_mat.nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::solvePnP(vector_Point3f objectPoints, vector_Point2f imagePoints, Mat cameraMatrix, vector_double distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE)
+ //
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns the rotation and the translation vectors that transform a 3D point expressed in the object
+ * coordinate frame to the camera coordinate frame, using different methods:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): need 4 input points to return a unique solution.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param flags Method for solving a PnP problem:
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * REF: projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F. Moreno-Noguer, V. Lepetit and P. Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of J. Hesch and S. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
+ * F. Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * REF: SOLVEPNP_SQPNP Method is based on the paper "A Consistently Fast and Globally Optimal Solution to the
+ * Perspective-n-Point Problem" by G. Terzakis and M.Lourakis (CITE: Terzakis20). It requires 3 or more points.
+ *
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ * -
+ * With REF: SOLVEPNP_SQPNP input points must be >= 3
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int flags) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnP_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, flags);
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns the rotation and the translation vectors that transform a 3D point expressed in the object
+ * coordinate frame to the camera coordinate frame, using different methods:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): need 4 input points to return a unique solution.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * REF: projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F. Moreno-Noguer, V. Lepetit and P. Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of J. Hesch and S. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
+ * F. Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * REF: SOLVEPNP_SQPNP Method is based on the paper "A Consistently Fast and Globally Optimal Solution to the
+ * Perspective-n-Point Problem" by G. Terzakis and M.Lourakis (CITE: Terzakis20). It requires 3 or more points.
+ *
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ * -
+ * With REF: SOLVEPNP_SQPNP input points must be >= 3
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnP_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess);
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns the rotation and the translation vectors that transform a 3D point expressed in the object
+ * coordinate frame to the camera coordinate frame, using different methods:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): need 4 input points to return a unique solution.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * REF: projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F. Moreno-Noguer, V. Lepetit and P. Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of J. Hesch and S. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
+ * F. Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * REF: SOLVEPNP_SQPNP Method is based on the paper "A Consistently Fast and Globally Optimal Solution to the
+ * Perspective-n-Point Problem" by G. Terzakis and M.Lourakis (CITE: Terzakis20). It requires 3 or more points.
+ *
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ * -
+ * With REF: SOLVEPNP_SQPNP input points must be >= 3
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnP_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::solvePnPRansac(vector_Point3f objectPoints, vector_Point2f imagePoints, Mat cameraMatrix, vector_double distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int iterationsCount = 100, float reprojectionError = 8.0, double confidence = 0.99, Mat& inliers = Mat(), int flags = SOLVEPNP_ITERATIVE)
+ //
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param iterationsCount Number of iterations.
+ * @param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
+ * is the maximum allowed distance between the observed and computed point projections to consider it
+ * an inlier.
+ * @param confidence The probability that the algorithm produces a useful result.
+ * @param inliers Output vector that contains indices of inliers in objectPoints and imagePoints .
+ * @param flags Method for solving a PnP problem (see REF: solvePnP ).
+ *
+ * The function estimates an object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
+ * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+ * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
+ * makes the function resistant to outliers.
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePNPRansac for object detection can be found at
+ * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ *
+ * -
+ * The default method used to estimate the camera pose for the Minimal Sample Sets step
+ * is #SOLVEPNP_EPNP. Exceptions are:
+ *
+ * -
+ * if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
+ *
+ * -
+ * if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
+ *
+ *
+ * -
+ * The method used to estimate the camera pose using all the inliers is defined by the
+ * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
+ * the method #SOLVEPNP_EPNP will be used instead.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, Mat inliers, int flags) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnPRansac_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError, confidence, inliers.nativeObj, flags);
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param iterationsCount Number of iterations.
+ * @param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
+ * is the maximum allowed distance between the observed and computed point projections to consider it
+ * an inlier.
+ * @param confidence The probability that the algorithm produces a useful result.
+ * @param inliers Output vector that contains indices of inliers in objectPoints and imagePoints .
+ *
+ * The function estimates an object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
+ * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+ * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
+ * makes the function resistant to outliers.
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePNPRansac for object detection can be found at
+ * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ *
+ * -
+ * The default method used to estimate the camera pose for the Minimal Sample Sets step
+ * is #SOLVEPNP_EPNP. Exceptions are:
+ *
+ * -
+ * if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
+ *
+ * -
+ * if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
+ *
+ *
+ * -
+ * The method used to estimate the camera pose using all the inliers is defined by the
+ * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
+ * the method #SOLVEPNP_EPNP will be used instead.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, Mat inliers) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnPRansac_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError, confidence, inliers.nativeObj);
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param iterationsCount Number of iterations.
+ * @param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
+ * is the maximum allowed distance between the observed and computed point projections to consider it
+ * an inlier.
+ * @param confidence The probability that the algorithm produces a useful result.
+ *
+ * The function estimates an object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
+ * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+ * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
+ * makes the function resistant to outliers.
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePNPRansac for object detection can be found at
+ * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ *
+ * -
+ * The default method used to estimate the camera pose for the Minimal Sample Sets step
+ * is #SOLVEPNP_EPNP. Exceptions are:
+ *
+ * -
+ * if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
+ *
+ * -
+ * if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
+ *
+ *
+ * -
+ * The method used to estimate the camera pose using all the inliers is defined by the
+ * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
+ * the method #SOLVEPNP_EPNP will be used instead.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnPRansac_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError, confidence);
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param iterationsCount Number of iterations.
+ * @param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
+ * is the maximum allowed distance between the observed and computed point projections to consider it
+ * an inlier.
+ *
+ * The function estimates an object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
+ * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+ * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
+ * makes the function resistant to outliers.
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePNPRansac for object detection can be found at
+ * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ *
+ * -
+ * The default method used to estimate the camera pose for the Minimal Sample Sets step
+ * is #SOLVEPNP_EPNP. Exceptions are:
+ *
+ * -
+ * if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
+ *
+ * -
+ * if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
+ *
+ *
+ * -
+ * The method used to estimate the camera pose using all the inliers is defined by the
+ * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
+ * the method #SOLVEPNP_EPNP will be used instead.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnPRansac_3(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError);
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param iterationsCount Number of iterations.
+ * is the maximum allowed distance between the observed and computed point projections to consider it
+ * an inlier.
+ *
+ * The function estimates an object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
+ * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+ * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
+ * makes the function resistant to outliers.
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePNPRansac for object detection can be found at
+ * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ *
+ * -
+ * The default method used to estimate the camera pose for the Minimal Sample Sets step
+ * is #SOLVEPNP_EPNP. Exceptions are:
+ *
+ * -
+ * if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
+ *
+ * -
+ * if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
+ *
+ *
+ * -
+ * The method used to estimate the camera pose using all the inliers is defined by the
+ * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
+ * the method #SOLVEPNP_EPNP will be used instead.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnPRansac_4(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount);
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * is the maximum allowed distance between the observed and computed point projections to consider it
+ * an inlier.
+ *
+ * The function estimates an object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
+ * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+ * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
+ * makes the function resistant to outliers.
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePNPRansac for object detection can be found at
+ * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ *
+ * -
+ * The default method used to estimate the camera pose for the Minimal Sample Sets step
+ * is #SOLVEPNP_EPNP. Exceptions are:
+ *
+ * -
+ * if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
+ *
+ * -
+ * if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
+ *
+ *
+ * -
+ * The method used to estimate the camera pose using all the inliers is defined by the
+ * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
+ * the method #SOLVEPNP_EPNP will be used instead.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnPRansac_5(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess);
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Output translation vector.
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * is the maximum allowed distance between the observed and computed point projections to consider it
+ * an inlier.
+ *
+ * The function estimates an object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
+ * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+ * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
+ * makes the function resistant to outliers.
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePNPRansac for object detection can be found at
+ * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ *
+ * -
+ * The default method used to estimate the camera pose for the Minimal Sample Sets step
+ * is #SOLVEPNP_EPNP. Exceptions are:
+ *
+ * -
+ * if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
+ *
+ * -
+ * if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
+ *
+ *
+ * -
+ * The method used to estimate the camera pose using all the inliers is defined by the
+ * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
+ * the method #SOLVEPNP_EPNP will be used instead.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec) {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ return solvePnPRansac_6(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj);
+ }
+
+
+ //
+ // C++: int cv::solveP3P(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags)
+ //
+
+ /**
+ * Finds an object pose from 3 3D-2D point correspondences.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, 3x3 1-channel or
+ * 1x3/3x1 3-channel. vector<Point3f> can be also passed here.
+ * @param imagePoints Array of corresponding image points, 3x2 1-channel or 1x3/3x1 2-channel.
+ * vector<Point2f> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvecs Output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
+ * the model coordinate system to the camera coordinate system. A P3P problem has up to 4 solutions.
+ * @param tvecs Output translation vectors.
+ * @param flags Method for solving a P3P problem:
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke and S. Roumeliotis.
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ *
+ *
+ *
+ * The function estimates the object pose given 3 object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients.
+ *
+ * Note:
+ * The solutions are sorted by reprojection errors (lowest to highest).
+ * @return automatically generated
+ */
+ public static int solveP3P(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, int flags) {
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ int retVal = solveP3P_0(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::solvePnPRefineLM(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, TermCriteria criteria = TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 20, FLT_EPSILON))
+ //
+
+ /**
+ * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
+ * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
+ * where N is the number of points. vector<Point3d> can also be passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can also be passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
+ * @param tvec Input/Output translation vector. Input values are used as an initial solution.
+ * @param criteria Criteria when to stop the Levenberg-Marquard iterative algorithm.
+ *
+ * The function refines the object pose given at least 3 object points, their corresponding image
+ * projections, an initial solution for the rotation and translation vector,
+ * as well as the camera intrinsic matrix and the distortion coefficients.
+ * The function minimizes the projection error with respect to the rotation and the translation vectors, according
+ * to a Levenberg-Marquardt iterative minimization CITE: Madsen04 CITE: Eade13 process.
+ */
+ public static void solvePnPRefineLM(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, TermCriteria criteria) {
+ solvePnPRefineLM_0(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvec.nativeObj, tvec.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon);
+ }
+
+ /**
+ * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
+ * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
+ * where N is the number of points. vector<Point3d> can also be passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can also be passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
+ * @param tvec Input/Output translation vector. Input values are used as an initial solution.
+ *
+ * The function refines the object pose given at least 3 object points, their corresponding image
+ * projections, an initial solution for the rotation and translation vector,
+ * as well as the camera intrinsic matrix and the distortion coefficients.
+ * The function minimizes the projection error with respect to the rotation and the translation vectors, according
+ * to a Levenberg-Marquardt iterative minimization CITE: Madsen04 CITE: Eade13 process.
+ */
+ public static void solvePnPRefineLM(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec) {
+ solvePnPRefineLM_1(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvec.nativeObj, tvec.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::solvePnPRefineVVS(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, TermCriteria criteria = TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 20, FLT_EPSILON), double VVSlambda = 1)
+ //
+
+ /**
+ * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
+ * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
+ * where N is the number of points. vector<Point3d> can also be passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can also be passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
+ * @param tvec Input/Output translation vector. Input values are used as an initial solution.
+ * @param criteria Criteria when to stop the Levenberg-Marquard iterative algorithm.
+ * @param VVSlambda Gain for the virtual visual servoing control law, equivalent to the \(\alpha\)
+ * gain in the Damped Gauss-Newton formulation.
+ *
+ * The function refines the object pose given at least 3 object points, their corresponding image
+ * projections, an initial solution for the rotation and translation vector,
+ * as well as the camera intrinsic matrix and the distortion coefficients.
+ * The function minimizes the projection error with respect to the rotation and the translation vectors, using a
+ * virtual visual servoing (VVS) CITE: Chaumette06 CITE: Marchand16 scheme.
+ */
+ public static void solvePnPRefineVVS(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, TermCriteria criteria, double VVSlambda) {
+ solvePnPRefineVVS_0(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvec.nativeObj, tvec.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon, VVSlambda);
+ }
+
+ /**
+ * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
+ * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
+ * where N is the number of points. vector<Point3d> can also be passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can also be passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
+ * @param tvec Input/Output translation vector. Input values are used as an initial solution.
+ * @param criteria Criteria when to stop the Levenberg-Marquard iterative algorithm.
+ * gain in the Damped Gauss-Newton formulation.
+ *
+ * The function refines the object pose given at least 3 object points, their corresponding image
+ * projections, an initial solution for the rotation and translation vector,
+ * as well as the camera intrinsic matrix and the distortion coefficients.
+ * The function minimizes the projection error with respect to the rotation and the translation vectors, using a
+ * virtual visual servoing (VVS) CITE: Chaumette06 CITE: Marchand16 scheme.
+ */
+ public static void solvePnPRefineVVS(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, TermCriteria criteria) {
+ solvePnPRefineVVS_1(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvec.nativeObj, tvec.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon);
+ }
+
+ /**
+ * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
+ * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
+ * where N is the number of points. vector<Point3d> can also be passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can also be passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
+ * @param tvec Input/Output translation vector. Input values are used as an initial solution.
+ * gain in the Damped Gauss-Newton formulation.
+ *
+ * The function refines the object pose given at least 3 object points, their corresponding image
+ * projections, an initial solution for the rotation and translation vector,
+ * as well as the camera intrinsic matrix and the distortion coefficients.
+ * The function minimizes the projection error with respect to the rotation and the translation vectors, using a
+ * virtual visual servoing (VVS) CITE: Chaumette06 CITE: Marchand16 scheme.
+ */
+ public static void solvePnPRefineVVS(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec) {
+ solvePnPRefineVVS_2(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvec.nativeObj, tvec.nativeObj);
+ }
+
+
+ //
+ // C++: int cv::solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, bool useExtrinsicGuess = false, SolvePnPMethod flags = SOLVEPNP_ITERATIVE, Mat rvec = Mat(), Mat tvec = Mat(), Mat& reprojectionError = Mat())
+ //
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
+ * couple), depending on the number of input points and the chosen method:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ * Only 1 solution is returned.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvecs Vector of output translation vectors.
+ * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param flags Method for solving a PnP problem:
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
+ * F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ * @param rvec Rotation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
+ * and useExtrinsicGuess is set to true.
+ * @param tvec Translation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
+ * and useExtrinsicGuess is set to true.
+ * @param reprojectionError Optional vector of reprojection error, that is the RMS error
+ * (\( \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} \)) between the input image points
+ * and the 3D object points projected with the estimated pose.
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ *
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static int solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, boolean useExtrinsicGuess, int flags, Mat rvec, Mat tvec, Mat reprojectionError) {
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ int retVal = solvePnPGeneric_0(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, useExtrinsicGuess, flags, rvec.nativeObj, tvec.nativeObj, reprojectionError.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
+ * couple), depending on the number of input points and the chosen method:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ * Only 1 solution is returned.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvecs Vector of output translation vectors.
+ * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param flags Method for solving a PnP problem:
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
+ * F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ * @param rvec Rotation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
+ * and useExtrinsicGuess is set to true.
+ * @param tvec Translation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
+ * and useExtrinsicGuess is set to true.
+ * (\( \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} \)) between the input image points
+ * and the 3D object points projected with the estimated pose.
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ *
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static int solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, boolean useExtrinsicGuess, int flags, Mat rvec, Mat tvec) {
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ int retVal = solvePnPGeneric_1(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, useExtrinsicGuess, flags, rvec.nativeObj, tvec.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
+ * couple), depending on the number of input points and the chosen method:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ * Only 1 solution is returned.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvecs Vector of output translation vectors.
+ * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param flags Method for solving a PnP problem:
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
+ * F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ * @param rvec Rotation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
+ * and useExtrinsicGuess is set to true.
+ * and useExtrinsicGuess is set to true.
+ * (\( \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} \)) between the input image points
+ * and the 3D object points projected with the estimated pose.
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ *
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static int solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, boolean useExtrinsicGuess, int flags, Mat rvec) {
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ int retVal = solvePnPGeneric_2(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, useExtrinsicGuess, flags, rvec.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
+ * couple), depending on the number of input points and the chosen method:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ * Only 1 solution is returned.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvecs Vector of output translation vectors.
+ * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ * @param flags Method for solving a PnP problem:
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
+ * F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ * and useExtrinsicGuess is set to true.
+ * and useExtrinsicGuess is set to true.
+ * (\( \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} \)) between the input image points
+ * and the 3D object points projected with the estimated pose.
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ *
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static int solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, boolean useExtrinsicGuess, int flags) {
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ int retVal = solvePnPGeneric_3(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, useExtrinsicGuess, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
+ * couple), depending on the number of input points and the chosen method:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ * Only 1 solution is returned.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvecs Vector of output translation vectors.
+ * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
+ * F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ * and useExtrinsicGuess is set to true.
+ * and useExtrinsicGuess is set to true.
+ * (\( \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} \)) between the input image points
+ * and the 3D object points projected with the estimated pose.
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ *
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static int solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, boolean useExtrinsicGuess) {
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ int retVal = solvePnPGeneric_4(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, useExtrinsicGuess);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Finds an object pose from 3D-2D point correspondences.
+ * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
+ * couple), depending on the number of input points and the chosen method:
+ *
+ * -
+ * P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
+ * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ * -
+ * for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
+ * Only 1 solution is returned.
+ *
+ *
+ *
+ * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
+ * 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can be also passed here.
+ * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
+ * where N is the number of points. vector<Point2d> can be also passed here.
+ * @param cameraMatrix Input camera intrinsic matrix \(\cameramatrix{A}\) .
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvecs Vector of output translation vectors.
+ * the provided rvec and tvec values as initial approximations of the rotation and translation
+ * vectors, respectively, and further optimizes them.
+ *
+ * -
+ * REF: SOLVEPNP_ITERATIVE Iterative method is based on a Levenberg-Marquardt optimization. In
+ * this case the function finds such a pose that minimizes reprojection error, that is the sum
+ * of squared distances between the observed projections imagePoints and the projected (using
+ * projectPoints ) objectPoints .
+ *
+ * -
+ * REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+ * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke, S. Roumeliotis
+ * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
+ * In this case the function requires exactly four object and image points.
+ *
+ * -
+ * REF: SOLVEPNP_EPNP Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
+ * paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (CITE: lepetit2009epnp).
+ *
+ * -
+ * REF: SOLVEPNP_DLS Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
+ * "A Direct Least-Squares (DLS) Method for PnP" (CITE: hesch2011direct).
+ *
+ * -
+ * REF: SOLVEPNP_UPNP Broken implementation. Using this flag will fallback to EPnP. \n
+ * Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
+ * F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+ * Estimation" (CITE: penate2013exhaustive). In this case the function also estimates the parameters \(f_x\) and \(f_y\)
+ * assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+ * focal length.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE Method is based on the paper of T. Collins and A. Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method requires coplanar object points.
+ *
+ * -
+ * REF: SOLVEPNP_IPPE_SQUARE Method is based on the paper of Toby Collins and Adrien Bartoli.
+ * "Infinitesimal Plane-Based Pose Estimation" (CITE: Collins14). This method is suitable for marker pose estimation.
+ * It requires 4 coplanar object points defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ * and useExtrinsicGuess is set to true.
+ * and useExtrinsicGuess is set to true.
+ * (\( \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} \)) between the input image points
+ * and the 3D object points projected with the estimated pose.
+ *
+ *
+ *
+ * The function estimates the object pose given a set of object points, their corresponding image
+ * projections, as well as the camera intrinsic matrix and the distortion coefficients, see the figure below
+ * (more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward
+ * and the Z-axis forward).
+ *
+ *
+ *
+ * ![](pnp.jpg)
+ *
+ * Points expressed in the world frame \( \bf{X}_w \) are projected into the image plane \( \left[ u, v \right] \)
+ * using the perspective projection model \( \Pi \) and the camera intrinsic parameters matrix \( \bf{A} \):
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * u \\
+ * v \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * f_x & 0 & c_x \\
+ * 0 & f_y & c_y \\
+ * 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * 1 & 0 & 0 & 0 \\
+ * 0 & 1 & 0 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * The estimated pose is thus the rotation ({@code rvec}) and the translation ({@code tvec}) vectors that allow transforming
+ * a 3D point expressed in the world frame into the camera frame:
+ *
+ * \(
+ * \begin{align*}
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \hspace{0.2em} ^{c}\bf{T}_w
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix} \\
+ * \begin{bmatrix}
+ * X_c \\
+ * Y_c \\
+ * Z_c \\
+ * 1
+ * \end{bmatrix} &=
+ * \begin{bmatrix}
+ * r_{11} & r_{12} & r_{13} & t_x \\
+ * r_{21} & r_{22} & r_{23} & t_y \\
+ * r_{31} & r_{32} & r_{33} & t_z \\
+ * 0 & 0 & 0 & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_{w} \\
+ * Y_{w} \\
+ * Z_{w} \\
+ * 1
+ * \end{bmatrix}
+ * \end{align*}
+ * \)
+ *
+ * Note:
+ *
+ * -
+ * An example of how to use solvePnP for planar augmented reality can be found at
+ * opencv_source_code/samples/python/plane_ar.py
+ *
+ * -
+ * If you are using Python:
+ *
+ * -
+ * Numpy array slices won't work as input because solvePnP requires contiguous
+ * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+ * modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ *
+ * -
+ * The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+ * to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+ * which requires 2-channel information.
+ *
+ * -
+ * Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+ * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+ * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ *
+ *
+ * -
+ * The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
+ * unstable and sometimes give completely wrong results. If you pass one of these two
+ * flags, REF: SOLVEPNP_EPNP method will be used instead.
+ *
+ * -
+ * The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
+ * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
+ * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
+ *
+ * -
+ * With REF: SOLVEPNP_ITERATIVE method and {@code useExtrinsicGuess=true}, the minimum number of points is 3 (3 points
+ * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
+ * global solution to converge.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
+ *
+ * -
+ * With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
+ * Number of input points must be 4. Object points must be defined in the following order:
+ *
+ * -
+ * point 0: [-squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 1: [ squareLength / 2, squareLength / 2, 0]
+ *
+ * -
+ * point 2: [ squareLength / 2, -squareLength / 2, 0]
+ *
+ * -
+ * point 3: [-squareLength / 2, -squareLength / 2, 0]
+ *
+ *
+ *
+ *
+ * @return automatically generated
+ */
+ public static int solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs) {
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ int retVal = solvePnPGeneric_5(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::initCameraMatrix2D(vector_vector_Point3f objectPoints, vector_vector_Point2f imagePoints, Size imageSize, double aspectRatio = 1.0)
+ //
+
+ /**
+ * Finds an initial camera intrinsic matrix from 3D-2D point correspondences.
+ *
+ * @param objectPoints Vector of vectors of the calibration pattern points in the calibration pattern
+ * coordinate space. In the old interface all the per-view vectors are concatenated. See
+ * calibrateCamera for details.
+ * @param imagePoints Vector of vectors of the projections of the calibration pattern points. In the
+ * old interface all the per-view vectors are concatenated.
+ * @param imageSize Image size in pixels used to initialize the principal point.
+ * @param aspectRatio If it is zero or negative, both \(f_x\) and \(f_y\) are estimated independently.
+ * Otherwise, \(f_x = f_y * \texttt{aspectRatio}\) .
+ *
+ * The function estimates and returns an initial camera intrinsic matrix for the camera calibration process.
+ * Currently, the function only supports planar calibration patterns, which are patterns where each
+ * object point has z-coordinate =0.
+ * @return automatically generated
+ */
+ public static Mat initCameraMatrix2D(List objectPoints, List imagePoints, Size imageSize, double aspectRatio) {
+ List objectPoints_tmplm = new ArrayList((objectPoints != null) ? objectPoints.size() : 0);
+ Mat objectPoints_mat = Converters.vector_vector_Point3f_to_Mat(objectPoints, objectPoints_tmplm);
+ List imagePoints_tmplm = new ArrayList((imagePoints != null) ? imagePoints.size() : 0);
+ Mat imagePoints_mat = Converters.vector_vector_Point2f_to_Mat(imagePoints, imagePoints_tmplm);
+ return new Mat(initCameraMatrix2D_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, aspectRatio));
+ }
+
+ /**
+ * Finds an initial camera intrinsic matrix from 3D-2D point correspondences.
+ *
+ * @param objectPoints Vector of vectors of the calibration pattern points in the calibration pattern
+ * coordinate space. In the old interface all the per-view vectors are concatenated. See
+ * calibrateCamera for details.
+ * @param imagePoints Vector of vectors of the projections of the calibration pattern points. In the
+ * old interface all the per-view vectors are concatenated.
+ * @param imageSize Image size in pixels used to initialize the principal point.
+ * Otherwise, \(f_x = f_y * \texttt{aspectRatio}\) .
+ *
+ * The function estimates and returns an initial camera intrinsic matrix for the camera calibration process.
+ * Currently, the function only supports planar calibration patterns, which are patterns where each
+ * object point has z-coordinate =0.
+ * @return automatically generated
+ */
+ public static Mat initCameraMatrix2D(List objectPoints, List imagePoints, Size imageSize) {
+ List objectPoints_tmplm = new ArrayList((objectPoints != null) ? objectPoints.size() : 0);
+ Mat objectPoints_mat = Converters.vector_vector_Point3f_to_Mat(objectPoints, objectPoints_tmplm);
+ List imagePoints_tmplm = new ArrayList((imagePoints != null) ? imagePoints.size() : 0);
+ Mat imagePoints_mat = Converters.vector_vector_Point2f_to_Mat(imagePoints, imagePoints_tmplm);
+ return new Mat(initCameraMatrix2D_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height));
+ }
+
+
+ //
+ // C++: bool cv::findChessboardCorners(Mat image, Size patternSize, vector_Point2f& corners, int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE)
+ //
+
+ /**
+ * Finds the positions of internal corners of the chessboard.
+ *
+ * @param image Source chessboard view. It must be an 8-bit grayscale or color image.
+ * @param patternSize Number of inner corners per a chessboard row and column
+ * ( patternSize = cvSize(points_per_row,points_per_colum) = cvSize(columns,rows) ).
+ * @param corners Output array of detected corners.
+ * @param flags Various operation flags that can be zero or a combination of the following values:
+ *
+ * -
+ * REF: CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black
+ * and white, rather than a fixed threshold level (computed from the average image brightness).
+ *
+ * -
+ * REF: CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before
+ * applying fixed or adaptive thresholding.
+ *
+ * -
+ * REF: CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter,
+ * square-like shape) to filter out false quads extracted at the contour retrieval stage.
+ *
+ * -
+ * REF: CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners,
+ * and shortcut the call if none is found. This can drastically speed up the call in the
+ * degenerate condition when no chessboard is observed.
+ *
+ *
+ *
+ * The function attempts to determine whether the input image is a view of the chessboard pattern and
+ * locate the internal chessboard corners. The function returns a non-zero value if all of the corners
+ * are found and they are placed in a certain order (row by row, left to right in every row).
+ * Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example,
+ * a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black
+ * squares touch each other. The detected coordinates are approximate, and to determine their positions
+ * more accurately, the function calls cornerSubPix. You also may use the function cornerSubPix with
+ * different parameters if returned coordinates are not accurate enough.
+ *
+ * Sample usage of detecting and drawing chessboard corners: :
+ *
+ * Size patternsize(8,6); //interior number of corners
+ * Mat gray = ....; //source image
+ * vector<Point2f> corners; //this will be filled by the detected corners
+ *
+ * //CALIB_CB_FAST_CHECK saves a lot of time on images
+ * //that do not contain any chessboard corners
+ * bool patternfound = findChessboardCorners(gray, patternsize, corners,
+ * CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
+ * + CALIB_CB_FAST_CHECK);
+ *
+ * if(patternfound)
+ * cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1),
+ * TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
+ *
+ * drawChessboardCorners(img, patternsize, Mat(corners), patternfound);
+ *
+ * Note: The function requires white space (like a square-thick border, the wider the better) around
+ * the board to make the detection more robust in various environments. Otherwise, if there is no
+ * border and the background is dark, the outer black squares cannot be segmented properly and so the
+ * square grouping and ordering algorithm fails.
+ * @return automatically generated
+ */
+ public static boolean findChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners, int flags) {
+ Mat corners_mat = corners;
+ return findChessboardCorners_0(image.nativeObj, patternSize.width, patternSize.height, corners_mat.nativeObj, flags);
+ }
+
+ /**
+ * Finds the positions of internal corners of the chessboard.
+ *
+ * @param image Source chessboard view. It must be an 8-bit grayscale or color image.
+ * @param patternSize Number of inner corners per a chessboard row and column
+ * ( patternSize = cvSize(points_per_row,points_per_colum) = cvSize(columns,rows) ).
+ * @param corners Output array of detected corners.
+ *
+ * -
+ * REF: CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black
+ * and white, rather than a fixed threshold level (computed from the average image brightness).
+ *
+ * -
+ * REF: CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before
+ * applying fixed or adaptive thresholding.
+ *
+ * -
+ * REF: CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter,
+ * square-like shape) to filter out false quads extracted at the contour retrieval stage.
+ *
+ * -
+ * REF: CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners,
+ * and shortcut the call if none is found. This can drastically speed up the call in the
+ * degenerate condition when no chessboard is observed.
+ *
+ *
+ *
+ * The function attempts to determine whether the input image is a view of the chessboard pattern and
+ * locate the internal chessboard corners. The function returns a non-zero value if all of the corners
+ * are found and they are placed in a certain order (row by row, left to right in every row).
+ * Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example,
+ * a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black
+ * squares touch each other. The detected coordinates are approximate, and to determine their positions
+ * more accurately, the function calls cornerSubPix. You also may use the function cornerSubPix with
+ * different parameters if returned coordinates are not accurate enough.
+ *
+ * Sample usage of detecting and drawing chessboard corners: :
+ *
+ * Size patternsize(8,6); //interior number of corners
+ * Mat gray = ....; //source image
+ * vector<Point2f> corners; //this will be filled by the detected corners
+ *
+ * //CALIB_CB_FAST_CHECK saves a lot of time on images
+ * //that do not contain any chessboard corners
+ * bool patternfound = findChessboardCorners(gray, patternsize, corners,
+ * CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
+ * + CALIB_CB_FAST_CHECK);
+ *
+ * if(patternfound)
+ * cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1),
+ * TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
+ *
+ * drawChessboardCorners(img, patternsize, Mat(corners), patternfound);
+ *
+ * Note: The function requires white space (like a square-thick border, the wider the better) around
+ * the board to make the detection more robust in various environments. Otherwise, if there is no
+ * border and the background is dark, the outer black squares cannot be segmented properly and so the
+ * square grouping and ordering algorithm fails.
+ * @return automatically generated
+ */
+ public static boolean findChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners) {
+ Mat corners_mat = corners;
+ return findChessboardCorners_1(image.nativeObj, patternSize.width, patternSize.height, corners_mat.nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::find4QuadCornerSubpix(Mat img, Mat& corners, Size region_size)
+ //
+
+ public static boolean find4QuadCornerSubpix(Mat img, Mat corners, Size region_size) {
+ return find4QuadCornerSubpix_0(img.nativeObj, corners.nativeObj, region_size.width, region_size.height);
+ }
+
+
+ //
+ // C++: void cv::drawChessboardCorners(Mat& image, Size patternSize, vector_Point2f corners, bool patternWasFound)
+ //
+
+ /**
+ * Renders the detected chessboard corners.
+ *
+ * @param image Destination image. It must be an 8-bit color image.
+ * @param patternSize Number of inner corners per a chessboard row and column
+ * (patternSize = cv::Size(points_per_row,points_per_column)).
+ * @param corners Array of detected corners, the output of findChessboardCorners.
+ * @param patternWasFound Parameter indicating whether the complete board was found or not. The
+ * return value of findChessboardCorners should be passed here.
+ *
+ * The function draws individual chessboard corners detected either as red circles if the board was not
+ * found, or as colored corners connected with lines if the board was found.
+ */
+ public static void drawChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners, boolean patternWasFound) {
+ Mat corners_mat = corners;
+ drawChessboardCorners_0(image.nativeObj, patternSize.width, patternSize.height, corners_mat.nativeObj, patternWasFound);
+ }
+
+
+ //
+ // C++: void cv::drawFrameAxes(Mat& image, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, float length, int thickness = 3)
+ //
+
+ /**
+ * Draw axes of the world/object coordinate system from pose estimation. SEE: solvePnP
+ *
+ * @param image Input/output image. It must have 1 or 3 channels. The number of channels is not altered.
+ * @param cameraMatrix Input 3x3 floating-point matrix of camera intrinsic parameters.
+ * \(\cameramatrix{A}\)
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is empty, the zero distortion coefficients are assumed.
+ * @param rvec Rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Translation vector.
+ * @param length Length of the painted axes in the same unit than tvec (usually in meters).
+ * @param thickness Line thickness of the painted axes.
+ *
+ * This function draws the axes of the world/object coordinate system w.r.t. to the camera frame.
+ * OX is drawn in red, OY in green and OZ in blue.
+ */
+ public static void drawFrameAxes(Mat image, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, float length, int thickness) {
+ drawFrameAxes_0(image.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvec.nativeObj, tvec.nativeObj, length, thickness);
+ }
+
+ /**
+ * Draw axes of the world/object coordinate system from pose estimation. SEE: solvePnP
+ *
+ * @param image Input/output image. It must have 1 or 3 channels. The number of channels is not altered.
+ * @param cameraMatrix Input 3x3 floating-point matrix of camera intrinsic parameters.
+ * \(\cameramatrix{A}\)
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is empty, the zero distortion coefficients are assumed.
+ * @param rvec Rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
+ * the model coordinate system to the camera coordinate system.
+ * @param tvec Translation vector.
+ * @param length Length of the painted axes in the same unit than tvec (usually in meters).
+ *
+ * This function draws the axes of the world/object coordinate system w.r.t. to the camera frame.
+ * OX is drawn in red, OY in green and OZ in blue.
+ */
+ public static void drawFrameAxes(Mat image, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, float length) {
+ drawFrameAxes_1(image.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvec.nativeObj, tvec.nativeObj, length);
+ }
+
+
+ //
+ // C++: bool cv::findCirclesGrid(Mat image, Size patternSize, Mat& centers, int flags, Ptr_FeatureDetector blobDetector, CirclesGridFinderParameters parameters)
+ //
+
+ // Unknown type 'Ptr_FeatureDetector' (I), skipping the function
+
+
+ //
+ // C++: bool cv::findCirclesGrid2(Mat image, Size patternSize, Mat& centers, int flags, Ptr_FeatureDetector blobDetector, CirclesGridFinderParameters2 parameters)
+ //
+
+ // Unknown type 'Ptr_FeatureDetector' (I), skipping the function
+
+
+ //
+ // C++: bool cv::findCirclesGrid(Mat image, Size patternSize, Mat& centers, int flags = CALIB_CB_SYMMETRIC_GRID, Ptr_FeatureDetector blobDetector = SimpleBlobDetector::create())
+ //
+
+ public static boolean findCirclesGrid(Mat image, Size patternSize, Mat centers, int flags) {
+ return findCirclesGrid_0(image.nativeObj, patternSize.width, patternSize.height, centers.nativeObj, flags);
+ }
+
+ public static boolean findCirclesGrid(Mat image, Size patternSize, Mat centers) {
+ return findCirclesGrid_2(image.nativeObj, patternSize.width, patternSize.height, centers.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, Mat& stdDeviationsIntrinsics, Mat& stdDeviationsExtrinsics, Mat& perViewErrors, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
+ //
+
+ /**
+ * Finds the camera intrinsic and extrinsic parameters from several views of a calibration
+ * pattern.
+ *
+ * @param objectPoints In the new interface it is a vector of vectors of calibration pattern points in
+ * the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
+ * vector contains as many elements as the number of pattern views. If the same calibration pattern
+ * is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
+ * possible to use partially occluded patterns or even different patterns in different views. Then,
+ * the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's
+ * XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig.
+ * In the old interface all the vectors of object points from different views are concatenated
+ * together.
+ * @param imagePoints In the new interface it is a vector of vectors of the projections of calibration
+ * pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
+ * objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal,
+ * respectively. In the old interface all the vectors of object points from different views are
+ * concatenated together.
+ * @param imageSize Size of the image used only to initialize the camera intrinsic matrix.
+ * @param cameraMatrix Input/output 3x3 floating-point camera intrinsic matrix
+ * \(\cameramatrix{A}\) . If REF: CALIB_USE_INTRINSIC_GUESS
+ * and/or REF: CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
+ * initialized before calling the function.
+ * @param distCoeffs Input/output vector of distortion coefficients
+ * \(\distcoeffs\).
+ * @param rvecs Output vector of rotation vectors (REF: Rodrigues ) estimated for each pattern view
+ * (e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding
+ * i-th translation vector (see the next output parameter description) brings the calibration pattern
+ * from the object coordinate space (in which object points are specified) to the camera coordinate
+ * space. In more technical terms, the tuple of the i-th rotation and translation vector performs
+ * a change of basis from object coordinate space to camera coordinate space. Due to its duality, this
+ * tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
+ * space.
+ * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter
+ * describtion above.
+ * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic
+ * parameters. Order of deviations values:
+ * \((f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
+ * s_4, \tau_x, \tau_y)\) If one of parameters is not estimated, it's deviation is equals to zero.
+ * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic
+ * parameters. Order of deviations values: \((R_0, T_0, \dotsc , R_{M - 1}, T_{M - 1})\) where M is
+ * the number of pattern views. \(R_i, T_i\) are concatenated 1x3 vectors.
+ * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
+ * @param flags Different flags that may be zero or a combination of the following values:
+ *
+ * -
+ * REF: CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+ * Note, that if intrinsic parameters are known, there is no need to use this function just to
+ * estimate extrinsic parameters. Use solvePnP instead.
+ *
+ * -
+ * REF: CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
+ * optimization. It stays at the center or at a different location specified when
+ * REF: CALIB_USE_INTRINSIC_GUESS is set too.
+ *
+ * -
+ * REF: CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The
+ * ratio fx/fy stays the same as in the input cameraMatrix . When
+ * REF: CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are
+ * ignored, only their ratio is computed and used further.
+ *
+ * -
+ * REF: CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients \((p_1, p_2)\) are set
+ * to zeros and stay zero.
+ *
+ * -
+ * REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 The corresponding radial distortion
+ * coefficient is not changed during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is
+ * set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the rational model and return 8 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the thin prism model and return 12 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ * @param criteria Termination criteria for the iterative optimization algorithm.
+ *
+ *
+ *
+ * @return the overall RMS re-projection error.
+ *
+ * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
+ * views. The algorithm is based on CITE: Zhang2000 and CITE: BouguetMCT . The coordinates of 3D object
+ * points and their corresponding 2D projections in each view must be specified. That may be achieved
+ * by using an object with known geometry and easily detectable feature points. Such an object is
+ * called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as
+ * a calibration rig (see REF: findChessboardCorners). Currently, initialization of intrinsic
+ * parameters (when REF: CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration
+ * patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also
+ * be used as long as initial cameraMatrix is provided.
+ *
+ * The algorithm performs the following steps:
+ *
+ *
+ * -
+ * Compute the initial intrinsic parameters (the option only available for planar calibration
+ * patterns) or read them from the input parameters. The distortion coefficients are all set to
+ * zeros initially unless some of CALIB_FIX_K? are specified.
+ *
+ *
+ *
+ *
+ * -
+ * Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
+ * done using solvePnP .
+ *
+ *
+ *
+ *
+ * -
+ * Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
+ * that is, the total sum of squared distances between the observed feature points imagePoints and
+ * the projected (using the current estimates for camera parameters and the poses) object points
+ * objectPoints. See projectPoints for details.
+ *
+ *
+ *
+ * Note:
+ * If you use a non-square (i.e. non-N-by-N) grid and REF: findChessboardCorners for calibration,
+ * and REF: calibrateCamera returns bad values (zero distortion coefficients, \(c_x\) and
+ * \(c_y\) very far from the image center, and/or large differences between \(f_x\) and
+ * \(f_y\) (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols)
+ * instead of using patternSize=cvSize(cols,rows) in REF: findChessboardCorners.
+ *
+ * SEE:
+ * findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
+ */
+ public static double calibrateCameraExtended(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, Mat stdDeviationsIntrinsics, Mat stdDeviationsExtrinsics, Mat perViewErrors, int flags, TermCriteria criteria) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCameraExtended_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, stdDeviationsIntrinsics.nativeObj, stdDeviationsExtrinsics.nativeObj, perViewErrors.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Finds the camera intrinsic and extrinsic parameters from several views of a calibration
+ * pattern.
+ *
+ * @param objectPoints In the new interface it is a vector of vectors of calibration pattern points in
+ * the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
+ * vector contains as many elements as the number of pattern views. If the same calibration pattern
+ * is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
+ * possible to use partially occluded patterns or even different patterns in different views. Then,
+ * the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's
+ * XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig.
+ * In the old interface all the vectors of object points from different views are concatenated
+ * together.
+ * @param imagePoints In the new interface it is a vector of vectors of the projections of calibration
+ * pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
+ * objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal,
+ * respectively. In the old interface all the vectors of object points from different views are
+ * concatenated together.
+ * @param imageSize Size of the image used only to initialize the camera intrinsic matrix.
+ * @param cameraMatrix Input/output 3x3 floating-point camera intrinsic matrix
+ * \(\cameramatrix{A}\) . If REF: CALIB_USE_INTRINSIC_GUESS
+ * and/or REF: CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
+ * initialized before calling the function.
+ * @param distCoeffs Input/output vector of distortion coefficients
+ * \(\distcoeffs\).
+ * @param rvecs Output vector of rotation vectors (REF: Rodrigues ) estimated for each pattern view
+ * (e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding
+ * i-th translation vector (see the next output parameter description) brings the calibration pattern
+ * from the object coordinate space (in which object points are specified) to the camera coordinate
+ * space. In more technical terms, the tuple of the i-th rotation and translation vector performs
+ * a change of basis from object coordinate space to camera coordinate space. Due to its duality, this
+ * tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
+ * space.
+ * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter
+ * describtion above.
+ * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic
+ * parameters. Order of deviations values:
+ * \((f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
+ * s_4, \tau_x, \tau_y)\) If one of parameters is not estimated, it's deviation is equals to zero.
+ * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic
+ * parameters. Order of deviations values: \((R_0, T_0, \dotsc , R_{M - 1}, T_{M - 1})\) where M is
+ * the number of pattern views. \(R_i, T_i\) are concatenated 1x3 vectors.
+ * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
+ * @param flags Different flags that may be zero or a combination of the following values:
+ *
+ * -
+ * REF: CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+ * Note, that if intrinsic parameters are known, there is no need to use this function just to
+ * estimate extrinsic parameters. Use solvePnP instead.
+ *
+ * -
+ * REF: CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
+ * optimization. It stays at the center or at a different location specified when
+ * REF: CALIB_USE_INTRINSIC_GUESS is set too.
+ *
+ * -
+ * REF: CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The
+ * ratio fx/fy stays the same as in the input cameraMatrix . When
+ * REF: CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are
+ * ignored, only their ratio is computed and used further.
+ *
+ * -
+ * REF: CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients \((p_1, p_2)\) are set
+ * to zeros and stay zero.
+ *
+ * -
+ * REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 The corresponding radial distortion
+ * coefficient is not changed during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is
+ * set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the rational model and return 8 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the thin prism model and return 12 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ *
+ *
+ * @return the overall RMS re-projection error.
+ *
+ * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
+ * views. The algorithm is based on CITE: Zhang2000 and CITE: BouguetMCT . The coordinates of 3D object
+ * points and their corresponding 2D projections in each view must be specified. That may be achieved
+ * by using an object with known geometry and easily detectable feature points. Such an object is
+ * called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as
+ * a calibration rig (see REF: findChessboardCorners). Currently, initialization of intrinsic
+ * parameters (when REF: CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration
+ * patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also
+ * be used as long as initial cameraMatrix is provided.
+ *
+ * The algorithm performs the following steps:
+ *
+ *
+ * -
+ * Compute the initial intrinsic parameters (the option only available for planar calibration
+ * patterns) or read them from the input parameters. The distortion coefficients are all set to
+ * zeros initially unless some of CALIB_FIX_K? are specified.
+ *
+ *
+ *
+ *
+ * -
+ * Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
+ * done using solvePnP .
+ *
+ *
+ *
+ *
+ * -
+ * Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
+ * that is, the total sum of squared distances between the observed feature points imagePoints and
+ * the projected (using the current estimates for camera parameters and the poses) object points
+ * objectPoints. See projectPoints for details.
+ *
+ *
+ *
+ * Note:
+ * If you use a non-square (i.e. non-N-by-N) grid and REF: findChessboardCorners for calibration,
+ * and REF: calibrateCamera returns bad values (zero distortion coefficients, \(c_x\) and
+ * \(c_y\) very far from the image center, and/or large differences between \(f_x\) and
+ * \(f_y\) (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols)
+ * instead of using patternSize=cvSize(cols,rows) in REF: findChessboardCorners.
+ *
+ * SEE:
+ * findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
+ */
+ public static double calibrateCameraExtended(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, Mat stdDeviationsIntrinsics, Mat stdDeviationsExtrinsics, Mat perViewErrors, int flags) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCameraExtended_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, stdDeviationsIntrinsics.nativeObj, stdDeviationsExtrinsics.nativeObj, perViewErrors.nativeObj, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Finds the camera intrinsic and extrinsic parameters from several views of a calibration
+ * pattern.
+ *
+ * @param objectPoints In the new interface it is a vector of vectors of calibration pattern points in
+ * the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
+ * vector contains as many elements as the number of pattern views. If the same calibration pattern
+ * is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
+ * possible to use partially occluded patterns or even different patterns in different views. Then,
+ * the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's
+ * XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig.
+ * In the old interface all the vectors of object points from different views are concatenated
+ * together.
+ * @param imagePoints In the new interface it is a vector of vectors of the projections of calibration
+ * pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
+ * objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal,
+ * respectively. In the old interface all the vectors of object points from different views are
+ * concatenated together.
+ * @param imageSize Size of the image used only to initialize the camera intrinsic matrix.
+ * @param cameraMatrix Input/output 3x3 floating-point camera intrinsic matrix
+ * \(\cameramatrix{A}\) . If REF: CALIB_USE_INTRINSIC_GUESS
+ * and/or REF: CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
+ * initialized before calling the function.
+ * @param distCoeffs Input/output vector of distortion coefficients
+ * \(\distcoeffs\).
+ * @param rvecs Output vector of rotation vectors (REF: Rodrigues ) estimated for each pattern view
+ * (e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding
+ * i-th translation vector (see the next output parameter description) brings the calibration pattern
+ * from the object coordinate space (in which object points are specified) to the camera coordinate
+ * space. In more technical terms, the tuple of the i-th rotation and translation vector performs
+ * a change of basis from object coordinate space to camera coordinate space. Due to its duality, this
+ * tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
+ * space.
+ * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter
+ * describtion above.
+ * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic
+ * parameters. Order of deviations values:
+ * \((f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
+ * s_4, \tau_x, \tau_y)\) If one of parameters is not estimated, it's deviation is equals to zero.
+ * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic
+ * parameters. Order of deviations values: \((R_0, T_0, \dotsc , R_{M - 1}, T_{M - 1})\) where M is
+ * the number of pattern views. \(R_i, T_i\) are concatenated 1x3 vectors.
+ * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
+ *
+ * -
+ * REF: CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+ * Note, that if intrinsic parameters are known, there is no need to use this function just to
+ * estimate extrinsic parameters. Use solvePnP instead.
+ *
+ * -
+ * REF: CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
+ * optimization. It stays at the center or at a different location specified when
+ * REF: CALIB_USE_INTRINSIC_GUESS is set too.
+ *
+ * -
+ * REF: CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The
+ * ratio fx/fy stays the same as in the input cameraMatrix . When
+ * REF: CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are
+ * ignored, only their ratio is computed and used further.
+ *
+ * -
+ * REF: CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients \((p_1, p_2)\) are set
+ * to zeros and stay zero.
+ *
+ * -
+ * REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 The corresponding radial distortion
+ * coefficient is not changed during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is
+ * set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the rational model and return 8 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the thin prism model and return 12 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ *
+ *
+ * @return the overall RMS re-projection error.
+ *
+ * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
+ * views. The algorithm is based on CITE: Zhang2000 and CITE: BouguetMCT . The coordinates of 3D object
+ * points and their corresponding 2D projections in each view must be specified. That may be achieved
+ * by using an object with known geometry and easily detectable feature points. Such an object is
+ * called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as
+ * a calibration rig (see REF: findChessboardCorners). Currently, initialization of intrinsic
+ * parameters (when REF: CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration
+ * patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also
+ * be used as long as initial cameraMatrix is provided.
+ *
+ * The algorithm performs the following steps:
+ *
+ *
+ * -
+ * Compute the initial intrinsic parameters (the option only available for planar calibration
+ * patterns) or read them from the input parameters. The distortion coefficients are all set to
+ * zeros initially unless some of CALIB_FIX_K? are specified.
+ *
+ *
+ *
+ *
+ * -
+ * Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
+ * done using solvePnP .
+ *
+ *
+ *
+ *
+ * -
+ * Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
+ * that is, the total sum of squared distances between the observed feature points imagePoints and
+ * the projected (using the current estimates for camera parameters and the poses) object points
+ * objectPoints. See projectPoints for details.
+ *
+ *
+ *
+ * Note:
+ * If you use a non-square (i.e. non-N-by-N) grid and REF: findChessboardCorners for calibration,
+ * and REF: calibrateCamera returns bad values (zero distortion coefficients, \(c_x\) and
+ * \(c_y\) very far from the image center, and/or large differences between \(f_x\) and
+ * \(f_y\) (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols)
+ * instead of using patternSize=cvSize(cols,rows) in REF: findChessboardCorners.
+ *
+ * SEE:
+ * findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
+ */
+ public static double calibrateCameraExtended(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, Mat stdDeviationsIntrinsics, Mat stdDeviationsExtrinsics, Mat perViewErrors) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCameraExtended_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, stdDeviationsIntrinsics.nativeObj, stdDeviationsExtrinsics.nativeObj, perViewErrors.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
+ //
+
+ /**
+ * double calibrateCamera( InputArrayOfArrays objectPoints,
+ * InputArrayOfArrays imagePoints, Size imageSize,
+ * InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
+ * OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
+ * OutputArray stdDeviations, OutputArray perViewErrors,
+ * int flags = 0, TermCriteria criteria = TermCriteria(
+ * TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON) )
+ * @param objectPoints automatically generated
+ * @param imagePoints automatically generated
+ * @param imageSize automatically generated
+ * @param cameraMatrix automatically generated
+ * @param distCoeffs automatically generated
+ * @param rvecs automatically generated
+ * @param tvecs automatically generated
+ * @param flags automatically generated
+ * @param criteria automatically generated
+ * @return automatically generated
+ */
+ public static double calibrateCamera(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, int flags, TermCriteria criteria) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCamera_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * double calibrateCamera( InputArrayOfArrays objectPoints,
+ * InputArrayOfArrays imagePoints, Size imageSize,
+ * InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
+ * OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
+ * OutputArray stdDeviations, OutputArray perViewErrors,
+ * int flags = 0, TermCriteria criteria = TermCriteria(
+ * TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON) )
+ * @param objectPoints automatically generated
+ * @param imagePoints automatically generated
+ * @param imageSize automatically generated
+ * @param cameraMatrix automatically generated
+ * @param distCoeffs automatically generated
+ * @param rvecs automatically generated
+ * @param tvecs automatically generated
+ * @param flags automatically generated
+ * @return automatically generated
+ */
+ public static double calibrateCamera(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, int flags) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCamera_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * double calibrateCamera( InputArrayOfArrays objectPoints,
+ * InputArrayOfArrays imagePoints, Size imageSize,
+ * InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
+ * OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
+ * OutputArray stdDeviations, OutputArray perViewErrors,
+ * int flags = 0, TermCriteria criteria = TermCriteria(
+ * TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON) )
+ * @param objectPoints automatically generated
+ * @param imagePoints automatically generated
+ * @param imageSize automatically generated
+ * @param cameraMatrix automatically generated
+ * @param distCoeffs automatically generated
+ * @param rvecs automatically generated
+ * @param tvecs automatically generated
+ * @return automatically generated
+ */
+ public static double calibrateCamera(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCamera_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::calibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double& fovx, double& fovy, double& focalLength, Point2d& principalPoint, double& aspectRatio)
+ //
+
+ /**
+ * Computes useful camera characteristics from the camera intrinsic matrix.
+ *
+ * @param cameraMatrix Input camera intrinsic matrix that can be estimated by calibrateCamera or
+ * stereoCalibrate .
+ * @param imageSize Input image size in pixels.
+ * @param apertureWidth Physical width in mm of the sensor.
+ * @param apertureHeight Physical height in mm of the sensor.
+ * @param fovx Output field of view in degrees along the horizontal sensor axis.
+ * @param fovy Output field of view in degrees along the vertical sensor axis.
+ * @param focalLength Focal length of the lens in mm.
+ * @param principalPoint Principal point in mm.
+ * @param aspectRatio \(f_y/f_x\)
+ *
+ * The function computes various useful camera characteristics from the previously estimated camera
+ * matrix.
+ *
+ * Note:
+ * Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for
+ * the chessboard pitch (it can thus be any value).
+ */
+ public static void calibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double[] fovx, double[] fovy, double[] focalLength, Point principalPoint, double[] aspectRatio) {
+ double[] fovx_out = new double[1];
+ double[] fovy_out = new double[1];
+ double[] focalLength_out = new double[1];
+ double[] principalPoint_out = new double[2];
+ double[] aspectRatio_out = new double[1];
+ calibrationMatrixValues_0(cameraMatrix.nativeObj, imageSize.width, imageSize.height, apertureWidth, apertureHeight, fovx_out, fovy_out, focalLength_out, principalPoint_out, aspectRatio_out);
+ if(fovx!=null) fovx[0] = (double)fovx_out[0];
+ if(fovy!=null) fovy[0] = (double)fovy_out[0];
+ if(focalLength!=null) focalLength[0] = (double)focalLength_out[0];
+ if(principalPoint!=null){ principalPoint.x = principalPoint_out[0]; principalPoint.y = principalPoint_out[1]; }
+ if(aspectRatio!=null) aspectRatio[0] = (double)aspectRatio_out[0];
+ }
+
+
+ //
+ // C++: double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, Mat& perViewErrors, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
+ //
+
+ /**
+ * Calibrates a stereo camera set up. This function finds the intrinsic parameters
+ * for each of the two cameras and the extrinsic parameters between the two cameras.
+ *
+ * @param objectPoints Vector of vectors of the calibration pattern points. The same structure as
+ * in REF: calibrateCamera. For each pattern view, both cameras need to see the same object
+ * points. Therefore, objectPoints.size(), imagePoints1.size(), and imagePoints2.size() need to be
+ * equal as well as objectPoints[i].size(), imagePoints1[i].size(), and imagePoints2[i].size() need to
+ * be equal for each i.
+ * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the first camera. The same structure as in REF: calibrateCamera.
+ * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the second camera. The same structure as in REF: calibrateCamera.
+ * @param cameraMatrix1 Input/output camera intrinsic matrix for the first camera, the same as in
+ * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
+ * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
+ * REF: calibrateCamera.
+ * @param cameraMatrix2 Input/output second camera intrinsic matrix for the second camera. See description for
+ * cameraMatrix1.
+ * @param distCoeffs2 Input/output lens distortion coefficients for the second camera. See
+ * description for distCoeffs1.
+ * @param imageSize Size of the image used only to initialize the camera intrinsic matrices.
+ * @param R Output rotation matrix. Together with the translation vector T, this matrix brings
+ * points given in the first camera's coordinate system to points in the second camera's
+ * coordinate system. In more technical terms, the tuple of R and T performs a change of basis
+ * from the first camera's coordinate system to the second camera's coordinate system. Due to its
+ * duality, this tuple is equivalent to the position of the first camera with respect to the
+ * second camera coordinate system.
+ * @param T Output translation vector, see description above.
+ * @param E Output essential matrix.
+ * @param F Output fundamental matrix.
+ * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
+ * @param flags Different flags that may be zero or a combination of the following values:
+ *
+ * -
+ * REF: CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E, and F
+ * matrices are estimated.
+ *
+ * -
+ * REF: CALIB_USE_INTRINSIC_GUESS Optimize some or all of the intrinsic parameters
+ * according to the specified flags. Initial values are provided by the user.
+ *
+ * -
+ * REF: CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
+ * Otherwise R and T are initialized to the median value of the pattern views (each dimension separately).
+ *
+ * -
+ * REF: CALIB_FIX_PRINCIPAL_POINT Fix the principal points during the optimization.
+ *
+ * -
+ * REF: CALIB_FIX_FOCAL_LENGTH Fix \(f^{(j)}_x\) and \(f^{(j)}_y\) .
+ *
+ * -
+ * REF: CALIB_FIX_ASPECT_RATIO Optimize \(f^{(j)}_y\) . Fix the ratio \(f^{(j)}_x/f^{(j)}_y\)
+ * .
+ *
+ * -
+ * REF: CALIB_SAME_FOCAL_LENGTH Enforce \(f^{(0)}_x=f^{(1)}_x\) and \(f^{(0)}_y=f^{(1)}_y\) .
+ *
+ * -
+ * REF: CALIB_ZERO_TANGENT_DIST Set tangential distortion coefficients for each camera to
+ * zeros and fix there.
+ *
+ * -
+ * REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 Do not change the corresponding radial
+ * distortion coefficient during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set,
+ * the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_RATIONAL_MODEL Enable coefficients k4, k5, and k6. To provide the backward
+ * compatibility, this extra flag should be explicitly specified to make the calibration
+ * function use the rational model and return 8 coefficients. If the flag is not set, the
+ * function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the thin prism model and return 12 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ * @param criteria Termination criteria for the iterative optimization algorithm.
+ *
+ *
+ *
+ * The function estimates the transformation between two cameras making a stereo pair. If one computes
+ * the poses of an object relative to the first camera and to the second camera,
+ * ( \(R_1\),\(T_1\) ) and (\(R_2\),\(T_2\)), respectively, for a stereo camera where the
+ * relative position and orientation between the two cameras are fixed, then those poses definitely
+ * relate to each other. This means, if the relative position and orientation (\(R\),\(T\)) of the
+ * two cameras is known, it is possible to compute (\(R_2\),\(T_2\)) when (\(R_1\),\(T_1\)) is
+ * given. This is what the described function does. It computes (\(R\),\(T\)) such that:
+ *
+ * \(R_2=R R_1\)
+ * \(T_2=R T_1 + T.\)
+ *
+ * Therefore, one can compute the coordinate representation of a 3D point for the second camera's
+ * coordinate system when given the point's coordinate representation in the first camera's coordinate
+ * system:
+ *
+ * \(\begin{bmatrix}
+ * X_2 \\
+ * Y_2 \\
+ * Z_2 \\
+ * 1
+ * \end{bmatrix} = \begin{bmatrix}
+ * R & T \\
+ * 0 & 1
+ * \end{bmatrix} \begin{bmatrix}
+ * X_1 \\
+ * Y_1 \\
+ * Z_1 \\
+ * 1
+ * \end{bmatrix}.\)
+ *
+ *
+ * Optionally, it computes the essential matrix E:
+ *
+ * \(E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} R\)
+ *
+ * where \(T_i\) are components of the translation vector \(T\) : \(T=[T_0, T_1, T_2]^T\) .
+ * And the function can also compute the fundamental matrix F:
+ *
+ * \(F = cameraMatrix2^{-T}\cdot E \cdot cameraMatrix1^{-1}\)
+ *
+ * Besides the stereo-related information, the function can also perform a full calibration of each of
+ * the two cameras. However, due to the high dimensionality of the parameter space and noise in the
+ * input data, the function can diverge from the correct solution. If the intrinsic parameters can be
+ * estimated with high accuracy for each of the cameras individually (for example, using
+ * calibrateCamera ), you are recommended to do so and then pass REF: CALIB_FIX_INTRINSIC flag to the
+ * function along with the computed intrinsic parameters. Otherwise, if all the parameters are
+ * estimated at once, it makes sense to restrict some parameters, for example, pass
+ * REF: CALIB_SAME_FOCAL_LENGTH and REF: CALIB_ZERO_TANGENT_DIST flags, which is usually a
+ * reasonable assumption.
+ *
+ * Similarly to calibrateCamera, the function minimizes the total re-projection error for all the
+ * points in all the available views from both cameras. The function returns the final value of the
+ * re-projection error.
+ * @return automatically generated
+ */
+ public static double stereoCalibrateExtended(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, Mat perViewErrors, int flags, TermCriteria criteria) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return stereoCalibrateExtended_0(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, perViewErrors.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ }
+
+ /**
+ * Calibrates a stereo camera set up. This function finds the intrinsic parameters
+ * for each of the two cameras and the extrinsic parameters between the two cameras.
+ *
+ * @param objectPoints Vector of vectors of the calibration pattern points. The same structure as
+ * in REF: calibrateCamera. For each pattern view, both cameras need to see the same object
+ * points. Therefore, objectPoints.size(), imagePoints1.size(), and imagePoints2.size() need to be
+ * equal as well as objectPoints[i].size(), imagePoints1[i].size(), and imagePoints2[i].size() need to
+ * be equal for each i.
+ * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the first camera. The same structure as in REF: calibrateCamera.
+ * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the second camera. The same structure as in REF: calibrateCamera.
+ * @param cameraMatrix1 Input/output camera intrinsic matrix for the first camera, the same as in
+ * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
+ * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
+ * REF: calibrateCamera.
+ * @param cameraMatrix2 Input/output second camera intrinsic matrix for the second camera. See description for
+ * cameraMatrix1.
+ * @param distCoeffs2 Input/output lens distortion coefficients for the second camera. See
+ * description for distCoeffs1.
+ * @param imageSize Size of the image used only to initialize the camera intrinsic matrices.
+ * @param R Output rotation matrix. Together with the translation vector T, this matrix brings
+ * points given in the first camera's coordinate system to points in the second camera's
+ * coordinate system. In more technical terms, the tuple of R and T performs a change of basis
+ * from the first camera's coordinate system to the second camera's coordinate system. Due to its
+ * duality, this tuple is equivalent to the position of the first camera with respect to the
+ * second camera coordinate system.
+ * @param T Output translation vector, see description above.
+ * @param E Output essential matrix.
+ * @param F Output fundamental matrix.
+ * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
+ * @param flags Different flags that may be zero or a combination of the following values:
+ *
+ * -
+ * REF: CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E, and F
+ * matrices are estimated.
+ *
+ * -
+ * REF: CALIB_USE_INTRINSIC_GUESS Optimize some or all of the intrinsic parameters
+ * according to the specified flags. Initial values are provided by the user.
+ *
+ * -
+ * REF: CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
+ * Otherwise R and T are initialized to the median value of the pattern views (each dimension separately).
+ *
+ * -
+ * REF: CALIB_FIX_PRINCIPAL_POINT Fix the principal points during the optimization.
+ *
+ * -
+ * REF: CALIB_FIX_FOCAL_LENGTH Fix \(f^{(j)}_x\) and \(f^{(j)}_y\) .
+ *
+ * -
+ * REF: CALIB_FIX_ASPECT_RATIO Optimize \(f^{(j)}_y\) . Fix the ratio \(f^{(j)}_x/f^{(j)}_y\)
+ * .
+ *
+ * -
+ * REF: CALIB_SAME_FOCAL_LENGTH Enforce \(f^{(0)}_x=f^{(1)}_x\) and \(f^{(0)}_y=f^{(1)}_y\) .
+ *
+ * -
+ * REF: CALIB_ZERO_TANGENT_DIST Set tangential distortion coefficients for each camera to
+ * zeros and fix there.
+ *
+ * -
+ * REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 Do not change the corresponding radial
+ * distortion coefficient during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set,
+ * the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_RATIONAL_MODEL Enable coefficients k4, k5, and k6. To provide the backward
+ * compatibility, this extra flag should be explicitly specified to make the calibration
+ * function use the rational model and return 8 coefficients. If the flag is not set, the
+ * function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the thin prism model and return 12 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ *
+ *
+ * The function estimates the transformation between two cameras making a stereo pair. If one computes
+ * the poses of an object relative to the first camera and to the second camera,
+ * ( \(R_1\),\(T_1\) ) and (\(R_2\),\(T_2\)), respectively, for a stereo camera where the
+ * relative position and orientation between the two cameras are fixed, then those poses definitely
+ * relate to each other. This means, if the relative position and orientation (\(R\),\(T\)) of the
+ * two cameras is known, it is possible to compute (\(R_2\),\(T_2\)) when (\(R_1\),\(T_1\)) is
+ * given. This is what the described function does. It computes (\(R\),\(T\)) such that:
+ *
+ * \(R_2=R R_1\)
+ * \(T_2=R T_1 + T.\)
+ *
+ * Therefore, one can compute the coordinate representation of a 3D point for the second camera's
+ * coordinate system when given the point's coordinate representation in the first camera's coordinate
+ * system:
+ *
+ * \(\begin{bmatrix}
+ * X_2 \\
+ * Y_2 \\
+ * Z_2 \\
+ * 1
+ * \end{bmatrix} = \begin{bmatrix}
+ * R & T \\
+ * 0 & 1
+ * \end{bmatrix} \begin{bmatrix}
+ * X_1 \\
+ * Y_1 \\
+ * Z_1 \\
+ * 1
+ * \end{bmatrix}.\)
+ *
+ *
+ * Optionally, it computes the essential matrix E:
+ *
+ * \(E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} R\)
+ *
+ * where \(T_i\) are components of the translation vector \(T\) : \(T=[T_0, T_1, T_2]^T\) .
+ * And the function can also compute the fundamental matrix F:
+ *
+ * \(F = cameraMatrix2^{-T}\cdot E \cdot cameraMatrix1^{-1}\)
+ *
+ * Besides the stereo-related information, the function can also perform a full calibration of each of
+ * the two cameras. However, due to the high dimensionality of the parameter space and noise in the
+ * input data, the function can diverge from the correct solution. If the intrinsic parameters can be
+ * estimated with high accuracy for each of the cameras individually (for example, using
+ * calibrateCamera ), you are recommended to do so and then pass REF: CALIB_FIX_INTRINSIC flag to the
+ * function along with the computed intrinsic parameters. Otherwise, if all the parameters are
+ * estimated at once, it makes sense to restrict some parameters, for example, pass
+ * REF: CALIB_SAME_FOCAL_LENGTH and REF: CALIB_ZERO_TANGENT_DIST flags, which is usually a
+ * reasonable assumption.
+ *
+ * Similarly to calibrateCamera, the function minimizes the total re-projection error for all the
+ * points in all the available views from both cameras. The function returns the final value of the
+ * re-projection error.
+ * @return automatically generated
+ */
+ public static double stereoCalibrateExtended(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, Mat perViewErrors, int flags) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return stereoCalibrateExtended_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, perViewErrors.nativeObj, flags);
+ }
+
+ /**
+ * Calibrates a stereo camera set up. This function finds the intrinsic parameters
+ * for each of the two cameras and the extrinsic parameters between the two cameras.
+ *
+ * @param objectPoints Vector of vectors of the calibration pattern points. The same structure as
+ * in REF: calibrateCamera. For each pattern view, both cameras need to see the same object
+ * points. Therefore, objectPoints.size(), imagePoints1.size(), and imagePoints2.size() need to be
+ * equal as well as objectPoints[i].size(), imagePoints1[i].size(), and imagePoints2[i].size() need to
+ * be equal for each i.
+ * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the first camera. The same structure as in REF: calibrateCamera.
+ * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the second camera. The same structure as in REF: calibrateCamera.
+ * @param cameraMatrix1 Input/output camera intrinsic matrix for the first camera, the same as in
+ * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
+ * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
+ * REF: calibrateCamera.
+ * @param cameraMatrix2 Input/output second camera intrinsic matrix for the second camera. See description for
+ * cameraMatrix1.
+ * @param distCoeffs2 Input/output lens distortion coefficients for the second camera. See
+ * description for distCoeffs1.
+ * @param imageSize Size of the image used only to initialize the camera intrinsic matrices.
+ * @param R Output rotation matrix. Together with the translation vector T, this matrix brings
+ * points given in the first camera's coordinate system to points in the second camera's
+ * coordinate system. In more technical terms, the tuple of R and T performs a change of basis
+ * from the first camera's coordinate system to the second camera's coordinate system. Due to its
+ * duality, this tuple is equivalent to the position of the first camera with respect to the
+ * second camera coordinate system.
+ * @param T Output translation vector, see description above.
+ * @param E Output essential matrix.
+ * @param F Output fundamental matrix.
+ * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
+ *
+ * -
+ * REF: CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E, and F
+ * matrices are estimated.
+ *
+ * -
+ * REF: CALIB_USE_INTRINSIC_GUESS Optimize some or all of the intrinsic parameters
+ * according to the specified flags. Initial values are provided by the user.
+ *
+ * -
+ * REF: CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
+ * Otherwise R and T are initialized to the median value of the pattern views (each dimension separately).
+ *
+ * -
+ * REF: CALIB_FIX_PRINCIPAL_POINT Fix the principal points during the optimization.
+ *
+ * -
+ * REF: CALIB_FIX_FOCAL_LENGTH Fix \(f^{(j)}_x\) and \(f^{(j)}_y\) .
+ *
+ * -
+ * REF: CALIB_FIX_ASPECT_RATIO Optimize \(f^{(j)}_y\) . Fix the ratio \(f^{(j)}_x/f^{(j)}_y\)
+ * .
+ *
+ * -
+ * REF: CALIB_SAME_FOCAL_LENGTH Enforce \(f^{(0)}_x=f^{(1)}_x\) and \(f^{(0)}_y=f^{(1)}_y\) .
+ *
+ * -
+ * REF: CALIB_ZERO_TANGENT_DIST Set tangential distortion coefficients for each camera to
+ * zeros and fix there.
+ *
+ * -
+ * REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 Do not change the corresponding radial
+ * distortion coefficient during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set,
+ * the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_RATIONAL_MODEL Enable coefficients k4, k5, and k6. To provide the backward
+ * compatibility, this extra flag should be explicitly specified to make the calibration
+ * function use the rational model and return 8 coefficients. If the flag is not set, the
+ * function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the thin prism model and return 12 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ * -
+ * REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
+ * backward compatibility, this extra flag should be explicitly specified to make the
+ * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+ * set, the function computes and returns only 5 distortion coefficients.
+ *
+ * -
+ * REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
+ * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+ * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+ *
+ *
+ *
+ * The function estimates the transformation between two cameras making a stereo pair. If one computes
+ * the poses of an object relative to the first camera and to the second camera,
+ * ( \(R_1\),\(T_1\) ) and (\(R_2\),\(T_2\)), respectively, for a stereo camera where the
+ * relative position and orientation between the two cameras are fixed, then those poses definitely
+ * relate to each other. This means, if the relative position and orientation (\(R\),\(T\)) of the
+ * two cameras is known, it is possible to compute (\(R_2\),\(T_2\)) when (\(R_1\),\(T_1\)) is
+ * given. This is what the described function does. It computes (\(R\),\(T\)) such that:
+ *
+ * \(R_2=R R_1\)
+ * \(T_2=R T_1 + T.\)
+ *
+ * Therefore, one can compute the coordinate representation of a 3D point for the second camera's
+ * coordinate system when given the point's coordinate representation in the first camera's coordinate
+ * system:
+ *
+ * \(\begin{bmatrix}
+ * X_2 \\
+ * Y_2 \\
+ * Z_2 \\
+ * 1
+ * \end{bmatrix} = \begin{bmatrix}
+ * R & T \\
+ * 0 & 1
+ * \end{bmatrix} \begin{bmatrix}
+ * X_1 \\
+ * Y_1 \\
+ * Z_1 \\
+ * 1
+ * \end{bmatrix}.\)
+ *
+ *
+ * Optionally, it computes the essential matrix E:
+ *
+ * \(E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} R\)
+ *
+ * where \(T_i\) are components of the translation vector \(T\) : \(T=[T_0, T_1, T_2]^T\) .
+ * And the function can also compute the fundamental matrix F:
+ *
+ * \(F = cameraMatrix2^{-T}\cdot E \cdot cameraMatrix1^{-1}\)
+ *
+ * Besides the stereo-related information, the function can also perform a full calibration of each of
+ * the two cameras. However, due to the high dimensionality of the parameter space and noise in the
+ * input data, the function can diverge from the correct solution. If the intrinsic parameters can be
+ * estimated with high accuracy for each of the cameras individually (for example, using
+ * calibrateCamera ), you are recommended to do so and then pass REF: CALIB_FIX_INTRINSIC flag to the
+ * function along with the computed intrinsic parameters. Otherwise, if all the parameters are
+ * estimated at once, it makes sense to restrict some parameters, for example, pass
+ * REF: CALIB_SAME_FOCAL_LENGTH and REF: CALIB_ZERO_TANGENT_DIST flags, which is usually a
+ * reasonable assumption.
+ *
+ * Similarly to calibrateCamera, the function minimizes the total re-projection error for all the
+ * points in all the available views from both cameras. The function returns the final value of the
+ * re-projection error.
+ * @return automatically generated
+ */
+ public static double stereoCalibrateExtended(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, Mat perViewErrors) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return stereoCalibrateExtended_2(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, perViewErrors.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
+ //
+
+ public static double stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, int flags, TermCriteria criteria) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return stereoCalibrate_0(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ }
+
+ public static double stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, int flags) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return stereoCalibrate_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, flags);
+ }
+
+ public static double stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return stereoCalibrate_2(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags = CALIB_ZERO_DISPARITY, double alpha = -1, Size newImageSize = Size(), Rect* validPixROI1 = 0, Rect* validPixROI2 = 0)
+ //
+
+ /**
+ * Computes rectification transforms for each head of a calibrated stereo camera.
+ *
+ * @param cameraMatrix1 First camera intrinsic matrix.
+ * @param distCoeffs1 First camera distortion parameters.
+ * @param cameraMatrix2 Second camera intrinsic matrix.
+ * @param distCoeffs2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param T Translation vector from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
+ * brings points given in the unrectified first camera's coordinate system to points in the rectified
+ * first camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
+ * brings points given in the unrectified second camera's coordinate system to points in the rectified
+ * second camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified first camera's image.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified second camera's image.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
+ * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * @param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
+ * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
+ * images are zoomed and shifted so that only valid pixels are visible (no black areas after
+ * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
+ * pixels from the original images from the cameras are retained in the rectified images (no source
+ * image pixels are lost). Any intermediate value yields an intermediate result between
+ * those two extreme cases.
+ * @param newImageSize New image resolution after rectification. The same size should be passed to
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * @param validPixROI1 Optional output rectangles inside the rectified images where all the pixels
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ * @param validPixROI2 Optional output rectangles inside the rectified images where all the pixels
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ *
+ * The function computes the rotation matrices for each camera that (virtually) make both camera image
+ * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
+ * the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate
+ * as input. As output, it provides two rotation matrices and also two projection matrices in the new
+ * coordinates. The function distinguishes the following two cases:
+ *
+ *
+ * -
+ * Horizontal stereo: the first and the second camera views are shifted relative to each other
+ * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
+ * corresponding epipolar lines in the left and right cameras are horizontal and have the same
+ * y-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx_1 & 0 \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx_2 & T_x*f \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix} ,\)
+ *
+ * where \(T_x\) is a horizontal shift between the cameras and \(cx_1=cx_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ *
+ * -
+ * Vertical stereo: the first and the second camera views are shifted relative to each other
+ * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
+ * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_1 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_2 & T_y*f \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix},\)
+ *
+ * where \(T_y\) is a vertical shift between the cameras and \(cy_1=cy_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
+ * matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to
+ * initialize the rectification map for each camera.
+ *
+ * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
+ * the corresponding image regions. This means that the images are well rectified, which is what most
+ * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
+ * their interiors are all valid pixels.
+ *
+ * ![image](pics/stereo_undistort.jpg)
+ */
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, double alpha, Size newImageSize, Rect validPixROI1, Rect validPixROI2) {
+ double[] validPixROI1_out = new double[4];
+ double[] validPixROI2_out = new double[4];
+ stereoRectify_0(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, alpha, newImageSize.width, newImageSize.height, validPixROI1_out, validPixROI2_out);
+ if(validPixROI1!=null){ validPixROI1.x = (int)validPixROI1_out[0]; validPixROI1.y = (int)validPixROI1_out[1]; validPixROI1.width = (int)validPixROI1_out[2]; validPixROI1.height = (int)validPixROI1_out[3]; }
+ if(validPixROI2!=null){ validPixROI2.x = (int)validPixROI2_out[0]; validPixROI2.y = (int)validPixROI2_out[1]; validPixROI2.width = (int)validPixROI2_out[2]; validPixROI2.height = (int)validPixROI2_out[3]; }
+ }
+
+ /**
+ * Computes rectification transforms for each head of a calibrated stereo camera.
+ *
+ * @param cameraMatrix1 First camera intrinsic matrix.
+ * @param distCoeffs1 First camera distortion parameters.
+ * @param cameraMatrix2 Second camera intrinsic matrix.
+ * @param distCoeffs2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param T Translation vector from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
+ * brings points given in the unrectified first camera's coordinate system to points in the rectified
+ * first camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
+ * brings points given in the unrectified second camera's coordinate system to points in the rectified
+ * second camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified first camera's image.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified second camera's image.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
+ * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * @param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
+ * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
+ * images are zoomed and shifted so that only valid pixels are visible (no black areas after
+ * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
+ * pixels from the original images from the cameras are retained in the rectified images (no source
+ * image pixels are lost). Any intermediate value yields an intermediate result between
+ * those two extreme cases.
+ * @param newImageSize New image resolution after rectification. The same size should be passed to
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * @param validPixROI1 Optional output rectangles inside the rectified images where all the pixels
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ *
+ * The function computes the rotation matrices for each camera that (virtually) make both camera image
+ * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
+ * the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate
+ * as input. As output, it provides two rotation matrices and also two projection matrices in the new
+ * coordinates. The function distinguishes the following two cases:
+ *
+ *
+ * -
+ * Horizontal stereo: the first and the second camera views are shifted relative to each other
+ * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
+ * corresponding epipolar lines in the left and right cameras are horizontal and have the same
+ * y-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx_1 & 0 \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx_2 & T_x*f \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix} ,\)
+ *
+ * where \(T_x\) is a horizontal shift between the cameras and \(cx_1=cx_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ *
+ * -
+ * Vertical stereo: the first and the second camera views are shifted relative to each other
+ * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
+ * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_1 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_2 & T_y*f \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix},\)
+ *
+ * where \(T_y\) is a vertical shift between the cameras and \(cy_1=cy_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
+ * matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to
+ * initialize the rectification map for each camera.
+ *
+ * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
+ * the corresponding image regions. This means that the images are well rectified, which is what most
+ * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
+ * their interiors are all valid pixels.
+ *
+ * ![image](pics/stereo_undistort.jpg)
+ */
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, double alpha, Size newImageSize, Rect validPixROI1) {
+ double[] validPixROI1_out = new double[4];
+ stereoRectify_1(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, alpha, newImageSize.width, newImageSize.height, validPixROI1_out);
+ if(validPixROI1!=null){ validPixROI1.x = (int)validPixROI1_out[0]; validPixROI1.y = (int)validPixROI1_out[1]; validPixROI1.width = (int)validPixROI1_out[2]; validPixROI1.height = (int)validPixROI1_out[3]; }
+ }
+
+ /**
+ * Computes rectification transforms for each head of a calibrated stereo camera.
+ *
+ * @param cameraMatrix1 First camera intrinsic matrix.
+ * @param distCoeffs1 First camera distortion parameters.
+ * @param cameraMatrix2 Second camera intrinsic matrix.
+ * @param distCoeffs2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param T Translation vector from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
+ * brings points given in the unrectified first camera's coordinate system to points in the rectified
+ * first camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
+ * brings points given in the unrectified second camera's coordinate system to points in the rectified
+ * second camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified first camera's image.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified second camera's image.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
+ * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * @param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
+ * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
+ * images are zoomed and shifted so that only valid pixels are visible (no black areas after
+ * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
+ * pixels from the original images from the cameras are retained in the rectified images (no source
+ * image pixels are lost). Any intermediate value yields an intermediate result between
+ * those two extreme cases.
+ * @param newImageSize New image resolution after rectification. The same size should be passed to
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ *
+ * The function computes the rotation matrices for each camera that (virtually) make both camera image
+ * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
+ * the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate
+ * as input. As output, it provides two rotation matrices and also two projection matrices in the new
+ * coordinates. The function distinguishes the following two cases:
+ *
+ *
+ * -
+ * Horizontal stereo: the first and the second camera views are shifted relative to each other
+ * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
+ * corresponding epipolar lines in the left and right cameras are horizontal and have the same
+ * y-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx_1 & 0 \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx_2 & T_x*f \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix} ,\)
+ *
+ * where \(T_x\) is a horizontal shift between the cameras and \(cx_1=cx_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ *
+ * -
+ * Vertical stereo: the first and the second camera views are shifted relative to each other
+ * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
+ * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_1 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_2 & T_y*f \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix},\)
+ *
+ * where \(T_y\) is a vertical shift between the cameras and \(cy_1=cy_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
+ * matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to
+ * initialize the rectification map for each camera.
+ *
+ * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
+ * the corresponding image regions. This means that the images are well rectified, which is what most
+ * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
+ * their interiors are all valid pixels.
+ *
+ * ![image](pics/stereo_undistort.jpg)
+ */
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, double alpha, Size newImageSize) {
+ stereoRectify_2(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, alpha, newImageSize.width, newImageSize.height);
+ }
+
+ /**
+ * Computes rectification transforms for each head of a calibrated stereo camera.
+ *
+ * @param cameraMatrix1 First camera intrinsic matrix.
+ * @param distCoeffs1 First camera distortion parameters.
+ * @param cameraMatrix2 Second camera intrinsic matrix.
+ * @param distCoeffs2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param T Translation vector from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
+ * brings points given in the unrectified first camera's coordinate system to points in the rectified
+ * first camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
+ * brings points given in the unrectified second camera's coordinate system to points in the rectified
+ * second camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified first camera's image.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified second camera's image.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
+ * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * @param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
+ * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
+ * images are zoomed and shifted so that only valid pixels are visible (no black areas after
+ * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
+ * pixels from the original images from the cameras are retained in the rectified images (no source
+ * image pixels are lost). Any intermediate value yields an intermediate result between
+ * those two extreme cases.
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ *
+ * The function computes the rotation matrices for each camera that (virtually) make both camera image
+ * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
+ * the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate
+ * as input. As output, it provides two rotation matrices and also two projection matrices in the new
+ * coordinates. The function distinguishes the following two cases:
+ *
+ *
+ * -
+ * Horizontal stereo: the first and the second camera views are shifted relative to each other
+ * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
+ * corresponding epipolar lines in the left and right cameras are horizontal and have the same
+ * y-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx_1 & 0 \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx_2 & T_x*f \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix} ,\)
+ *
+ * where \(T_x\) is a horizontal shift between the cameras and \(cx_1=cx_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ *
+ * -
+ * Vertical stereo: the first and the second camera views are shifted relative to each other
+ * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
+ * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_1 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_2 & T_y*f \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix},\)
+ *
+ * where \(T_y\) is a vertical shift between the cameras and \(cy_1=cy_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
+ * matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to
+ * initialize the rectification map for each camera.
+ *
+ * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
+ * the corresponding image regions. This means that the images are well rectified, which is what most
+ * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
+ * their interiors are all valid pixels.
+ *
+ * ![image](pics/stereo_undistort.jpg)
+ */
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, double alpha) {
+ stereoRectify_3(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, alpha);
+ }
+
+ /**
+ * Computes rectification transforms for each head of a calibrated stereo camera.
+ *
+ * @param cameraMatrix1 First camera intrinsic matrix.
+ * @param distCoeffs1 First camera distortion parameters.
+ * @param cameraMatrix2 Second camera intrinsic matrix.
+ * @param distCoeffs2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param T Translation vector from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
+ * brings points given in the unrectified first camera's coordinate system to points in the rectified
+ * first camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
+ * brings points given in the unrectified second camera's coordinate system to points in the rectified
+ * second camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified first camera's image.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified second camera's image.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
+ * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
+ * images are zoomed and shifted so that only valid pixels are visible (no black areas after
+ * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
+ * pixels from the original images from the cameras are retained in the rectified images (no source
+ * image pixels are lost). Any intermediate value yields an intermediate result between
+ * those two extreme cases.
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ *
+ * The function computes the rotation matrices for each camera that (virtually) make both camera image
+ * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
+ * the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate
+ * as input. As output, it provides two rotation matrices and also two projection matrices in the new
+ * coordinates. The function distinguishes the following two cases:
+ *
+ *
+ * -
+ * Horizontal stereo: the first and the second camera views are shifted relative to each other
+ * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
+ * corresponding epipolar lines in the left and right cameras are horizontal and have the same
+ * y-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx_1 & 0 \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx_2 & T_x*f \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix} ,\)
+ *
+ * where \(T_x\) is a horizontal shift between the cameras and \(cx_1=cx_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ *
+ * -
+ * Vertical stereo: the first and the second camera views are shifted relative to each other
+ * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
+ * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_1 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_2 & T_y*f \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix},\)
+ *
+ * where \(T_y\) is a vertical shift between the cameras and \(cy_1=cy_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
+ * matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to
+ * initialize the rectification map for each camera.
+ *
+ * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
+ * the corresponding image regions. This means that the images are well rectified, which is what most
+ * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
+ * their interiors are all valid pixels.
+ *
+ * ![image](pics/stereo_undistort.jpg)
+ */
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags) {
+ stereoRectify_4(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags);
+ }
+
+ /**
+ * Computes rectification transforms for each head of a calibrated stereo camera.
+ *
+ * @param cameraMatrix1 First camera intrinsic matrix.
+ * @param distCoeffs1 First camera distortion parameters.
+ * @param cameraMatrix2 Second camera intrinsic matrix.
+ * @param distCoeffs2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param T Translation vector from the coordinate system of the first camera to the second camera,
+ * see REF: stereoCalibrate.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
+ * brings points given in the unrectified first camera's coordinate system to points in the rectified
+ * first camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
+ * brings points given in the unrectified second camera's coordinate system to points in the rectified
+ * second camera's coordinate system. In more technical terms, it performs a change of basis from the
+ * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified first camera's image.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera, i.e. it projects points given in the rectified first camera coordinate system into the
+ * rectified second camera's image.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
+ * images are zoomed and shifted so that only valid pixels are visible (no black areas after
+ * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
+ * pixels from the original images from the cameras are retained in the rectified images (no source
+ * image pixels are lost). Any intermediate value yields an intermediate result between
+ * those two extreme cases.
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+ * (see the picture below).
+ *
+ * The function computes the rotation matrices for each camera that (virtually) make both camera image
+ * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
+ * the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate
+ * as input. As output, it provides two rotation matrices and also two projection matrices in the new
+ * coordinates. The function distinguishes the following two cases:
+ *
+ *
+ * -
+ * Horizontal stereo: the first and the second camera views are shifted relative to each other
+ * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
+ * corresponding epipolar lines in the left and right cameras are horizontal and have the same
+ * y-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx_1 & 0 \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx_2 & T_x*f \\
+ * 0 & f & cy & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix} ,\)
+ *
+ * where \(T_x\) is a horizontal shift between the cameras and \(cx_1=cx_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ *
+ * -
+ * Vertical stereo: the first and the second camera views are shifted relative to each other
+ * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
+ * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
+ *
+ *
+ *
+ * \(\texttt{P1} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_1 & 0 \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix}\)
+ *
+ * \(\texttt{P2} = \begin{bmatrix}
+ * f & 0 & cx & 0 \\
+ * 0 & f & cy_2 & T_y*f \\
+ * 0 & 0 & 1 & 0
+ * \end{bmatrix},\)
+ *
+ * where \(T_y\) is a vertical shift between the cameras and \(cy_1=cy_2\) if
+ * REF: CALIB_ZERO_DISPARITY is set.
+ *
+ * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
+ * matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to
+ * initialize the rectification map for each camera.
+ *
+ * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
+ * the corresponding image regions. This means that the images are well rectified, which is what most
+ * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
+ * their interiors are all valid pixels.
+ *
+ * ![image](pics/stereo_undistort.jpg)
+ */
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q) {
+ stereoRectify_5(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat& H1, Mat& H2, double threshold = 5)
+ //
+
+ /**
+ * Computes a rectification transform for an uncalibrated stereo camera.
+ *
+ * @param points1 Array of feature points in the first image.
+ * @param points2 The corresponding points in the second image. The same formats as in
+ * findFundamentalMat are supported.
+ * @param F Input fundamental matrix. It can be computed from the same set of point pairs using
+ * findFundamentalMat .
+ * @param imgSize Size of the image.
+ * @param H1 Output rectification homography matrix for the first image.
+ * @param H2 Output rectification homography matrix for the second image.
+ * @param threshold Optional threshold used to filter out the outliers. If the parameter is greater
+ * than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
+ * for which \(|\texttt{points2[i]}^T*\texttt{F}*\texttt{points1[i]}|>\texttt{threshold}\) ) are
+ * rejected prior to computing the homographies. Otherwise, all the points are considered inliers.
+ *
+ * The function computes the rectification transformations without knowing intrinsic parameters of the
+ * cameras and their relative position in the space, which explains the suffix "uncalibrated". Another
+ * related difference from stereoRectify is that the function outputs not the rectification
+ * transformations in the object (3D) space, but the planar perspective transformations encoded by the
+ * homography matrices H1 and H2 . The function implements the algorithm CITE: Hartley99 .
+ *
+ * Note:
+ * While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily
+ * depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion,
+ * it would be better to correct it before computing the fundamental matrix and calling this
+ * function. For example, distortion coefficients can be estimated for each head of stereo camera
+ * separately by using calibrateCamera . Then, the images can be corrected using undistort , or
+ * just the point coordinates can be corrected with undistortPoints .
+ * @return automatically generated
+ */
+ public static boolean stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat H1, Mat H2, double threshold) {
+ return stereoRectifyUncalibrated_0(points1.nativeObj, points2.nativeObj, F.nativeObj, imgSize.width, imgSize.height, H1.nativeObj, H2.nativeObj, threshold);
+ }
+
+ /**
+ * Computes a rectification transform for an uncalibrated stereo camera.
+ *
+ * @param points1 Array of feature points in the first image.
+ * @param points2 The corresponding points in the second image. The same formats as in
+ * findFundamentalMat are supported.
+ * @param F Input fundamental matrix. It can be computed from the same set of point pairs using
+ * findFundamentalMat .
+ * @param imgSize Size of the image.
+ * @param H1 Output rectification homography matrix for the first image.
+ * @param H2 Output rectification homography matrix for the second image.
+ * than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
+ * for which \(|\texttt{points2[i]}^T*\texttt{F}*\texttt{points1[i]}|>\texttt{threshold}\) ) are
+ * rejected prior to computing the homographies. Otherwise, all the points are considered inliers.
+ *
+ * The function computes the rectification transformations without knowing intrinsic parameters of the
+ * cameras and their relative position in the space, which explains the suffix "uncalibrated". Another
+ * related difference from stereoRectify is that the function outputs not the rectification
+ * transformations in the object (3D) space, but the planar perspective transformations encoded by the
+ * homography matrices H1 and H2 . The function implements the algorithm CITE: Hartley99 .
+ *
+ * Note:
+ * While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily
+ * depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion,
+ * it would be better to correct it before computing the fundamental matrix and calling this
+ * function. For example, distortion coefficients can be estimated for each head of stereo camera
+ * separately by using calibrateCamera . Then, the images can be corrected using undistort , or
+ * just the point coordinates can be corrected with undistortPoints .
+ * @return automatically generated
+ */
+ public static boolean stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat H1, Mat H2) {
+ return stereoRectifyUncalibrated_1(points1.nativeObj, points2.nativeObj, F.nativeObj, imgSize.width, imgSize.height, H1.nativeObj, H2.nativeObj);
+ }
+
+
+ //
+ // C++: float cv::rectify3Collinear(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat cameraMatrix3, Mat distCoeffs3, vector_Mat imgpt1, vector_Mat imgpt3, Size imageSize, Mat R12, Mat T12, Mat R13, Mat T13, Mat& R1, Mat& R2, Mat& R3, Mat& P1, Mat& P2, Mat& P3, Mat& Q, double alpha, Size newImgSize, Rect* roi1, Rect* roi2, int flags)
+ //
+
+ public static float rectify3Collinear(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat cameraMatrix3, Mat distCoeffs3, List imgpt1, List imgpt3, Size imageSize, Mat R12, Mat T12, Mat R13, Mat T13, Mat R1, Mat R2, Mat R3, Mat P1, Mat P2, Mat P3, Mat Q, double alpha, Size newImgSize, Rect roi1, Rect roi2, int flags) {
+ Mat imgpt1_mat = Converters.vector_Mat_to_Mat(imgpt1);
+ Mat imgpt3_mat = Converters.vector_Mat_to_Mat(imgpt3);
+ double[] roi1_out = new double[4];
+ double[] roi2_out = new double[4];
+ float retVal = rectify3Collinear_0(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, cameraMatrix3.nativeObj, distCoeffs3.nativeObj, imgpt1_mat.nativeObj, imgpt3_mat.nativeObj, imageSize.width, imageSize.height, R12.nativeObj, T12.nativeObj, R13.nativeObj, T13.nativeObj, R1.nativeObj, R2.nativeObj, R3.nativeObj, P1.nativeObj, P2.nativeObj, P3.nativeObj, Q.nativeObj, alpha, newImgSize.width, newImgSize.height, roi1_out, roi2_out, flags);
+ if(roi1!=null){ roi1.x = (int)roi1_out[0]; roi1.y = (int)roi1_out[1]; roi1.width = (int)roi1_out[2]; roi1.height = (int)roi1_out[3]; }
+ if(roi2!=null){ roi2.x = (int)roi2_out[0]; roi2.y = (int)roi2_out[1]; roi2.width = (int)roi2_out[2]; roi2.height = (int)roi2_out[3]; }
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize = Size(), Rect* validPixROI = 0, bool centerPrincipalPoint = false)
+ //
+
+ /**
+ * Returns the new camera intrinsic matrix based on the free scaling parameter.
+ *
+ * @param cameraMatrix Input camera intrinsic matrix.
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param imageSize Original image size.
+ * @param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
+ * valid) and 1 (when all the source image pixels are retained in the undistorted image). See
+ * stereoRectify for details.
+ * @param newImgSize Image size after rectification. By default, it is set to imageSize .
+ * @param validPixROI Optional output rectangle that outlines all-good-pixels region in the
+ * undistorted image. See roi1, roi2 description in stereoRectify .
+ * @param centerPrincipalPoint Optional flag that indicates whether in the new camera intrinsic matrix the
+ * principal point should be at the image center or not. By default, the principal point is chosen to
+ * best fit a subset of the source image (determined by alpha) to the corrected image.
+ * @return new_camera_matrix Output new camera intrinsic matrix.
+ *
+ * The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter.
+ * By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
+ * image pixels if there is valuable information in the corners alpha=1 , or get something in between.
+ * When alpha>0 , the undistorted result is likely to have some black pixels corresponding to
+ * "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion
+ * coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to
+ * initUndistortRectifyMap to produce the maps for remap .
+ */
+ public static Mat getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize, Rect validPixROI, boolean centerPrincipalPoint) {
+ double[] validPixROI_out = new double[4];
+ Mat retVal = new Mat(getOptimalNewCameraMatrix_0(cameraMatrix.nativeObj, distCoeffs.nativeObj, imageSize.width, imageSize.height, alpha, newImgSize.width, newImgSize.height, validPixROI_out, centerPrincipalPoint));
+ if(validPixROI!=null){ validPixROI.x = (int)validPixROI_out[0]; validPixROI.y = (int)validPixROI_out[1]; validPixROI.width = (int)validPixROI_out[2]; validPixROI.height = (int)validPixROI_out[3]; }
+ return retVal;
+ }
+
+ /**
+ * Returns the new camera intrinsic matrix based on the free scaling parameter.
+ *
+ * @param cameraMatrix Input camera intrinsic matrix.
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param imageSize Original image size.
+ * @param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
+ * valid) and 1 (when all the source image pixels are retained in the undistorted image). See
+ * stereoRectify for details.
+ * @param newImgSize Image size after rectification. By default, it is set to imageSize .
+ * @param validPixROI Optional output rectangle that outlines all-good-pixels region in the
+ * undistorted image. See roi1, roi2 description in stereoRectify .
+ * principal point should be at the image center or not. By default, the principal point is chosen to
+ * best fit a subset of the source image (determined by alpha) to the corrected image.
+ * @return new_camera_matrix Output new camera intrinsic matrix.
+ *
+ * The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter.
+ * By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
+ * image pixels if there is valuable information in the corners alpha=1 , or get something in between.
+ * When alpha>0 , the undistorted result is likely to have some black pixels corresponding to
+ * "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion
+ * coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to
+ * initUndistortRectifyMap to produce the maps for remap .
+ */
+ public static Mat getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize, Rect validPixROI) {
+ double[] validPixROI_out = new double[4];
+ Mat retVal = new Mat(getOptimalNewCameraMatrix_1(cameraMatrix.nativeObj, distCoeffs.nativeObj, imageSize.width, imageSize.height, alpha, newImgSize.width, newImgSize.height, validPixROI_out));
+ if(validPixROI!=null){ validPixROI.x = (int)validPixROI_out[0]; validPixROI.y = (int)validPixROI_out[1]; validPixROI.width = (int)validPixROI_out[2]; validPixROI.height = (int)validPixROI_out[3]; }
+ return retVal;
+ }
+
+ /**
+ * Returns the new camera intrinsic matrix based on the free scaling parameter.
+ *
+ * @param cameraMatrix Input camera intrinsic matrix.
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param imageSize Original image size.
+ * @param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
+ * valid) and 1 (when all the source image pixels are retained in the undistorted image). See
+ * stereoRectify for details.
+ * @param newImgSize Image size after rectification. By default, it is set to imageSize .
+ * undistorted image. See roi1, roi2 description in stereoRectify .
+ * principal point should be at the image center or not. By default, the principal point is chosen to
+ * best fit a subset of the source image (determined by alpha) to the corrected image.
+ * @return new_camera_matrix Output new camera intrinsic matrix.
+ *
+ * The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter.
+ * By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
+ * image pixels if there is valuable information in the corners alpha=1 , or get something in between.
+ * When alpha>0 , the undistorted result is likely to have some black pixels corresponding to
+ * "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion
+ * coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to
+ * initUndistortRectifyMap to produce the maps for remap .
+ */
+ public static Mat getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize) {
+ return new Mat(getOptimalNewCameraMatrix_2(cameraMatrix.nativeObj, distCoeffs.nativeObj, imageSize.width, imageSize.height, alpha, newImgSize.width, newImgSize.height));
+ }
+
+ /**
+ * Returns the new camera intrinsic matrix based on the free scaling parameter.
+ *
+ * @param cameraMatrix Input camera intrinsic matrix.
+ * @param distCoeffs Input vector of distortion coefficients
+ * \(\distcoeffs\). If the vector is NULL/empty, the zero distortion coefficients are
+ * assumed.
+ * @param imageSize Original image size.
+ * @param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
+ * valid) and 1 (when all the source image pixels are retained in the undistorted image). See
+ * stereoRectify for details.
+ * undistorted image. See roi1, roi2 description in stereoRectify .
+ * principal point should be at the image center or not. By default, the principal point is chosen to
+ * best fit a subset of the source image (determined by alpha) to the corrected image.
+ * @return new_camera_matrix Output new camera intrinsic matrix.
+ *
+ * The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter.
+ * By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
+ * image pixels if there is valuable information in the corners alpha=1 , or get something in between.
+ * When alpha>0 , the undistorted result is likely to have some black pixels corresponding to
+ * "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion
+ * coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to
+ * initUndistortRectifyMap to produce the maps for remap .
+ */
+ public static Mat getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha) {
+ return new Mat(getOptimalNewCameraMatrix_3(cameraMatrix.nativeObj, distCoeffs.nativeObj, imageSize.width, imageSize.height, alpha));
+ }
+
+
+ //
+ // C++: void cv::calibrateHandEye(vector_Mat R_gripper2base, vector_Mat t_gripper2base, vector_Mat R_target2cam, vector_Mat t_target2cam, Mat& R_cam2gripper, Mat& t_cam2gripper, HandEyeCalibrationMethod method = CALIB_HAND_EYE_TSAI)
+ //
+
+ /**
+ * Computes Hand-Eye calibration: \(_{}^{g}\textrm{T}_c\)
+ *
+ * @param R_gripper2base Rotation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the gripper frame to the robot base frame (\(_{}^{b}\textrm{T}_g\)).
+ * This is a vector ({@code vector<Mat>}) that contains the rotation, {@code (3x3)} rotation matrices or {@code (3x1)} rotation vectors,
+ * for all the transformations from gripper frame to robot base frame.
+ * @param t_gripper2base Translation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the gripper frame to the robot base frame (\(_{}^{b}\textrm{T}_g\)).
+ * This is a vector ({@code vector<Mat>}) that contains the {@code (3x1)} translation vectors for all the transformations
+ * from gripper frame to robot base frame.
+ * @param R_target2cam Rotation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the target frame to the camera frame (\(_{}^{c}\textrm{T}_t\)).
+ * This is a vector ({@code vector<Mat>}) that contains the rotation, {@code (3x3)} rotation matrices or {@code (3x1)} rotation vectors,
+ * for all the transformations from calibration target frame to camera frame.
+ * @param t_target2cam Rotation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the target frame to the camera frame (\(_{}^{c}\textrm{T}_t\)).
+ * This is a vector ({@code vector<Mat>}) that contains the {@code (3x1)} translation vectors for all the transformations
+ * from calibration target frame to camera frame.
+ * @param R_cam2gripper Estimated {@code (3x3)} rotation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the camera frame to the gripper frame (\(_{}^{g}\textrm{T}_c\)).
+ * @param t_cam2gripper Estimated {@code (3x1)} translation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the camera frame to the gripper frame (\(_{}^{g}\textrm{T}_c\)).
+ * @param method One of the implemented Hand-Eye calibration method, see cv::HandEyeCalibrationMethod
+ *
+ * The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the
+ * rotation then the translation (separable solutions) and the following methods are implemented:
+ *
+ * -
+ * R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
+ *
+ * -
+ * F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
+ *
+ * -
+ * R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95
+ *
+ *
+ *
+ * Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions),
+ * with the following implemented method:
+ *
+ * -
+ * N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99
+ *
+ * -
+ * K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98
+ *
+ *
+ *
+ * The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye")
+ * mounted on a robot gripper ("hand") has to be estimated.
+ *
+ * ![](pics/hand-eye_figure.png)
+ *
+ * The calibration procedure is the following:
+ *
+ * -
+ * a static calibration pattern is used to estimate the transformation between the target frame
+ * and the camera frame
+ *
+ * -
+ * the robot gripper is moved in order to acquire several poses
+ *
+ * -
+ * for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for
+ * instance the robot kinematics
+ * \(
+ * \begin{bmatrix}
+ * X_b\\
+ * Y_b\\
+ * Z_b\\
+ * 1
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\
+ * 0_{1 \times 3} & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_g\\
+ * Y_g\\
+ * Z_g\\
+ * 1
+ * \end{bmatrix}
+ * \)
+ *
+ * -
+ * for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using
+ * for instance a pose estimation method (PnP) from 2D-3D point correspondences
+ * \(
+ * \begin{bmatrix}
+ * X_c\\
+ * Y_c\\
+ * Z_c\\
+ * 1
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\
+ * 0_{1 \times 3} & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_t\\
+ * Y_t\\
+ * Z_t\\
+ * 1
+ * \end{bmatrix}
+ * \)
+ *
+ *
+ *
+ * The Hand-Eye calibration procedure returns the following homogeneous transformation
+ * \(
+ * \begin{bmatrix}
+ * X_g\\
+ * Y_g\\
+ * Z_g\\
+ * 1
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\
+ * 0_{1 \times 3} & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_c\\
+ * Y_c\\
+ * Z_c\\
+ * 1
+ * \end{bmatrix}
+ * \)
+ *
+ * This problem is also known as solving the \(\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}\) equation:
+ * \(
+ * \begin{align*}
+ * ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &=
+ * \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\
+ *
+ * (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &=
+ * \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\
+ *
+ * \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\
+ * \end{align*}
+ * \)
+ *
+ * \note
+ * Additional information can be found on this [website](http://campar.in.tum.de/Chair/HandEyeCalibration).
+ * \note
+ * A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation.
+ * So at least 3 different poses are required, but it is strongly recommended to use many more poses.
+ */
+ public static void calibrateHandEye(List R_gripper2base, List t_gripper2base, List R_target2cam, List t_target2cam, Mat R_cam2gripper, Mat t_cam2gripper, int method) {
+ Mat R_gripper2base_mat = Converters.vector_Mat_to_Mat(R_gripper2base);
+ Mat t_gripper2base_mat = Converters.vector_Mat_to_Mat(t_gripper2base);
+ Mat R_target2cam_mat = Converters.vector_Mat_to_Mat(R_target2cam);
+ Mat t_target2cam_mat = Converters.vector_Mat_to_Mat(t_target2cam);
+ calibrateHandEye_0(R_gripper2base_mat.nativeObj, t_gripper2base_mat.nativeObj, R_target2cam_mat.nativeObj, t_target2cam_mat.nativeObj, R_cam2gripper.nativeObj, t_cam2gripper.nativeObj, method);
+ }
+
+ /**
+ * Computes Hand-Eye calibration: \(_{}^{g}\textrm{T}_c\)
+ *
+ * @param R_gripper2base Rotation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the gripper frame to the robot base frame (\(_{}^{b}\textrm{T}_g\)).
+ * This is a vector ({@code vector<Mat>}) that contains the rotation, {@code (3x3)} rotation matrices or {@code (3x1)} rotation vectors,
+ * for all the transformations from gripper frame to robot base frame.
+ * @param t_gripper2base Translation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the gripper frame to the robot base frame (\(_{}^{b}\textrm{T}_g\)).
+ * This is a vector ({@code vector<Mat>}) that contains the {@code (3x1)} translation vectors for all the transformations
+ * from gripper frame to robot base frame.
+ * @param R_target2cam Rotation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the target frame to the camera frame (\(_{}^{c}\textrm{T}_t\)).
+ * This is a vector ({@code vector<Mat>}) that contains the rotation, {@code (3x3)} rotation matrices or {@code (3x1)} rotation vectors,
+ * for all the transformations from calibration target frame to camera frame.
+ * @param t_target2cam Rotation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the target frame to the camera frame (\(_{}^{c}\textrm{T}_t\)).
+ * This is a vector ({@code vector<Mat>}) that contains the {@code (3x1)} translation vectors for all the transformations
+ * from calibration target frame to camera frame.
+ * @param R_cam2gripper Estimated {@code (3x3)} rotation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the camera frame to the gripper frame (\(_{}^{g}\textrm{T}_c\)).
+ * @param t_cam2gripper Estimated {@code (3x1)} translation part extracted from the homogeneous matrix that transforms a point
+ * expressed in the camera frame to the gripper frame (\(_{}^{g}\textrm{T}_c\)).
+ *
+ * The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the
+ * rotation then the translation (separable solutions) and the following methods are implemented:
+ *
+ * -
+ * R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
+ *
+ * -
+ * F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
+ *
+ * -
+ * R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95
+ *
+ *
+ *
+ * Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions),
+ * with the following implemented method:
+ *
+ * -
+ * N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99
+ *
+ * -
+ * K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98
+ *
+ *
+ *
+ * The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye")
+ * mounted on a robot gripper ("hand") has to be estimated.
+ *
+ * ![](pics/hand-eye_figure.png)
+ *
+ * The calibration procedure is the following:
+ *
+ * -
+ * a static calibration pattern is used to estimate the transformation between the target frame
+ * and the camera frame
+ *
+ * -
+ * the robot gripper is moved in order to acquire several poses
+ *
+ * -
+ * for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for
+ * instance the robot kinematics
+ * \(
+ * \begin{bmatrix}
+ * X_b\\
+ * Y_b\\
+ * Z_b\\
+ * 1
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\
+ * 0_{1 \times 3} & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_g\\
+ * Y_g\\
+ * Z_g\\
+ * 1
+ * \end{bmatrix}
+ * \)
+ *
+ * -
+ * for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using
+ * for instance a pose estimation method (PnP) from 2D-3D point correspondences
+ * \(
+ * \begin{bmatrix}
+ * X_c\\
+ * Y_c\\
+ * Z_c\\
+ * 1
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\
+ * 0_{1 \times 3} & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_t\\
+ * Y_t\\
+ * Z_t\\
+ * 1
+ * \end{bmatrix}
+ * \)
+ *
+ *
+ *
+ * The Hand-Eye calibration procedure returns the following homogeneous transformation
+ * \(
+ * \begin{bmatrix}
+ * X_g\\
+ * Y_g\\
+ * Z_g\\
+ * 1
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\
+ * 0_{1 \times 3} & 1
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X_c\\
+ * Y_c\\
+ * Z_c\\
+ * 1
+ * \end{bmatrix}
+ * \)
+ *
+ * This problem is also known as solving the \(\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}\) equation:
+ * \(
+ * \begin{align*}
+ * ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &=
+ * \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\
+ *
+ * (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &=
+ * \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\
+ *
+ * \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\
+ * \end{align*}
+ * \)
+ *
+ * \note
+ * Additional information can be found on this [website](http://campar.in.tum.de/Chair/HandEyeCalibration).
+ * \note
+ * A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation.
+ * So at least 3 different poses are required, but it is strongly recommended to use many more poses.
+ */
+ public static void calibrateHandEye(List R_gripper2base, List t_gripper2base, List R_target2cam, List t_target2cam, Mat R_cam2gripper, Mat t_cam2gripper) {
+ Mat R_gripper2base_mat = Converters.vector_Mat_to_Mat(R_gripper2base);
+ Mat t_gripper2base_mat = Converters.vector_Mat_to_Mat(t_gripper2base);
+ Mat R_target2cam_mat = Converters.vector_Mat_to_Mat(R_target2cam);
+ Mat t_target2cam_mat = Converters.vector_Mat_to_Mat(t_target2cam);
+ calibrateHandEye_1(R_gripper2base_mat.nativeObj, t_gripper2base_mat.nativeObj, R_target2cam_mat.nativeObj, t_target2cam_mat.nativeObj, R_cam2gripper.nativeObj, t_cam2gripper.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::convertPointsToHomogeneous(Mat src, Mat& dst)
+ //
+
+ /**
+ * Converts points from Euclidean to homogeneous space.
+ *
+ * @param src Input vector of N-dimensional points.
+ * @param dst Output vector of N+1-dimensional points.
+ *
+ * The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of
+ * point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).
+ */
+ public static void convertPointsToHomogeneous(Mat src, Mat dst) {
+ convertPointsToHomogeneous_0(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::convertPointsFromHomogeneous(Mat src, Mat& dst)
+ //
+
+ /**
+ * Converts points from homogeneous to Euclidean space.
+ *
+ * @param src Input vector of N-dimensional points.
+ * @param dst Output vector of N-1-dimensional points.
+ *
+ * The function converts points homogeneous to Euclidean space using perspective projection. That is,
+ * each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the
+ * output point coordinates will be (0,0,0,...).
+ */
+ public static void convertPointsFromHomogeneous(Mat src, Mat dst) {
+ convertPointsFromHomogeneous_0(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: Mat cv::findFundamentalMat(vector_Point2f points1, vector_Point2f points2, int method, double ransacReprojThreshold, double confidence, int maxIters, Mat& mask = Mat())
+ //
+
+ /**
+ * Calculates a fundamental matrix from the corresponding points in two images.
+ *
+ * @param points1 Array of N points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param method Method for computing a fundamental matrix.
+ *
+ * -
+ * REF: FM_7POINT for a 7-point algorithm. \(N = 7\)
+ *
+ * -
+ * REF: FM_8POINT for an 8-point algorithm. \(N \ge 8\)
+ *
+ * -
+ * REF: FM_RANSAC for the RANSAC algorithm. \(N \ge 8\)
+ *
+ * -
+ * REF: FM_LMEDS for the LMedS algorithm. \(N \ge 8\)
+ * @param ransacReprojThreshold Parameter used only for RANSAC. It is the maximum distance from a point to an epipolar
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * @param confidence Parameter used for the RANSAC and LMedS methods only. It specifies a desirable level
+ * of confidence (probability) that the estimated matrix is correct.
+ * @param mask optional output mask
+ * @param maxIters The maximum number of robust method iterations.
+ *
+ *
+ *
+ * The epipolar geometry is described by the following equation:
+ *
+ * \([p_2; 1]^T F [p_1; 1] = 0\)
+ *
+ * where \(F\) is a fundamental matrix, \(p_1\) and \(p_2\) are corresponding points in the first and the
+ * second images, respectively.
+ *
+ * The function calculates the fundamental matrix using one of four methods listed above and returns
+ * the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point
+ * algorithm, the function may return up to 3 solutions ( \(9 \times 3\) matrix that stores all 3
+ * matrices sequentially).
+ *
+ * The calculated fundamental matrix may be passed further to computeCorrespondEpilines that finds the
+ * epipolar lines corresponding to the specified points. It can also be passed to
+ * stereoRectifyUncalibrated to compute the rectification transformation. :
+ *
+ * // Example. Estimation of fundamental matrix using the RANSAC algorithm
+ * int point_count = 100;
+ * vector<Point2f> points1(point_count);
+ * vector<Point2f> points2(point_count);
+ *
+ * // initialize the points here ...
+ * for( int i = 0; i < point_count; i++ )
+ * {
+ * points1[i] = ...;
+ * points2[i] = ...;
+ * }
+ *
+ * Mat fundamental_matrix =
+ * findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);
+ *
+ * @return automatically generated
+ */
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method, double ransacReprojThreshold, double confidence, int maxIters, Mat mask) {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ return new Mat(findFundamentalMat_0(points1_mat.nativeObj, points2_mat.nativeObj, method, ransacReprojThreshold, confidence, maxIters, mask.nativeObj));
+ }
+
+ /**
+ * Calculates a fundamental matrix from the corresponding points in two images.
+ *
+ * @param points1 Array of N points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param method Method for computing a fundamental matrix.
+ *
+ * -
+ * REF: FM_7POINT for a 7-point algorithm. \(N = 7\)
+ *
+ * -
+ * REF: FM_8POINT for an 8-point algorithm. \(N \ge 8\)
+ *
+ * -
+ * REF: FM_RANSAC for the RANSAC algorithm. \(N \ge 8\)
+ *
+ * -
+ * REF: FM_LMEDS for the LMedS algorithm. \(N \ge 8\)
+ * @param ransacReprojThreshold Parameter used only for RANSAC. It is the maximum distance from a point to an epipolar
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * @param confidence Parameter used for the RANSAC and LMedS methods only. It specifies a desirable level
+ * of confidence (probability) that the estimated matrix is correct.
+ * @param maxIters The maximum number of robust method iterations.
+ *
+ *
+ *
+ * The epipolar geometry is described by the following equation:
+ *
+ * \([p_2; 1]^T F [p_1; 1] = 0\)
+ *
+ * where \(F\) is a fundamental matrix, \(p_1\) and \(p_2\) are corresponding points in the first and the
+ * second images, respectively.
+ *
+ * The function calculates the fundamental matrix using one of four methods listed above and returns
+ * the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point
+ * algorithm, the function may return up to 3 solutions ( \(9 \times 3\) matrix that stores all 3
+ * matrices sequentially).
+ *
+ * The calculated fundamental matrix may be passed further to computeCorrespondEpilines that finds the
+ * epipolar lines corresponding to the specified points. It can also be passed to
+ * stereoRectifyUncalibrated to compute the rectification transformation. :
+ *
+ * // Example. Estimation of fundamental matrix using the RANSAC algorithm
+ * int point_count = 100;
+ * vector<Point2f> points1(point_count);
+ * vector<Point2f> points2(point_count);
+ *
+ * // initialize the points here ...
+ * for( int i = 0; i < point_count; i++ )
+ * {
+ * points1[i] = ...;
+ * points2[i] = ...;
+ * }
+ *
+ * Mat fundamental_matrix =
+ * findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);
+ *
+ * @return automatically generated
+ */
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method, double ransacReprojThreshold, double confidence, int maxIters) {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ return new Mat(findFundamentalMat_1(points1_mat.nativeObj, points2_mat.nativeObj, method, ransacReprojThreshold, confidence, maxIters));
+ }
+
+
+ //
+ // C++: Mat cv::findFundamentalMat(vector_Point2f points1, vector_Point2f points2, int method = FM_RANSAC, double ransacReprojThreshold = 3., double confidence = 0.99, Mat& mask = Mat())
+ //
+
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method, double ransacReprojThreshold, double confidence, Mat mask) {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ return new Mat(findFundamentalMat_2(points1_mat.nativeObj, points2_mat.nativeObj, method, ransacReprojThreshold, confidence, mask.nativeObj));
+ }
+
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method, double ransacReprojThreshold, double confidence) {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ return new Mat(findFundamentalMat_3(points1_mat.nativeObj, points2_mat.nativeObj, method, ransacReprojThreshold, confidence));
+ }
+
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method, double ransacReprojThreshold) {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ return new Mat(findFundamentalMat_4(points1_mat.nativeObj, points2_mat.nativeObj, method, ransacReprojThreshold));
+ }
+
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method) {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ return new Mat(findFundamentalMat_5(points1_mat.nativeObj, points2_mat.nativeObj, method));
+ }
+
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2) {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ return new Mat(findFundamentalMat_6(points1_mat.nativeObj, points2_mat.nativeObj));
+ }
+
+
+ //
+ // C++: Mat cv::findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
+ //
+
+ /**
+ * Calculates an essential matrix from the corresponding points in two images.
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix. If this assumption does not hold for your use case, use
+ * {@code undistortPoints()} with {@code P = cv::NoArray()} for both cameras to transform image points
+ * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
+ * passing these coordinates, pass the identity matrix for this parameter.
+ * @param method Method for computing an essential matrix.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+ * confidence (probability) that the estimated matrix is correct.
+ * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * @param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
+ * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
+ *
+ * \([p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\)
+ *
+ * where \(E\) is an essential matrix, \(p_1\) and \(p_2\) are corresponding points in the first and the
+ * second images, respectively. The result of this function may be passed further to
+ * decomposeEssentialMat or recoverPose to recover the relative pose between cameras.
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method, double prob, double threshold, Mat mask) {
+ return new Mat(findEssentialMat_0(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, method, prob, threshold, mask.nativeObj));
+ }
+
+ /**
+ * Calculates an essential matrix from the corresponding points in two images.
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix. If this assumption does not hold for your use case, use
+ * {@code undistortPoints()} with {@code P = cv::NoArray()} for both cameras to transform image points
+ * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
+ * passing these coordinates, pass the identity matrix for this parameter.
+ * @param method Method for computing an essential matrix.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+ * confidence (probability) that the estimated matrix is correct.
+ * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
+ * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
+ *
+ * \([p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\)
+ *
+ * where \(E\) is an essential matrix, \(p_1\) and \(p_2\) are corresponding points in the first and the
+ * second images, respectively. The result of this function may be passed further to
+ * decomposeEssentialMat or recoverPose to recover the relative pose between cameras.
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method, double prob, double threshold) {
+ return new Mat(findEssentialMat_1(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, method, prob, threshold));
+ }
+
+ /**
+ * Calculates an essential matrix from the corresponding points in two images.
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix. If this assumption does not hold for your use case, use
+ * {@code undistortPoints()} with {@code P = cv::NoArray()} for both cameras to transform image points
+ * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
+ * passing these coordinates, pass the identity matrix for this parameter.
+ * @param method Method for computing an essential matrix.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+ * confidence (probability) that the estimated matrix is correct.
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
+ * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
+ *
+ * \([p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\)
+ *
+ * where \(E\) is an essential matrix, \(p_1\) and \(p_2\) are corresponding points in the first and the
+ * second images, respectively. The result of this function may be passed further to
+ * decomposeEssentialMat or recoverPose to recover the relative pose between cameras.
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method, double prob) {
+ return new Mat(findEssentialMat_2(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, method, prob));
+ }
+
+ /**
+ * Calculates an essential matrix from the corresponding points in two images.
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix. If this assumption does not hold for your use case, use
+ * {@code undistortPoints()} with {@code P = cv::NoArray()} for both cameras to transform image points
+ * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
+ * passing these coordinates, pass the identity matrix for this parameter.
+ * @param method Method for computing an essential matrix.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * confidence (probability) that the estimated matrix is correct.
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
+ * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
+ *
+ * \([p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\)
+ *
+ * where \(E\) is an essential matrix, \(p_1\) and \(p_2\) are corresponding points in the first and the
+ * second images, respectively. The result of this function may be passed further to
+ * decomposeEssentialMat or recoverPose to recover the relative pose between cameras.
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method) {
+ return new Mat(findEssentialMat_3(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, method));
+ }
+
+ /**
+ * Calculates an essential matrix from the corresponding points in two images.
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix. If this assumption does not hold for your use case, use
+ * {@code undistortPoints()} with {@code P = cv::NoArray()} for both cameras to transform image points
+ * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
+ * passing these coordinates, pass the identity matrix for this parameter.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * confidence (probability) that the estimated matrix is correct.
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
+ * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
+ *
+ * \([p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\)
+ *
+ * where \(E\) is an essential matrix, \(p_1\) and \(p_2\) are corresponding points in the first and the
+ * second images, respectively. The result of this function may be passed further to
+ * decomposeEssentialMat or recoverPose to recover the relative pose between cameras.
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix) {
+ return new Mat(findEssentialMat_4(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj));
+ }
+
+
+ //
+ // C++: Mat cv::findEssentialMat(Mat points1, Mat points2, double focal = 1.0, Point2d pp = Point2d(0, 0), int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
+ //
+
+ /**
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param focal focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ * @param pp principal point of the camera.
+ * @param method Method for computing a fundamental matrix.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+ * confidence (probability) that the estimated matrix is correct.
+ * @param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp, int method, double prob, double threshold, Mat mask) {
+ return new Mat(findEssentialMat_5(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y, method, prob, threshold, mask.nativeObj));
+ }
+
+ /**
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param focal focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ * @param pp principal point of the camera.
+ * @param method Method for computing a fundamental matrix.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+ * confidence (probability) that the estimated matrix is correct.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp, int method, double prob, double threshold) {
+ return new Mat(findEssentialMat_6(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y, method, prob, threshold));
+ }
+
+ /**
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param focal focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ * @param pp principal point of the camera.
+ * @param method Method for computing a fundamental matrix.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+ * confidence (probability) that the estimated matrix is correct.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp, int method, double prob) {
+ return new Mat(findEssentialMat_7(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y, method, prob));
+ }
+
+ /**
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param focal focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ * @param pp principal point of the camera.
+ * @param method Method for computing a fundamental matrix.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * confidence (probability) that the estimated matrix is correct.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp, int method) {
+ return new Mat(findEssentialMat_8(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y, method));
+ }
+
+ /**
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param focal focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ * @param pp principal point of the camera.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * confidence (probability) that the estimated matrix is correct.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp) {
+ return new Mat(findEssentialMat_9(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y));
+ }
+
+ /**
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param focal focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * confidence (probability) that the estimated matrix is correct.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal) {
+ return new Mat(findEssentialMat_10(points1.nativeObj, points2.nativeObj, focal));
+ }
+
+ /**
+ *
+ * @param points1 Array of N (N >= 5) 2D points from the first image. The point coordinates should
+ * be floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * are feature points from cameras with same focal length and principal point.
+ *
+ * -
+ * REF: RANSAC for the RANSAC algorithm.
+ *
+ * -
+ * REF: LMEDS for the LMedS algorithm.
+ * line in pixels, beyond which the point is considered an outlier and is not used for computing the
+ * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+ * point localization, image resolution, and the image noise.
+ * confidence (probability) that the estimated matrix is correct.
+ * for the other points. The array is computed only in the RANSAC and LMedS methods.
+ *
+ *
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static Mat findEssentialMat(Mat points1, Mat points2) {
+ return new Mat(findEssentialMat_11(points1.nativeObj, points2.nativeObj));
+ }
+
+
+ //
+ // C++: void cv::decomposeEssentialMat(Mat E, Mat& R1, Mat& R2, Mat& t)
+ //
+
+ /**
+ * Decompose an essential matrix to possible rotations and translation.
+ *
+ * @param E The input essential matrix.
+ * @param R1 One possible rotation matrix.
+ * @param R2 Another possible rotation matrix.
+ * @param t One possible translation.
+ *
+ * This function decomposes the essential matrix E using svd decomposition CITE: HartleyZ00. In
+ * general, four possible poses exist for the decomposition of E. They are \([R_1, t]\),
+ * \([R_1, -t]\), \([R_2, t]\), \([R_2, -t]\).
+ *
+ * If E gives the epipolar constraint \([p_2; 1]^T A^{-T} E A^{-1} [p_1; 1] = 0\) between the image
+ * points \(p_1\) in the first image and \(p_2\) in second image, then any of the tuples
+ * \([R_1, t]\), \([R_1, -t]\), \([R_2, t]\), \([R_2, -t]\) is a change of basis from the first
+ * camera's coordinate system to the second camera's coordinate system. However, by decomposing E, one
+ * can only get the direction of the translation. For this reason, the translation t is returned with
+ * unit length.
+ */
+ public static void decomposeEssentialMat(Mat E, Mat R1, Mat R2, Mat t) {
+ decomposeEssentialMat_0(E.nativeObj, R1.nativeObj, R2.nativeObj, t.nativeObj);
+ }
+
+
+ //
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, Mat& mask = Mat())
+ //
+
+ /**
+ * Recovers the relative camera rotation and the translation from an estimated essential
+ * matrix and the corresponding points in two images, using cheirality check. Returns the number of
+ * inliers that pass the check.
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix.
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * described below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ *
+ * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
+ * possible pose hypotheses by doing cheirality check. The cheirality check means that the
+ * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
+ *
+ * This function can be used to process the output E and mask from REF: findEssentialMat. In this
+ * scenario, points1 and points2 are the same input for findEssentialMat.:
+ *
+ * // Example. Estimation of fundamental matrix using the RANSAC algorithm
+ * int point_count = 100;
+ * vector<Point2f> points1(point_count);
+ * vector<Point2f> points2(point_count);
+ *
+ * // initialize the points here ...
+ * for( int i = 0; i < point_count; i++ )
+ * {
+ * points1[i] = ...;
+ * points2[i] = ...;
+ * }
+ *
+ * // cametra matrix with both focal lengths = 1, and principal point = (0, 0)
+ * Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
+ *
+ * Mat E, R, t, mask;
+ *
+ * E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask);
+ * recoverPose(E, points1, points2, cameraMatrix, R, t, mask);
+ *
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t, Mat mask) {
+ return recoverPose_0(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * Recovers the relative camera rotation and the translation from an estimated essential
+ * matrix and the corresponding points in two images, using cheirality check. Returns the number of
+ * inliers that pass the check.
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix.
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * described below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ *
+ * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
+ * possible pose hypotheses by doing cheirality check. The cheirality check means that the
+ * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
+ *
+ * This function can be used to process the output E and mask from REF: findEssentialMat. In this
+ * scenario, points1 and points2 are the same input for findEssentialMat.:
+ *
+ * // Example. Estimation of fundamental matrix using the RANSAC algorithm
+ * int point_count = 100;
+ * vector<Point2f> points1(point_count);
+ * vector<Point2f> points2(point_count);
+ *
+ * // initialize the points here ...
+ * for( int i = 0; i < point_count; i++ )
+ * {
+ * points1[i] = ...;
+ * points2[i] = ...;
+ * }
+ *
+ * // cametra matrix with both focal lengths = 1, and principal point = (0, 0)
+ * Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
+ *
+ * Mat E, R, t, mask;
+ *
+ * E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask);
+ * recoverPose(E, points1, points2, cameraMatrix, R, t, mask);
+ *
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t) {
+ return recoverPose_1(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj);
+ }
+
+
+ //
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat& R, Mat& t, double focal = 1.0, Point2d pp = Point2d(0, 0), Mat& mask = Mat())
+ //
+
+ /**
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * description below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * @param focal Focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ * @param pp principal point of the camera.
+ * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat R, Mat t, double focal, Point pp, Mat mask) {
+ return recoverPose_2(E.nativeObj, points1.nativeObj, points2.nativeObj, R.nativeObj, t.nativeObj, focal, pp.x, pp.y, mask.nativeObj);
+ }
+
+ /**
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * description below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * @param focal Focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ * @param pp principal point of the camera.
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat R, Mat t, double focal, Point pp) {
+ return recoverPose_3(E.nativeObj, points1.nativeObj, points2.nativeObj, R.nativeObj, t.nativeObj, focal, pp.x, pp.y);
+ }
+
+ /**
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * description below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * @param focal Focal length of the camera. Note that this function assumes that points1 and points2
+ * are feature points from cameras with same focal length and principal point.
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat R, Mat t, double focal) {
+ return recoverPose_4(E.nativeObj, points1.nativeObj, points2.nativeObj, R.nativeObj, t.nativeObj, focal);
+ }
+
+ /**
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1 .
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * description below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * are feature points from cameras with same focal length and principal point.
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ *
+ * This function differs from the one above that it computes camera intrinsic matrix from focal length and
+ * principal point:
+ *
+ * \(A =
+ * \begin{bmatrix}
+ * f & 0 & x_{pp} \\
+ * 0 & f & y_{pp} \\
+ * 0 & 0 & 1
+ * \end{bmatrix}\)
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat R, Mat t) {
+ return recoverPose_5(E.nativeObj, points1.nativeObj, points2.nativeObj, R.nativeObj, t.nativeObj);
+ }
+
+
+ //
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, double distanceThresh, Mat& mask = Mat(), Mat& triangulatedPoints = Mat())
+ //
+
+ /**
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1.
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix.
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * description below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * @param distanceThresh threshold distance which is used to filter out far away points (i.e. infinite
+ * points).
+ * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ * @param triangulatedPoints 3D points which were reconstructed by triangulation.
+ *
+ * This function differs from the one above that it outputs the triangulated 3D point that are used for
+ * the cheirality check.
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t, double distanceThresh, Mat mask, Mat triangulatedPoints) {
+ return recoverPose_6(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj, distanceThresh, mask.nativeObj, triangulatedPoints.nativeObj);
+ }
+
+ /**
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1.
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix.
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * description below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * @param distanceThresh threshold distance which is used to filter out far away points (i.e. infinite
+ * points).
+ * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ *
+ * This function differs from the one above that it outputs the triangulated 3D point that are used for
+ * the cheirality check.
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t, double distanceThresh, Mat mask) {
+ return recoverPose_7(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj, distanceThresh, mask.nativeObj);
+ }
+
+ /**
+ *
+ * @param E The input essential matrix.
+ * @param points1 Array of N 2D points from the first image. The point coordinates should be
+ * floating-point (single or double precision).
+ * @param points2 Array of the second image points of the same size and format as points1.
+ * @param cameraMatrix Camera intrinsic matrix \(\cameramatrix{A}\) .
+ * Note that this function assumes that points1 and points2 are feature points from cameras with the
+ * same camera intrinsic matrix.
+ * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
+ * that performs a change of basis from the first camera's coordinate system to the second camera's
+ * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
+ * description below.
+ * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
+ * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
+ * length.
+ * @param distanceThresh threshold distance which is used to filter out far away points (i.e. infinite
+ * points).
+ * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
+ * recover pose. In the output mask only inliers which pass the cheirality check.
+ *
+ * This function differs from the one above that it outputs the triangulated 3D point that are used for
+ * the cheirality check.
+ * @return automatically generated
+ */
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t, double distanceThresh) {
+ return recoverPose_8(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj, distanceThresh);
+ }
+
+
+ //
+ // C++: void cv::computeCorrespondEpilines(Mat points, int whichImage, Mat F, Mat& lines)
+ //
+
+ /**
+ * For points in an image of a stereo pair, computes the corresponding epilines in the other image.
+ *
+ * @param points Input points. \(N \times 1\) or \(1 \times N\) matrix of type CV_32FC2 or
+ * vector<Point2f> .
+ * @param whichImage Index of the image (1 or 2) that contains the points .
+ * @param F Fundamental matrix that can be estimated using findFundamentalMat or stereoRectify .
+ * @param lines Output vector of the epipolar lines corresponding to the points in the other image.
+ * Each line \(ax + by + c=0\) is encoded by 3 numbers \((a, b, c)\) .
+ *
+ * For every point in one of the two images of a stereo pair, the function finds the equation of the
+ * corresponding epipolar line in the other image.
+ *
+ * From the fundamental matrix definition (see findFundamentalMat ), line \(l^{(2)}_i\) in the second
+ * image for the point \(p^{(1)}_i\) in the first image (when whichImage=1 ) is computed as:
+ *
+ * \(l^{(2)}_i = F p^{(1)}_i\)
+ *
+ * And vice versa, when whichImage=2, \(l^{(1)}_i\) is computed from \(p^{(2)}_i\) as:
+ *
+ * \(l^{(1)}_i = F^T p^{(2)}_i\)
+ *
+ * Line coefficients are defined up to a scale. They are normalized so that \(a_i^2+b_i^2=1\) .
+ */
+ public static void computeCorrespondEpilines(Mat points, int whichImage, Mat F, Mat lines) {
+ computeCorrespondEpilines_0(points.nativeObj, whichImage, F.nativeObj, lines.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::triangulatePoints(Mat projMatr1, Mat projMatr2, Mat projPoints1, Mat projPoints2, Mat& points4D)
+ //
+
+ /**
+ * This function reconstructs 3-dimensional points (in homogeneous coordinates) by using
+ * their observations with a stereo camera.
+ *
+ * @param projMatr1 3x4 projection matrix of the first camera, i.e. this matrix projects 3D points
+ * given in the world's coordinate system into the first image.
+ * @param projMatr2 3x4 projection matrix of the second camera, i.e. this matrix projects 3D points
+ * given in the world's coordinate system into the second image.
+ * @param projPoints1 2xN array of feature points in the first image. In the case of the c++ version,
+ * it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
+ * @param projPoints2 2xN array of corresponding points in the second image. In the case of the c++
+ * version, it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
+ * @param points4D 4xN array of reconstructed points in homogeneous coordinates. These points are
+ * returned in the world's coordinate system.
+ *
+ * Note:
+ * Keep in mind that all input data should be of float type in order for this function to work.
+ *
+ * Note:
+ * If the projection matrices from REF: stereoRectify are used, then the returned points are
+ * represented in the first camera's rectified coordinate system.
+ *
+ * SEE:
+ * reprojectImageTo3D
+ */
+ public static void triangulatePoints(Mat projMatr1, Mat projMatr2, Mat projPoints1, Mat projPoints2, Mat points4D) {
+ triangulatePoints_0(projMatr1.nativeObj, projMatr2.nativeObj, projPoints1.nativeObj, projPoints2.nativeObj, points4D.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::correctMatches(Mat F, Mat points1, Mat points2, Mat& newPoints1, Mat& newPoints2)
+ //
+
+ /**
+ * Refines coordinates of corresponding points.
+ *
+ * @param F 3x3 fundamental matrix.
+ * @param points1 1xN array containing the first set of points.
+ * @param points2 1xN array containing the second set of points.
+ * @param newPoints1 The optimized points1.
+ * @param newPoints2 The optimized points2.
+ *
+ * The function implements the Optimal Triangulation Method (see Multiple View Geometry for details).
+ * For each given point correspondence points1[i] <-> points2[i], and a fundamental matrix F, it
+ * computes the corrected correspondences newPoints1[i] <-> newPoints2[i] that minimize the geometric
+ * error \(d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2\) (where \(d(a,b)\) is the
+ * geometric distance between points \(a\) and \(b\) ) subject to the epipolar constraint
+ * \(newPoints2^T * F * newPoints1 = 0\) .
+ */
+ public static void correctMatches(Mat F, Mat points1, Mat points2, Mat newPoints1, Mat newPoints2) {
+ correctMatches_0(F.nativeObj, points1.nativeObj, points2.nativeObj, newPoints1.nativeObj, newPoints2.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::filterSpeckles(Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf = Mat())
+ //
+
+ /**
+ * Filters off small noise blobs (speckles) in the disparity map
+ *
+ * @param img The input 16-bit signed disparity image
+ * @param newVal The disparity value used to paint-off the speckles
+ * @param maxSpeckleSize The maximum speckle size to consider it a speckle. Larger blobs are not
+ * affected by the algorithm
+ * @param maxDiff Maximum difference between neighbor disparity pixels to put them into the same
+ * blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
+ * disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
+ * account when specifying this parameter value.
+ * @param buf The optional temporary buffer to avoid memory allocation within the function.
+ */
+ public static void filterSpeckles(Mat img, double newVal, int maxSpeckleSize, double maxDiff, Mat buf) {
+ filterSpeckles_0(img.nativeObj, newVal, maxSpeckleSize, maxDiff, buf.nativeObj);
+ }
+
+ /**
+ * Filters off small noise blobs (speckles) in the disparity map
+ *
+ * @param img The input 16-bit signed disparity image
+ * @param newVal The disparity value used to paint-off the speckles
+ * @param maxSpeckleSize The maximum speckle size to consider it a speckle. Larger blobs are not
+ * affected by the algorithm
+ * @param maxDiff Maximum difference between neighbor disparity pixels to put them into the same
+ * blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
+ * disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
+ * account when specifying this parameter value.
+ */
+ public static void filterSpeckles(Mat img, double newVal, int maxSpeckleSize, double maxDiff) {
+ filterSpeckles_1(img.nativeObj, newVal, maxSpeckleSize, maxDiff);
+ }
+
+
+ //
+ // C++: Rect cv::getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int blockSize)
+ //
+
+ public static Rect getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int blockSize) {
+ return new Rect(getValidDisparityROI_0(roi1.x, roi1.y, roi1.width, roi1.height, roi2.x, roi2.y, roi2.width, roi2.height, minDisparity, numberOfDisparities, blockSize));
+ }
+
+
+ //
+ // C++: void cv::validateDisparity(Mat& disparity, Mat cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp = 1)
+ //
+
+ public static void validateDisparity(Mat disparity, Mat cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp) {
+ validateDisparity_0(disparity.nativeObj, cost.nativeObj, minDisparity, numberOfDisparities, disp12MaxDisp);
+ }
+
+ public static void validateDisparity(Mat disparity, Mat cost, int minDisparity, int numberOfDisparities) {
+ validateDisparity_1(disparity.nativeObj, cost.nativeObj, minDisparity, numberOfDisparities);
+ }
+
+
+ //
+ // C++: void cv::reprojectImageTo3D(Mat disparity, Mat& _3dImage, Mat Q, bool handleMissingValues = false, int ddepth = -1)
+ //
+
+ /**
+ * Reprojects a disparity image to 3D space.
+ *
+ * @param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
+ * floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
+ * fractional bits. If the disparity is 16-bit signed format, as computed by REF: StereoBM or
+ * REF: StereoSGBM and maybe other algorithms, it should be divided by 16 (and scaled to float) before
+ * being used here.
+ * @param _3dImage Output 3-channel floating-point image of the same size as disparity. Each element of
+ * _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
+ * uses Q obtained by REF: stereoRectify, then the returned points are represented in the first
+ * camera's rectified coordinate system.
+ * @param Q \(4 \times 4\) perspective transformation matrix that can be obtained with
+ * REF: stereoRectify.
+ * @param handleMissingValues Indicates, whether the function should handle missing values (i.e.
+ * points where the disparity was not computed). If handleMissingValues=true, then pixels with the
+ * minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
+ * to 3D points with a very large Z value (currently set to 10000).
+ * @param ddepth The optional output array depth. If it is -1, the output image will have CV_32F
+ * depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
+ *
+ * The function transforms a single-channel disparity map to a 3-channel image representing a 3D
+ * surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it
+ * computes:
+ *
+ * \(\begin{bmatrix}
+ * X \\
+ * Y \\
+ * Z \\
+ * W
+ * \end{bmatrix} = Q \begin{bmatrix}
+ * x \\
+ * y \\
+ * \texttt{disparity} (x,y) \\
+ * z
+ * \end{bmatrix}.\)
+ *
+ * SEE:
+ * To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.
+ */
+ public static void reprojectImageTo3D(Mat disparity, Mat _3dImage, Mat Q, boolean handleMissingValues, int ddepth) {
+ reprojectImageTo3D_0(disparity.nativeObj, _3dImage.nativeObj, Q.nativeObj, handleMissingValues, ddepth);
+ }
+
+ /**
+ * Reprojects a disparity image to 3D space.
+ *
+ * @param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
+ * floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
+ * fractional bits. If the disparity is 16-bit signed format, as computed by REF: StereoBM or
+ * REF: StereoSGBM and maybe other algorithms, it should be divided by 16 (and scaled to float) before
+ * being used here.
+ * @param _3dImage Output 3-channel floating-point image of the same size as disparity. Each element of
+ * _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
+ * uses Q obtained by REF: stereoRectify, then the returned points are represented in the first
+ * camera's rectified coordinate system.
+ * @param Q \(4 \times 4\) perspective transformation matrix that can be obtained with
+ * REF: stereoRectify.
+ * @param handleMissingValues Indicates, whether the function should handle missing values (i.e.
+ * points where the disparity was not computed). If handleMissingValues=true, then pixels with the
+ * minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
+ * to 3D points with a very large Z value (currently set to 10000).
+ * depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
+ *
+ * The function transforms a single-channel disparity map to a 3-channel image representing a 3D
+ * surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it
+ * computes:
+ *
+ * \(\begin{bmatrix}
+ * X \\
+ * Y \\
+ * Z \\
+ * W
+ * \end{bmatrix} = Q \begin{bmatrix}
+ * x \\
+ * y \\
+ * \texttt{disparity} (x,y) \\
+ * z
+ * \end{bmatrix}.\)
+ *
+ * SEE:
+ * To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.
+ */
+ public static void reprojectImageTo3D(Mat disparity, Mat _3dImage, Mat Q, boolean handleMissingValues) {
+ reprojectImageTo3D_1(disparity.nativeObj, _3dImage.nativeObj, Q.nativeObj, handleMissingValues);
+ }
+
+ /**
+ * Reprojects a disparity image to 3D space.
+ *
+ * @param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
+ * floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
+ * fractional bits. If the disparity is 16-bit signed format, as computed by REF: StereoBM or
+ * REF: StereoSGBM and maybe other algorithms, it should be divided by 16 (and scaled to float) before
+ * being used here.
+ * @param _3dImage Output 3-channel floating-point image of the same size as disparity. Each element of
+ * _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
+ * uses Q obtained by REF: stereoRectify, then the returned points are represented in the first
+ * camera's rectified coordinate system.
+ * @param Q \(4 \times 4\) perspective transformation matrix that can be obtained with
+ * REF: stereoRectify.
+ * points where the disparity was not computed). If handleMissingValues=true, then pixels with the
+ * minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
+ * to 3D points with a very large Z value (currently set to 10000).
+ * depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
+ *
+ * The function transforms a single-channel disparity map to a 3-channel image representing a 3D
+ * surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it
+ * computes:
+ *
+ * \(\begin{bmatrix}
+ * X \\
+ * Y \\
+ * Z \\
+ * W
+ * \end{bmatrix} = Q \begin{bmatrix}
+ * x \\
+ * y \\
+ * \texttt{disparity} (x,y) \\
+ * z
+ * \end{bmatrix}.\)
+ *
+ * SEE:
+ * To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.
+ */
+ public static void reprojectImageTo3D(Mat disparity, Mat _3dImage, Mat Q) {
+ reprojectImageTo3D_2(disparity.nativeObj, _3dImage.nativeObj, Q.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::sampsonDistance(Mat pt1, Mat pt2, Mat F)
+ //
+
+ /**
+ * Calculates the Sampson Distance between two points.
+ *
+ * The function cv::sampsonDistance calculates and returns the first order approximation of the geometric error as:
+ * \(
+ * sd( \texttt{pt1} , \texttt{pt2} )=
+ * \frac{(\texttt{pt2}^t \cdot \texttt{F} \cdot \texttt{pt1})^2}
+ * {((\texttt{F} \cdot \texttt{pt1})(0))^2 +
+ * ((\texttt{F} \cdot \texttt{pt1})(1))^2 +
+ * ((\texttt{F}^t \cdot \texttt{pt2})(0))^2 +
+ * ((\texttt{F}^t \cdot \texttt{pt2})(1))^2}
+ * \)
+ * The fundamental matrix may be calculated using the cv::findFundamentalMat function. See CITE: HartleyZ00 11.4.3 for details.
+ * @param pt1 first homogeneous 2d point
+ * @param pt2 second homogeneous 2d point
+ * @param F fundamental matrix
+ * @return The computed Sampson distance.
+ */
+ public static double sampsonDistance(Mat pt1, Mat pt2, Mat F) {
+ return sampsonDistance_0(pt1.nativeObj, pt2.nativeObj, F.nativeObj);
+ }
+
+
+ //
+ // C++: int cv::estimateAffine3D(Mat src, Mat dst, Mat& out, Mat& inliers, double ransacThreshold = 3, double confidence = 0.99)
+ //
+
+ /**
+ * Computes an optimal affine transformation between two 3D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * z\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & a_{13}\\
+ * a_{21} & a_{22} & a_{23}\\
+ * a_{31} & a_{32} & a_{33}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * Z\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * b_3\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param src First input 3D point set containing \((X,Y,Z)\).
+ * @param dst Second input 3D point set containing \((x,y,z)\).
+ * @param out Output 3D affine transformation matrix \(3 \times 4\) of the form
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & a_{13} & b_1\\
+ * a_{21} & a_{22} & a_{23} & b_2\\
+ * a_{31} & a_{32} & a_{33} & b_3\\
+ * \end{bmatrix}
+ * \)
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ * @param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as
+ * an inlier.
+ * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ *
+ * The function estimates an optimal 3D affine transformation between two 3D point sets using the
+ * RANSAC algorithm.
+ * @return automatically generated
+ */
+ public static int estimateAffine3D(Mat src, Mat dst, Mat out, Mat inliers, double ransacThreshold, double confidence) {
+ return estimateAffine3D_0(src.nativeObj, dst.nativeObj, out.nativeObj, inliers.nativeObj, ransacThreshold, confidence);
+ }
+
+ /**
+ * Computes an optimal affine transformation between two 3D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * z\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & a_{13}\\
+ * a_{21} & a_{22} & a_{23}\\
+ * a_{31} & a_{32} & a_{33}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * Z\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * b_3\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param src First input 3D point set containing \((X,Y,Z)\).
+ * @param dst Second input 3D point set containing \((x,y,z)\).
+ * @param out Output 3D affine transformation matrix \(3 \times 4\) of the form
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & a_{13} & b_1\\
+ * a_{21} & a_{22} & a_{23} & b_2\\
+ * a_{31} & a_{32} & a_{33} & b_3\\
+ * \end{bmatrix}
+ * \)
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ * @param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as
+ * an inlier.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ *
+ * The function estimates an optimal 3D affine transformation between two 3D point sets using the
+ * RANSAC algorithm.
+ * @return automatically generated
+ */
+ public static int estimateAffine3D(Mat src, Mat dst, Mat out, Mat inliers, double ransacThreshold) {
+ return estimateAffine3D_1(src.nativeObj, dst.nativeObj, out.nativeObj, inliers.nativeObj, ransacThreshold);
+ }
+
+ /**
+ * Computes an optimal affine transformation between two 3D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * z\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & a_{13}\\
+ * a_{21} & a_{22} & a_{23}\\
+ * a_{31} & a_{32} & a_{33}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * Z\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * b_3\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param src First input 3D point set containing \((X,Y,Z)\).
+ * @param dst Second input 3D point set containing \((x,y,z)\).
+ * @param out Output 3D affine transformation matrix \(3 \times 4\) of the form
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & a_{13} & b_1\\
+ * a_{21} & a_{22} & a_{23} & b_2\\
+ * a_{31} & a_{32} & a_{33} & b_3\\
+ * \end{bmatrix}
+ * \)
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ * an inlier.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ *
+ * The function estimates an optimal 3D affine transformation between two 3D point sets using the
+ * RANSAC algorithm.
+ * @return automatically generated
+ */
+ public static int estimateAffine3D(Mat src, Mat dst, Mat out, Mat inliers) {
+ return estimateAffine3D_2(src.nativeObj, dst.nativeObj, out.nativeObj, inliers.nativeObj);
+ }
+
+
+ //
+ // C++: Mat cv::estimateAffine2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
+ //
+
+ /**
+ * Computes an optimal affine transformation between two 2D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12}\\
+ * a_{21} & a_{22}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param from First input 2D point set containing \((X,Y)\).
+ * @param to Second input 2D point set containing \((x,y)\).
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
+ * a point as an inlier. Applies only to RANSAC.
+ * @param maxIters The maximum number of robust method iterations.
+ * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * @param refineIters Maximum number of iterations of refining algorithm (Levenberg-Marquardt).
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation matrix \(2 \times 3\) or empty matrix if transformation
+ * could not be estimated. The returned matrix has the following form:
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & b_1\\
+ * a_{21} & a_{22} & b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * The function estimates an optimal 2D affine transformation between two 2D point sets using the
+ * selected robust algorithm.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffinePartial2D, getAffineTransform
+ */
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters, double confidence, long refineIters) {
+ return new Mat(estimateAffine2D_0(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters, confidence, refineIters));
+ }
+
+ /**
+ * Computes an optimal affine transformation between two 2D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12}\\
+ * a_{21} & a_{22}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param from First input 2D point set containing \((X,Y)\).
+ * @param to Second input 2D point set containing \((x,y)\).
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
+ * a point as an inlier. Applies only to RANSAC.
+ * @param maxIters The maximum number of robust method iterations.
+ * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation matrix \(2 \times 3\) or empty matrix if transformation
+ * could not be estimated. The returned matrix has the following form:
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & b_1\\
+ * a_{21} & a_{22} & b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * The function estimates an optimal 2D affine transformation between two 2D point sets using the
+ * selected robust algorithm.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffinePartial2D, getAffineTransform
+ */
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters, double confidence) {
+ return new Mat(estimateAffine2D_1(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters, confidence));
+ }
+
+ /**
+ * Computes an optimal affine transformation between two 2D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12}\\
+ * a_{21} & a_{22}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param from First input 2D point set containing \((X,Y)\).
+ * @param to Second input 2D point set containing \((x,y)\).
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
+ * a point as an inlier. Applies only to RANSAC.
+ * @param maxIters The maximum number of robust method iterations.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation matrix \(2 \times 3\) or empty matrix if transformation
+ * could not be estimated. The returned matrix has the following form:
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & b_1\\
+ * a_{21} & a_{22} & b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * The function estimates an optimal 2D affine transformation between two 2D point sets using the
+ * selected robust algorithm.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffinePartial2D, getAffineTransform
+ */
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters) {
+ return new Mat(estimateAffine2D_2(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters));
+ }
+
+ /**
+ * Computes an optimal affine transformation between two 2D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12}\\
+ * a_{21} & a_{22}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param from First input 2D point set containing \((X,Y)\).
+ * @param to Second input 2D point set containing \((x,y)\).
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
+ * a point as an inlier. Applies only to RANSAC.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation matrix \(2 \times 3\) or empty matrix if transformation
+ * could not be estimated. The returned matrix has the following form:
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & b_1\\
+ * a_{21} & a_{22} & b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * The function estimates an optimal 2D affine transformation between two 2D point sets using the
+ * selected robust algorithm.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffinePartial2D, getAffineTransform
+ */
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold) {
+ return new Mat(estimateAffine2D_3(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold));
+ }
+
+ /**
+ * Computes an optimal affine transformation between two 2D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12}\\
+ * a_{21} & a_{22}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param from First input 2D point set containing \((X,Y)\).
+ * @param to Second input 2D point set containing \((x,y)\).
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * a point as an inlier. Applies only to RANSAC.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation matrix \(2 \times 3\) or empty matrix if transformation
+ * could not be estimated. The returned matrix has the following form:
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & b_1\\
+ * a_{21} & a_{22} & b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * The function estimates an optimal 2D affine transformation between two 2D point sets using the
+ * selected robust algorithm.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffinePartial2D, getAffineTransform
+ */
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method) {
+ return new Mat(estimateAffine2D_4(from.nativeObj, to.nativeObj, inliers.nativeObj, method));
+ }
+
+ /**
+ * Computes an optimal affine transformation between two 2D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12}\\
+ * a_{21} & a_{22}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param from First input 2D point set containing \((X,Y)\).
+ * @param to Second input 2D point set containing \((x,y)\).
+ * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * a point as an inlier. Applies only to RANSAC.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation matrix \(2 \times 3\) or empty matrix if transformation
+ * could not be estimated. The returned matrix has the following form:
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & b_1\\
+ * a_{21} & a_{22} & b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * The function estimates an optimal 2D affine transformation between two 2D point sets using the
+ * selected robust algorithm.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffinePartial2D, getAffineTransform
+ */
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers) {
+ return new Mat(estimateAffine2D_5(from.nativeObj, to.nativeObj, inliers.nativeObj));
+ }
+
+ /**
+ * Computes an optimal affine transformation between two 2D point sets.
+ *
+ * It computes
+ * \(
+ * \begin{bmatrix}
+ * x\\
+ * y\\
+ * \end{bmatrix}
+ * =
+ * \begin{bmatrix}
+ * a_{11} & a_{12}\\
+ * a_{21} & a_{22}\\
+ * \end{bmatrix}
+ * \begin{bmatrix}
+ * X\\
+ * Y\\
+ * \end{bmatrix}
+ * +
+ * \begin{bmatrix}
+ * b_1\\
+ * b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * @param from First input 2D point set containing \((X,Y)\).
+ * @param to Second input 2D point set containing \((x,y)\).
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * a point as an inlier. Applies only to RANSAC.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation matrix \(2 \times 3\) or empty matrix if transformation
+ * could not be estimated. The returned matrix has the following form:
+ * \(
+ * \begin{bmatrix}
+ * a_{11} & a_{12} & b_1\\
+ * a_{21} & a_{22} & b_2\\
+ * \end{bmatrix}
+ * \)
+ *
+ * The function estimates an optimal 2D affine transformation between two 2D point sets using the
+ * selected robust algorithm.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffinePartial2D, getAffineTransform
+ */
+ public static Mat estimateAffine2D(Mat from, Mat to) {
+ return new Mat(estimateAffine2D_6(from.nativeObj, to.nativeObj));
+ }
+
+
+ //
+ // C++: Mat cv::estimateAffinePartial2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
+ //
+
+ /**
+ * Computes an optimal limited affine transformation with 4 degrees of freedom between
+ * two 2D point sets.
+ *
+ * @param from First input 2D point set.
+ * @param to Second input 2D point set.
+ * @param inliers Output vector indicating which points are inliers.
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
+ * a point as an inlier. Applies only to RANSAC.
+ * @param maxIters The maximum number of robust method iterations.
+ * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * @param refineIters Maximum number of iterations of refining algorithm (Levenberg-Marquardt).
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation (4 degrees of freedom) matrix \(2 \times 3\) or
+ * empty matrix if transformation could not be estimated.
+ *
+ * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
+ * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
+ * estimation.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Estimated transformation matrix is:
+ * \( \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
+ * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
+ * \end{bmatrix} \)
+ * Where \( \theta \) is the rotation angle, \( s \) the scaling factor and \( t_x, t_y \) are
+ * translations in \( x, y \) axes respectively.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffine2D, getAffineTransform
+ */
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters, double confidence, long refineIters) {
+ return new Mat(estimateAffinePartial2D_0(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters, confidence, refineIters));
+ }
+
+ /**
+ * Computes an optimal limited affine transformation with 4 degrees of freedom between
+ * two 2D point sets.
+ *
+ * @param from First input 2D point set.
+ * @param to Second input 2D point set.
+ * @param inliers Output vector indicating which points are inliers.
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
+ * a point as an inlier. Applies only to RANSAC.
+ * @param maxIters The maximum number of robust method iterations.
+ * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation (4 degrees of freedom) matrix \(2 \times 3\) or
+ * empty matrix if transformation could not be estimated.
+ *
+ * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
+ * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
+ * estimation.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Estimated transformation matrix is:
+ * \( \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
+ * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
+ * \end{bmatrix} \)
+ * Where \( \theta \) is the rotation angle, \( s \) the scaling factor and \( t_x, t_y \) are
+ * translations in \( x, y \) axes respectively.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffine2D, getAffineTransform
+ */
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters, double confidence) {
+ return new Mat(estimateAffinePartial2D_1(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters, confidence));
+ }
+
+ /**
+ * Computes an optimal limited affine transformation with 4 degrees of freedom between
+ * two 2D point sets.
+ *
+ * @param from First input 2D point set.
+ * @param to Second input 2D point set.
+ * @param inliers Output vector indicating which points are inliers.
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
+ * a point as an inlier. Applies only to RANSAC.
+ * @param maxIters The maximum number of robust method iterations.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation (4 degrees of freedom) matrix \(2 \times 3\) or
+ * empty matrix if transformation could not be estimated.
+ *
+ * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
+ * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
+ * estimation.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Estimated transformation matrix is:
+ * \( \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
+ * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
+ * \end{bmatrix} \)
+ * Where \( \theta \) is the rotation angle, \( s \) the scaling factor and \( t_x, t_y \) are
+ * translations in \( x, y \) axes respectively.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffine2D, getAffineTransform
+ */
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters) {
+ return new Mat(estimateAffinePartial2D_2(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters));
+ }
+
+ /**
+ * Computes an optimal limited affine transformation with 4 degrees of freedom between
+ * two 2D point sets.
+ *
+ * @param from First input 2D point set.
+ * @param to Second input 2D point set.
+ * @param inliers Output vector indicating which points are inliers.
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
+ * a point as an inlier. Applies only to RANSAC.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation (4 degrees of freedom) matrix \(2 \times 3\) or
+ * empty matrix if transformation could not be estimated.
+ *
+ * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
+ * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
+ * estimation.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Estimated transformation matrix is:
+ * \( \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
+ * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
+ * \end{bmatrix} \)
+ * Where \( \theta \) is the rotation angle, \( s \) the scaling factor and \( t_x, t_y \) are
+ * translations in \( x, y \) axes respectively.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffine2D, getAffineTransform
+ */
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold) {
+ return new Mat(estimateAffinePartial2D_3(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold));
+ }
+
+ /**
+ * Computes an optimal limited affine transformation with 4 degrees of freedom between
+ * two 2D point sets.
+ *
+ * @param from First input 2D point set.
+ * @param to Second input 2D point set.
+ * @param inliers Output vector indicating which points are inliers.
+ * @param method Robust method used to compute transformation. The following methods are possible:
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * a point as an inlier. Applies only to RANSAC.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation (4 degrees of freedom) matrix \(2 \times 3\) or
+ * empty matrix if transformation could not be estimated.
+ *
+ * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
+ * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
+ * estimation.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Estimated transformation matrix is:
+ * \( \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
+ * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
+ * \end{bmatrix} \)
+ * Where \( \theta \) is the rotation angle, \( s \) the scaling factor and \( t_x, t_y \) are
+ * translations in \( x, y \) axes respectively.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffine2D, getAffineTransform
+ */
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method) {
+ return new Mat(estimateAffinePartial2D_4(from.nativeObj, to.nativeObj, inliers.nativeObj, method));
+ }
+
+ /**
+ * Computes an optimal limited affine transformation with 4 degrees of freedom between
+ * two 2D point sets.
+ *
+ * @param from First input 2D point set.
+ * @param to Second input 2D point set.
+ * @param inliers Output vector indicating which points are inliers.
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * a point as an inlier. Applies only to RANSAC.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation (4 degrees of freedom) matrix \(2 \times 3\) or
+ * empty matrix if transformation could not be estimated.
+ *
+ * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
+ * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
+ * estimation.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Estimated transformation matrix is:
+ * \( \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
+ * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
+ * \end{bmatrix} \)
+ * Where \( \theta \) is the rotation angle, \( s \) the scaling factor and \( t_x, t_y \) are
+ * translations in \( x, y \) axes respectively.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffine2D, getAffineTransform
+ */
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers) {
+ return new Mat(estimateAffinePartial2D_5(from.nativeObj, to.nativeObj, inliers.nativeObj));
+ }
+
+ /**
+ * Computes an optimal limited affine transformation with 4 degrees of freedom between
+ * two 2D point sets.
+ *
+ * @param from First input 2D point set.
+ * @param to Second input 2D point set.
+ *
+ * -
+ * REF: RANSAC - RANSAC-based robust method
+ *
+ * -
+ * REF: LMEDS - Least-Median robust method
+ * RANSAC is the default method.
+ * a point as an inlier. Applies only to RANSAC.
+ * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+ * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+ * Passing 0 will disable refining, so the output matrix will be output of robust method.
+ *
+ *
+ *
+ * @return Output 2D affine transformation (4 degrees of freedom) matrix \(2 \times 3\) or
+ * empty matrix if transformation could not be estimated.
+ *
+ * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
+ * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
+ * estimation.
+ *
+ * The computed transformation is then refined further (using only inliers) with the
+ * Levenberg-Marquardt method to reduce the re-projection error even more.
+ *
+ * Estimated transformation matrix is:
+ * \( \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
+ * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
+ * \end{bmatrix} \)
+ * Where \( \theta \) is the rotation angle, \( s \) the scaling factor and \( t_x, t_y \) are
+ * translations in \( x, y \) axes respectively.
+ *
+ * Note:
+ * The RANSAC method can handle practically any ratio of outliers but need a threshold to
+ * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+ * correctly only when there are more than 50% of inliers.
+ *
+ * SEE: estimateAffine2D, getAffineTransform
+ */
+ public static Mat estimateAffinePartial2D(Mat from, Mat to) {
+ return new Mat(estimateAffinePartial2D_6(from.nativeObj, to.nativeObj));
+ }
+
+
+ //
+ // C++: int cv::decomposeHomographyMat(Mat H, Mat K, vector_Mat& rotations, vector_Mat& translations, vector_Mat& normals)
+ //
+
+ /**
+ * Decompose a homography matrix to rotation(s), translation(s) and plane normal(s).
+ *
+ * @param H The input homography matrix between two images.
+ * @param K The input camera intrinsic matrix.
+ * @param rotations Array of rotation matrices.
+ * @param translations Array of translation matrices.
+ * @param normals Array of plane normal matrices.
+ *
+ * This function extracts relative camera motion between two views of a planar object and returns up to
+ * four mathematical solution tuples of rotation, translation, and plane normal. The decomposition of
+ * the homography matrix H is described in detail in CITE: Malis.
+ *
+ * If the homography H, induced by the plane, gives the constraint
+ * \(s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\) on the source image points
+ * \(p_i\) and the destination image points \(p'_i\), then the tuple of rotations[k] and
+ * translations[k] is a change of basis from the source camera's coordinate system to the destination
+ * camera's coordinate system. However, by decomposing H, one can only get the translation normalized
+ * by the (typically unknown) depth of the scene, i.e. its direction but with normalized length.
+ *
+ * If point correspondences are available, at least two solutions may further be invalidated, by
+ * applying positive depth constraint, i.e. all points must be in front of the camera.
+ * @return automatically generated
+ */
+ public static int decomposeHomographyMat(Mat H, Mat K, List rotations, List translations, List normals) {
+ Mat rotations_mat = new Mat();
+ Mat translations_mat = new Mat();
+ Mat normals_mat = new Mat();
+ int retVal = decomposeHomographyMat_0(H.nativeObj, K.nativeObj, rotations_mat.nativeObj, translations_mat.nativeObj, normals_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(rotations_mat, rotations);
+ rotations_mat.release();
+ Converters.Mat_to_vector_Mat(translations_mat, translations);
+ translations_mat.release();
+ Converters.Mat_to_vector_Mat(normals_mat, normals);
+ normals_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::filterHomographyDecompByVisibleRefpoints(vector_Mat rotations, vector_Mat normals, Mat beforePoints, Mat afterPoints, Mat& possibleSolutions, Mat pointsMask = Mat())
+ //
+
+ /**
+ * Filters homography decompositions based on additional information.
+ *
+ * @param rotations Vector of rotation matrices.
+ * @param normals Vector of plane normal matrices.
+ * @param beforePoints Vector of (rectified) visible reference points before the homography is applied
+ * @param afterPoints Vector of (rectified) visible reference points after the homography is applied
+ * @param possibleSolutions Vector of int indices representing the viable solution set after filtering
+ * @param pointsMask optional Mat/Vector of 8u type representing the mask for the inliers as given by the findHomography function
+ *
+ * This function is intended to filter the output of the decomposeHomographyMat based on additional
+ * information as described in CITE: Malis . The summary of the method: the decomposeHomographyMat function
+ * returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the
+ * sets of points visible in the camera frame before and after the homography transformation is applied,
+ * we can determine which are the true potential solutions and which are the opposites by verifying which
+ * homographies are consistent with all visible reference points being in front of the camera. The inputs
+ * are left unchanged; the filtered solution set is returned as indices into the existing one.
+ */
+ public static void filterHomographyDecompByVisibleRefpoints(List rotations, List normals, Mat beforePoints, Mat afterPoints, Mat possibleSolutions, Mat pointsMask) {
+ Mat rotations_mat = Converters.vector_Mat_to_Mat(rotations);
+ Mat normals_mat = Converters.vector_Mat_to_Mat(normals);
+ filterHomographyDecompByVisibleRefpoints_0(rotations_mat.nativeObj, normals_mat.nativeObj, beforePoints.nativeObj, afterPoints.nativeObj, possibleSolutions.nativeObj, pointsMask.nativeObj);
+ }
+
+ /**
+ * Filters homography decompositions based on additional information.
+ *
+ * @param rotations Vector of rotation matrices.
+ * @param normals Vector of plane normal matrices.
+ * @param beforePoints Vector of (rectified) visible reference points before the homography is applied
+ * @param afterPoints Vector of (rectified) visible reference points after the homography is applied
+ * @param possibleSolutions Vector of int indices representing the viable solution set after filtering
+ *
+ * This function is intended to filter the output of the decomposeHomographyMat based on additional
+ * information as described in CITE: Malis . The summary of the method: the decomposeHomographyMat function
+ * returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the
+ * sets of points visible in the camera frame before and after the homography transformation is applied,
+ * we can determine which are the true potential solutions and which are the opposites by verifying which
+ * homographies are consistent with all visible reference points being in front of the camera. The inputs
+ * are left unchanged; the filtered solution set is returned as indices into the existing one.
+ */
+ public static void filterHomographyDecompByVisibleRefpoints(List rotations, List normals, Mat beforePoints, Mat afterPoints, Mat possibleSolutions) {
+ Mat rotations_mat = Converters.vector_Mat_to_Mat(rotations);
+ Mat normals_mat = Converters.vector_Mat_to_Mat(normals);
+ filterHomographyDecompByVisibleRefpoints_1(rotations_mat.nativeObj, normals_mat.nativeObj, beforePoints.nativeObj, afterPoints.nativeObj, possibleSolutions.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::fisheye::projectPoints(Mat objectPoints, Mat& imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha = 0, Mat& jacobian = Mat())
+ //
+
+ public static void fisheye_projectPoints(Mat objectPoints, Mat imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha, Mat jacobian) {
+ fisheye_projectPoints_0(objectPoints.nativeObj, imagePoints.nativeObj, rvec.nativeObj, tvec.nativeObj, K.nativeObj, D.nativeObj, alpha, jacobian.nativeObj);
+ }
+
+ public static void fisheye_projectPoints(Mat objectPoints, Mat imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha) {
+ fisheye_projectPoints_1(objectPoints.nativeObj, imagePoints.nativeObj, rvec.nativeObj, tvec.nativeObj, K.nativeObj, D.nativeObj, alpha);
+ }
+
+ public static void fisheye_projectPoints(Mat objectPoints, Mat imagePoints, Mat rvec, Mat tvec, Mat K, Mat D) {
+ fisheye_projectPoints_2(objectPoints.nativeObj, imagePoints.nativeObj, rvec.nativeObj, tvec.nativeObj, K.nativeObj, D.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::fisheye::distortPoints(Mat undistorted, Mat& distorted, Mat K, Mat D, double alpha = 0)
+ //
+
+ /**
+ * Distorts 2D points using fisheye model.
+ *
+ * @param undistorted Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), where N is
+ * the number of points in the view.
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param alpha The skew coefficient.
+ * @param distorted Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f> .
+ *
+ * Note that the function assumes the camera intrinsic matrix of the undistorted points to be identity.
+ * This means if you want to transform back points undistorted with undistortPoints() you have to
+ * multiply them with \(P^{-1}\).
+ */
+ public static void fisheye_distortPoints(Mat undistorted, Mat distorted, Mat K, Mat D, double alpha) {
+ fisheye_distortPoints_0(undistorted.nativeObj, distorted.nativeObj, K.nativeObj, D.nativeObj, alpha);
+ }
+
+ /**
+ * Distorts 2D points using fisheye model.
+ *
+ * @param undistorted Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), where N is
+ * the number of points in the view.
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param distorted Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f> .
+ *
+ * Note that the function assumes the camera intrinsic matrix of the undistorted points to be identity.
+ * This means if you want to transform back points undistorted with undistortPoints() you have to
+ * multiply them with \(P^{-1}\).
+ */
+ public static void fisheye_distortPoints(Mat undistorted, Mat distorted, Mat K, Mat D) {
+ fisheye_distortPoints_1(undistorted.nativeObj, distorted.nativeObj, K.nativeObj, D.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::fisheye::undistortPoints(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat R = Mat(), Mat P = Mat())
+ //
+
+ /**
+ * Undistorts 2D points using fisheye model
+ *
+ * @param distorted Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), where N is the
+ * number of points in the view.
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+ * 1-channel or 1x1 3-channel
+ * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
+ * @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f> .
+ */
+ public static void fisheye_undistortPoints(Mat distorted, Mat undistorted, Mat K, Mat D, Mat R, Mat P) {
+ fisheye_undistortPoints_0(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj, R.nativeObj, P.nativeObj);
+ }
+
+ /**
+ * Undistorts 2D points using fisheye model
+ *
+ * @param distorted Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), where N is the
+ * number of points in the view.
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+ * 1-channel or 1x1 3-channel
+ * @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f> .
+ */
+ public static void fisheye_undistortPoints(Mat distorted, Mat undistorted, Mat K, Mat D, Mat R) {
+ fisheye_undistortPoints_1(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj, R.nativeObj);
+ }
+
+ /**
+ * Undistorts 2D points using fisheye model
+ *
+ * @param distorted Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), where N is the
+ * number of points in the view.
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * 1-channel or 1x1 3-channel
+ * @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f> .
+ */
+ public static void fisheye_undistortPoints(Mat distorted, Mat undistorted, Mat K, Mat D) {
+ fisheye_undistortPoints_2(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::fisheye::initUndistortRectifyMap(Mat K, Mat D, Mat R, Mat P, Size size, int m1type, Mat& map1, Mat& map2)
+ //
+
+ /**
+ * Computes undistortion and rectification maps for image transform by cv::remap(). If D is empty zero
+ * distortion is used, if R or P is empty identity matrixes are used.
+ *
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+ * 1-channel or 1x1 3-channel
+ * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
+ * @param size Undistorted image size.
+ * @param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2 . See convertMaps()
+ * for details.
+ * @param map1 The first output map.
+ * @param map2 The second output map.
+ */
+ public static void fisheye_initUndistortRectifyMap(Mat K, Mat D, Mat R, Mat P, Size size, int m1type, Mat map1, Mat map2) {
+ fisheye_initUndistortRectifyMap_0(K.nativeObj, D.nativeObj, R.nativeObj, P.nativeObj, size.width, size.height, m1type, map1.nativeObj, map2.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::fisheye::undistortImage(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat Knew = cv::Mat(), Size new_size = Size())
+ //
+
+ /**
+ * Transforms an image to compensate for fisheye lens distortion.
+ *
+ * @param distorted image with fisheye lens distortion.
+ * @param undistorted Output image with compensated fisheye lens distortion.
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param Knew Camera intrinsic matrix of the distorted image. By default, it is the identity matrix but you
+ * may additionally scale and shift the result by using a different matrix.
+ * @param new_size the new size
+ *
+ * The function transforms an image to compensate radial and tangential lens distortion.
+ *
+ * The function is simply a combination of fisheye::initUndistortRectifyMap (with unity R ) and remap
+ * (with bilinear interpolation). See the former function for details of the transformation being
+ * performed.
+ *
+ * See below the results of undistortImage.
+ *
+ * -
+ * a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3,
+ * k_4, k_5, k_6) of distortion were optimized under calibration)
+ *
+ * -
+ * b\) result of fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2,
+ * k_3, k_4) of fisheye distortion were optimized under calibration)
+ *
+ * -
+ * c\) original image was captured with fisheye lens
+ *
+ *
+ *
+ * Pictures a) and b) almost the same. But if we consider points of image located far from the center
+ * of image, we can notice that on image a) these points are distorted.
+ *
+ *
+ *
+ * ![image](pics/fisheye_undistorted.jpg)
+ */
+ public static void fisheye_undistortImage(Mat distorted, Mat undistorted, Mat K, Mat D, Mat Knew, Size new_size) {
+ fisheye_undistortImage_0(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj, Knew.nativeObj, new_size.width, new_size.height);
+ }
+
+ /**
+ * Transforms an image to compensate for fisheye lens distortion.
+ *
+ * @param distorted image with fisheye lens distortion.
+ * @param undistorted Output image with compensated fisheye lens distortion.
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param Knew Camera intrinsic matrix of the distorted image. By default, it is the identity matrix but you
+ * may additionally scale and shift the result by using a different matrix.
+ *
+ * The function transforms an image to compensate radial and tangential lens distortion.
+ *
+ * The function is simply a combination of fisheye::initUndistortRectifyMap (with unity R ) and remap
+ * (with bilinear interpolation). See the former function for details of the transformation being
+ * performed.
+ *
+ * See below the results of undistortImage.
+ *
+ * -
+ * a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3,
+ * k_4, k_5, k_6) of distortion were optimized under calibration)
+ *
+ * -
+ * b\) result of fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2,
+ * k_3, k_4) of fisheye distortion were optimized under calibration)
+ *
+ * -
+ * c\) original image was captured with fisheye lens
+ *
+ *
+ *
+ * Pictures a) and b) almost the same. But if we consider points of image located far from the center
+ * of image, we can notice that on image a) these points are distorted.
+ *
+ *
+ *
+ * ![image](pics/fisheye_undistorted.jpg)
+ */
+ public static void fisheye_undistortImage(Mat distorted, Mat undistorted, Mat K, Mat D, Mat Knew) {
+ fisheye_undistortImage_1(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj, Knew.nativeObj);
+ }
+
+ /**
+ * Transforms an image to compensate for fisheye lens distortion.
+ *
+ * @param distorted image with fisheye lens distortion.
+ * @param undistorted Output image with compensated fisheye lens distortion.
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * may additionally scale and shift the result by using a different matrix.
+ *
+ * The function transforms an image to compensate radial and tangential lens distortion.
+ *
+ * The function is simply a combination of fisheye::initUndistortRectifyMap (with unity R ) and remap
+ * (with bilinear interpolation). See the former function for details of the transformation being
+ * performed.
+ *
+ * See below the results of undistortImage.
+ *
+ * -
+ * a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3,
+ * k_4, k_5, k_6) of distortion were optimized under calibration)
+ *
+ * -
+ * b\) result of fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2,
+ * k_3, k_4) of fisheye distortion were optimized under calibration)
+ *
+ * -
+ * c\) original image was captured with fisheye lens
+ *
+ *
+ *
+ * Pictures a) and b) almost the same. But if we consider points of image located far from the center
+ * of image, we can notice that on image a) these points are distorted.
+ *
+ *
+ *
+ * ![image](pics/fisheye_undistorted.jpg)
+ */
+ public static void fisheye_undistortImage(Mat distorted, Mat undistorted, Mat K, Mat D) {
+ fisheye_undistortImage_2(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat& P, double balance = 0.0, Size new_size = Size(), double fov_scale = 1.0)
+ //
+
+ /**
+ * Estimates new camera intrinsic matrix for undistortion or rectification.
+ *
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param image_size Size of the image
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+ * 1-channel or 1x1 3-channel
+ * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
+ * @param balance Sets the new focal length in range between the min focal length and the max focal
+ * length. Balance is in range of [0, 1].
+ * @param new_size the new size
+ * @param fov_scale Divisor for new focal length.
+ */
+ public static void fisheye_estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat P, double balance, Size new_size, double fov_scale) {
+ fisheye_estimateNewCameraMatrixForUndistortRectify_0(K.nativeObj, D.nativeObj, image_size.width, image_size.height, R.nativeObj, P.nativeObj, balance, new_size.width, new_size.height, fov_scale);
+ }
+
+ /**
+ * Estimates new camera intrinsic matrix for undistortion or rectification.
+ *
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param image_size Size of the image
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+ * 1-channel or 1x1 3-channel
+ * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
+ * @param balance Sets the new focal length in range between the min focal length and the max focal
+ * length. Balance is in range of [0, 1].
+ * @param new_size the new size
+ */
+ public static void fisheye_estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat P, double balance, Size new_size) {
+ fisheye_estimateNewCameraMatrixForUndistortRectify_1(K.nativeObj, D.nativeObj, image_size.width, image_size.height, R.nativeObj, P.nativeObj, balance, new_size.width, new_size.height);
+ }
+
+ /**
+ * Estimates new camera intrinsic matrix for undistortion or rectification.
+ *
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param image_size Size of the image
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+ * 1-channel or 1x1 3-channel
+ * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
+ * @param balance Sets the new focal length in range between the min focal length and the max focal
+ * length. Balance is in range of [0, 1].
+ */
+ public static void fisheye_estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat P, double balance) {
+ fisheye_estimateNewCameraMatrixForUndistortRectify_2(K.nativeObj, D.nativeObj, image_size.width, image_size.height, R.nativeObj, P.nativeObj, balance);
+ }
+
+ /**
+ * Estimates new camera intrinsic matrix for undistortion or rectification.
+ *
+ * @param K Camera intrinsic matrix \(cameramatrix{K}\).
+ * @param image_size Size of the image
+ * @param D Input vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+ * 1-channel or 1x1 3-channel
+ * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
+ * length. Balance is in range of [0, 1].
+ */
+ public static void fisheye_estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat P) {
+ fisheye_estimateNewCameraMatrixForUndistortRectify_3(K.nativeObj, D.nativeObj, image_size.width, image_size.height, R.nativeObj, P.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::fisheye::calibrate(vector_Mat objectPoints, vector_Mat imagePoints, Size image_size, Mat& K, Mat& D, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
+ //
+
+ /**
+ * Performs camera calibaration
+ *
+ * @param objectPoints vector of vectors of calibration pattern points in the calibration pattern
+ * coordinate space.
+ * @param imagePoints vector of vectors of the projections of calibration pattern points.
+ * imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to
+ * objectPoints[i].size() for each i.
+ * @param image_size Size of the image used only to initialize the camera intrinsic matrix.
+ * @param K Output 3x3 floating-point camera intrinsic matrix
+ * \(\cameramatrix{A}\) . If
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS is specified, some or all of fx, fy, cx, cy must be
+ * initialized before calling the function.
+ * @param D Output vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
+ * That is, each k-th rotation vector together with the corresponding k-th translation vector (see
+ * the next output parameter description) brings the calibration pattern from the model coordinate
+ * space (in which object points are specified) to the world coordinate space, that is, a real
+ * position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
+ * @param tvecs Output vector of translation vectors estimated for each pattern view.
+ * @param flags Different flags that may be zero or a combination of the following values:
+ *
+ * -
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+ *
+ * -
+ * REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
+ * of intrinsic optimization.
+ *
+ * -
+ * REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients
+ * are set to zeros and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
+ * optimization. It stays at the center or at a different location specified when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
+ * @param criteria Termination criteria for the iterative optimization algorithm.
+ *
+ *
+ * @return automatically generated
+ */
+ public static double fisheye_calibrate(List objectPoints, List imagePoints, Size image_size, Mat K, Mat D, List rvecs, List tvecs, int flags, TermCriteria criteria) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = fisheye_calibrate_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, image_size.width, image_size.height, K.nativeObj, D.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Performs camera calibaration
+ *
+ * @param objectPoints vector of vectors of calibration pattern points in the calibration pattern
+ * coordinate space.
+ * @param imagePoints vector of vectors of the projections of calibration pattern points.
+ * imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to
+ * objectPoints[i].size() for each i.
+ * @param image_size Size of the image used only to initialize the camera intrinsic matrix.
+ * @param K Output 3x3 floating-point camera intrinsic matrix
+ * \(\cameramatrix{A}\) . If
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS is specified, some or all of fx, fy, cx, cy must be
+ * initialized before calling the function.
+ * @param D Output vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
+ * That is, each k-th rotation vector together with the corresponding k-th translation vector (see
+ * the next output parameter description) brings the calibration pattern from the model coordinate
+ * space (in which object points are specified) to the world coordinate space, that is, a real
+ * position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
+ * @param tvecs Output vector of translation vectors estimated for each pattern view.
+ * @param flags Different flags that may be zero or a combination of the following values:
+ *
+ * -
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+ *
+ * -
+ * REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
+ * of intrinsic optimization.
+ *
+ * -
+ * REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients
+ * are set to zeros and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
+ * optimization. It stays at the center or at a different location specified when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
+ *
+ *
+ * @return automatically generated
+ */
+ public static double fisheye_calibrate(List objectPoints, List imagePoints, Size image_size, Mat K, Mat D, List rvecs, List tvecs, int flags) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = fisheye_calibrate_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, image_size.width, image_size.height, K.nativeObj, D.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ /**
+ * Performs camera calibaration
+ *
+ * @param objectPoints vector of vectors of calibration pattern points in the calibration pattern
+ * coordinate space.
+ * @param imagePoints vector of vectors of the projections of calibration pattern points.
+ * imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to
+ * objectPoints[i].size() for each i.
+ * @param image_size Size of the image used only to initialize the camera intrinsic matrix.
+ * @param K Output 3x3 floating-point camera intrinsic matrix
+ * \(\cameramatrix{A}\) . If
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS is specified, some or all of fx, fy, cx, cy must be
+ * initialized before calling the function.
+ * @param D Output vector of distortion coefficients \(\distcoeffsfisheye\).
+ * @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
+ * That is, each k-th rotation vector together with the corresponding k-th translation vector (see
+ * the next output parameter description) brings the calibration pattern from the model coordinate
+ * space (in which object points are specified) to the world coordinate space, that is, a real
+ * position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
+ * @param tvecs Output vector of translation vectors estimated for each pattern view.
+ *
+ * -
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+ *
+ * -
+ * REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
+ * of intrinsic optimization.
+ *
+ * -
+ * REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients
+ * are set to zeros and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
+ * optimization. It stays at the center or at a different location specified when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
+ *
+ *
+ * @return automatically generated
+ */
+ public static double fisheye_calibrate(List objectPoints, List imagePoints, Size image_size, Mat K, Mat D, List rvecs, List tvecs) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = fisheye_calibrate_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, image_size.width, image_size.height, K.nativeObj, D.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::fisheye::stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags, Size newImageSize = Size(), double balance = 0.0, double fov_scale = 1.0)
+ //
+
+ /**
+ * Stereo rectification for fisheye camera model
+ *
+ * @param K1 First camera intrinsic matrix.
+ * @param D1 First camera distortion parameters.
+ * @param K2 Second camera intrinsic matrix.
+ * @param D2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix between the coordinate systems of the first and the second
+ * cameras.
+ * @param tvec Translation vector between coordinate systems of the cameras.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see reprojectImageTo3D ).
+ * @param flags Operation flags that may be zero or REF: fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * @param newImageSize New image resolution after rectification. The same size should be passed to
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * @param balance Sets the new focal length in range between the min focal length and the max focal
+ * length. Balance is in range of [0, 1].
+ * @param fov_scale Divisor for new focal length.
+ */
+ public static void fisheye_stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, Size newImageSize, double balance, double fov_scale) {
+ fisheye_stereoRectify_0(K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, tvec.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, newImageSize.width, newImageSize.height, balance, fov_scale);
+ }
+
+ /**
+ * Stereo rectification for fisheye camera model
+ *
+ * @param K1 First camera intrinsic matrix.
+ * @param D1 First camera distortion parameters.
+ * @param K2 Second camera intrinsic matrix.
+ * @param D2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix between the coordinate systems of the first and the second
+ * cameras.
+ * @param tvec Translation vector between coordinate systems of the cameras.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see reprojectImageTo3D ).
+ * @param flags Operation flags that may be zero or REF: fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * @param newImageSize New image resolution after rectification. The same size should be passed to
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * @param balance Sets the new focal length in range between the min focal length and the max focal
+ * length. Balance is in range of [0, 1].
+ */
+ public static void fisheye_stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, Size newImageSize, double balance) {
+ fisheye_stereoRectify_1(K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, tvec.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, newImageSize.width, newImageSize.height, balance);
+ }
+
+ /**
+ * Stereo rectification for fisheye camera model
+ *
+ * @param K1 First camera intrinsic matrix.
+ * @param D1 First camera distortion parameters.
+ * @param K2 Second camera intrinsic matrix.
+ * @param D2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix between the coordinate systems of the first and the second
+ * cameras.
+ * @param tvec Translation vector between coordinate systems of the cameras.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see reprojectImageTo3D ).
+ * @param flags Operation flags that may be zero or REF: fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * @param newImageSize New image resolution after rectification. The same size should be passed to
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * length. Balance is in range of [0, 1].
+ */
+ public static void fisheye_stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, Size newImageSize) {
+ fisheye_stereoRectify_2(K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, tvec.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, newImageSize.width, newImageSize.height);
+ }
+
+ /**
+ * Stereo rectification for fisheye camera model
+ *
+ * @param K1 First camera intrinsic matrix.
+ * @param D1 First camera distortion parameters.
+ * @param K2 Second camera intrinsic matrix.
+ * @param D2 Second camera distortion parameters.
+ * @param imageSize Size of the image used for stereo calibration.
+ * @param R Rotation matrix between the coordinate systems of the first and the second
+ * cameras.
+ * @param tvec Translation vector between coordinate systems of the cameras.
+ * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
+ * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
+ * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+ * camera.
+ * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+ * camera.
+ * @param Q Output \(4 \times 4\) disparity-to-depth mapping matrix (see reprojectImageTo3D ).
+ * @param flags Operation flags that may be zero or REF: fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
+ * the function makes the principal points of each camera have the same pixel coordinates in the
+ * rectified views. And if the flag is not set, the function may still shift the images in the
+ * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+ * useful image area.
+ * initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+ * is passed (default), it is set to the original imageSize . Setting it to larger value can help you
+ * preserve details in the original image, especially when there is a big radial distortion.
+ * length. Balance is in range of [0, 1].
+ */
+ public static void fisheye_stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags) {
+ fisheye_stereoRectify_3(K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, tvec.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags);
+ }
+
+
+ //
+ // C++: double cv::fisheye::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& K1, Mat& D1, Mat& K2, Mat& D2, Size imageSize, Mat& R, Mat& T, int flags = fisheye::CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
+ //
+
+ /**
+ * Performs stereo calibration
+ *
+ * @param objectPoints Vector of vectors of the calibration pattern points.
+ * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the first camera.
+ * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the second camera.
+ * @param K1 Input/output first camera intrinsic matrix:
+ * \(\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\) , \(j = 0,\, 1\) . If
+ * any of REF: fisheye::CALIB_USE_INTRINSIC_GUESS , REF: fisheye::CALIB_FIX_INTRINSIC are specified,
+ * some or all of the matrix components must be initialized.
+ * @param D1 Input/output vector of distortion coefficients \(\distcoeffsfisheye\) of 4 elements.
+ * @param K2 Input/output second camera intrinsic matrix. The parameter is similar to K1 .
+ * @param D2 Input/output lens distortion coefficients for the second camera. The parameter is
+ * similar to D1 .
+ * @param imageSize Size of the image used only to initialize camera intrinsic matrix.
+ * @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
+ * @param T Output translation vector between the coordinate systems of the cameras.
+ * @param flags Different flags that may be zero or a combination of the following values:
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_INTRINSIC Fix K1, K2? and D1, D2? so that only R, T matrices
+ * are estimated.
+ *
+ * -
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS K1, K2 contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center (imageSize is used), and focal distances are computed in a least-squares fashion.
+ *
+ * -
+ * REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
+ * of intrinsic optimization.
+ *
+ * -
+ * REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay
+ * zero.
+ * @param criteria Termination criteria for the iterative optimization algorithm.
+ *
+ *
+ * @return automatically generated
+ */
+ public static double fisheye_stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat T, int flags, TermCriteria criteria) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return fisheye_stereoCalibrate_0(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ }
+
+ /**
+ * Performs stereo calibration
+ *
+ * @param objectPoints Vector of vectors of the calibration pattern points.
+ * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the first camera.
+ * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the second camera.
+ * @param K1 Input/output first camera intrinsic matrix:
+ * \(\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\) , \(j = 0,\, 1\) . If
+ * any of REF: fisheye::CALIB_USE_INTRINSIC_GUESS , REF: fisheye::CALIB_FIX_INTRINSIC are specified,
+ * some or all of the matrix components must be initialized.
+ * @param D1 Input/output vector of distortion coefficients \(\distcoeffsfisheye\) of 4 elements.
+ * @param K2 Input/output second camera intrinsic matrix. The parameter is similar to K1 .
+ * @param D2 Input/output lens distortion coefficients for the second camera. The parameter is
+ * similar to D1 .
+ * @param imageSize Size of the image used only to initialize camera intrinsic matrix.
+ * @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
+ * @param T Output translation vector between the coordinate systems of the cameras.
+ * @param flags Different flags that may be zero or a combination of the following values:
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_INTRINSIC Fix K1, K2? and D1, D2? so that only R, T matrices
+ * are estimated.
+ *
+ * -
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS K1, K2 contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center (imageSize is used), and focal distances are computed in a least-squares fashion.
+ *
+ * -
+ * REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
+ * of intrinsic optimization.
+ *
+ * -
+ * REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay
+ * zero.
+ *
+ *
+ * @return automatically generated
+ */
+ public static double fisheye_stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat T, int flags) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return fisheye_stereoCalibrate_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, flags);
+ }
+
+ /**
+ * Performs stereo calibration
+ *
+ * @param objectPoints Vector of vectors of the calibration pattern points.
+ * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the first camera.
+ * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+ * observed by the second camera.
+ * @param K1 Input/output first camera intrinsic matrix:
+ * \(\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\) , \(j = 0,\, 1\) . If
+ * any of REF: fisheye::CALIB_USE_INTRINSIC_GUESS , REF: fisheye::CALIB_FIX_INTRINSIC are specified,
+ * some or all of the matrix components must be initialized.
+ * @param D1 Input/output vector of distortion coefficients \(\distcoeffsfisheye\) of 4 elements.
+ * @param K2 Input/output second camera intrinsic matrix. The parameter is similar to K1 .
+ * @param D2 Input/output lens distortion coefficients for the second camera. The parameter is
+ * similar to D1 .
+ * @param imageSize Size of the image used only to initialize camera intrinsic matrix.
+ * @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
+ * @param T Output translation vector between the coordinate systems of the cameras.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_INTRINSIC Fix K1, K2? and D1, D2? so that only R, T matrices
+ * are estimated.
+ *
+ * -
+ * REF: fisheye::CALIB_USE_INTRINSIC_GUESS K1, K2 contains valid initial values of
+ * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+ * center (imageSize is used), and focal distances are computed in a least-squares fashion.
+ *
+ * -
+ * REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
+ * of intrinsic optimization.
+ *
+ * -
+ * REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
+ *
+ * -
+ * REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay
+ * zero.
+ *
+ *
+ * @return automatically generated
+ */
+ public static double fisheye_stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat T) {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ return fisheye_stereoCalibrate_2(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj);
+ }
+
+
+
+
+ // C++: void cv::Rodrigues(Mat src, Mat& dst, Mat& jacobian = Mat())
+ private static native void Rodrigues_0(long src_nativeObj, long dst_nativeObj, long jacobian_nativeObj);
+ private static native void Rodrigues_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: Mat cv::findHomography(vector_Point2f srcPoints, vector_Point2f dstPoints, int method = 0, double ransacReprojThreshold = 3, Mat& mask = Mat(), int maxIters = 2000, double confidence = 0.995)
+ private static native long findHomography_0(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method, double ransacReprojThreshold, long mask_nativeObj, int maxIters, double confidence);
+ private static native long findHomography_1(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method, double ransacReprojThreshold, long mask_nativeObj, int maxIters);
+ private static native long findHomography_2(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method, double ransacReprojThreshold, long mask_nativeObj);
+ private static native long findHomography_3(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method, double ransacReprojThreshold);
+ private static native long findHomography_4(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method);
+ private static native long findHomography_5(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj);
+
+ // C++: Vec3d cv::RQDecomp3x3(Mat src, Mat& mtxR, Mat& mtxQ, Mat& Qx = Mat(), Mat& Qy = Mat(), Mat& Qz = Mat())
+ private static native double[] RQDecomp3x3_0(long src_nativeObj, long mtxR_nativeObj, long mtxQ_nativeObj, long Qx_nativeObj, long Qy_nativeObj, long Qz_nativeObj);
+ private static native double[] RQDecomp3x3_1(long src_nativeObj, long mtxR_nativeObj, long mtxQ_nativeObj, long Qx_nativeObj, long Qy_nativeObj);
+ private static native double[] RQDecomp3x3_2(long src_nativeObj, long mtxR_nativeObj, long mtxQ_nativeObj, long Qx_nativeObj);
+ private static native double[] RQDecomp3x3_3(long src_nativeObj, long mtxR_nativeObj, long mtxQ_nativeObj);
+
+ // C++: void cv::decomposeProjectionMatrix(Mat projMatrix, Mat& cameraMatrix, Mat& rotMatrix, Mat& transVect, Mat& rotMatrixX = Mat(), Mat& rotMatrixY = Mat(), Mat& rotMatrixZ = Mat(), Mat& eulerAngles = Mat())
+ private static native void decomposeProjectionMatrix_0(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj, long rotMatrixX_nativeObj, long rotMatrixY_nativeObj, long rotMatrixZ_nativeObj, long eulerAngles_nativeObj);
+ private static native void decomposeProjectionMatrix_1(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj, long rotMatrixX_nativeObj, long rotMatrixY_nativeObj, long rotMatrixZ_nativeObj);
+ private static native void decomposeProjectionMatrix_2(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj, long rotMatrixX_nativeObj, long rotMatrixY_nativeObj);
+ private static native void decomposeProjectionMatrix_3(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj, long rotMatrixX_nativeObj);
+ private static native void decomposeProjectionMatrix_4(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj);
+
+ // C++: void cv::matMulDeriv(Mat A, Mat B, Mat& dABdA, Mat& dABdB)
+ private static native void matMulDeriv_0(long A_nativeObj, long B_nativeObj, long dABdA_nativeObj, long dABdB_nativeObj);
+
+ // C++: void cv::composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat& rvec3, Mat& tvec3, Mat& dr3dr1 = Mat(), Mat& dr3dt1 = Mat(), Mat& dr3dr2 = Mat(), Mat& dr3dt2 = Mat(), Mat& dt3dr1 = Mat(), Mat& dt3dt1 = Mat(), Mat& dt3dr2 = Mat(), Mat& dt3dt2 = Mat())
+ private static native void composeRT_0(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj, long dt3dr1_nativeObj, long dt3dt1_nativeObj, long dt3dr2_nativeObj, long dt3dt2_nativeObj);
+ private static native void composeRT_1(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj, long dt3dr1_nativeObj, long dt3dt1_nativeObj, long dt3dr2_nativeObj);
+ private static native void composeRT_2(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj, long dt3dr1_nativeObj, long dt3dt1_nativeObj);
+ private static native void composeRT_3(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj, long dt3dr1_nativeObj);
+ private static native void composeRT_4(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj);
+ private static native void composeRT_5(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj);
+ private static native void composeRT_6(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj);
+ private static native void composeRT_7(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj);
+ private static native void composeRT_8(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj);
+
+ // C++: void cv::projectPoints(vector_Point3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, vector_double distCoeffs, vector_Point2f& imagePoints, Mat& jacobian = Mat(), double aspectRatio = 0)
+ private static native void projectPoints_0(long objectPoints_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long imagePoints_mat_nativeObj, long jacobian_nativeObj, double aspectRatio);
+ private static native void projectPoints_1(long objectPoints_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long imagePoints_mat_nativeObj, long jacobian_nativeObj);
+ private static native void projectPoints_2(long objectPoints_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long imagePoints_mat_nativeObj);
+
+ // C++: bool cv::solvePnP(vector_Point3f objectPoints, vector_Point2f imagePoints, Mat cameraMatrix, vector_double distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE)
+ private static native boolean solvePnP_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int flags);
+ private static native boolean solvePnP_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess);
+ private static native boolean solvePnP_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj);
+
+ // C++: bool cv::solvePnPRansac(vector_Point3f objectPoints, vector_Point2f imagePoints, Mat cameraMatrix, vector_double distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int iterationsCount = 100, float reprojectionError = 8.0, double confidence = 0.99, Mat& inliers = Mat(), int flags = SOLVEPNP_ITERATIVE)
+ private static native boolean solvePnPRansac_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, long inliers_nativeObj, int flags);
+ private static native boolean solvePnPRansac_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, long inliers_nativeObj);
+ private static native boolean solvePnPRansac_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence);
+ private static native boolean solvePnPRansac_3(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError);
+ private static native boolean solvePnPRansac_4(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount);
+ private static native boolean solvePnPRansac_5(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess);
+ private static native boolean solvePnPRansac_6(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj);
+
+ // C++: int cv::solveP3P(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags)
+ private static native int solveP3P_0(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags);
+
+ // C++: void cv::solvePnPRefineLM(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, TermCriteria criteria = TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 20, FLT_EPSILON))
+ private static native void solvePnPRefineLM_0(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvec_nativeObj, long tvec_nativeObj, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native void solvePnPRefineLM_1(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvec_nativeObj, long tvec_nativeObj);
+
+ // C++: void cv::solvePnPRefineVVS(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, TermCriteria criteria = TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 20, FLT_EPSILON), double VVSlambda = 1)
+ private static native void solvePnPRefineVVS_0(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvec_nativeObj, long tvec_nativeObj, int criteria_type, int criteria_maxCount, double criteria_epsilon, double VVSlambda);
+ private static native void solvePnPRefineVVS_1(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvec_nativeObj, long tvec_nativeObj, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native void solvePnPRefineVVS_2(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvec_nativeObj, long tvec_nativeObj);
+
+ // C++: int cv::solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, bool useExtrinsicGuess = false, SolvePnPMethod flags = SOLVEPNP_ITERATIVE, Mat rvec = Mat(), Mat tvec = Mat(), Mat& reprojectionError = Mat())
+ private static native int solvePnPGeneric_0(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, boolean useExtrinsicGuess, int flags, long rvec_nativeObj, long tvec_nativeObj, long reprojectionError_nativeObj);
+ private static native int solvePnPGeneric_1(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, boolean useExtrinsicGuess, int flags, long rvec_nativeObj, long tvec_nativeObj);
+ private static native int solvePnPGeneric_2(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, boolean useExtrinsicGuess, int flags, long rvec_nativeObj);
+ private static native int solvePnPGeneric_3(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, boolean useExtrinsicGuess, int flags);
+ private static native int solvePnPGeneric_4(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, boolean useExtrinsicGuess);
+ private static native int solvePnPGeneric_5(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj);
+
+ // C++: Mat cv::initCameraMatrix2D(vector_vector_Point3f objectPoints, vector_vector_Point2f imagePoints, Size imageSize, double aspectRatio = 1.0)
+ private static native long initCameraMatrix2D_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, double aspectRatio);
+ private static native long initCameraMatrix2D_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height);
+
+ // C++: bool cv::findChessboardCorners(Mat image, Size patternSize, vector_Point2f& corners, int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE)
+ private static native boolean findChessboardCorners_0(long image_nativeObj, double patternSize_width, double patternSize_height, long corners_mat_nativeObj, int flags);
+ private static native boolean findChessboardCorners_1(long image_nativeObj, double patternSize_width, double patternSize_height, long corners_mat_nativeObj);
+
+ // C++: bool cv::find4QuadCornerSubpix(Mat img, Mat& corners, Size region_size)
+ private static native boolean find4QuadCornerSubpix_0(long img_nativeObj, long corners_nativeObj, double region_size_width, double region_size_height);
+
+ // C++: void cv::drawChessboardCorners(Mat& image, Size patternSize, vector_Point2f corners, bool patternWasFound)
+ private static native void drawChessboardCorners_0(long image_nativeObj, double patternSize_width, double patternSize_height, long corners_mat_nativeObj, boolean patternWasFound);
+
+ // C++: void cv::drawFrameAxes(Mat& image, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, float length, int thickness = 3)
+ private static native void drawFrameAxes_0(long image_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvec_nativeObj, long tvec_nativeObj, float length, int thickness);
+ private static native void drawFrameAxes_1(long image_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvec_nativeObj, long tvec_nativeObj, float length);
+
+ // C++: bool cv::findCirclesGrid(Mat image, Size patternSize, Mat& centers, int flags = CALIB_CB_SYMMETRIC_GRID, Ptr_FeatureDetector blobDetector = SimpleBlobDetector::create())
+ private static native boolean findCirclesGrid_0(long image_nativeObj, double patternSize_width, double patternSize_height, long centers_nativeObj, int flags);
+ private static native boolean findCirclesGrid_2(long image_nativeObj, double patternSize_width, double patternSize_height, long centers_nativeObj);
+
+ // C++: double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, Mat& stdDeviationsIntrinsics, Mat& stdDeviationsExtrinsics, Mat& perViewErrors, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
+ private static native double calibrateCameraExtended_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, long stdDeviationsIntrinsics_nativeObj, long stdDeviationsExtrinsics_nativeObj, long perViewErrors_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double calibrateCameraExtended_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, long stdDeviationsIntrinsics_nativeObj, long stdDeviationsExtrinsics_nativeObj, long perViewErrors_nativeObj, int flags);
+ private static native double calibrateCameraExtended_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, long stdDeviationsIntrinsics_nativeObj, long stdDeviationsExtrinsics_nativeObj, long perViewErrors_nativeObj);
+
+ // C++: double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
+ private static native double calibrateCamera_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double calibrateCamera_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags);
+ private static native double calibrateCamera_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj);
+
+ // C++: void cv::calibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double& fovx, double& fovy, double& focalLength, Point2d& principalPoint, double& aspectRatio)
+ private static native void calibrationMatrixValues_0(long cameraMatrix_nativeObj, double imageSize_width, double imageSize_height, double apertureWidth, double apertureHeight, double[] fovx_out, double[] fovy_out, double[] focalLength_out, double[] principalPoint_out, double[] aspectRatio_out);
+
+ // C++: double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, Mat& perViewErrors, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
+ private static native double stereoCalibrateExtended_0(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, long perViewErrors_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double stereoCalibrateExtended_1(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, long perViewErrors_nativeObj, int flags);
+ private static native double stereoCalibrateExtended_2(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, long perViewErrors_nativeObj);
+
+ // C++: double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
+ private static native double stereoCalibrate_0(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double stereoCalibrate_1(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, int flags);
+ private static native double stereoCalibrate_2(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj);
+
+ // C++: void cv::stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags = CALIB_ZERO_DISPARITY, double alpha = -1, Size newImageSize = Size(), Rect* validPixROI1 = 0, Rect* validPixROI2 = 0)
+ private static native void stereoRectify_0(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double alpha, double newImageSize_width, double newImageSize_height, double[] validPixROI1_out, double[] validPixROI2_out);
+ private static native void stereoRectify_1(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double alpha, double newImageSize_width, double newImageSize_height, double[] validPixROI1_out);
+ private static native void stereoRectify_2(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double alpha, double newImageSize_width, double newImageSize_height);
+ private static native void stereoRectify_3(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double alpha);
+ private static native void stereoRectify_4(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags);
+ private static native void stereoRectify_5(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj);
+
+ // C++: bool cv::stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat& H1, Mat& H2, double threshold = 5)
+ private static native boolean stereoRectifyUncalibrated_0(long points1_nativeObj, long points2_nativeObj, long F_nativeObj, double imgSize_width, double imgSize_height, long H1_nativeObj, long H2_nativeObj, double threshold);
+ private static native boolean stereoRectifyUncalibrated_1(long points1_nativeObj, long points2_nativeObj, long F_nativeObj, double imgSize_width, double imgSize_height, long H1_nativeObj, long H2_nativeObj);
+
+ // C++: float cv::rectify3Collinear(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat cameraMatrix3, Mat distCoeffs3, vector_Mat imgpt1, vector_Mat imgpt3, Size imageSize, Mat R12, Mat T12, Mat R13, Mat T13, Mat& R1, Mat& R2, Mat& R3, Mat& P1, Mat& P2, Mat& P3, Mat& Q, double alpha, Size newImgSize, Rect* roi1, Rect* roi2, int flags)
+ private static native float rectify3Collinear_0(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, long cameraMatrix3_nativeObj, long distCoeffs3_nativeObj, long imgpt1_mat_nativeObj, long imgpt3_mat_nativeObj, double imageSize_width, double imageSize_height, long R12_nativeObj, long T12_nativeObj, long R13_nativeObj, long T13_nativeObj, long R1_nativeObj, long R2_nativeObj, long R3_nativeObj, long P1_nativeObj, long P2_nativeObj, long P3_nativeObj, long Q_nativeObj, double alpha, double newImgSize_width, double newImgSize_height, double[] roi1_out, double[] roi2_out, int flags);
+
+ // C++: Mat cv::getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize = Size(), Rect* validPixROI = 0, bool centerPrincipalPoint = false)
+ private static native long getOptimalNewCameraMatrix_0(long cameraMatrix_nativeObj, long distCoeffs_nativeObj, double imageSize_width, double imageSize_height, double alpha, double newImgSize_width, double newImgSize_height, double[] validPixROI_out, boolean centerPrincipalPoint);
+ private static native long getOptimalNewCameraMatrix_1(long cameraMatrix_nativeObj, long distCoeffs_nativeObj, double imageSize_width, double imageSize_height, double alpha, double newImgSize_width, double newImgSize_height, double[] validPixROI_out);
+ private static native long getOptimalNewCameraMatrix_2(long cameraMatrix_nativeObj, long distCoeffs_nativeObj, double imageSize_width, double imageSize_height, double alpha, double newImgSize_width, double newImgSize_height);
+ private static native long getOptimalNewCameraMatrix_3(long cameraMatrix_nativeObj, long distCoeffs_nativeObj, double imageSize_width, double imageSize_height, double alpha);
+
+ // C++: void cv::calibrateHandEye(vector_Mat R_gripper2base, vector_Mat t_gripper2base, vector_Mat R_target2cam, vector_Mat t_target2cam, Mat& R_cam2gripper, Mat& t_cam2gripper, HandEyeCalibrationMethod method = CALIB_HAND_EYE_TSAI)
+ private static native void calibrateHandEye_0(long R_gripper2base_mat_nativeObj, long t_gripper2base_mat_nativeObj, long R_target2cam_mat_nativeObj, long t_target2cam_mat_nativeObj, long R_cam2gripper_nativeObj, long t_cam2gripper_nativeObj, int method);
+ private static native void calibrateHandEye_1(long R_gripper2base_mat_nativeObj, long t_gripper2base_mat_nativeObj, long R_target2cam_mat_nativeObj, long t_target2cam_mat_nativeObj, long R_cam2gripper_nativeObj, long t_cam2gripper_nativeObj);
+
+ // C++: void cv::convertPointsToHomogeneous(Mat src, Mat& dst)
+ private static native void convertPointsToHomogeneous_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::convertPointsFromHomogeneous(Mat src, Mat& dst)
+ private static native void convertPointsFromHomogeneous_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: Mat cv::findFundamentalMat(vector_Point2f points1, vector_Point2f points2, int method, double ransacReprojThreshold, double confidence, int maxIters, Mat& mask = Mat())
+ private static native long findFundamentalMat_0(long points1_mat_nativeObj, long points2_mat_nativeObj, int method, double ransacReprojThreshold, double confidence, int maxIters, long mask_nativeObj);
+ private static native long findFundamentalMat_1(long points1_mat_nativeObj, long points2_mat_nativeObj, int method, double ransacReprojThreshold, double confidence, int maxIters);
+
+ // C++: Mat cv::findFundamentalMat(vector_Point2f points1, vector_Point2f points2, int method = FM_RANSAC, double ransacReprojThreshold = 3., double confidence = 0.99, Mat& mask = Mat())
+ private static native long findFundamentalMat_2(long points1_mat_nativeObj, long points2_mat_nativeObj, int method, double ransacReprojThreshold, double confidence, long mask_nativeObj);
+ private static native long findFundamentalMat_3(long points1_mat_nativeObj, long points2_mat_nativeObj, int method, double ransacReprojThreshold, double confidence);
+ private static native long findFundamentalMat_4(long points1_mat_nativeObj, long points2_mat_nativeObj, int method, double ransacReprojThreshold);
+ private static native long findFundamentalMat_5(long points1_mat_nativeObj, long points2_mat_nativeObj, int method);
+ private static native long findFundamentalMat_6(long points1_mat_nativeObj, long points2_mat_nativeObj);
+
+ // C++: Mat cv::findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
+ private static native long findEssentialMat_0(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, int method, double prob, double threshold, long mask_nativeObj);
+ private static native long findEssentialMat_1(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, int method, double prob, double threshold);
+ private static native long findEssentialMat_2(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, int method, double prob);
+ private static native long findEssentialMat_3(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, int method);
+ private static native long findEssentialMat_4(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj);
+
+ // C++: Mat cv::findEssentialMat(Mat points1, Mat points2, double focal = 1.0, Point2d pp = Point2d(0, 0), int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
+ private static native long findEssentialMat_5(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y, int method, double prob, double threshold, long mask_nativeObj);
+ private static native long findEssentialMat_6(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y, int method, double prob, double threshold);
+ private static native long findEssentialMat_7(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y, int method, double prob);
+ private static native long findEssentialMat_8(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y, int method);
+ private static native long findEssentialMat_9(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y);
+ private static native long findEssentialMat_10(long points1_nativeObj, long points2_nativeObj, double focal);
+ private static native long findEssentialMat_11(long points1_nativeObj, long points2_nativeObj);
+
+ // C++: void cv::decomposeEssentialMat(Mat E, Mat& R1, Mat& R2, Mat& t)
+ private static native void decomposeEssentialMat_0(long E_nativeObj, long R1_nativeObj, long R2_nativeObj, long t_nativeObj);
+
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, Mat& mask = Mat())
+ private static native int recoverPose_0(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj, long mask_nativeObj);
+ private static native int recoverPose_1(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj);
+
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat& R, Mat& t, double focal = 1.0, Point2d pp = Point2d(0, 0), Mat& mask = Mat())
+ private static native int recoverPose_2(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long R_nativeObj, long t_nativeObj, double focal, double pp_x, double pp_y, long mask_nativeObj);
+ private static native int recoverPose_3(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long R_nativeObj, long t_nativeObj, double focal, double pp_x, double pp_y);
+ private static native int recoverPose_4(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long R_nativeObj, long t_nativeObj, double focal);
+ private static native int recoverPose_5(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long R_nativeObj, long t_nativeObj);
+
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, double distanceThresh, Mat& mask = Mat(), Mat& triangulatedPoints = Mat())
+ private static native int recoverPose_6(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj, double distanceThresh, long mask_nativeObj, long triangulatedPoints_nativeObj);
+ private static native int recoverPose_7(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj, double distanceThresh, long mask_nativeObj);
+ private static native int recoverPose_8(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj, double distanceThresh);
+
+ // C++: void cv::computeCorrespondEpilines(Mat points, int whichImage, Mat F, Mat& lines)
+ private static native void computeCorrespondEpilines_0(long points_nativeObj, int whichImage, long F_nativeObj, long lines_nativeObj);
+
+ // C++: void cv::triangulatePoints(Mat projMatr1, Mat projMatr2, Mat projPoints1, Mat projPoints2, Mat& points4D)
+ private static native void triangulatePoints_0(long projMatr1_nativeObj, long projMatr2_nativeObj, long projPoints1_nativeObj, long projPoints2_nativeObj, long points4D_nativeObj);
+
+ // C++: void cv::correctMatches(Mat F, Mat points1, Mat points2, Mat& newPoints1, Mat& newPoints2)
+ private static native void correctMatches_0(long F_nativeObj, long points1_nativeObj, long points2_nativeObj, long newPoints1_nativeObj, long newPoints2_nativeObj);
+
+ // C++: void cv::filterSpeckles(Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf = Mat())
+ private static native void filterSpeckles_0(long img_nativeObj, double newVal, int maxSpeckleSize, double maxDiff, long buf_nativeObj);
+ private static native void filterSpeckles_1(long img_nativeObj, double newVal, int maxSpeckleSize, double maxDiff);
+
+ // C++: Rect cv::getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int blockSize)
+ private static native double[] getValidDisparityROI_0(int roi1_x, int roi1_y, int roi1_width, int roi1_height, int roi2_x, int roi2_y, int roi2_width, int roi2_height, int minDisparity, int numberOfDisparities, int blockSize);
+
+ // C++: void cv::validateDisparity(Mat& disparity, Mat cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp = 1)
+ private static native void validateDisparity_0(long disparity_nativeObj, long cost_nativeObj, int minDisparity, int numberOfDisparities, int disp12MaxDisp);
+ private static native void validateDisparity_1(long disparity_nativeObj, long cost_nativeObj, int minDisparity, int numberOfDisparities);
+
+ // C++: void cv::reprojectImageTo3D(Mat disparity, Mat& _3dImage, Mat Q, bool handleMissingValues = false, int ddepth = -1)
+ private static native void reprojectImageTo3D_0(long disparity_nativeObj, long _3dImage_nativeObj, long Q_nativeObj, boolean handleMissingValues, int ddepth);
+ private static native void reprojectImageTo3D_1(long disparity_nativeObj, long _3dImage_nativeObj, long Q_nativeObj, boolean handleMissingValues);
+ private static native void reprojectImageTo3D_2(long disparity_nativeObj, long _3dImage_nativeObj, long Q_nativeObj);
+
+ // C++: double cv::sampsonDistance(Mat pt1, Mat pt2, Mat F)
+ private static native double sampsonDistance_0(long pt1_nativeObj, long pt2_nativeObj, long F_nativeObj);
+
+ // C++: int cv::estimateAffine3D(Mat src, Mat dst, Mat& out, Mat& inliers, double ransacThreshold = 3, double confidence = 0.99)
+ private static native int estimateAffine3D_0(long src_nativeObj, long dst_nativeObj, long out_nativeObj, long inliers_nativeObj, double ransacThreshold, double confidence);
+ private static native int estimateAffine3D_1(long src_nativeObj, long dst_nativeObj, long out_nativeObj, long inliers_nativeObj, double ransacThreshold);
+ private static native int estimateAffine3D_2(long src_nativeObj, long dst_nativeObj, long out_nativeObj, long inliers_nativeObj);
+
+ // C++: Mat cv::estimateAffine2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
+ private static native long estimateAffine2D_0(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters, double confidence, long refineIters);
+ private static native long estimateAffine2D_1(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters, double confidence);
+ private static native long estimateAffine2D_2(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters);
+ private static native long estimateAffine2D_3(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold);
+ private static native long estimateAffine2D_4(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method);
+ private static native long estimateAffine2D_5(long from_nativeObj, long to_nativeObj, long inliers_nativeObj);
+ private static native long estimateAffine2D_6(long from_nativeObj, long to_nativeObj);
+
+ // C++: Mat cv::estimateAffinePartial2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
+ private static native long estimateAffinePartial2D_0(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters, double confidence, long refineIters);
+ private static native long estimateAffinePartial2D_1(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters, double confidence);
+ private static native long estimateAffinePartial2D_2(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters);
+ private static native long estimateAffinePartial2D_3(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold);
+ private static native long estimateAffinePartial2D_4(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method);
+ private static native long estimateAffinePartial2D_5(long from_nativeObj, long to_nativeObj, long inliers_nativeObj);
+ private static native long estimateAffinePartial2D_6(long from_nativeObj, long to_nativeObj);
+
+ // C++: int cv::decomposeHomographyMat(Mat H, Mat K, vector_Mat& rotations, vector_Mat& translations, vector_Mat& normals)
+ private static native int decomposeHomographyMat_0(long H_nativeObj, long K_nativeObj, long rotations_mat_nativeObj, long translations_mat_nativeObj, long normals_mat_nativeObj);
+
+ // C++: void cv::filterHomographyDecompByVisibleRefpoints(vector_Mat rotations, vector_Mat normals, Mat beforePoints, Mat afterPoints, Mat& possibleSolutions, Mat pointsMask = Mat())
+ private static native void filterHomographyDecompByVisibleRefpoints_0(long rotations_mat_nativeObj, long normals_mat_nativeObj, long beforePoints_nativeObj, long afterPoints_nativeObj, long possibleSolutions_nativeObj, long pointsMask_nativeObj);
+ private static native void filterHomographyDecompByVisibleRefpoints_1(long rotations_mat_nativeObj, long normals_mat_nativeObj, long beforePoints_nativeObj, long afterPoints_nativeObj, long possibleSolutions_nativeObj);
+
+ // C++: void cv::fisheye::projectPoints(Mat objectPoints, Mat& imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha = 0, Mat& jacobian = Mat())
+ private static native void fisheye_projectPoints_0(long objectPoints_nativeObj, long imagePoints_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long K_nativeObj, long D_nativeObj, double alpha, long jacobian_nativeObj);
+ private static native void fisheye_projectPoints_1(long objectPoints_nativeObj, long imagePoints_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long K_nativeObj, long D_nativeObj, double alpha);
+ private static native void fisheye_projectPoints_2(long objectPoints_nativeObj, long imagePoints_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long K_nativeObj, long D_nativeObj);
+
+ // C++: void cv::fisheye::distortPoints(Mat undistorted, Mat& distorted, Mat K, Mat D, double alpha = 0)
+ private static native void fisheye_distortPoints_0(long undistorted_nativeObj, long distorted_nativeObj, long K_nativeObj, long D_nativeObj, double alpha);
+ private static native void fisheye_distortPoints_1(long undistorted_nativeObj, long distorted_nativeObj, long K_nativeObj, long D_nativeObj);
+
+ // C++: void cv::fisheye::undistortPoints(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat R = Mat(), Mat P = Mat())
+ private static native void fisheye_undistortPoints_0(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj, long R_nativeObj, long P_nativeObj);
+ private static native void fisheye_undistortPoints_1(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj, long R_nativeObj);
+ private static native void fisheye_undistortPoints_2(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj);
+
+ // C++: void cv::fisheye::initUndistortRectifyMap(Mat K, Mat D, Mat R, Mat P, Size size, int m1type, Mat& map1, Mat& map2)
+ private static native void fisheye_initUndistortRectifyMap_0(long K_nativeObj, long D_nativeObj, long R_nativeObj, long P_nativeObj, double size_width, double size_height, int m1type, long map1_nativeObj, long map2_nativeObj);
+
+ // C++: void cv::fisheye::undistortImage(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat Knew = cv::Mat(), Size new_size = Size())
+ private static native void fisheye_undistortImage_0(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj, long Knew_nativeObj, double new_size_width, double new_size_height);
+ private static native void fisheye_undistortImage_1(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj, long Knew_nativeObj);
+ private static native void fisheye_undistortImage_2(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj);
+
+ // C++: void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat& P, double balance = 0.0, Size new_size = Size(), double fov_scale = 1.0)
+ private static native void fisheye_estimateNewCameraMatrixForUndistortRectify_0(long K_nativeObj, long D_nativeObj, double image_size_width, double image_size_height, long R_nativeObj, long P_nativeObj, double balance, double new_size_width, double new_size_height, double fov_scale);
+ private static native void fisheye_estimateNewCameraMatrixForUndistortRectify_1(long K_nativeObj, long D_nativeObj, double image_size_width, double image_size_height, long R_nativeObj, long P_nativeObj, double balance, double new_size_width, double new_size_height);
+ private static native void fisheye_estimateNewCameraMatrixForUndistortRectify_2(long K_nativeObj, long D_nativeObj, double image_size_width, double image_size_height, long R_nativeObj, long P_nativeObj, double balance);
+ private static native void fisheye_estimateNewCameraMatrixForUndistortRectify_3(long K_nativeObj, long D_nativeObj, double image_size_width, double image_size_height, long R_nativeObj, long P_nativeObj);
+
+ // C++: double cv::fisheye::calibrate(vector_Mat objectPoints, vector_Mat imagePoints, Size image_size, Mat& K, Mat& D, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
+ private static native double fisheye_calibrate_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double image_size_width, double image_size_height, long K_nativeObj, long D_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double fisheye_calibrate_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double image_size_width, double image_size_height, long K_nativeObj, long D_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags);
+ private static native double fisheye_calibrate_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double image_size_width, double image_size_height, long K_nativeObj, long D_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj);
+
+ // C++: void cv::fisheye::stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags, Size newImageSize = Size(), double balance = 0.0, double fov_scale = 1.0)
+ private static native void fisheye_stereoRectify_0(long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long tvec_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double newImageSize_width, double newImageSize_height, double balance, double fov_scale);
+ private static native void fisheye_stereoRectify_1(long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long tvec_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double newImageSize_width, double newImageSize_height, double balance);
+ private static native void fisheye_stereoRectify_2(long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long tvec_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double newImageSize_width, double newImageSize_height);
+ private static native void fisheye_stereoRectify_3(long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long tvec_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags);
+
+ // C++: double cv::fisheye::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& K1, Mat& D1, Mat& K2, Mat& D2, Size imageSize, Mat& R, Mat& T, int flags = fisheye::CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
+ private static native double fisheye_stereoCalibrate_0(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double fisheye_stereoCalibrate_1(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, int flags);
+ private static native double fisheye_stereoCalibrate_2(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoBM.java b/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoBM.java
new file mode 100644
index 0000000..d827508
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoBM.java
@@ -0,0 +1,294 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.calib3d;
+
+import org.opencv.calib3d.StereoBM;
+import org.opencv.calib3d.StereoMatcher;
+import org.opencv.core.Rect;
+
+// C++: class StereoBM
+/**
+ * Class for computing stereo correspondence using the block matching algorithm, introduced and
+ * contributed to OpenCV by K. Konolige.
+ */
+public class StereoBM extends StereoMatcher {
+
+ protected StereoBM(long addr) { super(addr); }
+
+ // internal usage only
+ public static StereoBM __fromPtr__(long addr) { return new StereoBM(addr); }
+
+ // C++: enum
+ public static final int
+ PREFILTER_NORMALIZED_RESPONSE = 0,
+ PREFILTER_XSOBEL = 1;
+
+
+ //
+ // C++: int cv::StereoBM::getPreFilterType()
+ //
+
+ public int getPreFilterType() {
+ return getPreFilterType_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setPreFilterType(int preFilterType)
+ //
+
+ public void setPreFilterType(int preFilterType) {
+ setPreFilterType_0(nativeObj, preFilterType);
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getPreFilterSize()
+ //
+
+ public int getPreFilterSize() {
+ return getPreFilterSize_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setPreFilterSize(int preFilterSize)
+ //
+
+ public void setPreFilterSize(int preFilterSize) {
+ setPreFilterSize_0(nativeObj, preFilterSize);
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getPreFilterCap()
+ //
+
+ public int getPreFilterCap() {
+ return getPreFilterCap_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setPreFilterCap(int preFilterCap)
+ //
+
+ public void setPreFilterCap(int preFilterCap) {
+ setPreFilterCap_0(nativeObj, preFilterCap);
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getTextureThreshold()
+ //
+
+ public int getTextureThreshold() {
+ return getTextureThreshold_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setTextureThreshold(int textureThreshold)
+ //
+
+ public void setTextureThreshold(int textureThreshold) {
+ setTextureThreshold_0(nativeObj, textureThreshold);
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getUniquenessRatio()
+ //
+
+ public int getUniquenessRatio() {
+ return getUniquenessRatio_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setUniquenessRatio(int uniquenessRatio)
+ //
+
+ public void setUniquenessRatio(int uniquenessRatio) {
+ setUniquenessRatio_0(nativeObj, uniquenessRatio);
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getSmallerBlockSize()
+ //
+
+ public int getSmallerBlockSize() {
+ return getSmallerBlockSize_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setSmallerBlockSize(int blockSize)
+ //
+
+ public void setSmallerBlockSize(int blockSize) {
+ setSmallerBlockSize_0(nativeObj, blockSize);
+ }
+
+
+ //
+ // C++: Rect cv::StereoBM::getROI1()
+ //
+
+ public Rect getROI1() {
+ return new Rect(getROI1_0(nativeObj));
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setROI1(Rect roi1)
+ //
+
+ public void setROI1(Rect roi1) {
+ setROI1_0(nativeObj, roi1.x, roi1.y, roi1.width, roi1.height);
+ }
+
+
+ //
+ // C++: Rect cv::StereoBM::getROI2()
+ //
+
+ public Rect getROI2() {
+ return new Rect(getROI2_0(nativeObj));
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setROI2(Rect roi2)
+ //
+
+ public void setROI2(Rect roi2) {
+ setROI2_0(nativeObj, roi2.x, roi2.y, roi2.width, roi2.height);
+ }
+
+
+ //
+ // C++: static Ptr_StereoBM cv::StereoBM::create(int numDisparities = 0, int blockSize = 21)
+ //
+
+ /**
+ * Creates StereoBM object
+ *
+ * @param numDisparities the disparity search range. For each pixel algorithm will find the best
+ * disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
+ * shifted by changing the minimum disparity.
+ * @param blockSize the linear size of the blocks compared by the algorithm. The size should be odd
+ * (as the block is centered at the current pixel). Larger block size implies smoother, though less
+ * accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
+ * chance for algorithm to find a wrong correspondence.
+ *
+ * The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for
+ * a specific stereo pair.
+ * @return automatically generated
+ */
+ public static StereoBM create(int numDisparities, int blockSize) {
+ return StereoBM.__fromPtr__(create_0(numDisparities, blockSize));
+ }
+
+ /**
+ * Creates StereoBM object
+ *
+ * @param numDisparities the disparity search range. For each pixel algorithm will find the best
+ * disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
+ * shifted by changing the minimum disparity.
+ * (as the block is centered at the current pixel). Larger block size implies smoother, though less
+ * accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
+ * chance for algorithm to find a wrong correspondence.
+ *
+ * The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for
+ * a specific stereo pair.
+ * @return automatically generated
+ */
+ public static StereoBM create(int numDisparities) {
+ return StereoBM.__fromPtr__(create_1(numDisparities));
+ }
+
+ /**
+ * Creates StereoBM object
+ *
+ * disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
+ * shifted by changing the minimum disparity.
+ * (as the block is centered at the current pixel). Larger block size implies smoother, though less
+ * accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
+ * chance for algorithm to find a wrong correspondence.
+ *
+ * The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for
+ * a specific stereo pair.
+ * @return automatically generated
+ */
+ public static StereoBM create() {
+ return StereoBM.__fromPtr__(create_2());
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: int cv::StereoBM::getPreFilterType()
+ private static native int getPreFilterType_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setPreFilterType(int preFilterType)
+ private static native void setPreFilterType_0(long nativeObj, int preFilterType);
+
+ // C++: int cv::StereoBM::getPreFilterSize()
+ private static native int getPreFilterSize_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setPreFilterSize(int preFilterSize)
+ private static native void setPreFilterSize_0(long nativeObj, int preFilterSize);
+
+ // C++: int cv::StereoBM::getPreFilterCap()
+ private static native int getPreFilterCap_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setPreFilterCap(int preFilterCap)
+ private static native void setPreFilterCap_0(long nativeObj, int preFilterCap);
+
+ // C++: int cv::StereoBM::getTextureThreshold()
+ private static native int getTextureThreshold_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setTextureThreshold(int textureThreshold)
+ private static native void setTextureThreshold_0(long nativeObj, int textureThreshold);
+
+ // C++: int cv::StereoBM::getUniquenessRatio()
+ private static native int getUniquenessRatio_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setUniquenessRatio(int uniquenessRatio)
+ private static native void setUniquenessRatio_0(long nativeObj, int uniquenessRatio);
+
+ // C++: int cv::StereoBM::getSmallerBlockSize()
+ private static native int getSmallerBlockSize_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setSmallerBlockSize(int blockSize)
+ private static native void setSmallerBlockSize_0(long nativeObj, int blockSize);
+
+ // C++: Rect cv::StereoBM::getROI1()
+ private static native double[] getROI1_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setROI1(Rect roi1)
+ private static native void setROI1_0(long nativeObj, int roi1_x, int roi1_y, int roi1_width, int roi1_height);
+
+ // C++: Rect cv::StereoBM::getROI2()
+ private static native double[] getROI2_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setROI2(Rect roi2)
+ private static native void setROI2_0(long nativeObj, int roi2_x, int roi2_y, int roi2_width, int roi2_height);
+
+ // C++: static Ptr_StereoBM cv::StereoBM::create(int numDisparities = 0, int blockSize = 21)
+ private static native long create_0(int numDisparities, int blockSize);
+ private static native long create_1(int numDisparities);
+ private static native long create_2();
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoMatcher.java b/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoMatcher.java
new file mode 100644
index 0000000..9e4c87e
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoMatcher.java
@@ -0,0 +1,201 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.calib3d;
+
+import org.opencv.core.Algorithm;
+import org.opencv.core.Mat;
+
+// C++: class StereoMatcher
+/**
+ * The base class for stereo correspondence algorithms.
+ */
+public class StereoMatcher extends Algorithm {
+
+ protected StereoMatcher(long addr) { super(addr); }
+
+ // internal usage only
+ public static StereoMatcher __fromPtr__(long addr) { return new StereoMatcher(addr); }
+
+ // C++: enum
+ public static final int
+ DISP_SHIFT = 4,
+ DISP_SCALE = (1 << DISP_SHIFT);
+
+
+ //
+ // C++: void cv::StereoMatcher::compute(Mat left, Mat right, Mat& disparity)
+ //
+
+ /**
+ * Computes disparity map for the specified stereo pair
+ *
+ * @param left Left 8-bit single-channel image.
+ * @param right Right image of the same size and the same type as the left one.
+ * @param disparity Output disparity map. It has the same size as the input images. Some algorithms,
+ * like StereoBM or StereoSGBM compute 16-bit fixed-point disparity map (where each disparity value
+ * has 4 fractional bits), whereas other algorithms output 32-bit floating-point disparity map.
+ */
+ public void compute(Mat left, Mat right, Mat disparity) {
+ compute_0(nativeObj, left.nativeObj, right.nativeObj, disparity.nativeObj);
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getMinDisparity()
+ //
+
+ public int getMinDisparity() {
+ return getMinDisparity_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setMinDisparity(int minDisparity)
+ //
+
+ public void setMinDisparity(int minDisparity) {
+ setMinDisparity_0(nativeObj, minDisparity);
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getNumDisparities()
+ //
+
+ public int getNumDisparities() {
+ return getNumDisparities_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setNumDisparities(int numDisparities)
+ //
+
+ public void setNumDisparities(int numDisparities) {
+ setNumDisparities_0(nativeObj, numDisparities);
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getBlockSize()
+ //
+
+ public int getBlockSize() {
+ return getBlockSize_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setBlockSize(int blockSize)
+ //
+
+ public void setBlockSize(int blockSize) {
+ setBlockSize_0(nativeObj, blockSize);
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getSpeckleWindowSize()
+ //
+
+ public int getSpeckleWindowSize() {
+ return getSpeckleWindowSize_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setSpeckleWindowSize(int speckleWindowSize)
+ //
+
+ public void setSpeckleWindowSize(int speckleWindowSize) {
+ setSpeckleWindowSize_0(nativeObj, speckleWindowSize);
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getSpeckleRange()
+ //
+
+ public int getSpeckleRange() {
+ return getSpeckleRange_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setSpeckleRange(int speckleRange)
+ //
+
+ public void setSpeckleRange(int speckleRange) {
+ setSpeckleRange_0(nativeObj, speckleRange);
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getDisp12MaxDiff()
+ //
+
+ public int getDisp12MaxDiff() {
+ return getDisp12MaxDiff_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setDisp12MaxDiff(int disp12MaxDiff)
+ //
+
+ public void setDisp12MaxDiff(int disp12MaxDiff) {
+ setDisp12MaxDiff_0(nativeObj, disp12MaxDiff);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: void cv::StereoMatcher::compute(Mat left, Mat right, Mat& disparity)
+ private static native void compute_0(long nativeObj, long left_nativeObj, long right_nativeObj, long disparity_nativeObj);
+
+ // C++: int cv::StereoMatcher::getMinDisparity()
+ private static native int getMinDisparity_0(long nativeObj);
+
+ // C++: void cv::StereoMatcher::setMinDisparity(int minDisparity)
+ private static native void setMinDisparity_0(long nativeObj, int minDisparity);
+
+ // C++: int cv::StereoMatcher::getNumDisparities()
+ private static native int getNumDisparities_0(long nativeObj);
+
+ // C++: void cv::StereoMatcher::setNumDisparities(int numDisparities)
+ private static native void setNumDisparities_0(long nativeObj, int numDisparities);
+
+ // C++: int cv::StereoMatcher::getBlockSize()
+ private static native int getBlockSize_0(long nativeObj);
+
+ // C++: void cv::StereoMatcher::setBlockSize(int blockSize)
+ private static native void setBlockSize_0(long nativeObj, int blockSize);
+
+ // C++: int cv::StereoMatcher::getSpeckleWindowSize()
+ private static native int getSpeckleWindowSize_0(long nativeObj);
+
+ // C++: void cv::StereoMatcher::setSpeckleWindowSize(int speckleWindowSize)
+ private static native void setSpeckleWindowSize_0(long nativeObj, int speckleWindowSize);
+
+ // C++: int cv::StereoMatcher::getSpeckleRange()
+ private static native int getSpeckleRange_0(long nativeObj);
+
+ // C++: void cv::StereoMatcher::setSpeckleRange(int speckleRange)
+ private static native void setSpeckleRange_0(long nativeObj, int speckleRange);
+
+ // C++: int cv::StereoMatcher::getDisp12MaxDiff()
+ private static native int getDisp12MaxDiff_0(long nativeObj);
+
+ // C++: void cv::StereoMatcher::setDisp12MaxDiff(int disp12MaxDiff)
+ private static native void setDisp12MaxDiff_0(long nativeObj, int disp12MaxDiff);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoSGBM.java b/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoSGBM.java
new file mode 100644
index 0000000..30b2f0a
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/calib3d/StereoSGBM.java
@@ -0,0 +1,657 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.calib3d;
+
+import org.opencv.calib3d.StereoMatcher;
+import org.opencv.calib3d.StereoSGBM;
+
+// C++: class StereoSGBM
+/**
+ * The class implements the modified H. Hirschmuller algorithm CITE: HH08 that differs from the original
+ * one as follows:
+ *
+ *
+ * -
+ * By default, the algorithm is single-pass, which means that you consider only 5 directions
+ * instead of 8. Set mode=StereoSGBM::MODE_HH in createStereoSGBM to run the full variant of the
+ * algorithm but beware that it may consume a lot of memory.
+ *
+ * -
+ * The algorithm matches blocks, not individual pixels. Though, setting blockSize=1 reduces the
+ * blocks to single pixels.
+ *
+ * -
+ * Mutual information cost function is not implemented. Instead, a simpler Birchfield-Tomasi
+ * sub-pixel metric from CITE: BT98 is used. Though, the color images are supported as well.
+ *
+ * -
+ * Some pre- and post- processing steps from K. Konolige algorithm StereoBM are included, for
+ * example: pre-filtering (StereoBM::PREFILTER_XSOBEL type) and post-filtering (uniqueness
+ * check, quadratic interpolation and speckle filtering).
+ *
+ *
+ *
+ * Note:
+ *
+ * -
+ * (Python) An example illustrating the use of the StereoSGBM matching algorithm can be found
+ * at opencv_source_code/samples/python/stereo_match.py
+ *
+ *
+ */
+public class StereoSGBM extends StereoMatcher {
+
+ protected StereoSGBM(long addr) { super(addr); }
+
+ // internal usage only
+ public static StereoSGBM __fromPtr__(long addr) { return new StereoSGBM(addr); }
+
+ // C++: enum
+ public static final int
+ MODE_SGBM = 0,
+ MODE_HH = 1,
+ MODE_SGBM_3WAY = 2,
+ MODE_HH4 = 3;
+
+
+ //
+ // C++: int cv::StereoSGBM::getPreFilterCap()
+ //
+
+ public int getPreFilterCap() {
+ return getPreFilterCap_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setPreFilterCap(int preFilterCap)
+ //
+
+ public void setPreFilterCap(int preFilterCap) {
+ setPreFilterCap_0(nativeObj, preFilterCap);
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getUniquenessRatio()
+ //
+
+ public int getUniquenessRatio() {
+ return getUniquenessRatio_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setUniquenessRatio(int uniquenessRatio)
+ //
+
+ public void setUniquenessRatio(int uniquenessRatio) {
+ setUniquenessRatio_0(nativeObj, uniquenessRatio);
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getP1()
+ //
+
+ public int getP1() {
+ return getP1_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setP1(int P1)
+ //
+
+ public void setP1(int P1) {
+ setP1_0(nativeObj, P1);
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getP2()
+ //
+
+ public int getP2() {
+ return getP2_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setP2(int P2)
+ //
+
+ public void setP2(int P2) {
+ setP2_0(nativeObj, P2);
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getMode()
+ //
+
+ public int getMode() {
+ return getMode_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setMode(int mode)
+ //
+
+ public void setMode(int mode) {
+ setMode_0(nativeObj, mode);
+ }
+
+
+ //
+ // C++: static Ptr_StereoSGBM cv::StereoSGBM::create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = StereoSGBM::MODE_SGBM)
+ //
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * @param P1 The first parameter controlling the disparity smoothness. See below.
+ * @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right
+ * disparity check. Set it to a non-positive value to disable the check.
+ * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * @param speckleRange Maximum disparity variation within each connected component. If you do speckle
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * @param mode Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, int mode) {
+ return StereoSGBM.__fromPtr__(create_0(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, mode));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * @param P1 The first parameter controlling the disparity smoothness. See below.
+ * @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right
+ * disparity check. Set it to a non-positive value to disable the check.
+ * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * @param speckleRange Maximum disparity variation within each connected component. If you do speckle
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange) {
+ return StereoSGBM.__fromPtr__(create_1(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * @param P1 The first parameter controlling the disparity smoothness. See below.
+ * @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right
+ * disparity check. Set it to a non-positive value to disable the check.
+ * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize) {
+ return StereoSGBM.__fromPtr__(create_2(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * @param P1 The first parameter controlling the disparity smoothness. See below.
+ * @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right
+ * disparity check. Set it to a non-positive value to disable the check.
+ * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio) {
+ return StereoSGBM.__fromPtr__(create_3(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * @param P1 The first parameter controlling the disparity smoothness. See below.
+ * @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right
+ * disparity check. Set it to a non-positive value to disable the check.
+ * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap) {
+ return StereoSGBM.__fromPtr__(create_4(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * @param P1 The first parameter controlling the disparity smoothness. See below.
+ * @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right
+ * disparity check. Set it to a non-positive value to disable the check.
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff) {
+ return StereoSGBM.__fromPtr__(create_5(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * @param P1 The first parameter controlling the disparity smoothness. See below.
+ * @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * disparity check. Set it to a non-positive value to disable the check.
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2) {
+ return StereoSGBM.__fromPtr__(create_6(minDisparity, numDisparities, blockSize, P1, P2));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * @param P1 The first parameter controlling the disparity smoothness. See below.
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * disparity check. Set it to a non-positive value to disable the check.
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1) {
+ return StereoSGBM.__fromPtr__(create_7(minDisparity, numDisparities, blockSize, P1));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be
+ * somewhere in the 3..11 range.
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * disparity check. Set it to a non-positive value to disable the check.
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize) {
+ return StereoSGBM.__fromPtr__(create_8(minDisparity, numDisparities, blockSize));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * somewhere in the 3..11 range.
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * disparity check. Set it to a non-positive value to disable the check.
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity, int numDisparities) {
+ return StereoSGBM.__fromPtr__(create_9(minDisparity, numDisparities));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * somewhere in the 3..11 range.
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * disparity check. Set it to a non-positive value to disable the check.
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create(int minDisparity) {
+ return StereoSGBM.__fromPtr__(create_10(minDisparity));
+ }
+
+ /**
+ * Creates StereoSGBM object
+ *
+ * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+ * zero. In the current implementation, this parameter must be divisible by 16.
+ * somewhere in the 3..11 range.
+ * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+ * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+ * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good
+ * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
+ * 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
+ * disparity check. Set it to a non-positive value to disable the check.
+ * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+ * The result values are passed to the Birchfield-Tomasi pixel cost function.
+ * value should "win" the second best value to consider the found match correct. Normally, a value
+ * within the 5-15 range is good enough.
+ * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+ * 50-200 range.
+ * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+ * Normally, 1 or 2 is good enough.
+ * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+ * huge for HD-size pictures. By default, it is set to false .
+ *
+ * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+ * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+ * to a custom value.
+ * @return automatically generated
+ */
+ public static StereoSGBM create() {
+ return StereoSGBM.__fromPtr__(create_11());
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: int cv::StereoSGBM::getPreFilterCap()
+ private static native int getPreFilterCap_0(long nativeObj);
+
+ // C++: void cv::StereoSGBM::setPreFilterCap(int preFilterCap)
+ private static native void setPreFilterCap_0(long nativeObj, int preFilterCap);
+
+ // C++: int cv::StereoSGBM::getUniquenessRatio()
+ private static native int getUniquenessRatio_0(long nativeObj);
+
+ // C++: void cv::StereoSGBM::setUniquenessRatio(int uniquenessRatio)
+ private static native void setUniquenessRatio_0(long nativeObj, int uniquenessRatio);
+
+ // C++: int cv::StereoSGBM::getP1()
+ private static native int getP1_0(long nativeObj);
+
+ // C++: void cv::StereoSGBM::setP1(int P1)
+ private static native void setP1_0(long nativeObj, int P1);
+
+ // C++: int cv::StereoSGBM::getP2()
+ private static native int getP2_0(long nativeObj);
+
+ // C++: void cv::StereoSGBM::setP2(int P2)
+ private static native void setP2_0(long nativeObj, int P2);
+
+ // C++: int cv::StereoSGBM::getMode()
+ private static native int getMode_0(long nativeObj);
+
+ // C++: void cv::StereoSGBM::setMode(int mode)
+ private static native void setMode_0(long nativeObj, int mode);
+
+ // C++: static Ptr_StereoSGBM cv::StereoSGBM::create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = StereoSGBM::MODE_SGBM)
+ private static native long create_0(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, int mode);
+ private static native long create_1(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange);
+ private static native long create_2(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize);
+ private static native long create_3(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio);
+ private static native long create_4(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap);
+ private static native long create_5(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff);
+ private static native long create_6(int minDisparity, int numDisparities, int blockSize, int P1, int P2);
+ private static native long create_7(int minDisparity, int numDisparities, int blockSize, int P1);
+ private static native long create_8(int minDisparity, int numDisparities, int blockSize);
+ private static native long create_9(int minDisparity, int numDisparities);
+ private static native long create_10(int minDisparity);
+ private static native long create_11();
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Algorithm.java b/openCVLibrary3413/src/main/java/org/opencv/core/Algorithm.java
new file mode 100644
index 0000000..b2f053f
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Algorithm.java
@@ -0,0 +1,120 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.core;
+
+
+
+// C++: class Algorithm
+/**
+ * This is a base class for all more or less complex algorithms in OpenCV
+ *
+ * especially for classes of algorithms, for which there can be multiple implementations. The examples
+ * are stereo correspondence (for which there are algorithms like block matching, semi-global block
+ * matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians
+ * models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck
+ * etc.).
+ *
+ * Here is example of SimpleBlobDetector use in your application via Algorithm interface:
+ * SNIPPET: snippets/core_various.cpp Algorithm
+ */
+public class Algorithm {
+
+ protected final long nativeObj;
+ protected Algorithm(long addr) { nativeObj = addr; }
+
+ public long getNativeObjAddr() { return nativeObj; }
+
+ // internal usage only
+ public static Algorithm __fromPtr__(long addr) { return new Algorithm(addr); }
+
+ //
+ // C++: void cv::Algorithm::clear()
+ //
+
+ /**
+ * Clears the algorithm state
+ */
+ public void clear() {
+ clear_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::Algorithm::write(Ptr_FileStorage fs, String name = String())
+ //
+
+ // Unknown type 'Ptr_FileStorage' (I), skipping the function
+
+
+ //
+ // C++: void cv::Algorithm::read(FileNode fn)
+ //
+
+ // Unknown type 'FileNode' (I), skipping the function
+
+
+ //
+ // C++: bool cv::Algorithm::empty()
+ //
+
+ /**
+ * Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
+ * @return automatically generated
+ */
+ public boolean empty() {
+ return empty_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::Algorithm::save(String filename)
+ //
+
+ /**
+ * Saves the algorithm to a file.
+ * In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
+ * @param filename automatically generated
+ */
+ public void save(String filename) {
+ save_0(nativeObj, filename);
+ }
+
+
+ //
+ // C++: String cv::Algorithm::getDefaultName()
+ //
+
+ /**
+ * Returns the algorithm string identifier.
+ * This string is used as top level xml/yml node tag when the object is saved to a file or string.
+ * @return automatically generated
+ */
+ public String getDefaultName() {
+ return getDefaultName_0(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: void cv::Algorithm::clear()
+ private static native void clear_0(long nativeObj);
+
+ // C++: bool cv::Algorithm::empty()
+ private static native boolean empty_0(long nativeObj);
+
+ // C++: void cv::Algorithm::save(String filename)
+ private static native void save_0(long nativeObj, String filename);
+
+ // C++: String cv::Algorithm::getDefaultName()
+ private static native String getDefaultName_0(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Core.java b/openCVLibrary3413/src/main/java/org/opencv/core/Core.java
new file mode 100644
index 0000000..20d3643
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Core.java
@@ -0,0 +1,6123 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfDouble;
+import org.opencv.core.MatOfInt;
+import org.opencv.core.Scalar;
+import org.opencv.core.TermCriteria;
+import org.opencv.utils.Converters;
+
+// C++: class Core
+
+public class Core {
+ // these constants are wrapped inside functions to prevent inlining
+ private static String getVersion() { return "3.4.13"; }
+ private static String getNativeLibraryName() { return "opencv_java3413"; }
+ private static int getVersionMajorJ() { return 3; }
+ private static int getVersionMinorJ() { return 4; }
+ private static int getVersionRevisionJ() { return 13; }
+ private static String getVersionStatusJ() { return ""; }
+
+ public static final String VERSION = getVersion();
+ public static final String NATIVE_LIBRARY_NAME = getNativeLibraryName();
+ public static final int VERSION_MAJOR = getVersionMajorJ();
+ public static final int VERSION_MINOR = getVersionMinorJ();
+ public static final int VERSION_REVISION = getVersionRevisionJ();
+ public static final String VERSION_STATUS = getVersionStatusJ();
+
+ private static final int
+ CV_8U = 0,
+ CV_8S = 1,
+ CV_16U = 2,
+ CV_16S = 3,
+ CV_32S = 4,
+ CV_32F = 5,
+ CV_64F = 6,
+ CV_USRTYPE1 = 7;
+
+
+ // C++: enum
+ public static final int
+ SVD_MODIFY_A = 1,
+ SVD_NO_UV = 2,
+ SVD_FULL_UV = 4,
+ FILLED = -1,
+ REDUCE_SUM = 0,
+ REDUCE_AVG = 1,
+ REDUCE_MAX = 2,
+ REDUCE_MIN = 3,
+ Hamming_normType = 6,
+ RNG_UNIFORM = 0,
+ RNG_NORMAL = 1,
+ Formatter_FMT_DEFAULT = 0,
+ Formatter_FMT_MATLAB = 1,
+ Formatter_FMT_CSV = 2,
+ Formatter_FMT_PYTHON = 3,
+ Formatter_FMT_NUMPY = 4,
+ Formatter_FMT_C = 5,
+ Param_INT = 0,
+ Param_BOOLEAN = 1,
+ Param_REAL = 2,
+ Param_STRING = 3,
+ Param_MAT = 4,
+ Param_MAT_VECTOR = 5,
+ Param_ALGORITHM = 6,
+ Param_FLOAT = 7,
+ Param_UNSIGNED_INT = 8,
+ Param_UINT64 = 9,
+ Param_UCHAR = 11,
+ Param_SCALAR = 12;
+
+
+ // C++: enum BorderTypes (cv.BorderTypes)
+ public static final int
+ BORDER_CONSTANT = 0,
+ BORDER_REPLICATE = 1,
+ BORDER_REFLECT = 2,
+ BORDER_WRAP = 3,
+ BORDER_REFLECT_101 = 4,
+ BORDER_TRANSPARENT = 5,
+ BORDER_REFLECT101 = 4,
+ BORDER_DEFAULT = 4,
+ BORDER_ISOLATED = 16;
+
+
+ // C++: enum CmpTypes (cv.CmpTypes)
+ public static final int
+ CMP_EQ = 0,
+ CMP_GT = 1,
+ CMP_GE = 2,
+ CMP_LT = 3,
+ CMP_LE = 4,
+ CMP_NE = 5;
+
+
+ // C++: enum CovarFlags (cv.CovarFlags)
+ public static final int
+ COVAR_SCRAMBLED = 0,
+ COVAR_NORMAL = 1,
+ COVAR_USE_AVG = 2,
+ COVAR_SCALE = 4,
+ COVAR_ROWS = 8,
+ COVAR_COLS = 16;
+
+
+ // C++: enum DecompTypes (cv.DecompTypes)
+ public static final int
+ DECOMP_LU = 0,
+ DECOMP_SVD = 1,
+ DECOMP_EIG = 2,
+ DECOMP_CHOLESKY = 3,
+ DECOMP_QR = 4,
+ DECOMP_NORMAL = 16;
+
+
+ // C++: enum DftFlags (cv.DftFlags)
+ public static final int
+ DFT_INVERSE = 1,
+ DFT_SCALE = 2,
+ DFT_ROWS = 4,
+ DFT_COMPLEX_OUTPUT = 16,
+ DFT_REAL_OUTPUT = 32,
+ DFT_COMPLEX_INPUT = 64,
+ DCT_INVERSE = 1,
+ DCT_ROWS = 4;
+
+
+ // C++: enum Code (cv.Error.Code)
+ public static final int
+ StsOk = 0,
+ StsBackTrace = -1,
+ StsError = -2,
+ StsInternal = -3,
+ StsNoMem = -4,
+ StsBadArg = -5,
+ StsBadFunc = -6,
+ StsNoConv = -7,
+ StsAutoTrace = -8,
+ HeaderIsNull = -9,
+ BadImageSize = -10,
+ BadOffset = -11,
+ BadDataPtr = -12,
+ BadStep = -13,
+ BadModelOrChSeq = -14,
+ BadNumChannels = -15,
+ BadNumChannel1U = -16,
+ BadDepth = -17,
+ BadAlphaChannel = -18,
+ BadOrder = -19,
+ BadOrigin = -20,
+ BadAlign = -21,
+ BadCallBack = -22,
+ BadTileSize = -23,
+ BadCOI = -24,
+ BadROISize = -25,
+ MaskIsTiled = -26,
+ StsNullPtr = -27,
+ StsVecLengthErr = -28,
+ StsFilterStructContentErr = -29,
+ StsKernelStructContentErr = -30,
+ StsFilterOffsetErr = -31,
+ StsBadSize = -201,
+ StsDivByZero = -202,
+ StsInplaceNotSupported = -203,
+ StsObjectNotFound = -204,
+ StsUnmatchedFormats = -205,
+ StsBadFlag = -206,
+ StsBadPoint = -207,
+ StsBadMask = -208,
+ StsUnmatchedSizes = -209,
+ StsUnsupportedFormat = -210,
+ StsOutOfRange = -211,
+ StsParseError = -212,
+ StsNotImplemented = -213,
+ StsBadMemBlock = -214,
+ StsAssert = -215,
+ GpuNotSupported = -216,
+ GpuApiCallError = -217,
+ OpenGlNotSupported = -218,
+ OpenGlApiCallError = -219,
+ OpenCLApiCallError = -220,
+ OpenCLDoubleNotSupported = -221,
+ OpenCLInitError = -222,
+ OpenCLNoAMDBlasFft = -223;
+
+
+ // C++: enum GemmFlags (cv.GemmFlags)
+ public static final int
+ GEMM_1_T = 1,
+ GEMM_2_T = 2,
+ GEMM_3_T = 4;
+
+
+ // C++: enum HersheyFonts (cv.HersheyFonts)
+ public static final int
+ FONT_HERSHEY_SIMPLEX = 0,
+ FONT_HERSHEY_PLAIN = 1,
+ FONT_HERSHEY_DUPLEX = 2,
+ FONT_HERSHEY_COMPLEX = 3,
+ FONT_HERSHEY_TRIPLEX = 4,
+ FONT_HERSHEY_COMPLEX_SMALL = 5,
+ FONT_HERSHEY_SCRIPT_SIMPLEX = 6,
+ FONT_HERSHEY_SCRIPT_COMPLEX = 7,
+ FONT_ITALIC = 16;
+
+
+ // C++: enum KmeansFlags (cv.KmeansFlags)
+ public static final int
+ KMEANS_RANDOM_CENTERS = 0,
+ KMEANS_PP_CENTERS = 2,
+ KMEANS_USE_INITIAL_LABELS = 1;
+
+
+ // C++: enum LineTypes (cv.LineTypes)
+ public static final int
+ LINE_4 = 4,
+ LINE_8 = 8,
+ LINE_AA = 16;
+
+
+ // C++: enum NormTypes (cv.NormTypes)
+ public static final int
+ NORM_INF = 1,
+ NORM_L1 = 2,
+ NORM_L2 = 4,
+ NORM_L2SQR = 5,
+ NORM_HAMMING = 6,
+ NORM_HAMMING2 = 7,
+ NORM_TYPE_MASK = 7,
+ NORM_RELATIVE = 8,
+ NORM_MINMAX = 32;
+
+
+ // C++: enum Flags (cv.PCA.Flags)
+ public static final int
+ PCA_DATA_AS_ROW = 0,
+ PCA_DATA_AS_COL = 1,
+ PCA_USE_AVG = 2;
+
+
+ // C++: enum RotateFlags (cv.RotateFlags)
+ public static final int
+ ROTATE_90_CLOCKWISE = 0,
+ ROTATE_180 = 1,
+ ROTATE_90_COUNTERCLOCKWISE = 2;
+
+
+ // C++: enum SortFlags (cv.SortFlags)
+ public static final int
+ SORT_EVERY_ROW = 0,
+ SORT_EVERY_COLUMN = 1,
+ SORT_ASCENDING = 0,
+ SORT_DESCENDING = 16;
+
+
+ //
+ // C++: float cv::cubeRoot(float val)
+ //
+
+ /**
+ * Computes the cube root of an argument.
+ *
+ * The function cubeRoot computes \(\sqrt[3]{\texttt{val}}\). Negative arguments are handled correctly.
+ * NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for
+ * single-precision data.
+ * @param val A function argument.
+ * @return automatically generated
+ */
+ public static float cubeRoot(float val) {
+ return cubeRoot_0(val);
+ }
+
+
+ //
+ // C++: float cv::fastAtan2(float y, float x)
+ //
+
+ /**
+ * Calculates the angle of a 2D vector in degrees.
+ *
+ * The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured
+ * in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees.
+ * @param x x-coordinate of the vector.
+ * @param y y-coordinate of the vector.
+ * @return automatically generated
+ */
+ public static float fastAtan2(float y, float x) {
+ return fastAtan2_0(y, x);
+ }
+
+
+ //
+ // C++: bool cv::ipp::useIPP()
+ //
+
+ /**
+ * proxy for hal::Cholesky
+ * @return automatically generated
+ */
+ public static boolean useIPP() {
+ return useIPP_0();
+ }
+
+
+ //
+ // C++: void cv::ipp::setUseIPP(bool flag)
+ //
+
+ public static void setUseIPP(boolean flag) {
+ setUseIPP_0(flag);
+ }
+
+
+ //
+ // C++: String cv::ipp::getIppVersion()
+ //
+
+ public static String getIppVersion() {
+ return getIppVersion_0();
+ }
+
+
+ //
+ // C++: bool cv::ipp::useIPP_NotExact()
+ //
+
+ public static boolean useIPP_NotExact() {
+ return useIPP_NotExact_0();
+ }
+
+
+ //
+ // C++: void cv::ipp::setUseIPP_NotExact(bool flag)
+ //
+
+ public static void setUseIPP_NotExact(boolean flag) {
+ setUseIPP_NotExact_0(flag);
+ }
+
+
+ //
+ // C++: bool cv::ipp::useIPP_NE()
+ //
+
+ public static boolean useIPP_NE() {
+ return useIPP_NE_0();
+ }
+
+
+ //
+ // C++: void cv::ipp::setUseIPP_NE(bool flag)
+ //
+
+ public static void setUseIPP_NE(boolean flag) {
+ setUseIPP_NE_0(flag);
+ }
+
+
+ //
+ // C++: int cv::borderInterpolate(int p, int len, int borderType)
+ //
+
+ /**
+ * Computes the source location of an extrapolated pixel.
+ *
+ * The function computes and returns the coordinate of a donor pixel corresponding to the specified
+ * extrapolated pixel when using the specified extrapolation border mode. For example, if you use
+ * cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and
+ * want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img , it
+ * looks like:
+ *
+ * float val = img.at<float>(borderInterpolate(100, img.rows, cv::BORDER_REFLECT_101),
+ * borderInterpolate(-5, img.cols, cv::BORDER_WRAP));
+ *
+ * Normally, the function is not called directly. It is used inside filtering functions and also in
+ * copyMakeBorder.
+ * @param p 0-based coordinate of the extrapolated pixel along one of the axes, likely <0 or >= len
+ * @param len Length of the array along the corresponding axis.
+ * @param borderType Border type, one of the #BorderTypes, except for #BORDER_TRANSPARENT and
+ * #BORDER_ISOLATED . When borderType==#BORDER_CONSTANT , the function always returns -1, regardless
+ * of p and len.
+ *
+ * SEE: copyMakeBorder
+ * @return automatically generated
+ */
+ public static int borderInterpolate(int p, int len, int borderType) {
+ return borderInterpolate_0(p, len, borderType);
+ }
+
+
+ //
+ // C++: void cv::copyMakeBorder(Mat src, Mat& dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar())
+ //
+
+ /**
+ * Forms a border around an image.
+ *
+ * The function copies the source image into the middle of the destination image. The areas to the
+ * left, to the right, above and below the copied source image will be filled with extrapolated
+ * pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but
+ * what other more complex functions, including your own, may do to simplify image boundary handling.
+ *
+ * The function supports the mode when src is already in the middle of dst . In this case, the
+ * function does not copy src itself but simply constructs the border, for example:
+ *
+ *
+ * // let border be the same in all directions
+ * int border=2;
+ * // constructs a larger image to fit both the image and the border
+ * Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth());
+ * // select the middle part of it w/o copying data
+ * Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
+ * // convert image from RGB to grayscale
+ * cvtColor(rgb, gray, COLOR_RGB2GRAY);
+ * // form a border in-place
+ * copyMakeBorder(gray, gray_buf, border, border,
+ * border, border, BORDER_REPLICATE);
+ * // now do some custom filtering ...
+ * ...
+ *
+ * Note: When the source image is a part (ROI) of a bigger image, the function will try to use the
+ * pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as
+ * if src was not a ROI, use borderType | #BORDER_ISOLATED.
+ *
+ * @param src Source image.
+ * @param dst Destination image of the same type as src and the size Size(src.cols+left+right,
+ * src.rows+top+bottom) .
+ * @param top the top pixels
+ * @param bottom the bottom pixels
+ * @param left the left pixels
+ * @param right Parameter specifying how many pixels in each direction from the source image rectangle
+ * to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs
+ * to be built.
+ * @param borderType Border type. See borderInterpolate for details.
+ * @param value Border value if borderType==BORDER_CONSTANT .
+ *
+ * SEE: borderInterpolate
+ */
+ public static void copyMakeBorder(Mat src, Mat dst, int top, int bottom, int left, int right, int borderType, Scalar value) {
+ copyMakeBorder_0(src.nativeObj, dst.nativeObj, top, bottom, left, right, borderType, value.val[0], value.val[1], value.val[2], value.val[3]);
+ }
+
+ /**
+ * Forms a border around an image.
+ *
+ * The function copies the source image into the middle of the destination image. The areas to the
+ * left, to the right, above and below the copied source image will be filled with extrapolated
+ * pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but
+ * what other more complex functions, including your own, may do to simplify image boundary handling.
+ *
+ * The function supports the mode when src is already in the middle of dst . In this case, the
+ * function does not copy src itself but simply constructs the border, for example:
+ *
+ *
+ * // let border be the same in all directions
+ * int border=2;
+ * // constructs a larger image to fit both the image and the border
+ * Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth());
+ * // select the middle part of it w/o copying data
+ * Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
+ * // convert image from RGB to grayscale
+ * cvtColor(rgb, gray, COLOR_RGB2GRAY);
+ * // form a border in-place
+ * copyMakeBorder(gray, gray_buf, border, border,
+ * border, border, BORDER_REPLICATE);
+ * // now do some custom filtering ...
+ * ...
+ *
+ * Note: When the source image is a part (ROI) of a bigger image, the function will try to use the
+ * pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as
+ * if src was not a ROI, use borderType | #BORDER_ISOLATED.
+ *
+ * @param src Source image.
+ * @param dst Destination image of the same type as src and the size Size(src.cols+left+right,
+ * src.rows+top+bottom) .
+ * @param top the top pixels
+ * @param bottom the bottom pixels
+ * @param left the left pixels
+ * @param right Parameter specifying how many pixels in each direction from the source image rectangle
+ * to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs
+ * to be built.
+ * @param borderType Border type. See borderInterpolate for details.
+ *
+ * SEE: borderInterpolate
+ */
+ public static void copyMakeBorder(Mat src, Mat dst, int top, int bottom, int left, int right, int borderType) {
+ copyMakeBorder_1(src.nativeObj, dst.nativeObj, top, bottom, left, right, borderType);
+ }
+
+
+ //
+ // C++: void cv::add(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ //
+
+ /**
+ * Calculates the per-element sum of two arrays or an array and a scalar.
+ *
+ * The function add calculates:
+ *
+ * -
+ * Sum of two arrays when both input arrays have the same size and the same number of channels:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of
+ * elements as {@code src1.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of
+ * elements as {@code src2.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} + \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ * where {@code I} is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+ * channel is processed independently.
+ *
+ *
+ *
+ * The first function in the list above can be replaced with matrix expressions:
+ *
+ * dst = src1 + src2;
+ * dst += src1; // equivalent to add(dst, src1, dst);
+ *
+ * The input arrays and the output array can all have the same or different depths. For example, you
+ * can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
+ * floating-point array. Depth of the output array is determined by the dtype parameter. In the second
+ * and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
+ * be set to the default -1. In this case, the output array will have the same depth as the input
+ * array, be it src1, src2 or both.
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and number of channels as the input array(s); the
+ * depth is defined by dtype or src1/src2.
+ * @param mask optional operation mask - 8-bit single channel array, that specifies elements of the
+ * output array to be changed.
+ * @param dtype optional depth of the output array (see the discussion below).
+ * SEE: subtract, addWeighted, scaleAdd, Mat::convertTo
+ */
+ public static void add(Mat src1, Mat src2, Mat dst, Mat mask, int dtype) {
+ add_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj, dtype);
+ }
+
+ /**
+ * Calculates the per-element sum of two arrays or an array and a scalar.
+ *
+ * The function add calculates:
+ *
+ * -
+ * Sum of two arrays when both input arrays have the same size and the same number of channels:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of
+ * elements as {@code src1.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of
+ * elements as {@code src2.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} + \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ * where {@code I} is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+ * channel is processed independently.
+ *
+ *
+ *
+ * The first function in the list above can be replaced with matrix expressions:
+ *
+ * dst = src1 + src2;
+ * dst += src1; // equivalent to add(dst, src1, dst);
+ *
+ * The input arrays and the output array can all have the same or different depths. For example, you
+ * can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
+ * floating-point array. Depth of the output array is determined by the dtype parameter. In the second
+ * and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
+ * be set to the default -1. In this case, the output array will have the same depth as the input
+ * array, be it src1, src2 or both.
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and number of channels as the input array(s); the
+ * depth is defined by dtype or src1/src2.
+ * @param mask optional operation mask - 8-bit single channel array, that specifies elements of the
+ * output array to be changed.
+ * SEE: subtract, addWeighted, scaleAdd, Mat::convertTo
+ */
+ public static void add(Mat src1, Mat src2, Mat dst, Mat mask) {
+ add_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * Calculates the per-element sum of two arrays or an array and a scalar.
+ *
+ * The function add calculates:
+ *
+ * -
+ * Sum of two arrays when both input arrays have the same size and the same number of channels:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of
+ * elements as {@code src1.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of
+ * elements as {@code src2.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} + \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ * where {@code I} is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+ * channel is processed independently.
+ *
+ *
+ *
+ * The first function in the list above can be replaced with matrix expressions:
+ *
+ * dst = src1 + src2;
+ * dst += src1; // equivalent to add(dst, src1, dst);
+ *
+ * The input arrays and the output array can all have the same or different depths. For example, you
+ * can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
+ * floating-point array. Depth of the output array is determined by the dtype parameter. In the second
+ * and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
+ * be set to the default -1. In this case, the output array will have the same depth as the input
+ * array, be it src1, src2 or both.
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and number of channels as the input array(s); the
+ * depth is defined by dtype or src1/src2.
+ * output array to be changed.
+ * SEE: subtract, addWeighted, scaleAdd, Mat::convertTo
+ */
+ public static void add(Mat src1, Mat src2, Mat dst) {
+ add_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::subtract(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ //
+
+ /**
+ * Calculates the per-element difference between two arrays or array and a scalar.
+ *
+ * The function subtract calculates:
+ *
+ * -
+ * Difference between two arrays, when both input arrays have the same size and the same number of
+ * channels:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Difference between an array and a scalar, when src2 is constructed from Scalar or has the same
+ * number of elements as {@code src1.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Difference between a scalar and an array, when src1 is constructed from Scalar or has the same
+ * number of elements as {@code src2.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} - \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * The reverse difference between a scalar and an array in the case of {@code SubRS}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src2} - \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+ * channel is processed independently.
+ *
+ *
+ *
+ * The first function in the list above can be replaced with matrix expressions:
+ *
+ * dst = src1 - src2;
+ * dst -= src1; // equivalent to subtract(dst, src1, dst);
+ *
+ * The input arrays and the output array can all have the same or different depths. For example, you
+ * can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of
+ * the output array is determined by dtype parameter. In the second and third cases above, as well as
+ * in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this
+ * case the output array will have the same depth as the input array, be it src1, src2 or both.
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array of the same size and the same number of channels as the input array.
+ * @param mask optional operation mask; this is an 8-bit single channel array that specifies elements
+ * of the output array to be changed.
+ * @param dtype optional depth of the output array
+ * SEE: add, addWeighted, scaleAdd, Mat::convertTo
+ */
+ public static void subtract(Mat src1, Mat src2, Mat dst, Mat mask, int dtype) {
+ subtract_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj, dtype);
+ }
+
+ /**
+ * Calculates the per-element difference between two arrays or array and a scalar.
+ *
+ * The function subtract calculates:
+ *
+ * -
+ * Difference between two arrays, when both input arrays have the same size and the same number of
+ * channels:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Difference between an array and a scalar, when src2 is constructed from Scalar or has the same
+ * number of elements as {@code src1.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Difference between a scalar and an array, when src1 is constructed from Scalar or has the same
+ * number of elements as {@code src2.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} - \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * The reverse difference between a scalar and an array in the case of {@code SubRS}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src2} - \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+ * channel is processed independently.
+ *
+ *
+ *
+ * The first function in the list above can be replaced with matrix expressions:
+ *
+ * dst = src1 - src2;
+ * dst -= src1; // equivalent to subtract(dst, src1, dst);
+ *
+ * The input arrays and the output array can all have the same or different depths. For example, you
+ * can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of
+ * the output array is determined by dtype parameter. In the second and third cases above, as well as
+ * in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this
+ * case the output array will have the same depth as the input array, be it src1, src2 or both.
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array of the same size and the same number of channels as the input array.
+ * @param mask optional operation mask; this is an 8-bit single channel array that specifies elements
+ * of the output array to be changed.
+ * SEE: add, addWeighted, scaleAdd, Mat::convertTo
+ */
+ public static void subtract(Mat src1, Mat src2, Mat dst, Mat mask) {
+ subtract_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * Calculates the per-element difference between two arrays or array and a scalar.
+ *
+ * The function subtract calculates:
+ *
+ * -
+ * Difference between two arrays, when both input arrays have the same size and the same number of
+ * channels:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Difference between an array and a scalar, when src2 is constructed from Scalar or has the same
+ * number of elements as {@code src1.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * Difference between a scalar and an array, when src1 is constructed from Scalar or has the same
+ * number of elements as {@code src2.channels()}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} - \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ *
+ * -
+ * The reverse difference between a scalar and an array in the case of {@code SubRS}:
+ * \(\texttt{dst}(I) = \texttt{saturate} ( \texttt{src2} - \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\)
+ * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+ * channel is processed independently.
+ *
+ *
+ *
+ * The first function in the list above can be replaced with matrix expressions:
+ *
+ * dst = src1 - src2;
+ * dst -= src1; // equivalent to subtract(dst, src1, dst);
+ *
+ * The input arrays and the output array can all have the same or different depths. For example, you
+ * can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of
+ * the output array is determined by dtype parameter. In the second and third cases above, as well as
+ * in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this
+ * case the output array will have the same depth as the input array, be it src1, src2 or both.
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array of the same size and the same number of channels as the input array.
+ * of the output array to be changed.
+ * SEE: add, addWeighted, scaleAdd, Mat::convertTo
+ */
+ public static void subtract(Mat src1, Mat src2, Mat dst) {
+ subtract_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::multiply(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
+ //
+
+ /**
+ * Calculates the per-element scaled product of two arrays.
+ *
+ * The function multiply calculates the per-element product of two arrays:
+ *
+ * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I) \cdot \texttt{src2} (I))\)
+ *
+ * There is also a REF: MatrixExpressions -friendly variant of the first function. See Mat::mul .
+ *
+ * For a not-per-element matrix product, see gemm .
+ *
+ * Note: Saturation is not applied when the output array has the depth
+ * CV_32S. You may even get result of an incorrect sign in the case of
+ * overflow.
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and the same type as src1.
+ * @param dst output array of the same size and type as src1.
+ * @param scale optional scale factor.
+ * @param dtype optional depth of the output array
+ * SEE: add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare,
+ * Mat::convertTo
+ */
+ public static void multiply(Mat src1, Mat src2, Mat dst, double scale, int dtype) {
+ multiply_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale, dtype);
+ }
+
+ /**
+ * Calculates the per-element scaled product of two arrays.
+ *
+ * The function multiply calculates the per-element product of two arrays:
+ *
+ * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I) \cdot \texttt{src2} (I))\)
+ *
+ * There is also a REF: MatrixExpressions -friendly variant of the first function. See Mat::mul .
+ *
+ * For a not-per-element matrix product, see gemm .
+ *
+ * Note: Saturation is not applied when the output array has the depth
+ * CV_32S. You may even get result of an incorrect sign in the case of
+ * overflow.
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and the same type as src1.
+ * @param dst output array of the same size and type as src1.
+ * @param scale optional scale factor.
+ * SEE: add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare,
+ * Mat::convertTo
+ */
+ public static void multiply(Mat src1, Mat src2, Mat dst, double scale) {
+ multiply_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale);
+ }
+
+ /**
+ * Calculates the per-element scaled product of two arrays.
+ *
+ * The function multiply calculates the per-element product of two arrays:
+ *
+ * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I) \cdot \texttt{src2} (I))\)
+ *
+ * There is also a REF: MatrixExpressions -friendly variant of the first function. See Mat::mul .
+ *
+ * For a not-per-element matrix product, see gemm .
+ *
+ * Note: Saturation is not applied when the output array has the depth
+ * CV_32S. You may even get result of an incorrect sign in the case of
+ * overflow.
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and the same type as src1.
+ * @param dst output array of the same size and type as src1.
+ * SEE: add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare,
+ * Mat::convertTo
+ */
+ public static void multiply(Mat src1, Mat src2, Mat dst) {
+ multiply_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::divide(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
+ //
+
+ /**
+ * Performs per-element division of two arrays or a scalar by an array.
+ *
+ * The function cv::divide divides one array by another:
+ * \(\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\)
+ * or a scalar by an array when there is no src1 :
+ * \(\texttt{dst(I) = saturate(scale/src2(I))}\)
+ *
+ * When src2(I) is zero, dst(I) will also be zero. Different channels of
+ * multi-channel arrays are processed independently.
+ *
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and type as src1.
+ * @param scale scalar factor.
+ * @param dst output array of the same size and type as src2.
+ * @param dtype optional depth of the output array; if -1, dst will have depth src2.depth(), but in
+ * case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
+ * SEE: multiply, add, subtract
+ */
+ public static void divide(Mat src1, Mat src2, Mat dst, double scale, int dtype) {
+ divide_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale, dtype);
+ }
+
+ /**
+ * Performs per-element division of two arrays or a scalar by an array.
+ *
+ * The function cv::divide divides one array by another:
+ * \(\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\)
+ * or a scalar by an array when there is no src1 :
+ * \(\texttt{dst(I) = saturate(scale/src2(I))}\)
+ *
+ * When src2(I) is zero, dst(I) will also be zero. Different channels of
+ * multi-channel arrays are processed independently.
+ *
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and type as src1.
+ * @param scale scalar factor.
+ * @param dst output array of the same size and type as src2.
+ * case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
+ * SEE: multiply, add, subtract
+ */
+ public static void divide(Mat src1, Mat src2, Mat dst, double scale) {
+ divide_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale);
+ }
+
+ /**
+ * Performs per-element division of two arrays or a scalar by an array.
+ *
+ * The function cv::divide divides one array by another:
+ * \(\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\)
+ * or a scalar by an array when there is no src1 :
+ * \(\texttt{dst(I) = saturate(scale/src2(I))}\)
+ *
+ * When src2(I) is zero, dst(I) will also be zero. Different channels of
+ * multi-channel arrays are processed independently.
+ *
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and type as src1.
+ * @param dst output array of the same size and type as src2.
+ * case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
+ * SEE: multiply, add, subtract
+ */
+ public static void divide(Mat src1, Mat src2, Mat dst) {
+ divide_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::divide(double scale, Mat src2, Mat& dst, int dtype = -1)
+ //
+
+ public static void divide(double scale, Mat src2, Mat dst, int dtype) {
+ divide_3(scale, src2.nativeObj, dst.nativeObj, dtype);
+ }
+
+ public static void divide(double scale, Mat src2, Mat dst) {
+ divide_4(scale, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::scaleAdd(Mat src1, double alpha, Mat src2, Mat& dst)
+ //
+
+ /**
+ * Calculates the sum of a scaled array and another array.
+ *
+ * The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY
+ * or SAXPY in [BLAS](http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms). It calculates
+ * the sum of a scaled array and another array:
+ * \(\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) + \texttt{src2} (I)\)
+ * The function can also be emulated with a matrix expression, for example:
+ *
+ * Mat A(3, 3, CV_64F);
+ * ...
+ * A.row(0) = A.row(1)*2 + A.row(2);
+ *
+ * @param src1 first input array.
+ * @param alpha scale factor for the first array.
+ * @param src2 second input array of the same size and type as src1.
+ * @param dst output array of the same size and type as src1.
+ * SEE: add, addWeighted, subtract, Mat::dot, Mat::convertTo
+ */
+ public static void scaleAdd(Mat src1, double alpha, Mat src2, Mat dst) {
+ scaleAdd_0(src1.nativeObj, alpha, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat& dst, int dtype = -1)
+ //
+
+ /**
+ * Calculates the weighted sum of two arrays.
+ *
+ * The function addWeighted calculates the weighted sum of two arrays as follows:
+ * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\)
+ * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+ * channel is processed independently.
+ * The function can be replaced with a matrix expression:
+ *
+ * dst = src1*alpha + src2*beta + gamma;
+ *
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array.
+ * @param alpha weight of the first array elements.
+ * @param src2 second input array of the same size and channel number as src1.
+ * @param beta weight of the second array elements.
+ * @param gamma scalar added to each sum.
+ * @param dst output array that has the same size and number of channels as the input arrays.
+ * @param dtype optional depth of the output array; when both input arrays have the same depth, dtype
+ * can be set to -1, which will be equivalent to src1.depth().
+ * SEE: add, subtract, scaleAdd, Mat::convertTo
+ */
+ public static void addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst, int dtype) {
+ addWeighted_0(src1.nativeObj, alpha, src2.nativeObj, beta, gamma, dst.nativeObj, dtype);
+ }
+
+ /**
+ * Calculates the weighted sum of two arrays.
+ *
+ * The function addWeighted calculates the weighted sum of two arrays as follows:
+ * \(\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\)
+ * where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+ * channel is processed independently.
+ * The function can be replaced with a matrix expression:
+ *
+ * dst = src1*alpha + src2*beta + gamma;
+ *
+ * Note: Saturation is not applied when the output array has the depth CV_32S. You may even get
+ * result of an incorrect sign in the case of overflow.
+ * @param src1 first input array.
+ * @param alpha weight of the first array elements.
+ * @param src2 second input array of the same size and channel number as src1.
+ * @param beta weight of the second array elements.
+ * @param gamma scalar added to each sum.
+ * @param dst output array that has the same size and number of channels as the input arrays.
+ * can be set to -1, which will be equivalent to src1.depth().
+ * SEE: add, subtract, scaleAdd, Mat::convertTo
+ */
+ public static void addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst) {
+ addWeighted_1(src1.nativeObj, alpha, src2.nativeObj, beta, gamma, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::convertScaleAbs(Mat src, Mat& dst, double alpha = 1, double beta = 0)
+ //
+
+ /**
+ * Scales, calculates absolute values, and converts the result to 8-bit.
+ *
+ * On each element of the input array, the function convertScaleAbs
+ * performs three operations sequentially: scaling, taking an absolute
+ * value, conversion to an unsigned 8-bit type:
+ * \(\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\)
+ * In case of multi-channel arrays, the function processes each channel
+ * independently. When the output is not 8-bit, the operation can be
+ * emulated by calling the Mat::convertTo method (or by using matrix
+ * expressions) and then by calculating an absolute value of the result.
+ * For example:
+ *
+ * Mat_<float> A(30,30);
+ * randu(A, Scalar(-100), Scalar(100));
+ * Mat_<float> B = A*5 + 3;
+ * B = abs(B);
+ * // Mat_<float> B = abs(A*5+3) will also do the job,
+ * // but it will allocate a temporary matrix
+ *
+ * @param src input array.
+ * @param dst output array.
+ * @param alpha optional scale factor.
+ * @param beta optional delta added to the scaled values.
+ * SEE: Mat::convertTo, cv::abs(const Mat&)
+ */
+ public static void convertScaleAbs(Mat src, Mat dst, double alpha, double beta) {
+ convertScaleAbs_0(src.nativeObj, dst.nativeObj, alpha, beta);
+ }
+
+ /**
+ * Scales, calculates absolute values, and converts the result to 8-bit.
+ *
+ * On each element of the input array, the function convertScaleAbs
+ * performs three operations sequentially: scaling, taking an absolute
+ * value, conversion to an unsigned 8-bit type:
+ * \(\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\)
+ * In case of multi-channel arrays, the function processes each channel
+ * independently. When the output is not 8-bit, the operation can be
+ * emulated by calling the Mat::convertTo method (or by using matrix
+ * expressions) and then by calculating an absolute value of the result.
+ * For example:
+ *
+ * Mat_<float> A(30,30);
+ * randu(A, Scalar(-100), Scalar(100));
+ * Mat_<float> B = A*5 + 3;
+ * B = abs(B);
+ * // Mat_<float> B = abs(A*5+3) will also do the job,
+ * // but it will allocate a temporary matrix
+ *
+ * @param src input array.
+ * @param dst output array.
+ * @param alpha optional scale factor.
+ * SEE: Mat::convertTo, cv::abs(const Mat&)
+ */
+ public static void convertScaleAbs(Mat src, Mat dst, double alpha) {
+ convertScaleAbs_1(src.nativeObj, dst.nativeObj, alpha);
+ }
+
+ /**
+ * Scales, calculates absolute values, and converts the result to 8-bit.
+ *
+ * On each element of the input array, the function convertScaleAbs
+ * performs three operations sequentially: scaling, taking an absolute
+ * value, conversion to an unsigned 8-bit type:
+ * \(\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\)
+ * In case of multi-channel arrays, the function processes each channel
+ * independently. When the output is not 8-bit, the operation can be
+ * emulated by calling the Mat::convertTo method (or by using matrix
+ * expressions) and then by calculating an absolute value of the result.
+ * For example:
+ *
+ * Mat_<float> A(30,30);
+ * randu(A, Scalar(-100), Scalar(100));
+ * Mat_<float> B = A*5 + 3;
+ * B = abs(B);
+ * // Mat_<float> B = abs(A*5+3) will also do the job,
+ * // but it will allocate a temporary matrix
+ *
+ * @param src input array.
+ * @param dst output array.
+ * SEE: Mat::convertTo, cv::abs(const Mat&)
+ */
+ public static void convertScaleAbs(Mat src, Mat dst) {
+ convertScaleAbs_2(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::convertFp16(Mat src, Mat& dst)
+ //
+
+ /**
+ * Converts an array to half precision floating number.
+ *
+ * This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data.
+ * There are two use modes (src -> dst): CV_32F -> CV_16S and CV_16S -> CV_32F. The input array has to have type of CV_32F or
+ * CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error.
+ * The format of half precision floating point is defined in IEEE 754-2008.
+ *
+ * @param src input array.
+ * @param dst output array.
+ */
+ public static void convertFp16(Mat src, Mat dst) {
+ convertFp16_0(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::LUT(Mat src, Mat lut, Mat& dst)
+ //
+
+ /**
+ * Performs a look-up table transform of an array.
+ *
+ * The function LUT fills the output array with values from the look-up table. Indices of the entries
+ * are taken from the input array. That is, the function processes each element of src as follows:
+ * \(\texttt{dst} (I) \leftarrow \texttt{lut(src(I) + d)}\)
+ * where
+ * \(d = \fork{0}{if \(\texttt{src}\) has depth \(\texttt{CV_8U}\)}{128}{if \(\texttt{src}\) has depth \(\texttt{CV_8S}\)}\)
+ * @param src input array of 8-bit elements.
+ * @param lut look-up table of 256 elements; in case of multi-channel input array, the table should
+ * either have a single channel (in this case the same table is used for all channels) or the same
+ * number of channels as in the input array.
+ * @param dst output array of the same size and number of channels as src, and the same depth as lut.
+ * SEE: convertScaleAbs, Mat::convertTo
+ */
+ public static void LUT(Mat src, Mat lut, Mat dst) {
+ LUT_0(src.nativeObj, lut.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: Scalar cv::sum(Mat src)
+ //
+
+ /**
+ * Calculates the sum of array elements.
+ *
+ * The function cv::sum calculates and returns the sum of array elements,
+ * independently for each channel.
+ * @param src input array that must have from 1 to 4 channels.
+ * SEE: countNonZero, mean, meanStdDev, norm, minMaxLoc, reduce
+ * @return automatically generated
+ */
+ public static Scalar sumElems(Mat src) {
+ return new Scalar(sumElems_0(src.nativeObj));
+ }
+
+
+ //
+ // C++: int cv::countNonZero(Mat src)
+ //
+
+ /**
+ * Counts non-zero array elements.
+ *
+ * The function returns the number of non-zero elements in src :
+ * \(\sum _{I: \; \texttt{src} (I) \ne0 } 1\)
+ * @param src single-channel array.
+ * SEE: mean, meanStdDev, norm, minMaxLoc, calcCovarMatrix
+ * @return automatically generated
+ */
+ public static int countNonZero(Mat src) {
+ return countNonZero_0(src.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::findNonZero(Mat src, Mat& idx)
+ //
+
+ /**
+ * Returns the list of locations of non-zero pixels
+ *
+ * Given a binary matrix (likely returned from an operation such
+ * as threshold(), compare(), >, ==, etc, return all of
+ * the non-zero indices as a cv::Mat or std::vector<cv::Point> (x,y)
+ * For example:
+ *
+ * cv::Mat binaryImage; // input, binary image
+ * cv::Mat locations; // output, locations of non-zero pixels
+ * cv::findNonZero(binaryImage, locations);
+ *
+ * // access pixel coordinates
+ * Point pnt = locations.at<Point>(i);
+ *
+ * or
+ *
+ * cv::Mat binaryImage; // input, binary image
+ * vector<Point> locations; // output, locations of non-zero pixels
+ * cv::findNonZero(binaryImage, locations);
+ *
+ * // access pixel coordinates
+ * Point pnt = locations[i];
+ *
+ * @param src single-channel array (type CV_8UC1)
+ * @param idx the output array, type of cv::Mat or std::vector<Point>, corresponding to non-zero indices in the input
+ */
+ public static void findNonZero(Mat src, Mat idx) {
+ findNonZero_0(src.nativeObj, idx.nativeObj);
+ }
+
+
+ //
+ // C++: Scalar cv::mean(Mat src, Mat mask = Mat())
+ //
+
+ /**
+ * Calculates an average (mean) of array elements.
+ *
+ * The function cv::mean calculates the mean value M of array elements,
+ * independently for each channel, and return it:
+ * \(\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}\)
+ * When all the mask elements are 0's, the function returns Scalar::all(0)
+ * @param src input array that should have from 1 to 4 channels so that the result can be stored in
+ * Scalar_ .
+ * @param mask optional operation mask.
+ * SEE: countNonZero, meanStdDev, norm, minMaxLoc
+ * @return automatically generated
+ */
+ public static Scalar mean(Mat src, Mat mask) {
+ return new Scalar(mean_0(src.nativeObj, mask.nativeObj));
+ }
+
+ /**
+ * Calculates an average (mean) of array elements.
+ *
+ * The function cv::mean calculates the mean value M of array elements,
+ * independently for each channel, and return it:
+ * \(\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}\)
+ * When all the mask elements are 0's, the function returns Scalar::all(0)
+ * @param src input array that should have from 1 to 4 channels so that the result can be stored in
+ * Scalar_ .
+ * SEE: countNonZero, meanStdDev, norm, minMaxLoc
+ * @return automatically generated
+ */
+ public static Scalar mean(Mat src) {
+ return new Scalar(mean_1(src.nativeObj));
+ }
+
+
+ //
+ // C++: void cv::meanStdDev(Mat src, vector_double& mean, vector_double& stddev, Mat mask = Mat())
+ //
+
+ /**
+ * Calculates a mean and standard deviation of array elements.
+ *
+ * The function cv::meanStdDev calculates the mean and the standard deviation M
+ * of array elements independently for each channel and returns it via the
+ * output parameters:
+ * \(\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}\)
+ * When all the mask elements are 0's, the function returns
+ * mean=stddev=Scalar::all(0).
+ * Note: The calculated standard deviation is only the diagonal of the
+ * complete normalized covariance matrix. If the full matrix is needed, you
+ * can reshape the multi-channel array M x N to the single-channel array
+ * M\*N x mtx.channels() (only possible when the matrix is continuous) and
+ * then pass the matrix to calcCovarMatrix .
+ * @param src input array that should have from 1 to 4 channels so that the results can be stored in
+ * Scalar_ 's.
+ * @param mean output parameter: calculated mean value.
+ * @param stddev output parameter: calculated standard deviation.
+ * @param mask optional operation mask.
+ * SEE: countNonZero, mean, norm, minMaxLoc, calcCovarMatrix
+ */
+ public static void meanStdDev(Mat src, MatOfDouble mean, MatOfDouble stddev, Mat mask) {
+ Mat mean_mat = mean;
+ Mat stddev_mat = stddev;
+ meanStdDev_0(src.nativeObj, mean_mat.nativeObj, stddev_mat.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * Calculates a mean and standard deviation of array elements.
+ *
+ * The function cv::meanStdDev calculates the mean and the standard deviation M
+ * of array elements independently for each channel and returns it via the
+ * output parameters:
+ * \(\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}\)
+ * When all the mask elements are 0's, the function returns
+ * mean=stddev=Scalar::all(0).
+ * Note: The calculated standard deviation is only the diagonal of the
+ * complete normalized covariance matrix. If the full matrix is needed, you
+ * can reshape the multi-channel array M x N to the single-channel array
+ * M\*N x mtx.channels() (only possible when the matrix is continuous) and
+ * then pass the matrix to calcCovarMatrix .
+ * @param src input array that should have from 1 to 4 channels so that the results can be stored in
+ * Scalar_ 's.
+ * @param mean output parameter: calculated mean value.
+ * @param stddev output parameter: calculated standard deviation.
+ * SEE: countNonZero, mean, norm, minMaxLoc, calcCovarMatrix
+ */
+ public static void meanStdDev(Mat src, MatOfDouble mean, MatOfDouble stddev) {
+ Mat mean_mat = mean;
+ Mat stddev_mat = stddev;
+ meanStdDev_1(src.nativeObj, mean_mat.nativeObj, stddev_mat.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::norm(Mat src1, int normType = NORM_L2, Mat mask = Mat())
+ //
+
+ /**
+ * Calculates the absolute norm of an array.
+ *
+ * This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes.
+ *
+ * As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\).
+ * The \( L_{1}, L_{2} \) and \( L_{\infty} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\)
+ * is calculated as follows
+ * \(align*}
+ * \| r(-1) \|_{L_1} &= |-1| + |2| = 3 \\
+ * \| r(-1) \|_{L_2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\
+ * \| r(-1) \|_{L_\infty} &= \max(|-1|,|2|) = 2
+ * \)
+ * and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
+ * \(align*}
+ * \| r(0.5) \|_{L_1} &= |0.5| + |0.5| = 1 \\
+ * \| r(0.5) \|_{L_2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\
+ * \| r(0.5) \|_{L_\infty} &= \max(|0.5|,|0.5|) = 0.5.
+ * \)
+ * The following graphic shows all values for the three norm functions \(\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\) and \(\| r(x) \|_{L_\infty}\).
+ * 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) \).
+ * ![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png)
+ *
+ * When the mask parameter is specified and it is not empty, the norm is
+ *
+ * If normType is not specified, #NORM_L2 is used.
+ * calculated only over the region specified by the mask.
+ *
+ * Multi-channel input arrays are treated as single-channel arrays, that is,
+ * the results for all channels are combined.
+ *
+ * Hamming norms can only be calculated with CV_8U depth arrays.
+ *
+ * @param src1 first input array.
+ * @param normType type of the norm (see #NormTypes).
+ * @param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type.
+ * @return automatically generated
+ */
+ public static double norm(Mat src1, int normType, Mat mask) {
+ return norm_0(src1.nativeObj, normType, mask.nativeObj);
+ }
+
+ /**
+ * Calculates the absolute norm of an array.
+ *
+ * This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes.
+ *
+ * As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\).
+ * The \( L_{1}, L_{2} \) and \( L_{\infty} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\)
+ * is calculated as follows
+ * \(align*}
+ * \| r(-1) \|_{L_1} &= |-1| + |2| = 3 \\
+ * \| r(-1) \|_{L_2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\
+ * \| r(-1) \|_{L_\infty} &= \max(|-1|,|2|) = 2
+ * \)
+ * and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
+ * \(align*}
+ * \| r(0.5) \|_{L_1} &= |0.5| + |0.5| = 1 \\
+ * \| r(0.5) \|_{L_2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\
+ * \| r(0.5) \|_{L_\infty} &= \max(|0.5|,|0.5|) = 0.5.
+ * \)
+ * The following graphic shows all values for the three norm functions \(\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\) and \(\| r(x) \|_{L_\infty}\).
+ * 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) \).
+ * ![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png)
+ *
+ * When the mask parameter is specified and it is not empty, the norm is
+ *
+ * If normType is not specified, #NORM_L2 is used.
+ * calculated only over the region specified by the mask.
+ *
+ * Multi-channel input arrays are treated as single-channel arrays, that is,
+ * the results for all channels are combined.
+ *
+ * Hamming norms can only be calculated with CV_8U depth arrays.
+ *
+ * @param src1 first input array.
+ * @param normType type of the norm (see #NormTypes).
+ * @return automatically generated
+ */
+ public static double norm(Mat src1, int normType) {
+ return norm_1(src1.nativeObj, normType);
+ }
+
+ /**
+ * Calculates the absolute norm of an array.
+ *
+ * This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes.
+ *
+ * As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\).
+ * The \( L_{1}, L_{2} \) and \( L_{\infty} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\)
+ * is calculated as follows
+ * \(align*}
+ * \| r(-1) \|_{L_1} &= |-1| + |2| = 3 \\
+ * \| r(-1) \|_{L_2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\
+ * \| r(-1) \|_{L_\infty} &= \max(|-1|,|2|) = 2
+ * \)
+ * and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
+ * \(align*}
+ * \| r(0.5) \|_{L_1} &= |0.5| + |0.5| = 1 \\
+ * \| r(0.5) \|_{L_2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\
+ * \| r(0.5) \|_{L_\infty} &= \max(|0.5|,|0.5|) = 0.5.
+ * \)
+ * The following graphic shows all values for the three norm functions \(\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\) and \(\| r(x) \|_{L_\infty}\).
+ * 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) \).
+ * ![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png)
+ *
+ * When the mask parameter is specified and it is not empty, the norm is
+ *
+ * If normType is not specified, #NORM_L2 is used.
+ * calculated only over the region specified by the mask.
+ *
+ * Multi-channel input arrays are treated as single-channel arrays, that is,
+ * the results for all channels are combined.
+ *
+ * Hamming norms can only be calculated with CV_8U depth arrays.
+ *
+ * @param src1 first input array.
+ * @return automatically generated
+ */
+ public static double norm(Mat src1) {
+ return norm_2(src1.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::norm(Mat src1, Mat src2, int normType = NORM_L2, Mat mask = Mat())
+ //
+
+ /**
+ * Calculates an absolute difference norm or a relative difference norm.
+ *
+ * This version of cv::norm calculates the absolute difference norm
+ * or the relative difference norm of arrays src1 and src2.
+ * The type of norm to calculate is specified using #NormTypes.
+ *
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and the same type as src1.
+ * @param normType type of the norm (see #NormTypes).
+ * @param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type.
+ * @return automatically generated
+ */
+ public static double norm(Mat src1, Mat src2, int normType, Mat mask) {
+ return norm_3(src1.nativeObj, src2.nativeObj, normType, mask.nativeObj);
+ }
+
+ /**
+ * Calculates an absolute difference norm or a relative difference norm.
+ *
+ * This version of cv::norm calculates the absolute difference norm
+ * or the relative difference norm of arrays src1 and src2.
+ * The type of norm to calculate is specified using #NormTypes.
+ *
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and the same type as src1.
+ * @param normType type of the norm (see #NormTypes).
+ * @return automatically generated
+ */
+ public static double norm(Mat src1, Mat src2, int normType) {
+ return norm_4(src1.nativeObj, src2.nativeObj, normType);
+ }
+
+ /**
+ * Calculates an absolute difference norm or a relative difference norm.
+ *
+ * This version of cv::norm calculates the absolute difference norm
+ * or the relative difference norm of arrays src1 and src2.
+ * The type of norm to calculate is specified using #NormTypes.
+ *
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and the same type as src1.
+ * @return automatically generated
+ */
+ public static double norm(Mat src1, Mat src2) {
+ return norm_5(src1.nativeObj, src2.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::PSNR(Mat src1, Mat src2)
+ //
+
+ /**
+ * Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric.
+ *
+ * This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB), between two input arrays src1 and src2. Arrays must have depth CV_8U.
+ *
+ * The PSNR is calculated as follows:
+ *
+ * \(
+ * \texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) }
+ * \)
+ *
+ * where R is the maximum integer value of depth CV_8U (255) and MSE is the mean squared error between the two arrays.
+ *
+ * @param src1 first input array.
+ * @param src2 second input array of the same size as src1.
+ * @return automatically generated
+ */
+ public static double PSNR(Mat src1, Mat src2) {
+ return PSNR_0(src1.nativeObj, src2.nativeObj);
+ }
+
+
+ //
+ // 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)
+ //
+
+ /**
+ * naive nearest neighbor finder
+ *
+ * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
+ * TODO: document
+ * @param src1 automatically generated
+ * @param src2 automatically generated
+ * @param dist automatically generated
+ * @param dtype automatically generated
+ * @param nidx automatically generated
+ * @param normType automatically generated
+ * @param K automatically generated
+ * @param mask automatically generated
+ * @param update automatically generated
+ * @param crosscheck automatically generated
+ */
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask, int update, boolean crosscheck) {
+ batchDistance_0(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj, update, crosscheck);
+ }
+
+ /**
+ * naive nearest neighbor finder
+ *
+ * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
+ * TODO: document
+ * @param src1 automatically generated
+ * @param src2 automatically generated
+ * @param dist automatically generated
+ * @param dtype automatically generated
+ * @param nidx automatically generated
+ * @param normType automatically generated
+ * @param K automatically generated
+ * @param mask automatically generated
+ * @param update automatically generated
+ */
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask, int update) {
+ batchDistance_1(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj, update);
+ }
+
+ /**
+ * naive nearest neighbor finder
+ *
+ * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
+ * TODO: document
+ * @param src1 automatically generated
+ * @param src2 automatically generated
+ * @param dist automatically generated
+ * @param dtype automatically generated
+ * @param nidx automatically generated
+ * @param normType automatically generated
+ * @param K automatically generated
+ * @param mask automatically generated
+ */
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask) {
+ batchDistance_2(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj);
+ }
+
+ /**
+ * naive nearest neighbor finder
+ *
+ * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
+ * TODO: document
+ * @param src1 automatically generated
+ * @param src2 automatically generated
+ * @param dist automatically generated
+ * @param dtype automatically generated
+ * @param nidx automatically generated
+ * @param normType automatically generated
+ * @param K automatically generated
+ */
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K) {
+ batchDistance_3(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K);
+ }
+
+ /**
+ * naive nearest neighbor finder
+ *
+ * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
+ * TODO: document
+ * @param src1 automatically generated
+ * @param src2 automatically generated
+ * @param dist automatically generated
+ * @param dtype automatically generated
+ * @param nidx automatically generated
+ * @param normType automatically generated
+ */
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType) {
+ batchDistance_4(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType);
+ }
+
+ /**
+ * naive nearest neighbor finder
+ *
+ * see http://en.wikipedia.org/wiki/Nearest_neighbor_search
+ * TODO: document
+ * @param src1 automatically generated
+ * @param src2 automatically generated
+ * @param dist automatically generated
+ * @param dtype automatically generated
+ * @param nidx automatically generated
+ */
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx) {
+ batchDistance_5(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj);
+ }
+
+
+ //
+ // 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())
+ //
+
+ /**
+ * Normalizes the norm or value range of an array.
+ *
+ * The function cv::normalize normalizes scale and shift the input array elements so that
+ * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
+ * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
+ * \(\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\)
+ *
+ * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
+ * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
+ * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
+ * min-max but modify the whole array, you can use norm and Mat::convertTo.
+ *
+ * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
+ * the range transformation for sparse matrices is not allowed since it can shift the zero level.
+ *
+ * Possible usage with some positive example data:
+ *
+ * vector<double> positiveData = { 2.0, 8.0, 10.0 };
+ * vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
+ *
+ * // Norm to probability (total count)
+ * // sum(numbers) = 20.0
+ * // 2.0 0.1 (2.0/20.0)
+ * // 8.0 0.4 (8.0/20.0)
+ * // 10.0 0.5 (10.0/20.0)
+ * normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
+ *
+ * // Norm to unit vector: ||positiveData|| = 1.0
+ * // 2.0 0.15
+ * // 8.0 0.62
+ * // 10.0 0.77
+ * normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
+ *
+ * // Norm to max element
+ * // 2.0 0.2 (2.0/10.0)
+ * // 8.0 0.8 (8.0/10.0)
+ * // 10.0 1.0 (10.0/10.0)
+ * normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
+ *
+ * // Norm to range [0.0;1.0]
+ * // 2.0 0.0 (shift to left border)
+ * // 8.0 0.75 (6.0/8.0)
+ * // 10.0 1.0 (shift to right border)
+ * normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
+ *
+ *
+ * @param src input array.
+ * @param dst output array of the same size as src .
+ * @param alpha norm value to normalize to or the lower range boundary in case of the range
+ * normalization.
+ * @param beta upper range boundary in case of the range normalization; it is not used for the norm
+ * normalization.
+ * @param norm_type normalization type (see cv::NormTypes).
+ * @param dtype when negative, the output array has the same type as src; otherwise, it has the same
+ * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
+ * @param mask optional operation mask.
+ * SEE: norm, Mat::convertTo, SparseMat::convertTo
+ */
+ public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type, int dtype, Mat mask) {
+ normalize_0(src.nativeObj, dst.nativeObj, alpha, beta, norm_type, dtype, mask.nativeObj);
+ }
+
+ /**
+ * Normalizes the norm or value range of an array.
+ *
+ * The function cv::normalize normalizes scale and shift the input array elements so that
+ * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
+ * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
+ * \(\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\)
+ *
+ * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
+ * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
+ * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
+ * min-max but modify the whole array, you can use norm and Mat::convertTo.
+ *
+ * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
+ * the range transformation for sparse matrices is not allowed since it can shift the zero level.
+ *
+ * Possible usage with some positive example data:
+ *
+ * vector<double> positiveData = { 2.0, 8.0, 10.0 };
+ * vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
+ *
+ * // Norm to probability (total count)
+ * // sum(numbers) = 20.0
+ * // 2.0 0.1 (2.0/20.0)
+ * // 8.0 0.4 (8.0/20.0)
+ * // 10.0 0.5 (10.0/20.0)
+ * normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
+ *
+ * // Norm to unit vector: ||positiveData|| = 1.0
+ * // 2.0 0.15
+ * // 8.0 0.62
+ * // 10.0 0.77
+ * normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
+ *
+ * // Norm to max element
+ * // 2.0 0.2 (2.0/10.0)
+ * // 8.0 0.8 (8.0/10.0)
+ * // 10.0 1.0 (10.0/10.0)
+ * normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
+ *
+ * // Norm to range [0.0;1.0]
+ * // 2.0 0.0 (shift to left border)
+ * // 8.0 0.75 (6.0/8.0)
+ * // 10.0 1.0 (shift to right border)
+ * normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
+ *
+ *
+ * @param src input array.
+ * @param dst output array of the same size as src .
+ * @param alpha norm value to normalize to or the lower range boundary in case of the range
+ * normalization.
+ * @param beta upper range boundary in case of the range normalization; it is not used for the norm
+ * normalization.
+ * @param norm_type normalization type (see cv::NormTypes).
+ * @param dtype when negative, the output array has the same type as src; otherwise, it has the same
+ * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
+ * SEE: norm, Mat::convertTo, SparseMat::convertTo
+ */
+ public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type, int dtype) {
+ normalize_1(src.nativeObj, dst.nativeObj, alpha, beta, norm_type, dtype);
+ }
+
+ /**
+ * Normalizes the norm or value range of an array.
+ *
+ * The function cv::normalize normalizes scale and shift the input array elements so that
+ * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
+ * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
+ * \(\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\)
+ *
+ * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
+ * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
+ * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
+ * min-max but modify the whole array, you can use norm and Mat::convertTo.
+ *
+ * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
+ * the range transformation for sparse matrices is not allowed since it can shift the zero level.
+ *
+ * Possible usage with some positive example data:
+ *
+ * vector<double> positiveData = { 2.0, 8.0, 10.0 };
+ * vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
+ *
+ * // Norm to probability (total count)
+ * // sum(numbers) = 20.0
+ * // 2.0 0.1 (2.0/20.0)
+ * // 8.0 0.4 (8.0/20.0)
+ * // 10.0 0.5 (10.0/20.0)
+ * normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
+ *
+ * // Norm to unit vector: ||positiveData|| = 1.0
+ * // 2.0 0.15
+ * // 8.0 0.62
+ * // 10.0 0.77
+ * normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
+ *
+ * // Norm to max element
+ * // 2.0 0.2 (2.0/10.0)
+ * // 8.0 0.8 (8.0/10.0)
+ * // 10.0 1.0 (10.0/10.0)
+ * normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
+ *
+ * // Norm to range [0.0;1.0]
+ * // 2.0 0.0 (shift to left border)
+ * // 8.0 0.75 (6.0/8.0)
+ * // 10.0 1.0 (shift to right border)
+ * normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
+ *
+ *
+ * @param src input array.
+ * @param dst output array of the same size as src .
+ * @param alpha norm value to normalize to or the lower range boundary in case of the range
+ * normalization.
+ * @param beta upper range boundary in case of the range normalization; it is not used for the norm
+ * normalization.
+ * @param norm_type normalization type (see cv::NormTypes).
+ * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
+ * SEE: norm, Mat::convertTo, SparseMat::convertTo
+ */
+ public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type) {
+ normalize_2(src.nativeObj, dst.nativeObj, alpha, beta, norm_type);
+ }
+
+ /**
+ * Normalizes the norm or value range of an array.
+ *
+ * The function cv::normalize normalizes scale and shift the input array elements so that
+ * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
+ * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
+ * \(\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\)
+ *
+ * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
+ * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
+ * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
+ * min-max but modify the whole array, you can use norm and Mat::convertTo.
+ *
+ * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
+ * the range transformation for sparse matrices is not allowed since it can shift the zero level.
+ *
+ * Possible usage with some positive example data:
+ *
+ * vector<double> positiveData = { 2.0, 8.0, 10.0 };
+ * vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
+ *
+ * // Norm to probability (total count)
+ * // sum(numbers) = 20.0
+ * // 2.0 0.1 (2.0/20.0)
+ * // 8.0 0.4 (8.0/20.0)
+ * // 10.0 0.5 (10.0/20.0)
+ * normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
+ *
+ * // Norm to unit vector: ||positiveData|| = 1.0
+ * // 2.0 0.15
+ * // 8.0 0.62
+ * // 10.0 0.77
+ * normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
+ *
+ * // Norm to max element
+ * // 2.0 0.2 (2.0/10.0)
+ * // 8.0 0.8 (8.0/10.0)
+ * // 10.0 1.0 (10.0/10.0)
+ * normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
+ *
+ * // Norm to range [0.0;1.0]
+ * // 2.0 0.0 (shift to left border)
+ * // 8.0 0.75 (6.0/8.0)
+ * // 10.0 1.0 (shift to right border)
+ * normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
+ *
+ *
+ * @param src input array.
+ * @param dst output array of the same size as src .
+ * @param alpha norm value to normalize to or the lower range boundary in case of the range
+ * normalization.
+ * @param beta upper range boundary in case of the range normalization; it is not used for the norm
+ * normalization.
+ * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
+ * SEE: norm, Mat::convertTo, SparseMat::convertTo
+ */
+ public static void normalize(Mat src, Mat dst, double alpha, double beta) {
+ normalize_3(src.nativeObj, dst.nativeObj, alpha, beta);
+ }
+
+ /**
+ * Normalizes the norm or value range of an array.
+ *
+ * The function cv::normalize normalizes scale and shift the input array elements so that
+ * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
+ * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
+ * \(\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\)
+ *
+ * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
+ * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
+ * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
+ * min-max but modify the whole array, you can use norm and Mat::convertTo.
+ *
+ * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
+ * the range transformation for sparse matrices is not allowed since it can shift the zero level.
+ *
+ * Possible usage with some positive example data:
+ *
+ * vector<double> positiveData = { 2.0, 8.0, 10.0 };
+ * vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
+ *
+ * // Norm to probability (total count)
+ * // sum(numbers) = 20.0
+ * // 2.0 0.1 (2.0/20.0)
+ * // 8.0 0.4 (8.0/20.0)
+ * // 10.0 0.5 (10.0/20.0)
+ * normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
+ *
+ * // Norm to unit vector: ||positiveData|| = 1.0
+ * // 2.0 0.15
+ * // 8.0 0.62
+ * // 10.0 0.77
+ * normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
+ *
+ * // Norm to max element
+ * // 2.0 0.2 (2.0/10.0)
+ * // 8.0 0.8 (8.0/10.0)
+ * // 10.0 1.0 (10.0/10.0)
+ * normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
+ *
+ * // Norm to range [0.0;1.0]
+ * // 2.0 0.0 (shift to left border)
+ * // 8.0 0.75 (6.0/8.0)
+ * // 10.0 1.0 (shift to right border)
+ * normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
+ *
+ *
+ * @param src input array.
+ * @param dst output array of the same size as src .
+ * @param alpha norm value to normalize to or the lower range boundary in case of the range
+ * normalization.
+ * normalization.
+ * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
+ * SEE: norm, Mat::convertTo, SparseMat::convertTo
+ */
+ public static void normalize(Mat src, Mat dst, double alpha) {
+ normalize_4(src.nativeObj, dst.nativeObj, alpha);
+ }
+
+ /**
+ * Normalizes the norm or value range of an array.
+ *
+ * The function cv::normalize normalizes scale and shift the input array elements so that
+ * \(\| \texttt{dst} \| _{L_p}= \texttt{alpha}\)
+ * (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
+ * \(\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\)
+ *
+ * when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
+ * normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
+ * sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
+ * min-max but modify the whole array, you can use norm and Mat::convertTo.
+ *
+ * In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
+ * the range transformation for sparse matrices is not allowed since it can shift the zero level.
+ *
+ * Possible usage with some positive example data:
+ *
+ * vector<double> positiveData = { 2.0, 8.0, 10.0 };
+ * vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
+ *
+ * // Norm to probability (total count)
+ * // sum(numbers) = 20.0
+ * // 2.0 0.1 (2.0/20.0)
+ * // 8.0 0.4 (8.0/20.0)
+ * // 10.0 0.5 (10.0/20.0)
+ * normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
+ *
+ * // Norm to unit vector: ||positiveData|| = 1.0
+ * // 2.0 0.15
+ * // 8.0 0.62
+ * // 10.0 0.77
+ * normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
+ *
+ * // Norm to max element
+ * // 2.0 0.2 (2.0/10.0)
+ * // 8.0 0.8 (8.0/10.0)
+ * // 10.0 1.0 (10.0/10.0)
+ * normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
+ *
+ * // Norm to range [0.0;1.0]
+ * // 2.0 0.0 (shift to left border)
+ * // 8.0 0.75 (6.0/8.0)
+ * // 10.0 1.0 (shift to right border)
+ * normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
+ *
+ *
+ * @param src input array.
+ * @param dst output array of the same size as src .
+ * normalization.
+ * normalization.
+ * number of channels as src and the depth =CV_MAT_DEPTH(dtype).
+ * SEE: norm, Mat::convertTo, SparseMat::convertTo
+ */
+ public static void normalize(Mat src, Mat dst) {
+ normalize_5(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::reduce(Mat src, Mat& dst, int dim, int rtype, int dtype = -1)
+ //
+
+ /**
+ * Reduces a matrix to a vector.
+ *
+ * The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of
+ * 1D vectors and performing the specified operation on the vectors until a single row/column is
+ * obtained. For example, the function can be used to compute horizontal and vertical projections of a
+ * raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one.
+ * In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy.
+ * And multi-channel arrays are also supported in these two reduction modes.
+ *
+ * The following code demonstrates its usage for a single channel matrix.
+ * SNIPPET: snippets/core_reduce.cpp example
+ *
+ * And the following code demonstrates its usage for a two-channel matrix.
+ * SNIPPET: snippets/core_reduce.cpp example2
+ *
+ * @param src input 2D matrix.
+ * @param dst output vector. Its size and type is defined by dim and dtype parameters.
+ * @param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to
+ * a single row. 1 means that the matrix is reduced to a single column.
+ * @param rtype reduction operation that could be one of #ReduceTypes
+ * @param dtype when negative, the output vector will have the same type as the input matrix,
+ * otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).
+ * SEE: repeat
+ */
+ public static void reduce(Mat src, Mat dst, int dim, int rtype, int dtype) {
+ reduce_0(src.nativeObj, dst.nativeObj, dim, rtype, dtype);
+ }
+
+ /**
+ * Reduces a matrix to a vector.
+ *
+ * The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of
+ * 1D vectors and performing the specified operation on the vectors until a single row/column is
+ * obtained. For example, the function can be used to compute horizontal and vertical projections of a
+ * raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one.
+ * In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy.
+ * And multi-channel arrays are also supported in these two reduction modes.
+ *
+ * The following code demonstrates its usage for a single channel matrix.
+ * SNIPPET: snippets/core_reduce.cpp example
+ *
+ * And the following code demonstrates its usage for a two-channel matrix.
+ * SNIPPET: snippets/core_reduce.cpp example2
+ *
+ * @param src input 2D matrix.
+ * @param dst output vector. Its size and type is defined by dim and dtype parameters.
+ * @param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to
+ * a single row. 1 means that the matrix is reduced to a single column.
+ * @param rtype reduction operation that could be one of #ReduceTypes
+ * otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).
+ * SEE: repeat
+ */
+ public static void reduce(Mat src, Mat dst, int dim, int rtype) {
+ reduce_1(src.nativeObj, dst.nativeObj, dim, rtype);
+ }
+
+
+ //
+ // C++: void cv::merge(vector_Mat mv, Mat& dst)
+ //
+
+ /**
+ *
+ * @param mv input vector of matrices to be merged; all the matrices in mv must have the same
+ * size and the same depth.
+ * @param dst output array of the same size and the same depth as mv[0]; The number of channels will
+ * be the total number of channels in the matrix array.
+ */
+ public static void merge(List mv, Mat dst) {
+ Mat mv_mat = Converters.vector_Mat_to_Mat(mv);
+ merge_0(mv_mat.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::split(Mat m, vector_Mat& mv)
+ //
+
+ /**
+ *
+ * @param m input multi-channel array.
+ * @param mv output vector of arrays; the arrays themselves are reallocated, if needed.
+ */
+ public static void split(Mat m, List mv) {
+ Mat mv_mat = new Mat();
+ split_0(m.nativeObj, mv_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(mv_mat, mv);
+ mv_mat.release();
+ }
+
+
+ //
+ // C++: void cv::mixChannels(vector_Mat src, vector_Mat dst, vector_int fromTo)
+ //
+
+ /**
+ *
+ * @param src input array or vector of matrices; all of the matrices must have the same size and the
+ * same depth.
+ * @param dst output array or vector of matrices; all the matrices must be allocated; their size and
+ * depth must be the same as in src[0].
+ * @param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is
+ * a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
+ * dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
+ * src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
+ * src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
+ * channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
+ * filled with zero .
+ */
+ public static void mixChannels(List src, List dst, MatOfInt fromTo) {
+ Mat src_mat = Converters.vector_Mat_to_Mat(src);
+ Mat dst_mat = Converters.vector_Mat_to_Mat(dst);
+ Mat fromTo_mat = fromTo;
+ mixChannels_0(src_mat.nativeObj, dst_mat.nativeObj, fromTo_mat.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::extractChannel(Mat src, Mat& dst, int coi)
+ //
+
+ /**
+ * Extracts a single channel from src (coi is 0-based index)
+ * @param src input array
+ * @param dst output array
+ * @param coi index of channel to extract
+ * SEE: mixChannels, split
+ */
+ public static void extractChannel(Mat src, Mat dst, int coi) {
+ extractChannel_0(src.nativeObj, dst.nativeObj, coi);
+ }
+
+
+ //
+ // C++: void cv::insertChannel(Mat src, Mat& dst, int coi)
+ //
+
+ /**
+ * Inserts a single channel to dst (coi is 0-based index)
+ * @param src input array
+ * @param dst output array
+ * @param coi index of channel for insertion
+ * SEE: mixChannels, merge
+ */
+ public static void insertChannel(Mat src, Mat dst, int coi) {
+ insertChannel_0(src.nativeObj, dst.nativeObj, coi);
+ }
+
+
+ //
+ // C++: void cv::flip(Mat src, Mat& dst, int flipCode)
+ //
+
+ /**
+ * Flips a 2D array around vertical, horizontal, or both axes.
+ *
+ * The function cv::flip flips the array in one of three different ways (row
+ * and column indices are 0-based):
+ * \(\texttt{dst} _{ij} =
+ * \left\{
+ * \begin{array}{l l}
+ * \texttt{src} _{\texttt{src.rows}-i-1,j} & if\; \texttt{flipCode} = 0 \\
+ * \texttt{src} _{i, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} > 0 \\
+ * \texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\
+ * \end{array}
+ * \right.\)
+ * The example scenarios of using the function are the following:
+ * Vertical flipping of the image (flipCode == 0) to switch between
+ * top-left and bottom-left image origin. This is a typical operation
+ * in video processing on Microsoft Windows\* OS.
+ * Horizontal flipping of the image with the subsequent horizontal
+ * shift and absolute difference calculation to check for a
+ * vertical-axis symmetry (flipCode > 0).
+ * Simultaneous horizontal and vertical flipping of the image with
+ * the subsequent shift and absolute difference calculation to check
+ * for a central symmetry (flipCode < 0).
+ * Reversing the order of point arrays (flipCode > 0 or
+ * flipCode == 0).
+ * @param src input array.
+ * @param dst output array of the same size and type as src.
+ * @param flipCode a flag to specify how to flip the array; 0 means
+ * flipping around the x-axis and positive value (for example, 1) means
+ * flipping around y-axis. Negative value (for example, -1) means flipping
+ * around both axes.
+ * SEE: transpose , repeat , completeSymm
+ */
+ public static void flip(Mat src, Mat dst, int flipCode) {
+ flip_0(src.nativeObj, dst.nativeObj, flipCode);
+ }
+
+
+ //
+ // C++: void cv::rotate(Mat src, Mat& dst, int rotateCode)
+ //
+
+ /**
+ * Rotates a 2D array in multiples of 90 degrees.
+ * The function cv::rotate rotates the array in one of three different ways:
+ * Rotate by 90 degrees clockwise (rotateCode = ROTATE_90_CLOCKWISE).
+ * Rotate by 180 degrees clockwise (rotateCode = ROTATE_180).
+ * Rotate by 270 degrees clockwise (rotateCode = ROTATE_90_COUNTERCLOCKWISE).
+ * @param src input array.
+ * @param dst output array of the same type as src. The size is the same with ROTATE_180,
+ * and the rows and cols are switched for ROTATE_90_CLOCKWISE and ROTATE_90_COUNTERCLOCKWISE.
+ * @param rotateCode an enum to specify how to rotate the array; see the enum #RotateFlags
+ * SEE: transpose , repeat , completeSymm, flip, RotateFlags
+ */
+ public static void rotate(Mat src, Mat dst, int rotateCode) {
+ rotate_0(src.nativeObj, dst.nativeObj, rotateCode);
+ }
+
+
+ //
+ // C++: void cv::repeat(Mat src, int ny, int nx, Mat& dst)
+ //
+
+ /**
+ * Fills the output array with repeated copies of the input array.
+ *
+ * The function cv::repeat duplicates the input array one or more times along each of the two axes:
+ * \(\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }\)
+ * The second variant of the function is more convenient to use with REF: MatrixExpressions.
+ * @param src input array to replicate.
+ * @param ny Flag to specify how many times the {@code src} is repeated along the
+ * vertical axis.
+ * @param nx Flag to specify how many times the {@code src} is repeated along the
+ * horizontal axis.
+ * @param dst output array of the same type as {@code src}.
+ * SEE: cv::reduce
+ */
+ public static void repeat(Mat src, int ny, int nx, Mat dst) {
+ repeat_0(src.nativeObj, ny, nx, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::hconcat(vector_Mat src, Mat& dst)
+ //
+
+ /**
+ *
+ *
+ * std::vector<cv::Mat> matrices = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
+ * cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
+ * cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
+ *
+ * cv::Mat out;
+ * cv::hconcat( matrices, out );
+ * //out:
+ * //[1, 2, 3;
+ * // 1, 2, 3;
+ * // 1, 2, 3;
+ * // 1, 2, 3]
+ *
+ * @param src input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.
+ * @param dst output array. It has the same number of rows and depth as the src, and the sum of cols of the src.
+ * same depth.
+ */
+ public static void hconcat(List src, Mat dst) {
+ Mat src_mat = Converters.vector_Mat_to_Mat(src);
+ hconcat_0(src_mat.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::vconcat(vector_Mat src, Mat& dst)
+ //
+
+ /**
+ *
+ *
+ * std::vector<cv::Mat> matrices = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)),
+ * cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)),
+ * cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),};
+ *
+ * cv::Mat out;
+ * cv::vconcat( matrices, out );
+ * //out:
+ * //[1, 1, 1, 1;
+ * // 2, 2, 2, 2;
+ * // 3, 3, 3, 3]
+ *
+ * @param src input array or vector of matrices. all of the matrices must have the same number of cols and the same depth
+ * @param dst output array. It has the same number of cols and depth as the src, and the sum of rows of the src.
+ * same depth.
+ */
+ public static void vconcat(List src, Mat dst) {
+ Mat src_mat = Converters.vector_Mat_to_Mat(src);
+ vconcat_0(src_mat.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::bitwise_and(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ //
+
+ /**
+ * computes bitwise conjunction of the two arrays (dst = src1 & src2)
+ * Calculates the per-element bit-wise conjunction of two arrays or an
+ * array and a scalar.
+ *
+ * The function cv::bitwise_and calculates the per-element bit-wise logical conjunction for:
+ * Two arrays when src1 and src2 have the same size:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * An array and a scalar when src2 is constructed from Scalar or has
+ * the same number of elements as {@code src1.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \wedge \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
+ * A scalar and an array when src1 is constructed from Scalar or has
+ * the same number of elements as {@code src2.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * In case of floating-point arrays, their machine-specific bit
+ * representations (usually IEEE754-compliant) are used for the operation.
+ * In case of multi-channel arrays, each channel is processed
+ * independently. In the second and third cases above, the scalar is first
+ * converted to the array type.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and type as the input
+ * arrays.
+ * @param mask optional operation mask, 8-bit single channel array, that
+ * specifies elements of the output array to be changed.
+ */
+ public static void bitwise_and(Mat src1, Mat src2, Mat dst, Mat mask) {
+ bitwise_and_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * computes bitwise conjunction of the two arrays (dst = src1 & src2)
+ * Calculates the per-element bit-wise conjunction of two arrays or an
+ * array and a scalar.
+ *
+ * The function cv::bitwise_and calculates the per-element bit-wise logical conjunction for:
+ * Two arrays when src1 and src2 have the same size:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * An array and a scalar when src2 is constructed from Scalar or has
+ * the same number of elements as {@code src1.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \wedge \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
+ * A scalar and an array when src1 is constructed from Scalar or has
+ * the same number of elements as {@code src2.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * In case of floating-point arrays, their machine-specific bit
+ * representations (usually IEEE754-compliant) are used for the operation.
+ * In case of multi-channel arrays, each channel is processed
+ * independently. In the second and third cases above, the scalar is first
+ * converted to the array type.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and type as the input
+ * arrays.
+ * specifies elements of the output array to be changed.
+ */
+ public static void bitwise_and(Mat src1, Mat src2, Mat dst) {
+ bitwise_and_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::bitwise_or(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ //
+
+ /**
+ * Calculates the per-element bit-wise disjunction of two arrays or an
+ * array and a scalar.
+ *
+ * The function cv::bitwise_or calculates the per-element bit-wise logical disjunction for:
+ * Two arrays when src1 and src2 have the same size:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * An array and a scalar when src2 is constructed from Scalar or has
+ * the same number of elements as {@code src1.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \vee \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
+ * A scalar and an array when src1 is constructed from Scalar or has
+ * the same number of elements as {@code src2.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * In case of floating-point arrays, their machine-specific bit
+ * representations (usually IEEE754-compliant) are used for the operation.
+ * In case of multi-channel arrays, each channel is processed
+ * independently. In the second and third cases above, the scalar is first
+ * converted to the array type.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and type as the input
+ * arrays.
+ * @param mask optional operation mask, 8-bit single channel array, that
+ * specifies elements of the output array to be changed.
+ */
+ public static void bitwise_or(Mat src1, Mat src2, Mat dst, Mat mask) {
+ bitwise_or_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * Calculates the per-element bit-wise disjunction of two arrays or an
+ * array and a scalar.
+ *
+ * The function cv::bitwise_or calculates the per-element bit-wise logical disjunction for:
+ * Two arrays when src1 and src2 have the same size:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * An array and a scalar when src2 is constructed from Scalar or has
+ * the same number of elements as {@code src1.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \vee \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
+ * A scalar and an array when src1 is constructed from Scalar or has
+ * the same number of elements as {@code src2.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * In case of floating-point arrays, their machine-specific bit
+ * representations (usually IEEE754-compliant) are used for the operation.
+ * In case of multi-channel arrays, each channel is processed
+ * independently. In the second and third cases above, the scalar is first
+ * converted to the array type.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and type as the input
+ * arrays.
+ * specifies elements of the output array to be changed.
+ */
+ public static void bitwise_or(Mat src1, Mat src2, Mat dst) {
+ bitwise_or_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::bitwise_xor(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ //
+
+ /**
+ * Calculates the per-element bit-wise "exclusive or" operation on two
+ * arrays or an array and a scalar.
+ *
+ * The function cv::bitwise_xor calculates the per-element bit-wise logical "exclusive-or"
+ * operation for:
+ * Two arrays when src1 and src2 have the same size:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * An array and a scalar when src2 is constructed from Scalar or has
+ * the same number of elements as {@code src1.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \oplus \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
+ * A scalar and an array when src1 is constructed from Scalar or has
+ * the same number of elements as {@code src2.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * In case of floating-point arrays, their machine-specific bit
+ * representations (usually IEEE754-compliant) are used for the operation.
+ * In case of multi-channel arrays, each channel is processed
+ * independently. In the 2nd and 3rd cases above, the scalar is first
+ * converted to the array type.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and type as the input
+ * arrays.
+ * @param mask optional operation mask, 8-bit single channel array, that
+ * specifies elements of the output array to be changed.
+ */
+ public static void bitwise_xor(Mat src1, Mat src2, Mat dst, Mat mask) {
+ bitwise_xor_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * Calculates the per-element bit-wise "exclusive or" operation on two
+ * arrays or an array and a scalar.
+ *
+ * The function cv::bitwise_xor calculates the per-element bit-wise logical "exclusive-or"
+ * operation for:
+ * Two arrays when src1 and src2 have the same size:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * An array and a scalar when src2 is constructed from Scalar or has
+ * the same number of elements as {@code src1.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \oplus \texttt{src2} \quad \texttt{if mask} (I) \ne0\)
+ * A scalar and an array when src1 is constructed from Scalar or has
+ * the same number of elements as {@code src2.channels()}:
+ * \(\texttt{dst} (I) = \texttt{src1} \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\)
+ * In case of floating-point arrays, their machine-specific bit
+ * representations (usually IEEE754-compliant) are used for the operation.
+ * In case of multi-channel arrays, each channel is processed
+ * independently. In the 2nd and 3rd cases above, the scalar is first
+ * converted to the array type.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and type as the input
+ * arrays.
+ * specifies elements of the output array to be changed.
+ */
+ public static void bitwise_xor(Mat src1, Mat src2, Mat dst) {
+ bitwise_xor_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::bitwise_not(Mat src, Mat& dst, Mat mask = Mat())
+ //
+
+ /**
+ * Inverts every bit of an array.
+ *
+ * The function cv::bitwise_not calculates per-element bit-wise inversion of the input
+ * array:
+ * \(\texttt{dst} (I) = \neg \texttt{src} (I)\)
+ * In case of a floating-point input array, its machine-specific bit
+ * representation (usually IEEE754-compliant) is used for the operation. In
+ * case of multi-channel arrays, each channel is processed independently.
+ * @param src input array.
+ * @param dst output array that has the same size and type as the input
+ * array.
+ * @param mask optional operation mask, 8-bit single channel array, that
+ * specifies elements of the output array to be changed.
+ */
+ public static void bitwise_not(Mat src, Mat dst, Mat mask) {
+ bitwise_not_0(src.nativeObj, dst.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * Inverts every bit of an array.
+ *
+ * The function cv::bitwise_not calculates per-element bit-wise inversion of the input
+ * array:
+ * \(\texttt{dst} (I) = \neg \texttt{src} (I)\)
+ * In case of a floating-point input array, its machine-specific bit
+ * representation (usually IEEE754-compliant) is used for the operation. In
+ * case of multi-channel arrays, each channel is processed independently.
+ * @param src input array.
+ * @param dst output array that has the same size and type as the input
+ * array.
+ * specifies elements of the output array to be changed.
+ */
+ public static void bitwise_not(Mat src, Mat dst) {
+ bitwise_not_1(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::absdiff(Mat src1, Mat src2, Mat& dst)
+ //
+
+ /**
+ * Calculates the per-element absolute difference between two arrays or between an array and a scalar.
+ *
+ * The function cv::absdiff calculates:
+ * Absolute difference between two arrays when they have the same
+ * size and type:
+ * \(\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2}(I)|)\)
+ * Absolute difference between an array and a scalar when the second
+ * array is constructed from Scalar or has as many elements as the
+ * number of channels in {@code src1}:
+ * \(\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2} |)\)
+ * Absolute difference between a scalar and an array when the first
+ * array is constructed from Scalar or has as many elements as the
+ * number of channels in {@code src2}:
+ * \(\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1} - \texttt{src2}(I) |)\)
+ * where I is a multi-dimensional index of array elements. In case of
+ * multi-channel arrays, each channel is processed independently.
+ * Note: Saturation is not applied when the arrays have the depth CV_32S.
+ * You may even get a negative value in the case of overflow.
+ * @param src1 first input array or a scalar.
+ * @param src2 second input array or a scalar.
+ * @param dst output array that has the same size and type as input arrays.
+ * SEE: cv::abs(const Mat&)
+ */
+ public static void absdiff(Mat src1, Mat src2, Mat dst) {
+ absdiff_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::inRange(Mat src, Scalar lowerb, Scalar upperb, Mat& dst)
+ //
+
+ /**
+ * Checks if array elements lie between the elements of two other arrays.
+ *
+ * The function checks the range as follows:
+ *
+ * -
+ * For every element of a single-channel input array:
+ * \(\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0\)
+ *
+ * -
+ * For two-channel arrays:
+ * \(\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\)
+ *
+ * -
+ * and so forth.
+ *
+ *
+ *
+ * That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the
+ * specified 1D, 2D, 3D, ... box and 0 otherwise.
+ *
+ * When the lower and/or upper boundary parameters are scalars, the indexes
+ * (I) at lowerb and upperb in the above formulas should be omitted.
+ * @param src first input array.
+ * @param lowerb inclusive lower boundary array or a scalar.
+ * @param upperb inclusive upper boundary array or a scalar.
+ * @param dst output array of the same size as src and CV_8U type.
+ */
+ public static void inRange(Mat src, Scalar lowerb, Scalar upperb, Mat dst) {
+ 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);
+ }
+
+
+ //
+ // C++: void cv::compare(Mat src1, Mat src2, Mat& dst, int cmpop)
+ //
+
+ /**
+ * Performs the per-element comparison of two arrays or an array and scalar value.
+ *
+ * The function compares:
+ * Elements of two arrays when src1 and src2 have the same size:
+ * \(\texttt{dst} (I) = \texttt{src1} (I) \,\texttt{cmpop}\, \texttt{src2} (I)\)
+ * Elements of src1 with a scalar src2 when src2 is constructed from
+ * Scalar or has a single element:
+ * \(\texttt{dst} (I) = \texttt{src1}(I) \,\texttt{cmpop}\, \texttt{src2}\)
+ * src1 with elements of src2 when src1 is constructed from Scalar or
+ * has a single element:
+ * \(\texttt{dst} (I) = \texttt{src1} \,\texttt{cmpop}\, \texttt{src2} (I)\)
+ * When the comparison result is true, the corresponding element of output
+ * array is set to 255. The comparison operations can be replaced with the
+ * equivalent matrix expressions:
+ *
+ * Mat dst1 = src1 >= src2;
+ * Mat dst2 = src1 < 8;
+ * ...
+ *
+ * @param src1 first input array or a scalar; when it is an array, it must have a single channel.
+ * @param src2 second input array or a scalar; when it is an array, it must have a single channel.
+ * @param dst output array of type ref CV_8U that has the same size and the same number of channels as
+ * the input arrays.
+ * @param cmpop a flag, that specifies correspondence between the arrays (cv::CmpTypes)
+ * SEE: checkRange, min, max, threshold
+ */
+ public static void compare(Mat src1, Mat src2, Mat dst, int cmpop) {
+ compare_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, cmpop);
+ }
+
+
+ //
+ // C++: void cv::min(Mat src1, Mat src2, Mat& dst)
+ //
+
+ /**
+ * Calculates per-element minimum of two arrays or an array and a scalar.
+ *
+ * The function cv::min calculates the per-element minimum of two arrays:
+ * \(\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\)
+ * or array and a scalar:
+ * \(\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\)
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and type as src1.
+ * @param dst output array of the same size and type as src1.
+ * SEE: max, compare, inRange, minMaxLoc
+ */
+ public static void min(Mat src1, Mat src2, Mat dst) {
+ min_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::max(Mat src1, Mat src2, Mat& dst)
+ //
+
+ /**
+ * Calculates per-element maximum of two arrays or an array and a scalar.
+ *
+ * The function cv::max calculates the per-element maximum of two arrays:
+ * \(\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\)
+ * or array and a scalar:
+ * \(\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\)
+ * @param src1 first input array.
+ * @param src2 second input array of the same size and type as src1 .
+ * @param dst output array of the same size and type as src1.
+ * SEE: min, compare, inRange, minMaxLoc, REF: MatrixExpressions
+ */
+ public static void max(Mat src1, Mat src2, Mat dst) {
+ max_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::sqrt(Mat src, Mat& dst)
+ //
+
+ /**
+ * Calculates a square root of array elements.
+ *
+ * The function cv::sqrt calculates a square root of each input array element.
+ * In case of multi-channel arrays, each channel is processed
+ * independently. The accuracy is approximately the same as of the built-in
+ * std::sqrt .
+ * @param src input floating-point array.
+ * @param dst output array of the same size and type as src.
+ */
+ public static void sqrt(Mat src, Mat dst) {
+ sqrt_0(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::pow(Mat src, double power, Mat& dst)
+ //
+
+ /**
+ * Raises every array element to a power.
+ *
+ * The function cv::pow raises every element of the input array to power :
+ * \(\texttt{dst} (I) = \fork{\texttt{src}(I)^{power}}{if \(\texttt{power}\) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\)
+ *
+ * So, for a non-integer power exponent, the absolute values of input array
+ * elements are used. However, it is possible to get true values for
+ * negative values using some extra operations. In the example below,
+ * computing the 5th root of array src shows:
+ *
+ * Mat mask = src < 0;
+ * pow(src, 1./5, dst);
+ * subtract(Scalar::all(0), dst, dst, mask);
+ *
+ * For some values of power, such as integer values, 0.5 and -0.5,
+ * specialized faster algorithms are used.
+ *
+ * Special values (NaN, Inf) are not handled.
+ * @param src input array.
+ * @param power exponent of power.
+ * @param dst output array of the same size and type as src.
+ * SEE: sqrt, exp, log, cartToPolar, polarToCart
+ */
+ public static void pow(Mat src, double power, Mat dst) {
+ pow_0(src.nativeObj, power, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::exp(Mat src, Mat& dst)
+ //
+
+ /**
+ * Calculates the exponent of every array element.
+ *
+ * The function cv::exp calculates the exponent of every element of the input
+ * array:
+ * \(\texttt{dst} [I] = e^{ src(I) }\)
+ *
+ * The maximum relative error is about 7e-6 for single-precision input and
+ * less than 1e-10 for double-precision input. Currently, the function
+ * converts denormalized values to zeros on output. Special values (NaN,
+ * Inf) are not handled.
+ * @param src input array.
+ * @param dst output array of the same size and type as src.
+ * SEE: log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude
+ */
+ public static void exp(Mat src, Mat dst) {
+ exp_0(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::log(Mat src, Mat& dst)
+ //
+
+ /**
+ * Calculates the natural logarithm of every array element.
+ *
+ * The function cv::log calculates the natural logarithm of every element of the input array:
+ * \(\texttt{dst} (I) = \log (\texttt{src}(I)) \)
+ *
+ * Output on zero, negative and special (NaN, Inf) values is undefined.
+ *
+ * @param src input array.
+ * @param dst output array of the same size and type as src .
+ * SEE: exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude
+ */
+ public static void log(Mat src, Mat dst) {
+ log_0(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::polarToCart(Mat magnitude, Mat angle, Mat& x, Mat& y, bool angleInDegrees = false)
+ //
+
+ /**
+ * Calculates x and y coordinates of 2D vectors from their magnitude and angle.
+ *
+ * The function cv::polarToCart calculates the Cartesian coordinates of each 2D
+ * vector represented by the corresponding elements of magnitude and angle:
+ * \(\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}\)
+ *
+ * The relative accuracy of the estimated coordinates is about 1e-6.
+ * @param magnitude input floating-point array of magnitudes of 2D vectors;
+ * it can be an empty matrix (=Mat()), in this case, the function assumes
+ * that all the magnitudes are =1; if it is not empty, it must have the
+ * same size and type as angle.
+ * @param angle input floating-point array of angles of 2D vectors.
+ * @param x output array of x-coordinates of 2D vectors; it has the same
+ * size and type as angle.
+ * @param y output array of y-coordinates of 2D vectors; it has the same
+ * size and type as angle.
+ * @param angleInDegrees when true, the input angles are measured in
+ * degrees, otherwise, they are measured in radians.
+ * SEE: cartToPolar, magnitude, phase, exp, log, pow, sqrt
+ */
+ public static void polarToCart(Mat magnitude, Mat angle, Mat x, Mat y, boolean angleInDegrees) {
+ polarToCart_0(magnitude.nativeObj, angle.nativeObj, x.nativeObj, y.nativeObj, angleInDegrees);
+ }
+
+ /**
+ * Calculates x and y coordinates of 2D vectors from their magnitude and angle.
+ *
+ * The function cv::polarToCart calculates the Cartesian coordinates of each 2D
+ * vector represented by the corresponding elements of magnitude and angle:
+ * \(\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}\)
+ *
+ * The relative accuracy of the estimated coordinates is about 1e-6.
+ * @param magnitude input floating-point array of magnitudes of 2D vectors;
+ * it can be an empty matrix (=Mat()), in this case, the function assumes
+ * that all the magnitudes are =1; if it is not empty, it must have the
+ * same size and type as angle.
+ * @param angle input floating-point array of angles of 2D vectors.
+ * @param x output array of x-coordinates of 2D vectors; it has the same
+ * size and type as angle.
+ * @param y output array of y-coordinates of 2D vectors; it has the same
+ * size and type as angle.
+ * degrees, otherwise, they are measured in radians.
+ * SEE: cartToPolar, magnitude, phase, exp, log, pow, sqrt
+ */
+ public static void polarToCart(Mat magnitude, Mat angle, Mat x, Mat y) {
+ polarToCart_1(magnitude.nativeObj, angle.nativeObj, x.nativeObj, y.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::cartToPolar(Mat x, Mat y, Mat& magnitude, Mat& angle, bool angleInDegrees = false)
+ //
+
+ /**
+ * Calculates the magnitude and angle of 2D vectors.
+ *
+ * The function cv::cartToPolar calculates either the magnitude, angle, or both
+ * for every 2D vector (x(I),y(I)):
+ * \(\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}\)
+ *
+ * The angles are calculated with accuracy about 0.3 degrees. For the point
+ * (0,0), the angle is set to 0.
+ * @param x array of x-coordinates; this must be a single-precision or
+ * double-precision floating-point array.
+ * @param y array of y-coordinates, that must have the same size and same type as x.
+ * @param magnitude output array of magnitudes of the same size and type as x.
+ * @param angle output array of angles that has the same size and type as
+ * x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees).
+ * @param angleInDegrees a flag, indicating whether the angles are measured
+ * in radians (which is by default), or in degrees.
+ * SEE: Sobel, Scharr
+ */
+ public static void cartToPolar(Mat x, Mat y, Mat magnitude, Mat angle, boolean angleInDegrees) {
+ cartToPolar_0(x.nativeObj, y.nativeObj, magnitude.nativeObj, angle.nativeObj, angleInDegrees);
+ }
+
+ /**
+ * Calculates the magnitude and angle of 2D vectors.
+ *
+ * The function cv::cartToPolar calculates either the magnitude, angle, or both
+ * for every 2D vector (x(I),y(I)):
+ * \(\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}\)
+ *
+ * The angles are calculated with accuracy about 0.3 degrees. For the point
+ * (0,0), the angle is set to 0.
+ * @param x array of x-coordinates; this must be a single-precision or
+ * double-precision floating-point array.
+ * @param y array of y-coordinates, that must have the same size and same type as x.
+ * @param magnitude output array of magnitudes of the same size and type as x.
+ * @param angle output array of angles that has the same size and type as
+ * x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees).
+ * in radians (which is by default), or in degrees.
+ * SEE: Sobel, Scharr
+ */
+ public static void cartToPolar(Mat x, Mat y, Mat magnitude, Mat angle) {
+ cartToPolar_1(x.nativeObj, y.nativeObj, magnitude.nativeObj, angle.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::phase(Mat x, Mat y, Mat& angle, bool angleInDegrees = false)
+ //
+
+ /**
+ * Calculates the rotation angle of 2D vectors.
+ *
+ * The function cv::phase calculates the rotation angle of each 2D vector that
+ * is formed from the corresponding elements of x and y :
+ * \(\texttt{angle} (I) = \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\)
+ *
+ * The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 ,
+ * the corresponding angle(I) is set to 0.
+ * @param x input floating-point array of x-coordinates of 2D vectors.
+ * @param y input array of y-coordinates of 2D vectors; it must have the
+ * same size and the same type as x.
+ * @param angle output array of vector angles; it has the same size and
+ * same type as x .
+ * @param angleInDegrees when true, the function calculates the angle in
+ * degrees, otherwise, they are measured in radians.
+ */
+ public static void phase(Mat x, Mat y, Mat angle, boolean angleInDegrees) {
+ phase_0(x.nativeObj, y.nativeObj, angle.nativeObj, angleInDegrees);
+ }
+
+ /**
+ * Calculates the rotation angle of 2D vectors.
+ *
+ * The function cv::phase calculates the rotation angle of each 2D vector that
+ * is formed from the corresponding elements of x and y :
+ * \(\texttt{angle} (I) = \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\)
+ *
+ * The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 ,
+ * the corresponding angle(I) is set to 0.
+ * @param x input floating-point array of x-coordinates of 2D vectors.
+ * @param y input array of y-coordinates of 2D vectors; it must have the
+ * same size and the same type as x.
+ * @param angle output array of vector angles; it has the same size and
+ * same type as x .
+ * degrees, otherwise, they are measured in radians.
+ */
+ public static void phase(Mat x, Mat y, Mat angle) {
+ phase_1(x.nativeObj, y.nativeObj, angle.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::magnitude(Mat x, Mat y, Mat& magnitude)
+ //
+
+ /**
+ * Calculates the magnitude of 2D vectors.
+ *
+ * The function cv::magnitude calculates the magnitude of 2D vectors formed
+ * from the corresponding elements of x and y arrays:
+ * \(\texttt{dst} (I) = \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\)
+ * @param x floating-point array of x-coordinates of the vectors.
+ * @param y floating-point array of y-coordinates of the vectors; it must
+ * have the same size as x.
+ * @param magnitude output array of the same size and type as x.
+ * SEE: cartToPolar, polarToCart, phase, sqrt
+ */
+ public static void magnitude(Mat x, Mat y, Mat magnitude) {
+ magnitude_0(x.nativeObj, y.nativeObj, magnitude.nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::checkRange(Mat a, bool quiet = true, _hidden_ * pos = 0, double minVal = -DBL_MAX, double maxVal = DBL_MAX)
+ //
+
+ /**
+ * Checks every element of an input array for invalid values.
+ *
+ * The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal >
+ *
+ * -
+ * DBL_MAX and maxVal < DBL_MAX, the function also checks that each value is between minVal and
+ * maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
+ * are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
+ * function either returns false (when quiet=true) or throws an exception.
+ * @param a input array.
+ * @param quiet a flag, indicating whether the functions quietly return false when the array elements
+ * are out of range or they throw an exception.
+ * elements.
+ * @param minVal inclusive lower boundary of valid values range.
+ * @param maxVal exclusive upper boundary of valid values range.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean checkRange(Mat a, boolean quiet, double minVal, double maxVal) {
+ return checkRange_0(a.nativeObj, quiet, minVal, maxVal);
+ }
+
+ /**
+ * Checks every element of an input array for invalid values.
+ *
+ * The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal >
+ *
+ * -
+ * DBL_MAX and maxVal < DBL_MAX, the function also checks that each value is between minVal and
+ * maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
+ * are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
+ * function either returns false (when quiet=true) or throws an exception.
+ * @param a input array.
+ * @param quiet a flag, indicating whether the functions quietly return false when the array elements
+ * are out of range or they throw an exception.
+ * elements.
+ * @param minVal inclusive lower boundary of valid values range.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean checkRange(Mat a, boolean quiet, double minVal) {
+ return checkRange_1(a.nativeObj, quiet, minVal);
+ }
+
+ /**
+ * Checks every element of an input array for invalid values.
+ *
+ * The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal >
+ *
+ * -
+ * DBL_MAX and maxVal < DBL_MAX, the function also checks that each value is between minVal and
+ * maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
+ * are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
+ * function either returns false (when quiet=true) or throws an exception.
+ * @param a input array.
+ * @param quiet a flag, indicating whether the functions quietly return false when the array elements
+ * are out of range or they throw an exception.
+ * elements.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean checkRange(Mat a, boolean quiet) {
+ return checkRange_2(a.nativeObj, quiet);
+ }
+
+ /**
+ * Checks every element of an input array for invalid values.
+ *
+ * The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal >
+ *
+ * -
+ * DBL_MAX and maxVal < DBL_MAX, the function also checks that each value is between minVal and
+ * maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
+ * are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
+ * function either returns false (when quiet=true) or throws an exception.
+ * @param a input array.
+ * are out of range or they throw an exception.
+ * elements.
+ *
+ *
+ * @return automatically generated
+ */
+ public static boolean checkRange(Mat a) {
+ return checkRange_4(a.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::patchNaNs(Mat& a, double val = 0)
+ //
+
+ /**
+ * converts NaNs to the given number
+ * @param a input/output matrix (CV_32F type).
+ * @param val value to convert the NaNs
+ */
+ public static void patchNaNs(Mat a, double val) {
+ patchNaNs_0(a.nativeObj, val);
+ }
+
+ /**
+ * converts NaNs to the given number
+ * @param a input/output matrix (CV_32F type).
+ */
+ public static void patchNaNs(Mat a) {
+ patchNaNs_1(a.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat& dst, int flags = 0)
+ //
+
+ /**
+ * Performs generalized matrix multiplication.
+ *
+ * The function cv::gemm performs generalized matrix multiplication similar to the
+ * gemm functions in BLAS level 3. For example,
+ * {@code gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)}
+ * corresponds to
+ * \(\texttt{dst} = \texttt{alpha} \cdot \texttt{src1} ^T \cdot \texttt{src2} + \texttt{beta} \cdot \texttt{src3} ^T\)
+ *
+ * In case of complex (two-channel) data, performed a complex matrix
+ * multiplication.
+ *
+ * The function can be replaced with a matrix expression. For example, the
+ * above call can be replaced with:
+ *
+ * dst = alpha*src1.t()*src2 + beta*src3.t();
+ *
+ * @param src1 first multiplied input matrix that could be real(CV_32FC1,
+ * CV_64FC1) or complex(CV_32FC2, CV_64FC2).
+ * @param src2 second multiplied input matrix of the same type as src1.
+ * @param alpha weight of the matrix product.
+ * @param src3 third optional delta matrix added to the matrix product; it
+ * should have the same type as src1 and src2.
+ * @param beta weight of src3.
+ * @param dst output matrix; it has the proper size and the same type as
+ * input matrices.
+ * @param flags operation flags (cv::GemmFlags)
+ * SEE: mulTransposed , transform
+ */
+ public static void gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst, int flags) {
+ gemm_0(src1.nativeObj, src2.nativeObj, alpha, src3.nativeObj, beta, dst.nativeObj, flags);
+ }
+
+ /**
+ * Performs generalized matrix multiplication.
+ *
+ * The function cv::gemm performs generalized matrix multiplication similar to the
+ * gemm functions in BLAS level 3. For example,
+ * {@code gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)}
+ * corresponds to
+ * \(\texttt{dst} = \texttt{alpha} \cdot \texttt{src1} ^T \cdot \texttt{src2} + \texttt{beta} \cdot \texttt{src3} ^T\)
+ *
+ * In case of complex (two-channel) data, performed a complex matrix
+ * multiplication.
+ *
+ * The function can be replaced with a matrix expression. For example, the
+ * above call can be replaced with:
+ *
+ * dst = alpha*src1.t()*src2 + beta*src3.t();
+ *
+ * @param src1 first multiplied input matrix that could be real(CV_32FC1,
+ * CV_64FC1) or complex(CV_32FC2, CV_64FC2).
+ * @param src2 second multiplied input matrix of the same type as src1.
+ * @param alpha weight of the matrix product.
+ * @param src3 third optional delta matrix added to the matrix product; it
+ * should have the same type as src1 and src2.
+ * @param beta weight of src3.
+ * @param dst output matrix; it has the proper size and the same type as
+ * input matrices.
+ * SEE: mulTransposed , transform
+ */
+ public static void gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst) {
+ gemm_1(src1.nativeObj, src2.nativeObj, alpha, src3.nativeObj, beta, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::mulTransposed(Mat src, Mat& dst, bool aTa, Mat delta = Mat(), double scale = 1, int dtype = -1)
+ //
+
+ /**
+ * Calculates the product of a matrix and its transposition.
+ *
+ * The function cv::mulTransposed calculates the product of src and its
+ * transposition:
+ * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\)
+ * if aTa=true , and
+ * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\)
+ * otherwise. The function is used to calculate the covariance matrix. With
+ * zero delta, it can be used as a faster substitute for general matrix
+ * product A\*B when B=A'
+ * @param src input single-channel matrix. Note that unlike gemm, the
+ * function can multiply not only floating-point matrices.
+ * @param dst output square matrix.
+ * @param aTa Flag specifying the multiplication ordering. See the
+ * description below.
+ * @param delta Optional delta matrix subtracted from src before the
+ * multiplication. When the matrix is empty ( delta=noArray() ), it is
+ * assumed to be zero, that is, nothing is subtracted. If it has the same
+ * size as src , it is simply subtracted. Otherwise, it is "repeated" (see
+ * repeat ) to cover the full src and then subtracted. Type of the delta
+ * matrix, when it is not empty, must be the same as the type of created
+ * output matrix. See the dtype parameter description below.
+ * @param scale Optional scale factor for the matrix product.
+ * @param dtype Optional type of the output matrix. When it is negative,
+ * the output matrix will have the same type as src . Otherwise, it will be
+ * type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
+ * SEE: calcCovarMatrix, gemm, repeat, reduce
+ */
+ public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta, double scale, int dtype) {
+ mulTransposed_0(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj, scale, dtype);
+ }
+
+ /**
+ * Calculates the product of a matrix and its transposition.
+ *
+ * The function cv::mulTransposed calculates the product of src and its
+ * transposition:
+ * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\)
+ * if aTa=true , and
+ * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\)
+ * otherwise. The function is used to calculate the covariance matrix. With
+ * zero delta, it can be used as a faster substitute for general matrix
+ * product A\*B when B=A'
+ * @param src input single-channel matrix. Note that unlike gemm, the
+ * function can multiply not only floating-point matrices.
+ * @param dst output square matrix.
+ * @param aTa Flag specifying the multiplication ordering. See the
+ * description below.
+ * @param delta Optional delta matrix subtracted from src before the
+ * multiplication. When the matrix is empty ( delta=noArray() ), it is
+ * assumed to be zero, that is, nothing is subtracted. If it has the same
+ * size as src , it is simply subtracted. Otherwise, it is "repeated" (see
+ * repeat ) to cover the full src and then subtracted. Type of the delta
+ * matrix, when it is not empty, must be the same as the type of created
+ * output matrix. See the dtype parameter description below.
+ * @param scale Optional scale factor for the matrix product.
+ * the output matrix will have the same type as src . Otherwise, it will be
+ * type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
+ * SEE: calcCovarMatrix, gemm, repeat, reduce
+ */
+ public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta, double scale) {
+ mulTransposed_1(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj, scale);
+ }
+
+ /**
+ * Calculates the product of a matrix and its transposition.
+ *
+ * The function cv::mulTransposed calculates the product of src and its
+ * transposition:
+ * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\)
+ * if aTa=true , and
+ * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\)
+ * otherwise. The function is used to calculate the covariance matrix. With
+ * zero delta, it can be used as a faster substitute for general matrix
+ * product A\*B when B=A'
+ * @param src input single-channel matrix. Note that unlike gemm, the
+ * function can multiply not only floating-point matrices.
+ * @param dst output square matrix.
+ * @param aTa Flag specifying the multiplication ordering. See the
+ * description below.
+ * @param delta Optional delta matrix subtracted from src before the
+ * multiplication. When the matrix is empty ( delta=noArray() ), it is
+ * assumed to be zero, that is, nothing is subtracted. If it has the same
+ * size as src , it is simply subtracted. Otherwise, it is "repeated" (see
+ * repeat ) to cover the full src and then subtracted. Type of the delta
+ * matrix, when it is not empty, must be the same as the type of created
+ * output matrix. See the dtype parameter description below.
+ * the output matrix will have the same type as src . Otherwise, it will be
+ * type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
+ * SEE: calcCovarMatrix, gemm, repeat, reduce
+ */
+ public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta) {
+ mulTransposed_2(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj);
+ }
+
+ /**
+ * Calculates the product of a matrix and its transposition.
+ *
+ * The function cv::mulTransposed calculates the product of src and its
+ * transposition:
+ * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\)
+ * if aTa=true , and
+ * \(\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\)
+ * otherwise. The function is used to calculate the covariance matrix. With
+ * zero delta, it can be used as a faster substitute for general matrix
+ * product A\*B when B=A'
+ * @param src input single-channel matrix. Note that unlike gemm, the
+ * function can multiply not only floating-point matrices.
+ * @param dst output square matrix.
+ * @param aTa Flag specifying the multiplication ordering. See the
+ * description below.
+ * multiplication. When the matrix is empty ( delta=noArray() ), it is
+ * assumed to be zero, that is, nothing is subtracted. If it has the same
+ * size as src , it is simply subtracted. Otherwise, it is "repeated" (see
+ * repeat ) to cover the full src and then subtracted. Type of the delta
+ * matrix, when it is not empty, must be the same as the type of created
+ * output matrix. See the dtype parameter description below.
+ * the output matrix will have the same type as src . Otherwise, it will be
+ * type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
+ * SEE: calcCovarMatrix, gemm, repeat, reduce
+ */
+ public static void mulTransposed(Mat src, Mat dst, boolean aTa) {
+ mulTransposed_3(src.nativeObj, dst.nativeObj, aTa);
+ }
+
+
+ //
+ // C++: void cv::transpose(Mat src, Mat& dst)
+ //
+
+ /**
+ * Transposes a matrix.
+ *
+ * The function cv::transpose transposes the matrix src :
+ * \(\texttt{dst} (i,j) = \texttt{src} (j,i)\)
+ * Note: No complex conjugation is done in case of a complex matrix. It
+ * should be done separately if needed.
+ * @param src input array.
+ * @param dst output array of the same type as src.
+ */
+ public static void transpose(Mat src, Mat dst) {
+ transpose_0(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::transform(Mat src, Mat& dst, Mat m)
+ //
+
+ /**
+ * Performs the matrix transformation of every array element.
+ *
+ * The function cv::transform performs the matrix transformation of every
+ * element of the array src and stores the results in dst :
+ * \(\texttt{dst} (I) = \texttt{m} \cdot \texttt{src} (I)\)
+ * (when m.cols=src.channels() ), or
+ * \(\texttt{dst} (I) = \texttt{m} \cdot [ \texttt{src} (I); 1]\)
+ * (when m.cols=src.channels()+1 )
+ *
+ * Every element of the N -channel array src is interpreted as N -element
+ * vector that is transformed using the M x N or M x (N+1) matrix m to
+ * M-element vector - the corresponding element of the output array dst .
+ *
+ * The function may be used for geometrical transformation of
+ * N -dimensional points, arbitrary linear color space transformation (such
+ * as various kinds of RGB to YUV transforms), shuffling the image
+ * channels, and so forth.
+ * @param src input array that must have as many channels (1 to 4) as
+ * m.cols or m.cols-1.
+ * @param dst output array of the same size and depth as src; it has as
+ * many channels as m.rows.
+ * @param m transformation 2x2 or 2x3 floating-point matrix.
+ * SEE: perspectiveTransform, getAffineTransform, estimateAffine2D, warpAffine, warpPerspective
+ */
+ public static void transform(Mat src, Mat dst, Mat m) {
+ transform_0(src.nativeObj, dst.nativeObj, m.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::perspectiveTransform(Mat src, Mat& dst, Mat m)
+ //
+
+ /**
+ * Performs the perspective matrix transformation of vectors.
+ *
+ * The function cv::perspectiveTransform transforms every element of src by
+ * treating it as a 2D or 3D vector, in the following way:
+ * \((x, y, z) \rightarrow (x'/w, y'/w, z'/w)\)
+ * where
+ * \((x', y', z', w') = \texttt{mat} \cdot \begin{bmatrix} x & y & z & 1 \end{bmatrix}\)
+ * and
+ * \(w = \fork{w'}{if \(w' \ne 0\)}{\infty}{otherwise}\)
+ *
+ * Here a 3D vector transformation is shown. In case of a 2D vector
+ * transformation, the z component is omitted.
+ *
+ * Note: The function transforms a sparse set of 2D or 3D vectors. If you
+ * want to transform an image using perspective transformation, use
+ * warpPerspective . If you have an inverse problem, that is, you want to
+ * compute the most probable perspective transformation out of several
+ * pairs of corresponding points, you can use getPerspectiveTransform or
+ * findHomography .
+ * @param src input two-channel or three-channel floating-point array; each
+ * element is a 2D/3D vector to be transformed.
+ * @param dst output array of the same size and type as src.
+ * @param m 3x3 or 4x4 floating-point transformation matrix.
+ * SEE: transform, warpPerspective, getPerspectiveTransform, findHomography
+ */
+ public static void perspectiveTransform(Mat src, Mat dst, Mat m) {
+ perspectiveTransform_0(src.nativeObj, dst.nativeObj, m.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::completeSymm(Mat& m, bool lowerToUpper = false)
+ //
+
+ /**
+ * Copies the lower or the upper half of a square matrix to its another half.
+ *
+ * The function cv::completeSymm copies the lower or the upper half of a square matrix to
+ * its another half. The matrix diagonal remains unchanged:
+ *
+ * -
+ * \(\texttt{m}_{ij}=\texttt{m}_{ji}\) for \(i > j\) if
+ * lowerToUpper=false
+ *
+ * -
+ * \(\texttt{m}_{ij}=\texttt{m}_{ji}\) for \(i < j\) if
+ * lowerToUpper=true
+ *
+ *
+ *
+ * @param m input-output floating-point square matrix.
+ * @param lowerToUpper operation flag; if true, the lower half is copied to
+ * the upper half. Otherwise, the upper half is copied to the lower half.
+ * SEE: flip, transpose
+ */
+ public static void completeSymm(Mat m, boolean lowerToUpper) {
+ completeSymm_0(m.nativeObj, lowerToUpper);
+ }
+
+ /**
+ * Copies the lower or the upper half of a square matrix to its another half.
+ *
+ * The function cv::completeSymm copies the lower or the upper half of a square matrix to
+ * its another half. The matrix diagonal remains unchanged:
+ *
+ * -
+ * \(\texttt{m}_{ij}=\texttt{m}_{ji}\) for \(i > j\) if
+ * lowerToUpper=false
+ *
+ * -
+ * \(\texttt{m}_{ij}=\texttt{m}_{ji}\) for \(i < j\) if
+ * lowerToUpper=true
+ *
+ *
+ *
+ * @param m input-output floating-point square matrix.
+ * the upper half. Otherwise, the upper half is copied to the lower half.
+ * SEE: flip, transpose
+ */
+ public static void completeSymm(Mat m) {
+ completeSymm_1(m.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::setIdentity(Mat& mtx, Scalar s = Scalar(1))
+ //
+
+ /**
+ * Initializes a scaled identity matrix.
+ *
+ * The function cv::setIdentity initializes a scaled identity matrix:
+ * \(\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if \(i=j\)}{0}{otherwise}\)
+ *
+ * The function can also be emulated using the matrix initializers and the
+ * matrix expressions:
+ *
+ * Mat A = Mat::eye(4, 3, CV_32F)*5;
+ * // A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]
+ *
+ * @param mtx matrix to initialize (not necessarily square).
+ * @param s value to assign to diagonal elements.
+ * SEE: Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=
+ */
+ public static void setIdentity(Mat mtx, Scalar s) {
+ setIdentity_0(mtx.nativeObj, s.val[0], s.val[1], s.val[2], s.val[3]);
+ }
+
+ /**
+ * Initializes a scaled identity matrix.
+ *
+ * The function cv::setIdentity initializes a scaled identity matrix:
+ * \(\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if \(i=j\)}{0}{otherwise}\)
+ *
+ * The function can also be emulated using the matrix initializers and the
+ * matrix expressions:
+ *
+ * Mat A = Mat::eye(4, 3, CV_32F)*5;
+ * // A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]
+ *
+ * @param mtx matrix to initialize (not necessarily square).
+ * SEE: Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=
+ */
+ public static void setIdentity(Mat mtx) {
+ setIdentity_1(mtx.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::determinant(Mat mtx)
+ //
+
+ /**
+ * Returns the determinant of a square floating-point matrix.
+ *
+ * The function cv::determinant calculates and returns the determinant of the
+ * specified matrix. For small matrices ( mtx.cols=mtx.rows<=3 ), the
+ * direct method is used. For larger matrices, the function uses LU
+ * factorization with partial pivoting.
+ *
+ * For symmetric positively-determined matrices, it is also possible to use
+ * eigen decomposition to calculate the determinant.
+ * @param mtx input matrix that must have CV_32FC1 or CV_64FC1 type and
+ * square size.
+ * SEE: trace, invert, solve, eigen, REF: MatrixExpressions
+ * @return automatically generated
+ */
+ public static double determinant(Mat mtx) {
+ return determinant_0(mtx.nativeObj);
+ }
+
+
+ //
+ // C++: Scalar cv::trace(Mat mtx)
+ //
+
+ /**
+ * Returns the trace of a matrix.
+ *
+ * The function cv::trace returns the sum of the diagonal elements of the
+ * matrix mtx .
+ * \(\mathrm{tr} ( \texttt{mtx} ) = \sum _i \texttt{mtx} (i,i)\)
+ * @param mtx input matrix.
+ * @return automatically generated
+ */
+ public static Scalar trace(Mat mtx) {
+ return new Scalar(trace_0(mtx.nativeObj));
+ }
+
+
+ //
+ // C++: double cv::invert(Mat src, Mat& dst, int flags = DECOMP_LU)
+ //
+
+ /**
+ * Finds the inverse or pseudo-inverse of a matrix.
+ *
+ * The function cv::invert inverts the matrix src and stores the result in dst
+ * . When the matrix src is singular or non-square, the function calculates
+ * the pseudo-inverse matrix (the dst matrix) so that norm(src\*dst - I) is
+ * minimal, where I is an identity matrix.
+ *
+ * In case of the #DECOMP_LU method, the function returns non-zero value if
+ * the inverse has been successfully calculated and 0 if src is singular.
+ *
+ * In case of the #DECOMP_SVD method, the function returns the inverse
+ * condition number of src (the ratio of the smallest singular value to the
+ * largest singular value) and 0 if src is singular. The SVD method
+ * calculates a pseudo-inverse matrix if src is singular.
+ *
+ * Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with
+ * non-singular square matrices that should also be symmetrical and
+ * positively defined. In this case, the function stores the inverted
+ * matrix in dst and returns non-zero. Otherwise, it returns 0.
+ *
+ * @param src input floating-point M x N matrix.
+ * @param dst output matrix of N x M size and the same type as src.
+ * @param flags inversion method (cv::DecompTypes)
+ * SEE: solve, SVD
+ * @return automatically generated
+ */
+ public static double invert(Mat src, Mat dst, int flags) {
+ return invert_0(src.nativeObj, dst.nativeObj, flags);
+ }
+
+ /**
+ * Finds the inverse or pseudo-inverse of a matrix.
+ *
+ * The function cv::invert inverts the matrix src and stores the result in dst
+ * . When the matrix src is singular or non-square, the function calculates
+ * the pseudo-inverse matrix (the dst matrix) so that norm(src\*dst - I) is
+ * minimal, where I is an identity matrix.
+ *
+ * In case of the #DECOMP_LU method, the function returns non-zero value if
+ * the inverse has been successfully calculated and 0 if src is singular.
+ *
+ * In case of the #DECOMP_SVD method, the function returns the inverse
+ * condition number of src (the ratio of the smallest singular value to the
+ * largest singular value) and 0 if src is singular. The SVD method
+ * calculates a pseudo-inverse matrix if src is singular.
+ *
+ * Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with
+ * non-singular square matrices that should also be symmetrical and
+ * positively defined. In this case, the function stores the inverted
+ * matrix in dst and returns non-zero. Otherwise, it returns 0.
+ *
+ * @param src input floating-point M x N matrix.
+ * @param dst output matrix of N x M size and the same type as src.
+ * SEE: solve, SVD
+ * @return automatically generated
+ */
+ public static double invert(Mat src, Mat dst) {
+ return invert_1(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::solve(Mat src1, Mat src2, Mat& dst, int flags = DECOMP_LU)
+ //
+
+ /**
+ * Solves one or more linear systems or least-squares problems.
+ *
+ * The function cv::solve solves a linear system or least-squares problem (the
+ * latter is possible with SVD or QR methods, or by specifying the flag
+ * #DECOMP_NORMAL ):
+ * \(\texttt{dst} = \arg \min _X \| \texttt{src1} \cdot \texttt{X} - \texttt{src2} \|\)
+ *
+ * If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1
+ * if src1 (or \(\texttt{src1}^T\texttt{src1}\) ) is non-singular. Otherwise,
+ * it returns 0. In the latter case, dst is not valid. Other methods find a
+ * pseudo-solution in case of a singular left-hand side part.
+ *
+ * Note: If you want to find a unity-norm solution of an under-defined
+ * singular system \(\texttt{src1}\cdot\texttt{dst}=0\) , the function solve
+ * will not do the work. Use SVD::solveZ instead.
+ *
+ * @param src1 input matrix on the left-hand side of the system.
+ * @param src2 input matrix on the right-hand side of the system.
+ * @param dst output solution.
+ * @param flags solution (matrix inversion) method (#DecompTypes)
+ * SEE: invert, SVD, eigen
+ * @return automatically generated
+ */
+ public static boolean solve(Mat src1, Mat src2, Mat dst, int flags) {
+ return solve_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, flags);
+ }
+
+ /**
+ * Solves one or more linear systems or least-squares problems.
+ *
+ * The function cv::solve solves a linear system or least-squares problem (the
+ * latter is possible with SVD or QR methods, or by specifying the flag
+ * #DECOMP_NORMAL ):
+ * \(\texttt{dst} = \arg \min _X \| \texttt{src1} \cdot \texttt{X} - \texttt{src2} \|\)
+ *
+ * If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1
+ * if src1 (or \(\texttt{src1}^T\texttt{src1}\) ) is non-singular. Otherwise,
+ * it returns 0. In the latter case, dst is not valid. Other methods find a
+ * pseudo-solution in case of a singular left-hand side part.
+ *
+ * Note: If you want to find a unity-norm solution of an under-defined
+ * singular system \(\texttt{src1}\cdot\texttt{dst}=0\) , the function solve
+ * will not do the work. Use SVD::solveZ instead.
+ *
+ * @param src1 input matrix on the left-hand side of the system.
+ * @param src2 input matrix on the right-hand side of the system.
+ * @param dst output solution.
+ * SEE: invert, SVD, eigen
+ * @return automatically generated
+ */
+ public static boolean solve(Mat src1, Mat src2, Mat dst) {
+ return solve_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::sort(Mat src, Mat& dst, int flags)
+ //
+
+ /**
+ * Sorts each row or each column of a matrix.
+ *
+ * The function cv::sort sorts each matrix row or each matrix column in
+ * ascending or descending order. So you should pass two operation flags to
+ * get desired behaviour. If you want to sort matrix rows or columns
+ * lexicographically, you can use STL std::sort generic function with the
+ * proper comparison predicate.
+ *
+ * @param src input single-channel array.
+ * @param dst output array of the same size and type as src.
+ * @param flags operation flags, a combination of #SortFlags
+ * SEE: sortIdx, randShuffle
+ */
+ public static void sort(Mat src, Mat dst, int flags) {
+ sort_0(src.nativeObj, dst.nativeObj, flags);
+ }
+
+
+ //
+ // C++: void cv::sortIdx(Mat src, Mat& dst, int flags)
+ //
+
+ /**
+ * Sorts each row or each column of a matrix.
+ *
+ * The function cv::sortIdx sorts each matrix row or each matrix column in the
+ * ascending or descending order. So you should pass two operation flags to
+ * get desired behaviour. Instead of reordering the elements themselves, it
+ * stores the indices of sorted elements in the output array. For example:
+ *
+ * Mat A = Mat::eye(3,3,CV_32F), B;
+ * sortIdx(A, B, SORT_EVERY_ROW + SORT_ASCENDING);
+ * // B will probably contain
+ * // (because of equal elements in A some permutations are possible):
+ * // [[1, 2, 0], [0, 2, 1], [0, 1, 2]]
+ *
+ * @param src input single-channel array.
+ * @param dst output integer array of the same size as src.
+ * @param flags operation flags that could be a combination of cv::SortFlags
+ * SEE: sort, randShuffle
+ */
+ public static void sortIdx(Mat src, Mat dst, int flags) {
+ sortIdx_0(src.nativeObj, dst.nativeObj, flags);
+ }
+
+
+ //
+ // C++: int cv::solveCubic(Mat coeffs, Mat& roots)
+ //
+
+ /**
+ * Finds the real roots of a cubic equation.
+ *
+ * The function solveCubic finds the real roots of a cubic equation:
+ *
+ * -
+ * if coeffs is a 4-element vector:
+ * \(\texttt{coeffs} [0] x^3 + \texttt{coeffs} [1] x^2 + \texttt{coeffs} [2] x + \texttt{coeffs} [3] = 0\)
+ *
+ * -
+ * if coeffs is a 3-element vector:
+ * \(x^3 + \texttt{coeffs} [0] x^2 + \texttt{coeffs} [1] x + \texttt{coeffs} [2] = 0\)
+ *
+ *
+ *
+ * The roots are stored in the roots array.
+ * @param coeffs equation coefficients, an array of 3 or 4 elements.
+ * @param roots output array of real roots that has 1 or 3 elements.
+ * @return number of real roots. It can be 0, 1 or 2.
+ */
+ public static int solveCubic(Mat coeffs, Mat roots) {
+ return solveCubic_0(coeffs.nativeObj, roots.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::solvePoly(Mat coeffs, Mat& roots, int maxIters = 300)
+ //
+
+ /**
+ * Finds the real or complex roots of a polynomial equation.
+ *
+ * The function cv::solvePoly finds real and complex roots of a polynomial equation:
+ * \(\texttt{coeffs} [n] x^{n} + \texttt{coeffs} [n-1] x^{n-1} + ... + \texttt{coeffs} [1] x + \texttt{coeffs} [0] = 0\)
+ * @param coeffs array of polynomial coefficients.
+ * @param roots output (complex) array of roots.
+ * @param maxIters maximum number of iterations the algorithm does.
+ * @return automatically generated
+ */
+ public static double solvePoly(Mat coeffs, Mat roots, int maxIters) {
+ return solvePoly_0(coeffs.nativeObj, roots.nativeObj, maxIters);
+ }
+
+ /**
+ * Finds the real or complex roots of a polynomial equation.
+ *
+ * The function cv::solvePoly finds real and complex roots of a polynomial equation:
+ * \(\texttt{coeffs} [n] x^{n} + \texttt{coeffs} [n-1] x^{n-1} + ... + \texttt{coeffs} [1] x + \texttt{coeffs} [0] = 0\)
+ * @param coeffs array of polynomial coefficients.
+ * @param roots output (complex) array of roots.
+ * @return automatically generated
+ */
+ public static double solvePoly(Mat coeffs, Mat roots) {
+ return solvePoly_1(coeffs.nativeObj, roots.nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::eigen(Mat src, Mat& eigenvalues, Mat& eigenvectors = Mat())
+ //
+
+ /**
+ * Calculates eigenvalues and eigenvectors of a symmetric matrix.
+ *
+ * The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric
+ * matrix src:
+ *
+ * src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()
+ *
+ *
+ * Note: Use cv::eigenNonSymmetric for calculation of real eigenvalues and eigenvectors of non-symmetric matrix.
+ *
+ * @param src input matrix that must have CV_32FC1 or CV_64FC1 type, square size and be symmetrical
+ * (src ^T^ == src).
+ * @param eigenvalues output vector of eigenvalues of the same type as src; the eigenvalues are stored
+ * in the descending order.
+ * @param eigenvectors output matrix of eigenvectors; it has the same size and type as src; the
+ * eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding
+ * eigenvalues.
+ * SEE: eigenNonSymmetric, completeSymm , PCA
+ * @return automatically generated
+ */
+ public static boolean eigen(Mat src, Mat eigenvalues, Mat eigenvectors) {
+ return eigen_0(src.nativeObj, eigenvalues.nativeObj, eigenvectors.nativeObj);
+ }
+
+ /**
+ * Calculates eigenvalues and eigenvectors of a symmetric matrix.
+ *
+ * The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric
+ * matrix src:
+ *
+ * src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()
+ *
+ *
+ * Note: Use cv::eigenNonSymmetric for calculation of real eigenvalues and eigenvectors of non-symmetric matrix.
+ *
+ * @param src input matrix that must have CV_32FC1 or CV_64FC1 type, square size and be symmetrical
+ * (src ^T^ == src).
+ * @param eigenvalues output vector of eigenvalues of the same type as src; the eigenvalues are stored
+ * in the descending order.
+ * eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding
+ * eigenvalues.
+ * SEE: eigenNonSymmetric, completeSymm , PCA
+ * @return automatically generated
+ */
+ public static boolean eigen(Mat src, Mat eigenvalues) {
+ return eigen_1(src.nativeObj, eigenvalues.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::eigenNonSymmetric(Mat src, Mat& eigenvalues, Mat& eigenvectors)
+ //
+
+ /**
+ * Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only).
+ *
+ * Note: Assumes real eigenvalues.
+ *
+ * The function calculates eigenvalues and eigenvectors (optional) of the square matrix src:
+ *
+ * src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()
+ *
+ *
+ * @param src input matrix (CV_32FC1 or CV_64FC1 type).
+ * @param eigenvalues output vector of eigenvalues (type is the same type as src).
+ * @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.
+ * SEE: eigen
+ */
+ public static void eigenNonSymmetric(Mat src, Mat eigenvalues, Mat eigenvectors) {
+ eigenNonSymmetric_0(src.nativeObj, eigenvalues.nativeObj, eigenvectors.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::calcCovarMatrix(Mat samples, Mat& covar, Mat& mean, int flags, int ctype = CV_64F)
+ //
+
+ /**
+ *
+ * Note: use #COVAR_ROWS or #COVAR_COLS flag
+ * @param samples samples stored as rows/columns of a single matrix.
+ * @param covar output covariance matrix of the type ctype and square size.
+ * @param mean input or output (depending on the flags) array as the average value of the input vectors.
+ * @param flags operation flags as a combination of #CovarFlags
+ * @param ctype type of the matrixl; it equals 'CV_64F' by default.
+ */
+ public static void calcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags, int ctype) {
+ calcCovarMatrix_0(samples.nativeObj, covar.nativeObj, mean.nativeObj, flags, ctype);
+ }
+
+ /**
+ *
+ * Note: use #COVAR_ROWS or #COVAR_COLS flag
+ * @param samples samples stored as rows/columns of a single matrix.
+ * @param covar output covariance matrix of the type ctype and square size.
+ * @param mean input or output (depending on the flags) array as the average value of the input vectors.
+ * @param flags operation flags as a combination of #CovarFlags
+ */
+ public static void calcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags) {
+ calcCovarMatrix_1(samples.nativeObj, covar.nativeObj, mean.nativeObj, flags);
+ }
+
+
+ //
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, int maxComponents = 0)
+ //
+
+ /**
+ * wrap PCA::operator()
+ * @param data automatically generated
+ * @param mean automatically generated
+ * @param eigenvectors automatically generated
+ * @param maxComponents automatically generated
+ */
+ public static void PCACompute(Mat data, Mat mean, Mat eigenvectors, int maxComponents) {
+ PCACompute_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, maxComponents);
+ }
+
+ /**
+ * wrap PCA::operator()
+ * @param data automatically generated
+ * @param mean automatically generated
+ * @param eigenvectors automatically generated
+ */
+ public static void PCACompute(Mat data, Mat mean, Mat eigenvectors) {
+ PCACompute_1(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, int maxComponents = 0)
+ //
+
+ /**
+ * wrap PCA::operator() and add eigenvalues output parameter
+ * @param data automatically generated
+ * @param mean automatically generated
+ * @param eigenvectors automatically generated
+ * @param eigenvalues automatically generated
+ * @param maxComponents automatically generated
+ */
+ public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues, int maxComponents) {
+ PCACompute2_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj, maxComponents);
+ }
+
+ /**
+ * wrap PCA::operator() and add eigenvalues output parameter
+ * @param data automatically generated
+ * @param mean automatically generated
+ * @param eigenvectors automatically generated
+ * @param eigenvalues automatically generated
+ */
+ public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues) {
+ PCACompute2_1(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, double retainedVariance)
+ //
+
+ /**
+ * wrap PCA::operator()
+ * @param data automatically generated
+ * @param mean automatically generated
+ * @param eigenvectors automatically generated
+ * @param retainedVariance automatically generated
+ */
+ public static void PCACompute(Mat data, Mat mean, Mat eigenvectors, double retainedVariance) {
+ PCACompute_2(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, retainedVariance);
+ }
+
+
+ //
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, double retainedVariance)
+ //
+
+ /**
+ * wrap PCA::operator() and add eigenvalues output parameter
+ * @param data automatically generated
+ * @param mean automatically generated
+ * @param eigenvectors automatically generated
+ * @param eigenvalues automatically generated
+ * @param retainedVariance automatically generated
+ */
+ public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues, double retainedVariance) {
+ PCACompute2_2(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj, retainedVariance);
+ }
+
+
+ //
+ // C++: void cv::PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
+ //
+
+ /**
+ * wrap PCA::project
+ * @param data automatically generated
+ * @param mean automatically generated
+ * @param eigenvectors automatically generated
+ * @param result automatically generated
+ */
+ public static void PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat result) {
+ PCAProject_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, result.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
+ //
+
+ /**
+ * wrap PCA::backProject
+ * @param data automatically generated
+ * @param mean automatically generated
+ * @param eigenvectors automatically generated
+ * @param result automatically generated
+ */
+ public static void PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat result) {
+ PCABackProject_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, result.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::SVDecomp(Mat src, Mat& w, Mat& u, Mat& vt, int flags = 0)
+ //
+
+ /**
+ * wrap SVD::compute
+ * @param src automatically generated
+ * @param w automatically generated
+ * @param u automatically generated
+ * @param vt automatically generated
+ * @param flags automatically generated
+ */
+ public static void SVDecomp(Mat src, Mat w, Mat u, Mat vt, int flags) {
+ SVDecomp_0(src.nativeObj, w.nativeObj, u.nativeObj, vt.nativeObj, flags);
+ }
+
+ /**
+ * wrap SVD::compute
+ * @param src automatically generated
+ * @param w automatically generated
+ * @param u automatically generated
+ * @param vt automatically generated
+ */
+ public static void SVDecomp(Mat src, Mat w, Mat u, Mat vt) {
+ SVDecomp_1(src.nativeObj, w.nativeObj, u.nativeObj, vt.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat& dst)
+ //
+
+ /**
+ * wrap SVD::backSubst
+ * @param w automatically generated
+ * @param u automatically generated
+ * @param vt automatically generated
+ * @param rhs automatically generated
+ * @param dst automatically generated
+ */
+ public static void SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat dst) {
+ SVBackSubst_0(w.nativeObj, u.nativeObj, vt.nativeObj, rhs.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::Mahalanobis(Mat v1, Mat v2, Mat icovar)
+ //
+
+ /**
+ * Calculates the Mahalanobis distance between two vectors.
+ *
+ * The function cv::Mahalanobis calculates and returns the weighted distance between two vectors:
+ * \(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)})} }\)
+ * The covariance matrix may be calculated using the #calcCovarMatrix function and then inverted using
+ * the invert function (preferably using the #DECOMP_SVD method, as the most accurate).
+ * @param v1 first 1D input vector.
+ * @param v2 second 1D input vector.
+ * @param icovar inverse covariance matrix.
+ * @return automatically generated
+ */
+ public static double Mahalanobis(Mat v1, Mat v2, Mat icovar) {
+ return Mahalanobis_0(v1.nativeObj, v2.nativeObj, icovar.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::dft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
+ //
+
+ /**
+ * Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
+ *
+ * The function cv::dft performs one of the following:
+ *
+ * -
+ * Forward the Fourier transform of a 1D vector of N elements:
+ * \(Y = F^{(N)} \cdot X,\)
+ * where \(F^{(N)}_{jk}=\exp(-2\pi i j k/N)\) and \(i=\sqrt{-1}\)
+ *
+ * -
+ * Inverse the Fourier transform of a 1D vector of N elements:
+ * \(\begin{array}{l} X'= \left (F^{(N)} \right )^{-1} \cdot Y = \left (F^{(N)} \right )^* \cdot y \\ X = (1/N) \cdot X, \end{array}\)
+ * where \(F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\)
+ *
+ * -
+ * Forward the 2D Fourier transform of a M x N matrix:
+ * \(Y = F^{(M)} \cdot X \cdot F^{(N)}\)
+ *
+ * -
+ * Inverse the 2D Fourier transform of a M x N matrix:
+ * \(\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}\)
+ *
+ *
+ *
+ * In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input
+ * spectrum of the inverse Fourier transform can be represented in a packed format called *CCS*
+ * (complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here
+ * is how 2D *CCS* spectrum looks:
+ * \(\begin{bmatrix} Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} & \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2} \\ Re Y_{1,0} & Re Y_{1,1} & Im Y_{1,1} & Re Y_{1,2} & Im Y_{1,2} & \cdots & Re Y_{1,N/2-1} & Im Y_{1,N/2-1} & Re Y_{1,N/2} \\ Im Y_{1,0} & Re Y_{2,1} & Im Y_{2,1} & Re Y_{2,2} & Im Y_{2,2} & \cdots & Re Y_{2,N/2-1} & Im Y_{2,N/2-1} & Im Y_{1,N/2} \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} & Re Y_{M-3,1} & Im Y_{M-3,1} & \hdotsfor{3} & Re Y_{M-3,N/2-1} & Im Y_{M-3,N/2-1}& Re Y_{M/2-1,N/2} \\ Im Y_{M/2-1,0} & Re Y_{M-2,1} & Im Y_{M-2,1} & \hdotsfor{3} & Re Y_{M-2,N/2-1} & Im Y_{M-2,N/2-1}& Im Y_{M/2-1,N/2} \\ Re Y_{M/2,0} & Re Y_{M-1,1} & Im Y_{M-1,1} & \hdotsfor{3} & Re Y_{M-1,N/2-1} & Im Y_{M-1,N/2-1}& Re Y_{M/2,N/2} \end{bmatrix}\)
+ *
+ * In case of 1D transform of a real vector, the output looks like the first row of the matrix above.
+ *
+ * So, the function chooses an operation mode depending on the flags and size of the input array:
+ *
+ * -
+ * If #DFT_ROWS is set or the input array has a single row or single column, the function
+ * performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set.
+ * Otherwise, it performs a 2D transform.
+ *
+ * -
+ * If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or
+ * 2D transform:
+ *
+ * -
+ * When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as
+ * input.
+ *
+ * -
+ * When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as
+ * input. In case of 2D transform, it uses the packed format as shown above. In case of a
+ * single 1D transform, it looks like the first row of the matrix above. In case of
+ * multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix
+ * looks like the first row of the matrix above.
+ *
+ *
+ * -
+ * If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the
+ * output is a complex array of the same size as input. The function performs a forward or
+ * inverse 1D or 2D transform of the whole input array or each row of the input array
+ * independently, depending on the flags DFT_INVERSE and DFT_ROWS.
+ *
+ * -
+ * When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT
+ * is set, the output is a real array of the same size as input. The function performs a 1D or 2D
+ * inverse transformation of the whole input array or each individual row, depending on the flags
+ * #DFT_INVERSE and #DFT_ROWS.
+ *
+ *
+ *
+ * If #DFT_SCALE is set, the scaling is done after the transformation.
+ *
+ * Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed
+ * efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the
+ * current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize
+ * method.
+ *
+ * The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
+ *
+ * void convolveDFT(InputArray A, InputArray B, OutputArray C)
+ * {
+ * // reallocate the output array if needed
+ * C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
+ * Size dftSize;
+ * // calculate the size of DFT transform
+ * dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
+ * dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
+ *
+ * // allocate temporary buffers and initialize them with 0's
+ * Mat tempA(dftSize, A.type(), Scalar::all(0));
+ * Mat tempB(dftSize, B.type(), Scalar::all(0));
+ *
+ * // copy A and B to the top-left corners of tempA and tempB, respectively
+ * Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
+ * A.copyTo(roiA);
+ * Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
+ * B.copyTo(roiB);
+ *
+ * // now transform the padded A & B in-place;
+ * // use "nonzeroRows" hint for faster processing
+ * dft(tempA, tempA, 0, A.rows);
+ * dft(tempB, tempB, 0, B.rows);
+ *
+ * // multiply the spectrums;
+ * // the function handles packed spectrum representations well
+ * mulSpectrums(tempA, tempB, tempA);
+ *
+ * // transform the product back from the frequency domain.
+ * // Even though all the result rows will be non-zero,
+ * // you need only the first C.rows of them, and thus you
+ * // pass nonzeroRows == C.rows
+ * dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
+ *
+ * // now copy the result back to C.
+ * tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
+ *
+ * // all the temporary buffers will be deallocated automatically
+ * }
+ *
+ * To optimize this sample, consider the following approaches:
+ *
+ * -
+ * Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to
+ * the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole
+ * tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols)
+ * rightmost columns of the matrices.
+ *
+ * -
+ * This DFT-based convolution does not have to be applied to the whole big arrays, especially if B
+ * is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts.
+ * To do this, you need to split the output array C into multiple tiles. For each tile, estimate
+ * which parts of A and B are required to calculate convolution in this tile. If the tiles in C are
+ * too small, the speed will decrease a lot because of repeated work. In the ultimate case, when
+ * each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution
+ * algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and
+ * there is also a slowdown because of bad cache locality. So, there is an optimal tile size
+ * somewhere in the middle.
+ *
+ * -
+ * If different tiles in C can be calculated in parallel and, thus, the convolution is done by
+ * parts, the loop can be threaded.
+ *
+ *
+ *
+ * All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by
+ * using them, you can get the performance even better than with the above theoretically optimal
+ * implementation. Though, those two functions actually calculate cross-correlation, not convolution,
+ * so you need to "flip" the second convolution operand B vertically and horizontally using flip .
+ * Note:
+ *
+ * -
+ * An example using the discrete fourier transform can be found at
+ * opencv_source_code/samples/cpp/dft.cpp
+ *
+ * -
+ * (Python) An example using the dft functionality to perform Wiener deconvolution can be found
+ * at opencv_source/samples/python/deconvolution.py
+ *
+ * -
+ * (Python) An example rearranging the quadrants of a Fourier image can be found at
+ * opencv_source/samples/python/dft.py
+ * @param src input array that could be real or complex.
+ * @param dst output array whose size and type depends on the flags .
+ * @param flags transformation flags, representing a combination of the #DftFlags
+ * @param nonzeroRows when the parameter is not zero, the function assumes that only the first
+ * nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the
+ * output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the
+ * rows more efficiently and save some time; this technique is very useful for calculating array
+ * cross-correlation or convolution using DFT.
+ * SEE: dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar ,
+ * magnitude , phase
+ *
+ *
+ */
+ public static void dft(Mat src, Mat dst, int flags, int nonzeroRows) {
+ dft_0(src.nativeObj, dst.nativeObj, flags, nonzeroRows);
+ }
+
+ /**
+ * Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
+ *
+ * The function cv::dft performs one of the following:
+ *
+ * -
+ * Forward the Fourier transform of a 1D vector of N elements:
+ * \(Y = F^{(N)} \cdot X,\)
+ * where \(F^{(N)}_{jk}=\exp(-2\pi i j k/N)\) and \(i=\sqrt{-1}\)
+ *
+ * -
+ * Inverse the Fourier transform of a 1D vector of N elements:
+ * \(\begin{array}{l} X'= \left (F^{(N)} \right )^{-1} \cdot Y = \left (F^{(N)} \right )^* \cdot y \\ X = (1/N) \cdot X, \end{array}\)
+ * where \(F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\)
+ *
+ * -
+ * Forward the 2D Fourier transform of a M x N matrix:
+ * \(Y = F^{(M)} \cdot X \cdot F^{(N)}\)
+ *
+ * -
+ * Inverse the 2D Fourier transform of a M x N matrix:
+ * \(\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}\)
+ *
+ *
+ *
+ * In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input
+ * spectrum of the inverse Fourier transform can be represented in a packed format called *CCS*
+ * (complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here
+ * is how 2D *CCS* spectrum looks:
+ * \(\begin{bmatrix} Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} & \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2} \\ Re Y_{1,0} & Re Y_{1,1} & Im Y_{1,1} & Re Y_{1,2} & Im Y_{1,2} & \cdots & Re Y_{1,N/2-1} & Im Y_{1,N/2-1} & Re Y_{1,N/2} \\ Im Y_{1,0} & Re Y_{2,1} & Im Y_{2,1} & Re Y_{2,2} & Im Y_{2,2} & \cdots & Re Y_{2,N/2-1} & Im Y_{2,N/2-1} & Im Y_{1,N/2} \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} & Re Y_{M-3,1} & Im Y_{M-3,1} & \hdotsfor{3} & Re Y_{M-3,N/2-1} & Im Y_{M-3,N/2-1}& Re Y_{M/2-1,N/2} \\ Im Y_{M/2-1,0} & Re Y_{M-2,1} & Im Y_{M-2,1} & \hdotsfor{3} & Re Y_{M-2,N/2-1} & Im Y_{M-2,N/2-1}& Im Y_{M/2-1,N/2} \\ Re Y_{M/2,0} & Re Y_{M-1,1} & Im Y_{M-1,1} & \hdotsfor{3} & Re Y_{M-1,N/2-1} & Im Y_{M-1,N/2-1}& Re Y_{M/2,N/2} \end{bmatrix}\)
+ *
+ * In case of 1D transform of a real vector, the output looks like the first row of the matrix above.
+ *
+ * So, the function chooses an operation mode depending on the flags and size of the input array:
+ *
+ * -
+ * If #DFT_ROWS is set or the input array has a single row or single column, the function
+ * performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set.
+ * Otherwise, it performs a 2D transform.
+ *
+ * -
+ * If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or
+ * 2D transform:
+ *
+ * -
+ * When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as
+ * input.
+ *
+ * -
+ * When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as
+ * input. In case of 2D transform, it uses the packed format as shown above. In case of a
+ * single 1D transform, it looks like the first row of the matrix above. In case of
+ * multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix
+ * looks like the first row of the matrix above.
+ *
+ *
+ * -
+ * If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the
+ * output is a complex array of the same size as input. The function performs a forward or
+ * inverse 1D or 2D transform of the whole input array or each row of the input array
+ * independently, depending on the flags DFT_INVERSE and DFT_ROWS.
+ *
+ * -
+ * When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT
+ * is set, the output is a real array of the same size as input. The function performs a 1D or 2D
+ * inverse transformation of the whole input array or each individual row, depending on the flags
+ * #DFT_INVERSE and #DFT_ROWS.
+ *
+ *
+ *
+ * If #DFT_SCALE is set, the scaling is done after the transformation.
+ *
+ * Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed
+ * efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the
+ * current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize
+ * method.
+ *
+ * The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
+ *
+ * void convolveDFT(InputArray A, InputArray B, OutputArray C)
+ * {
+ * // reallocate the output array if needed
+ * C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
+ * Size dftSize;
+ * // calculate the size of DFT transform
+ * dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
+ * dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
+ *
+ * // allocate temporary buffers and initialize them with 0's
+ * Mat tempA(dftSize, A.type(), Scalar::all(0));
+ * Mat tempB(dftSize, B.type(), Scalar::all(0));
+ *
+ * // copy A and B to the top-left corners of tempA and tempB, respectively
+ * Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
+ * A.copyTo(roiA);
+ * Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
+ * B.copyTo(roiB);
+ *
+ * // now transform the padded A & B in-place;
+ * // use "nonzeroRows" hint for faster processing
+ * dft(tempA, tempA, 0, A.rows);
+ * dft(tempB, tempB, 0, B.rows);
+ *
+ * // multiply the spectrums;
+ * // the function handles packed spectrum representations well
+ * mulSpectrums(tempA, tempB, tempA);
+ *
+ * // transform the product back from the frequency domain.
+ * // Even though all the result rows will be non-zero,
+ * // you need only the first C.rows of them, and thus you
+ * // pass nonzeroRows == C.rows
+ * dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
+ *
+ * // now copy the result back to C.
+ * tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
+ *
+ * // all the temporary buffers will be deallocated automatically
+ * }
+ *
+ * To optimize this sample, consider the following approaches:
+ *
+ * -
+ * Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to
+ * the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole
+ * tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols)
+ * rightmost columns of the matrices.
+ *
+ * -
+ * This DFT-based convolution does not have to be applied to the whole big arrays, especially if B
+ * is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts.
+ * To do this, you need to split the output array C into multiple tiles. For each tile, estimate
+ * which parts of A and B are required to calculate convolution in this tile. If the tiles in C are
+ * too small, the speed will decrease a lot because of repeated work. In the ultimate case, when
+ * each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution
+ * algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and
+ * there is also a slowdown because of bad cache locality. So, there is an optimal tile size
+ * somewhere in the middle.
+ *
+ * -
+ * If different tiles in C can be calculated in parallel and, thus, the convolution is done by
+ * parts, the loop can be threaded.
+ *
+ *
+ *
+ * All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by
+ * using them, you can get the performance even better than with the above theoretically optimal
+ * implementation. Though, those two functions actually calculate cross-correlation, not convolution,
+ * so you need to "flip" the second convolution operand B vertically and horizontally using flip .
+ * Note:
+ *
+ * -
+ * An example using the discrete fourier transform can be found at
+ * opencv_source_code/samples/cpp/dft.cpp
+ *
+ * -
+ * (Python) An example using the dft functionality to perform Wiener deconvolution can be found
+ * at opencv_source/samples/python/deconvolution.py
+ *
+ * -
+ * (Python) An example rearranging the quadrants of a Fourier image can be found at
+ * opencv_source/samples/python/dft.py
+ * @param src input array that could be real or complex.
+ * @param dst output array whose size and type depends on the flags .
+ * @param flags transformation flags, representing a combination of the #DftFlags
+ * nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the
+ * output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the
+ * rows more efficiently and save some time; this technique is very useful for calculating array
+ * cross-correlation or convolution using DFT.
+ * SEE: dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar ,
+ * magnitude , phase
+ *
+ *
+ */
+ public static void dft(Mat src, Mat dst, int flags) {
+ dft_1(src.nativeObj, dst.nativeObj, flags);
+ }
+
+ /**
+ * Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
+ *
+ * The function cv::dft performs one of the following:
+ *
+ * -
+ * Forward the Fourier transform of a 1D vector of N elements:
+ * \(Y = F^{(N)} \cdot X,\)
+ * where \(F^{(N)}_{jk}=\exp(-2\pi i j k/N)\) and \(i=\sqrt{-1}\)
+ *
+ * -
+ * Inverse the Fourier transform of a 1D vector of N elements:
+ * \(\begin{array}{l} X'= \left (F^{(N)} \right )^{-1} \cdot Y = \left (F^{(N)} \right )^* \cdot y \\ X = (1/N) \cdot X, \end{array}\)
+ * where \(F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\)
+ *
+ * -
+ * Forward the 2D Fourier transform of a M x N matrix:
+ * \(Y = F^{(M)} \cdot X \cdot F^{(N)}\)
+ *
+ * -
+ * Inverse the 2D Fourier transform of a M x N matrix:
+ * \(\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}\)
+ *
+ *
+ *
+ * In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input
+ * spectrum of the inverse Fourier transform can be represented in a packed format called *CCS*
+ * (complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here
+ * is how 2D *CCS* spectrum looks:
+ * \(\begin{bmatrix} Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} & \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2} \\ Re Y_{1,0} & Re Y_{1,1} & Im Y_{1,1} & Re Y_{1,2} & Im Y_{1,2} & \cdots & Re Y_{1,N/2-1} & Im Y_{1,N/2-1} & Re Y_{1,N/2} \\ Im Y_{1,0} & Re Y_{2,1} & Im Y_{2,1} & Re Y_{2,2} & Im Y_{2,2} & \cdots & Re Y_{2,N/2-1} & Im Y_{2,N/2-1} & Im Y_{1,N/2} \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} & Re Y_{M-3,1} & Im Y_{M-3,1} & \hdotsfor{3} & Re Y_{M-3,N/2-1} & Im Y_{M-3,N/2-1}& Re Y_{M/2-1,N/2} \\ Im Y_{M/2-1,0} & Re Y_{M-2,1} & Im Y_{M-2,1} & \hdotsfor{3} & Re Y_{M-2,N/2-1} & Im Y_{M-2,N/2-1}& Im Y_{M/2-1,N/2} \\ Re Y_{M/2,0} & Re Y_{M-1,1} & Im Y_{M-1,1} & \hdotsfor{3} & Re Y_{M-1,N/2-1} & Im Y_{M-1,N/2-1}& Re Y_{M/2,N/2} \end{bmatrix}\)
+ *
+ * In case of 1D transform of a real vector, the output looks like the first row of the matrix above.
+ *
+ * So, the function chooses an operation mode depending on the flags and size of the input array:
+ *
+ * -
+ * If #DFT_ROWS is set or the input array has a single row or single column, the function
+ * performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set.
+ * Otherwise, it performs a 2D transform.
+ *
+ * -
+ * If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or
+ * 2D transform:
+ *
+ * -
+ * When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as
+ * input.
+ *
+ * -
+ * When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as
+ * input. In case of 2D transform, it uses the packed format as shown above. In case of a
+ * single 1D transform, it looks like the first row of the matrix above. In case of
+ * multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix
+ * looks like the first row of the matrix above.
+ *
+ *
+ * -
+ * If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the
+ * output is a complex array of the same size as input. The function performs a forward or
+ * inverse 1D or 2D transform of the whole input array or each row of the input array
+ * independently, depending on the flags DFT_INVERSE and DFT_ROWS.
+ *
+ * -
+ * When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT
+ * is set, the output is a real array of the same size as input. The function performs a 1D or 2D
+ * inverse transformation of the whole input array or each individual row, depending on the flags
+ * #DFT_INVERSE and #DFT_ROWS.
+ *
+ *
+ *
+ * If #DFT_SCALE is set, the scaling is done after the transformation.
+ *
+ * Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed
+ * efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the
+ * current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize
+ * method.
+ *
+ * The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
+ *
+ * void convolveDFT(InputArray A, InputArray B, OutputArray C)
+ * {
+ * // reallocate the output array if needed
+ * C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
+ * Size dftSize;
+ * // calculate the size of DFT transform
+ * dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
+ * dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
+ *
+ * // allocate temporary buffers and initialize them with 0's
+ * Mat tempA(dftSize, A.type(), Scalar::all(0));
+ * Mat tempB(dftSize, B.type(), Scalar::all(0));
+ *
+ * // copy A and B to the top-left corners of tempA and tempB, respectively
+ * Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
+ * A.copyTo(roiA);
+ * Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
+ * B.copyTo(roiB);
+ *
+ * // now transform the padded A & B in-place;
+ * // use "nonzeroRows" hint for faster processing
+ * dft(tempA, tempA, 0, A.rows);
+ * dft(tempB, tempB, 0, B.rows);
+ *
+ * // multiply the spectrums;
+ * // the function handles packed spectrum representations well
+ * mulSpectrums(tempA, tempB, tempA);
+ *
+ * // transform the product back from the frequency domain.
+ * // Even though all the result rows will be non-zero,
+ * // you need only the first C.rows of them, and thus you
+ * // pass nonzeroRows == C.rows
+ * dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
+ *
+ * // now copy the result back to C.
+ * tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
+ *
+ * // all the temporary buffers will be deallocated automatically
+ * }
+ *
+ * To optimize this sample, consider the following approaches:
+ *
+ * -
+ * Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to
+ * the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole
+ * tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols)
+ * rightmost columns of the matrices.
+ *
+ * -
+ * This DFT-based convolution does not have to be applied to the whole big arrays, especially if B
+ * is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts.
+ * To do this, you need to split the output array C into multiple tiles. For each tile, estimate
+ * which parts of A and B are required to calculate convolution in this tile. If the tiles in C are
+ * too small, the speed will decrease a lot because of repeated work. In the ultimate case, when
+ * each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution
+ * algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and
+ * there is also a slowdown because of bad cache locality. So, there is an optimal tile size
+ * somewhere in the middle.
+ *
+ * -
+ * If different tiles in C can be calculated in parallel and, thus, the convolution is done by
+ * parts, the loop can be threaded.
+ *
+ *
+ *
+ * All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by
+ * using them, you can get the performance even better than with the above theoretically optimal
+ * implementation. Though, those two functions actually calculate cross-correlation, not convolution,
+ * so you need to "flip" the second convolution operand B vertically and horizontally using flip .
+ * Note:
+ *
+ * -
+ * An example using the discrete fourier transform can be found at
+ * opencv_source_code/samples/cpp/dft.cpp
+ *
+ * -
+ * (Python) An example using the dft functionality to perform Wiener deconvolution can be found
+ * at opencv_source/samples/python/deconvolution.py
+ *
+ * -
+ * (Python) An example rearranging the quadrants of a Fourier image can be found at
+ * opencv_source/samples/python/dft.py
+ * @param src input array that could be real or complex.
+ * @param dst output array whose size and type depends on the flags .
+ * nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the
+ * output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the
+ * rows more efficiently and save some time; this technique is very useful for calculating array
+ * cross-correlation or convolution using DFT.
+ * SEE: dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar ,
+ * magnitude , phase
+ *
+ *
+ */
+ public static void dft(Mat src, Mat dst) {
+ dft_2(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::idft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
+ //
+
+ /**
+ * Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
+ *
+ * idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) .
+ * Note: None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of
+ * dft or idft explicitly to make these transforms mutually inverse.
+ * SEE: dft, dct, idct, mulSpectrums, getOptimalDFTSize
+ * @param src input floating-point real or complex array.
+ * @param dst output array whose size and type depend on the flags.
+ * @param flags operation flags (see dft and #DftFlags).
+ * @param nonzeroRows number of dst rows to process; the rest of the rows have undefined content (see
+ * the convolution sample in dft description.
+ */
+ public static void idft(Mat src, Mat dst, int flags, int nonzeroRows) {
+ idft_0(src.nativeObj, dst.nativeObj, flags, nonzeroRows);
+ }
+
+ /**
+ * Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
+ *
+ * idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) .
+ * Note: None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of
+ * dft or idft explicitly to make these transforms mutually inverse.
+ * SEE: dft, dct, idct, mulSpectrums, getOptimalDFTSize
+ * @param src input floating-point real or complex array.
+ * @param dst output array whose size and type depend on the flags.
+ * @param flags operation flags (see dft and #DftFlags).
+ * the convolution sample in dft description.
+ */
+ public static void idft(Mat src, Mat dst, int flags) {
+ idft_1(src.nativeObj, dst.nativeObj, flags);
+ }
+
+ /**
+ * Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
+ *
+ * idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) .
+ * Note: None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of
+ * dft or idft explicitly to make these transforms mutually inverse.
+ * SEE: dft, dct, idct, mulSpectrums, getOptimalDFTSize
+ * @param src input floating-point real or complex array.
+ * @param dst output array whose size and type depend on the flags.
+ * the convolution sample in dft description.
+ */
+ public static void idft(Mat src, Mat dst) {
+ idft_2(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::dct(Mat src, Mat& dst, int flags = 0)
+ //
+
+ /**
+ * Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
+ *
+ * The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D
+ * floating-point array:
+ *
+ * -
+ * Forward Cosine transform of a 1D vector of N elements:
+ * \(Y = C^{(N)} \cdot X\)
+ * where
+ * \(C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\)
+ * and
+ * \(\alpha_0=1\), \(\alpha_j=2\) for *j > 0*.
+ *
+ * -
+ * Inverse Cosine transform of a 1D vector of N elements:
+ * \(X = \left (C^{(N)} \right )^{-1} \cdot Y = \left (C^{(N)} \right )^T \cdot Y\)
+ * (since \(C^{(N)}\) is an orthogonal matrix, \(C^{(N)} \cdot \left(C^{(N)}\right)^T = I\) )
+ *
+ * -
+ * Forward 2D Cosine transform of M x N matrix:
+ * \(Y = C^{(N)} \cdot X \cdot \left (C^{(N)} \right )^T\)
+ *
+ * -
+ * Inverse 2D Cosine transform of M x N matrix:
+ * \(X = \left (C^{(N)} \right )^T \cdot X \cdot C^{(N)}\)
+ *
+ *
+ *
+ * The function chooses the mode of operation by looking at the flags and size of the input array:
+ *
+ * -
+ * If (flags & #DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it
+ * is an inverse 1D or 2D transform.
+ *
+ * -
+ * If (flags & #DCT_ROWS) != 0 , the function performs a 1D transform of each row.
+ *
+ * -
+ * If the array is a single column or a single row, the function performs a 1D transform.
+ *
+ * -
+ * If none of the above is true, the function performs a 2D transform.
+ *
+ *
+ *
+ * Note: Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you
+ * can pad the array when necessary.
+ * Also, the function performance depends very much, and not monotonically, on the array size (see
+ * getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT
+ * of a vector of size N/2 . Thus, the optimal DCT size N1 >= N can be calculated as:
+ *
+ * size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); }
+ * N1 = getOptimalDCTSize(N);
+ *
+ * @param src input floating-point array.
+ * @param dst output array of the same size and type as src .
+ * @param flags transformation flags as a combination of cv::DftFlags (DCT_*)
+ * SEE: dft , getOptimalDFTSize , idct
+ */
+ public static void dct(Mat src, Mat dst, int flags) {
+ dct_0(src.nativeObj, dst.nativeObj, flags);
+ }
+
+ /**
+ * Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
+ *
+ * The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D
+ * floating-point array:
+ *
+ * -
+ * Forward Cosine transform of a 1D vector of N elements:
+ * \(Y = C^{(N)} \cdot X\)
+ * where
+ * \(C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\)
+ * and
+ * \(\alpha_0=1\), \(\alpha_j=2\) for *j > 0*.
+ *
+ * -
+ * Inverse Cosine transform of a 1D vector of N elements:
+ * \(X = \left (C^{(N)} \right )^{-1} \cdot Y = \left (C^{(N)} \right )^T \cdot Y\)
+ * (since \(C^{(N)}\) is an orthogonal matrix, \(C^{(N)} \cdot \left(C^{(N)}\right)^T = I\) )
+ *
+ * -
+ * Forward 2D Cosine transform of M x N matrix:
+ * \(Y = C^{(N)} \cdot X \cdot \left (C^{(N)} \right )^T\)
+ *
+ * -
+ * Inverse 2D Cosine transform of M x N matrix:
+ * \(X = \left (C^{(N)} \right )^T \cdot X \cdot C^{(N)}\)
+ *
+ *
+ *
+ * The function chooses the mode of operation by looking at the flags and size of the input array:
+ *
+ * -
+ * If (flags & #DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it
+ * is an inverse 1D or 2D transform.
+ *
+ * -
+ * If (flags & #DCT_ROWS) != 0 , the function performs a 1D transform of each row.
+ *
+ * -
+ * If the array is a single column or a single row, the function performs a 1D transform.
+ *
+ * -
+ * If none of the above is true, the function performs a 2D transform.
+ *
+ *
+ *
+ * Note: Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you
+ * can pad the array when necessary.
+ * Also, the function performance depends very much, and not monotonically, on the array size (see
+ * getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT
+ * of a vector of size N/2 . Thus, the optimal DCT size N1 >= N can be calculated as:
+ *
+ * size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); }
+ * N1 = getOptimalDCTSize(N);
+ *
+ * @param src input floating-point array.
+ * @param dst output array of the same size and type as src .
+ * SEE: dft , getOptimalDFTSize , idct
+ */
+ public static void dct(Mat src, Mat dst) {
+ dct_1(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::idct(Mat src, Mat& dst, int flags = 0)
+ //
+
+ /**
+ * Calculates the inverse Discrete Cosine Transform of a 1D or 2D array.
+ *
+ * idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE).
+ * @param src input floating-point single-channel array.
+ * @param dst output array of the same size and type as src.
+ * @param flags operation flags.
+ * SEE: dct, dft, idft, getOptimalDFTSize
+ */
+ public static void idct(Mat src, Mat dst, int flags) {
+ idct_0(src.nativeObj, dst.nativeObj, flags);
+ }
+
+ /**
+ * Calculates the inverse Discrete Cosine Transform of a 1D or 2D array.
+ *
+ * idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE).
+ * @param src input floating-point single-channel array.
+ * @param dst output array of the same size and type as src.
+ * SEE: dct, dft, idft, getOptimalDFTSize
+ */
+ public static void idct(Mat src, Mat dst) {
+ idct_1(src.nativeObj, dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::mulSpectrums(Mat a, Mat b, Mat& c, int flags, bool conjB = false)
+ //
+
+ /**
+ * Performs the per-element multiplication of two Fourier spectrums.
+ *
+ * The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex
+ * matrices that are results of a real or complex Fourier transform.
+ *
+ * The function, together with dft and idft , may be used to calculate convolution (pass conjB=false )
+ * or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are
+ * simply multiplied (per element) with an optional conjugation of the second-array elements. When the
+ * arrays are real, they are assumed to be CCS-packed (see dft for details).
+ * @param a first input array.
+ * @param b second input array of the same size and type as src1 .
+ * @param c output array of the same size and type as src1 .
+ * @param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that
+ * 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.
+ * @param conjB optional flag that conjugates the second input array before the multiplication (true)
+ * or not (false).
+ */
+ public static void mulSpectrums(Mat a, Mat b, Mat c, int flags, boolean conjB) {
+ mulSpectrums_0(a.nativeObj, b.nativeObj, c.nativeObj, flags, conjB);
+ }
+
+ /**
+ * Performs the per-element multiplication of two Fourier spectrums.
+ *
+ * The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex
+ * matrices that are results of a real or complex Fourier transform.
+ *
+ * The function, together with dft and idft , may be used to calculate convolution (pass conjB=false )
+ * or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are
+ * simply multiplied (per element) with an optional conjugation of the second-array elements. When the
+ * arrays are real, they are assumed to be CCS-packed (see dft for details).
+ * @param a first input array.
+ * @param b second input array of the same size and type as src1 .
+ * @param c output array of the same size and type as src1 .
+ * @param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that
+ * 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.
+ * or not (false).
+ */
+ public static void mulSpectrums(Mat a, Mat b, Mat c, int flags) {
+ mulSpectrums_1(a.nativeObj, b.nativeObj, c.nativeObj, flags);
+ }
+
+
+ //
+ // C++: int cv::getOptimalDFTSize(int vecsize)
+ //
+
+ /**
+ * Returns the optimal DFT size for a given vector size.
+ *
+ * DFT performance is not a monotonic function of a vector size. Therefore, when you calculate
+ * convolution of two arrays or perform the spectral analysis of an array, it usually makes sense to
+ * pad the input data with zeros to get a bit larger array that can be transformed much faster than the
+ * original one. Arrays whose size is a power-of-two (2, 4, 8, 16, 32, ...) are the fastest to process.
+ * Though, the arrays whose size is a product of 2's, 3's, and 5's (for example, 300 = 5\*5\*3\*2\*2)
+ * are also processed quite efficiently.
+ *
+ * The function cv::getOptimalDFTSize returns the minimum number N that is greater than or equal to vecsize
+ * so that the DFT of a vector of size N can be processed efficiently. In the current implementation N
+ * = 2 ^p^ \* 3 ^q^ \* 5 ^r^ for some integer p, q, r.
+ *
+ * The function returns a negative number if vecsize is too large (very close to INT_MAX ).
+ *
+ * While the function cannot be used directly to estimate the optimal vector size for DCT transform
+ * (since the current DCT implementation supports only even-size vectors), it can be easily processed
+ * as getOptimalDFTSize((vecsize+1)/2)\*2.
+ * @param vecsize vector size.
+ * SEE: dft , dct , idft , idct , mulSpectrums
+ * @return automatically generated
+ */
+ public static int getOptimalDFTSize(int vecsize) {
+ return getOptimalDFTSize_0(vecsize);
+ }
+
+
+ //
+ // C++: void cv::setRNGSeed(int seed)
+ //
+
+ /**
+ * Sets state of default random number generator.
+ *
+ * The function cv::setRNGSeed sets state of default random number generator to custom value.
+ * @param seed new state for default random number generator
+ * SEE: RNG, randu, randn
+ */
+ public static void setRNGSeed(int seed) {
+ setRNGSeed_0(seed);
+ }
+
+
+ //
+ // C++: void cv::randu(Mat& dst, double low, double high)
+ //
+
+ /**
+ * Generates a single uniformly-distributed random number or an array of random numbers.
+ *
+ * Non-template variant of the function fills the matrix dst with uniformly-distributed
+ * random numbers from the specified range:
+ * \(\texttt{low} _c \leq \texttt{dst} (I)_c < \texttt{high} _c\)
+ * @param dst output array of random numbers; the array must be pre-allocated.
+ * @param low inclusive lower boundary of the generated random numbers.
+ * @param high exclusive upper boundary of the generated random numbers.
+ * SEE: RNG, randn, theRNG
+ */
+ public static void randu(Mat dst, double low, double high) {
+ randu_0(dst.nativeObj, low, high);
+ }
+
+
+ //
+ // C++: void cv::randn(Mat& dst, double mean, double stddev)
+ //
+
+ /**
+ * Fills the array with normally distributed random numbers.
+ *
+ * The function cv::randn fills the matrix dst with normally distributed random numbers with the specified
+ * mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the
+ * value range of the output array data type.
+ * @param dst output array of random numbers; the array must be pre-allocated and have 1 to 4 channels.
+ * @param mean mean value (expectation) of the generated random numbers.
+ * @param stddev standard deviation of the generated random numbers; it can be either a vector (in
+ * which case a diagonal standard deviation matrix is assumed) or a square matrix.
+ * SEE: RNG, randu
+ */
+ public static void randn(Mat dst, double mean, double stddev) {
+ randn_0(dst.nativeObj, mean, stddev);
+ }
+
+
+ //
+ // C++: void cv::randShuffle(Mat& dst, double iterFactor = 1., RNG* rng = 0)
+ //
+
+ /**
+ * Shuffles the array elements randomly.
+ *
+ * The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and
+ * swapping them. The number of such swap operations will be dst.rows\*dst.cols\*iterFactor .
+ * @param dst input/output numerical 1D array.
+ * @param iterFactor scale factor that determines the number of random swap operations (see the details
+ * below).
+ * instead.
+ * SEE: RNG, sort
+ */
+ public static void randShuffle(Mat dst, double iterFactor) {
+ randShuffle_0(dst.nativeObj, iterFactor);
+ }
+
+ /**
+ * Shuffles the array elements randomly.
+ *
+ * The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and
+ * swapping them. The number of such swap operations will be dst.rows\*dst.cols\*iterFactor .
+ * @param dst input/output numerical 1D array.
+ * below).
+ * instead.
+ * SEE: RNG, sort
+ */
+ public static void randShuffle(Mat dst) {
+ randShuffle_2(dst.nativeObj);
+ }
+
+
+ //
+ // C++: double cv::kmeans(Mat data, int K, Mat& bestLabels, TermCriteria criteria, int attempts, int flags, Mat& centers = Mat())
+ //
+
+ /**
+ * Finds centers of clusters and groups input samples around the clusters.
+ *
+ * The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
+ * and groups the input samples around the clusters. As an output, \(\texttt{bestLabels}_i\) contains a
+ * 0-based cluster index for the sample stored in the \(i^{th}\) row of the samples matrix.
+ *
+ * Note:
+ *
+ * -
+ * (Python) An example on K-means clustering can be found at
+ * opencv_source_code/samples/python/kmeans.py
+ * @param data Data for clustering. An array of N-Dimensional points with float coordinates is needed.
+ * Examples of this array can be:
+ *
+ * -
+ * Mat points(count, 2, CV_32F);
+ *
+ * -
+ * Mat points(count, 1, CV_32FC2);
+ *
+ * -
+ * Mat points(1, count, CV_32FC2);
+ *
+ * -
+ * std::vector<cv::Point2f> points(sampleCount);
+ * @param K Number of clusters to split the set by.
+ * @param bestLabels Input/output integer array that stores the cluster indices for every sample.
+ * @param criteria The algorithm termination criteria, that is, the maximum number of iterations and/or
+ * the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster
+ * centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
+ * @param attempts Flag to specify the number of times the algorithm is executed using different
+ * initial labellings. The algorithm returns the labels that yield the best compactness (see the last
+ * function parameter).
+ * @param flags Flag that can take values of cv::KmeansFlags
+ * @param centers Output matrix of the cluster centers, one row per each cluster center.
+ * @return The function returns the compactness measure that is computed as
+ * \(\sum _i \| \texttt{samples} _i - \texttt{centers} _{ \texttt{labels} _i} \| ^2\)
+ * after every attempt. The best (minimum) value is chosen and the corresponding labels and the
+ * compactness value are returned by the function. Basically, you can use only the core of the
+ * function, set the number of attempts to 1, initialize labels each time using a custom algorithm,
+ * pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best
+ * (most-compact) clustering.
+ *
+ *
+ */
+ public static double kmeans(Mat data, int K, Mat bestLabels, TermCriteria criteria, int attempts, int flags, Mat centers) {
+ return kmeans_0(data.nativeObj, K, bestLabels.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon, attempts, flags, centers.nativeObj);
+ }
+
+ /**
+ * Finds centers of clusters and groups input samples around the clusters.
+ *
+ * The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
+ * and groups the input samples around the clusters. As an output, \(\texttt{bestLabels}_i\) contains a
+ * 0-based cluster index for the sample stored in the \(i^{th}\) row of the samples matrix.
+ *
+ * Note:
+ *
+ * -
+ * (Python) An example on K-means clustering can be found at
+ * opencv_source_code/samples/python/kmeans.py
+ * @param data Data for clustering. An array of N-Dimensional points with float coordinates is needed.
+ * Examples of this array can be:
+ *
+ * -
+ * Mat points(count, 2, CV_32F);
+ *
+ * -
+ * Mat points(count, 1, CV_32FC2);
+ *
+ * -
+ * Mat points(1, count, CV_32FC2);
+ *
+ * -
+ * std::vector<cv::Point2f> points(sampleCount);
+ * @param K Number of clusters to split the set by.
+ * @param bestLabels Input/output integer array that stores the cluster indices for every sample.
+ * @param criteria The algorithm termination criteria, that is, the maximum number of iterations and/or
+ * the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster
+ * centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
+ * @param attempts Flag to specify the number of times the algorithm is executed using different
+ * initial labellings. The algorithm returns the labels that yield the best compactness (see the last
+ * function parameter).
+ * @param flags Flag that can take values of cv::KmeansFlags
+ * @return The function returns the compactness measure that is computed as
+ * \(\sum _i \| \texttt{samples} _i - \texttt{centers} _{ \texttt{labels} _i} \| ^2\)
+ * after every attempt. The best (minimum) value is chosen and the corresponding labels and the
+ * compactness value are returned by the function. Basically, you can use only the core of the
+ * function, set the number of attempts to 1, initialize labels each time using a custom algorithm,
+ * pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best
+ * (most-compact) clustering.
+ *
+ *
+ */
+ public static double kmeans(Mat data, int K, Mat bestLabels, TermCriteria criteria, int attempts, int flags) {
+ return kmeans_1(data.nativeObj, K, bestLabels.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon, attempts, flags);
+ }
+
+
+ //
+ // C++: void cv::setNumThreads(int nthreads)
+ //
+
+ /**
+ * OpenCV will try to set the number of threads for the next parallel region.
+ *
+ * If threads == 0, OpenCV will disable threading optimizations and run all it's functions
+ * sequentially. Passing threads < 0 will reset threads number to system default. This function must
+ * be called outside of parallel region.
+ *
+ * OpenCV will try to run its functions with specified threads number, but some behaviour differs from
+ * framework:
+ *
+ * -
+ * {@code TBB} - User-defined parallel constructions will run with the same threads number, if
+ * another is not specified. If later on user creates his own scheduler, OpenCV will use it.
+ *
+ * -
+ * {@code OpenMP} - No special defined behaviour.
+ *
+ * -
+ * {@code Concurrency} - If threads == 1, OpenCV will disable threading optimizations and run its
+ * functions sequentially.
+ *
+ * -
+ * {@code GCD} - Supports only values <= 0.
+ *
+ * -
+ * {@code C=} - No special defined behaviour.
+ * @param nthreads Number of threads used by OpenCV.
+ * SEE: getNumThreads, getThreadNum
+ *
+ *
+ */
+ public static void setNumThreads(int nthreads) {
+ setNumThreads_0(nthreads);
+ }
+
+
+ //
+ // C++: int cv::getNumThreads()
+ //
+
+ /**
+ * Returns the number of threads used by OpenCV for parallel regions.
+ *
+ * Always returns 1 if OpenCV is built without threading support.
+ *
+ * The exact meaning of return value depends on the threading framework used by OpenCV library:
+ *
+ * -
+ * {@code TBB} - The number of threads, that OpenCV will try to use for parallel regions. If there is
+ * any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns
+ * default number of threads used by TBB library.
+ *
+ * -
+ * {@code OpenMP} - An upper bound on the number of threads that could be used to form a new team.
+ *
+ * -
+ * {@code Concurrency} - The number of threads, that OpenCV will try to use for parallel regions.
+ *
+ * -
+ * {@code GCD} - Unsupported; returns the GCD thread pool limit (512) for compatibility.
+ *
+ * -
+ * {@code C=} - The number of threads, that OpenCV will try to use for parallel regions, if before
+ * called setNumThreads with threads > 0, otherwise returns the number of logical CPUs,
+ * available for the process.
+ * SEE: setNumThreads, getThreadNum
+ *
+ *
+ * @return automatically generated
+ */
+ public static int getNumThreads() {
+ return getNumThreads_0();
+ }
+
+
+ //
+ // C++: int cv::getThreadNum()
+ //
+
+ /**
+ * Returns the index of the currently executed thread within the current parallel region. Always
+ * returns 0 if called outside of parallel region.
+ *
+ * @deprecated Current implementation doesn't corresponding to this documentation.
+ *
+ * The exact meaning of the return value depends on the threading framework used by OpenCV library:
+ *
+ * -
+ * {@code TBB} - Unsupported with current 4.1 TBB release. Maybe will be supported in future.
+ *
+ * -
+ * {@code OpenMP} - The thread number, within the current team, of the calling thread.
+ *
+ * -
+ * {@code Concurrency} - An ID for the virtual processor that the current context is executing on (0
+ * for master thread and unique number for others, but not necessary 1,2,3,...).
+ *
+ * -
+ * {@code GCD} - System calling thread's ID. Never returns 0 inside parallel region.
+ *
+ * -
+ * {@code C=} - The index of the current parallel task.
+ * SEE: setNumThreads, getNumThreads
+ *
+ *
+ * @return automatically generated
+ */
+ @Deprecated
+ public static int getThreadNum() {
+ return getThreadNum_0();
+ }
+
+
+ //
+ // C++: String cv::getBuildInformation()
+ //
+
+ /**
+ * Returns full configuration time cmake output.
+ *
+ * Returned value is raw cmake output including version control system revision, compiler version,
+ * compiler flags, enabled modules and third party libraries, etc. Output format depends on target
+ * architecture.
+ * @return automatically generated
+ */
+ public static String getBuildInformation() {
+ return getBuildInformation_0();
+ }
+
+
+ //
+ // C++: String cv::getVersionString()
+ //
+
+ /**
+ * Returns library version string
+ *
+ * For example "3.4.1-dev".
+ *
+ * SEE: getMajorVersion, getMinorVersion, getRevisionVersion
+ * @return automatically generated
+ */
+ public static String getVersionString() {
+ return getVersionString_0();
+ }
+
+
+ //
+ // C++: int cv::getVersionMajor()
+ //
+
+ /**
+ * Returns major library version
+ * @return automatically generated
+ */
+ public static int getVersionMajor() {
+ return getVersionMajor_0();
+ }
+
+
+ //
+ // C++: int cv::getVersionMinor()
+ //
+
+ /**
+ * Returns minor library version
+ * @return automatically generated
+ */
+ public static int getVersionMinor() {
+ return getVersionMinor_0();
+ }
+
+
+ //
+ // C++: int cv::getVersionRevision()
+ //
+
+ /**
+ * Returns revision field of the library version
+ * @return automatically generated
+ */
+ public static int getVersionRevision() {
+ return getVersionRevision_0();
+ }
+
+
+ //
+ // C++: int64 cv::getTickCount()
+ //
+
+ /**
+ * Returns the number of ticks.
+ *
+ * The function returns the number of ticks after the certain event (for example, when the machine was
+ * turned on). It can be used to initialize RNG or to measure a function execution time by reading the
+ * tick count before and after the function call.
+ * SEE: getTickFrequency, TickMeter
+ * @return automatically generated
+ */
+ public static long getTickCount() {
+ return getTickCount_0();
+ }
+
+
+ //
+ // C++: double cv::getTickFrequency()
+ //
+
+ /**
+ * Returns the number of ticks per second.
+ *
+ * The function returns the number of ticks per second. That is, the following code computes the
+ * execution time in seconds:
+ *
+ * double t = (double)getTickCount();
+ * // do something ...
+ * t = ((double)getTickCount() - t)/getTickFrequency();
+ *
+ * SEE: getTickCount, TickMeter
+ * @return automatically generated
+ */
+ public static double getTickFrequency() {
+ return getTickFrequency_0();
+ }
+
+
+ //
+ // C++: int64 cv::getCPUTickCount()
+ //
+
+ /**
+ * Returns the number of CPU ticks.
+ *
+ * The function returns the current number of CPU ticks on some architectures (such as x86, x64,
+ * PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for
+ * very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU
+ * systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU
+ * with its own counter. So, theoretically (and practically) the subsequent calls to the function do
+ * not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU
+ * frequency depending on the load, the number of CPU clocks spent in some code cannot be directly
+ * converted to time units. Therefore, getTickCount is generally a preferable solution for measuring
+ * execution time.
+ * @return automatically generated
+ */
+ public static long getCPUTickCount() {
+ return getCPUTickCount_0();
+ }
+
+
+ //
+ // C++: String cv::getHardwareFeatureName(int feature)
+ //
+
+ /**
+ * Returns feature name by ID
+ *
+ * Returns empty string if feature is not defined
+ * @param feature automatically generated
+ * @return automatically generated
+ */
+ public static String getHardwareFeatureName(int feature) {
+ return getHardwareFeatureName_0(feature);
+ }
+
+
+ //
+ // C++: string cv::getCPUFeaturesLine()
+ //
+
+ // Return type 'string' is not supported, skipping the function
+
+
+ //
+ // C++: int cv::getNumberOfCPUs()
+ //
+
+ /**
+ * Returns the number of logical CPUs available for the process.
+ * @return automatically generated
+ */
+ public static int getNumberOfCPUs() {
+ return getNumberOfCPUs_0();
+ }
+
+
+ //
+ // C++: String cv::samples::findFile(String relative_path, bool required = true, bool silentMode = false)
+ //
+
+ /**
+ * Try to find requested data file
+ *
+ * Search directories:
+ *
+ * 1. Directories passed via {@code addSamplesDataSearchPath()}
+ * 2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
+ * 3. OPENCV_SAMPLES_DATA_PATH environment variable
+ * If parameter value is not empty and nothing is found then stop searching.
+ * 4. Detects build/install path based on:
+ * a. current working directory (CWD)
+ * b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
+ * 5. Scan {@code <source>/{,data,samples/data}} directories if build directory is detected or the current directory is in source tree.
+ * 6. Scan {@code <install>/share/OpenCV} directory if install directory is detected.
+ *
+ * SEE: cv::utils::findDataFile
+ *
+ * @param relative_path Relative path to data file
+ * @param required Specify "file not found" handling.
+ * If true, function prints information message and raises cv::Exception.
+ * If false, function returns empty result
+ * @param silentMode Disables messages
+ * @return Returns path (absolute or relative to the current directory) or empty string if file is not found
+ */
+ public static String findFile(String relative_path, boolean required, boolean silentMode) {
+ return findFile_0(relative_path, required, silentMode);
+ }
+
+ /**
+ * Try to find requested data file
+ *
+ * Search directories:
+ *
+ * 1. Directories passed via {@code addSamplesDataSearchPath()}
+ * 2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
+ * 3. OPENCV_SAMPLES_DATA_PATH environment variable
+ * If parameter value is not empty and nothing is found then stop searching.
+ * 4. Detects build/install path based on:
+ * a. current working directory (CWD)
+ * b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
+ * 5. Scan {@code <source>/{,data,samples/data}} directories if build directory is detected or the current directory is in source tree.
+ * 6. Scan {@code <install>/share/OpenCV} directory if install directory is detected.
+ *
+ * SEE: cv::utils::findDataFile
+ *
+ * @param relative_path Relative path to data file
+ * @param required Specify "file not found" handling.
+ * If true, function prints information message and raises cv::Exception.
+ * If false, function returns empty result
+ * @return Returns path (absolute or relative to the current directory) or empty string if file is not found
+ */
+ public static String findFile(String relative_path, boolean required) {
+ return findFile_1(relative_path, required);
+ }
+
+ /**
+ * Try to find requested data file
+ *
+ * Search directories:
+ *
+ * 1. Directories passed via {@code addSamplesDataSearchPath()}
+ * 2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
+ * 3. OPENCV_SAMPLES_DATA_PATH environment variable
+ * If parameter value is not empty and nothing is found then stop searching.
+ * 4. Detects build/install path based on:
+ * a. current working directory (CWD)
+ * b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
+ * 5. Scan {@code <source>/{,data,samples/data}} directories if build directory is detected or the current directory is in source tree.
+ * 6. Scan {@code <install>/share/OpenCV} directory if install directory is detected.
+ *
+ * SEE: cv::utils::findDataFile
+ *
+ * @param relative_path Relative path to data file
+ * If true, function prints information message and raises cv::Exception.
+ * If false, function returns empty result
+ * @return Returns path (absolute or relative to the current directory) or empty string if file is not found
+ */
+ public static String findFile(String relative_path) {
+ return findFile_2(relative_path);
+ }
+
+
+ //
+ // C++: String cv::samples::findFileOrKeep(String relative_path, bool silentMode = false)
+ //
+
+ public static String findFileOrKeep(String relative_path, boolean silentMode) {
+ return findFileOrKeep_0(relative_path, silentMode);
+ }
+
+ public static String findFileOrKeep(String relative_path) {
+ return findFileOrKeep_1(relative_path);
+ }
+
+
+ //
+ // C++: void cv::samples::addSamplesDataSearchPath(String path)
+ //
+
+ /**
+ * Override search data path by adding new search location
+ *
+ * Use this only to override default behavior
+ * Passed paths are used in LIFO order.
+ *
+ * @param path Path to used samples data
+ */
+ public static void addSamplesDataSearchPath(String path) {
+ addSamplesDataSearchPath_0(path);
+ }
+
+
+ //
+ // C++: void cv::samples::addSamplesDataSearchSubDirectory(String subdir)
+ //
+
+ /**
+ * Append samples search data sub directory
+ *
+ * General usage is to add OpenCV modules name ({@code <opencv_contrib>/modules/<name>/samples/data} -> {@code <name>/samples/data} + {@code modules/<name>/samples/data}).
+ * Passed subdirectories are used in LIFO order.
+ *
+ * @param subdir samples data sub directory
+ */
+ public static void addSamplesDataSearchSubDirectory(String subdir) {
+ addSamplesDataSearchSubDirectory_0(subdir);
+ }
+
+
+ //
+ // C++: void cv::setErrorVerbosity(bool verbose)
+ //
+
+ public static void setErrorVerbosity(boolean verbose) {
+ setErrorVerbosity_0(verbose);
+ }
+
+
+ //
+ // C++: void cv::add(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ //
+
+ public static void add(Mat src1, Scalar src2, Mat dst, Mat mask, int dtype) {
+ add_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj, dtype);
+ }
+
+ public static void add(Mat src1, Scalar src2, Mat dst, Mat mask) {
+ add_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj);
+ }
+
+ public static void add(Mat src1, Scalar src2, Mat dst) {
+ add_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::subtract(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ //
+
+ public static void subtract(Mat src1, Scalar src2, Mat dst, Mat mask, int dtype) {
+ subtract_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj, dtype);
+ }
+
+ public static void subtract(Mat src1, Scalar src2, Mat dst, Mat mask) {
+ subtract_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj);
+ }
+
+ public static void subtract(Mat src1, Scalar src2, Mat dst) {
+ subtract_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::multiply(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
+ //
+
+ public static void multiply(Mat src1, Scalar src2, Mat dst, double scale, int dtype) {
+ multiply_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale, dtype);
+ }
+
+ public static void multiply(Mat src1, Scalar src2, Mat dst, double scale) {
+ multiply_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale);
+ }
+
+ public static void multiply(Mat src1, Scalar src2, Mat dst) {
+ multiply_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::divide(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
+ //
+
+ public static void divide(Mat src1, Scalar src2, Mat dst, double scale, int dtype) {
+ divide_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale, dtype);
+ }
+
+ public static void divide(Mat src1, Scalar src2, Mat dst, double scale) {
+ divide_6(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale);
+ }
+
+ public static void divide(Mat src1, Scalar src2, Mat dst) {
+ divide_7(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::absdiff(Mat src1, Scalar src2, Mat& dst)
+ //
+
+ public static void absdiff(Mat src1, Scalar src2, Mat dst) {
+ absdiff_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::compare(Mat src1, Scalar src2, Mat& dst, int cmpop)
+ //
+
+ public static void compare(Mat src1, Scalar src2, Mat dst, int cmpop) {
+ compare_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, cmpop);
+ }
+
+
+ //
+ // C++: void cv::min(Mat src1, Scalar src2, Mat& dst)
+ //
+
+ public static void min(Mat src1, Scalar src2, Mat dst) {
+ min_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::max(Mat src1, Scalar src2, Mat& dst)
+ //
+
+ public static void max(Mat src1, Scalar src2, Mat dst) {
+ max_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+ }
+
+// manual port
+public static class MinMaxLocResult {
+ public double minVal;
+ public double maxVal;
+ public Point minLoc;
+ public Point maxLoc;
+
+
+ public MinMaxLocResult() {
+ minVal=0; maxVal=0;
+ minLoc=new Point();
+ maxLoc=new Point();
+ }
+}
+
+
+// C++: minMaxLoc(Mat src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray())
+
+
+//javadoc: minMaxLoc(src, mask)
+public static MinMaxLocResult minMaxLoc(Mat src, Mat mask) {
+ MinMaxLocResult res = new MinMaxLocResult();
+ long maskNativeObj=0;
+ if (mask != null) {
+ maskNativeObj=mask.nativeObj;
+ }
+ double resarr[] = n_minMaxLocManual(src.nativeObj, maskNativeObj);
+ res.minVal=resarr[0];
+ res.maxVal=resarr[1];
+ res.minLoc.x=resarr[2];
+ res.minLoc.y=resarr[3];
+ res.maxLoc.x=resarr[4];
+ res.maxLoc.y=resarr[5];
+ return res;
+}
+
+
+//javadoc: minMaxLoc(src)
+public static MinMaxLocResult minMaxLoc(Mat src) {
+ return minMaxLoc(src, null);
+}
+
+
+ // C++: float cv::cubeRoot(float val)
+ private static native float cubeRoot_0(float val);
+
+ // C++: float cv::fastAtan2(float y, float x)
+ private static native float fastAtan2_0(float y, float x);
+
+ // C++: bool cv::ipp::useIPP()
+ private static native boolean useIPP_0();
+
+ // C++: void cv::ipp::setUseIPP(bool flag)
+ private static native void setUseIPP_0(boolean flag);
+
+ // C++: String cv::ipp::getIppVersion()
+ private static native String getIppVersion_0();
+
+ // C++: bool cv::ipp::useIPP_NotExact()
+ private static native boolean useIPP_NotExact_0();
+
+ // C++: void cv::ipp::setUseIPP_NotExact(bool flag)
+ private static native void setUseIPP_NotExact_0(boolean flag);
+
+ // C++: bool cv::ipp::useIPP_NE()
+ private static native boolean useIPP_NE_0();
+
+ // C++: void cv::ipp::setUseIPP_NE(bool flag)
+ private static native void setUseIPP_NE_0(boolean flag);
+
+ // C++: int cv::borderInterpolate(int p, int len, int borderType)
+ private static native int borderInterpolate_0(int p, int len, int borderType);
+
+ // C++: void cv::copyMakeBorder(Mat src, Mat& dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar())
+ 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);
+ private static native void copyMakeBorder_1(long src_nativeObj, long dst_nativeObj, int top, int bottom, int left, int right, int borderType);
+
+ // C++: void cv::add(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ private static native void add_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj, int dtype);
+ private static native void add_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void add_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::subtract(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ private static native void subtract_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj, int dtype);
+ private static native void subtract_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void subtract_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::multiply(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
+ private static native void multiply_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale, int dtype);
+ private static native void multiply_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale);
+ private static native void multiply_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::divide(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
+ private static native void divide_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale, int dtype);
+ private static native void divide_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale);
+ private static native void divide_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::divide(double scale, Mat src2, Mat& dst, int dtype = -1)
+ private static native void divide_3(double scale, long src2_nativeObj, long dst_nativeObj, int dtype);
+ private static native void divide_4(double scale, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::scaleAdd(Mat src1, double alpha, Mat src2, Mat& dst)
+ private static native void scaleAdd_0(long src1_nativeObj, double alpha, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat& dst, int dtype = -1)
+ private static native void addWeighted_0(long src1_nativeObj, double alpha, long src2_nativeObj, double beta, double gamma, long dst_nativeObj, int dtype);
+ private static native void addWeighted_1(long src1_nativeObj, double alpha, long src2_nativeObj, double beta, double gamma, long dst_nativeObj);
+
+ // C++: void cv::convertScaleAbs(Mat src, Mat& dst, double alpha = 1, double beta = 0)
+ private static native void convertScaleAbs_0(long src_nativeObj, long dst_nativeObj, double alpha, double beta);
+ private static native void convertScaleAbs_1(long src_nativeObj, long dst_nativeObj, double alpha);
+ private static native void convertScaleAbs_2(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::convertFp16(Mat src, Mat& dst)
+ private static native void convertFp16_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::LUT(Mat src, Mat lut, Mat& dst)
+ private static native void LUT_0(long src_nativeObj, long lut_nativeObj, long dst_nativeObj);
+
+ // C++: Scalar cv::sum(Mat src)
+ private static native double[] sumElems_0(long src_nativeObj);
+
+ // C++: int cv::countNonZero(Mat src)
+ private static native int countNonZero_0(long src_nativeObj);
+
+ // C++: void cv::findNonZero(Mat src, Mat& idx)
+ private static native void findNonZero_0(long src_nativeObj, long idx_nativeObj);
+
+ // C++: Scalar cv::mean(Mat src, Mat mask = Mat())
+ private static native double[] mean_0(long src_nativeObj, long mask_nativeObj);
+ private static native double[] mean_1(long src_nativeObj);
+
+ // C++: void cv::meanStdDev(Mat src, vector_double& mean, vector_double& stddev, Mat mask = Mat())
+ private static native void meanStdDev_0(long src_nativeObj, long mean_mat_nativeObj, long stddev_mat_nativeObj, long mask_nativeObj);
+ private static native void meanStdDev_1(long src_nativeObj, long mean_mat_nativeObj, long stddev_mat_nativeObj);
+
+ // C++: double cv::norm(Mat src1, int normType = NORM_L2, Mat mask = Mat())
+ private static native double norm_0(long src1_nativeObj, int normType, long mask_nativeObj);
+ private static native double norm_1(long src1_nativeObj, int normType);
+ private static native double norm_2(long src1_nativeObj);
+
+ // C++: double cv::norm(Mat src1, Mat src2, int normType = NORM_L2, Mat mask = Mat())
+ private static native double norm_3(long src1_nativeObj, long src2_nativeObj, int normType, long mask_nativeObj);
+ private static native double norm_4(long src1_nativeObj, long src2_nativeObj, int normType);
+ private static native double norm_5(long src1_nativeObj, long src2_nativeObj);
+
+ // C++: double cv::PSNR(Mat src1, Mat src2)
+ private static native double PSNR_0(long src1_nativeObj, long src2_nativeObj);
+
+ // 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)
+ 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);
+ 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);
+ 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);
+ private static native void batchDistance_3(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K);
+ private static native void batchDistance_4(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType);
+ private static native void batchDistance_5(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj);
+
+ // 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())
+ private static native void normalize_0(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type, int dtype, long mask_nativeObj);
+ private static native void normalize_1(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type, int dtype);
+ private static native void normalize_2(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type);
+ private static native void normalize_3(long src_nativeObj, long dst_nativeObj, double alpha, double beta);
+ private static native void normalize_4(long src_nativeObj, long dst_nativeObj, double alpha);
+ private static native void normalize_5(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::reduce(Mat src, Mat& dst, int dim, int rtype, int dtype = -1)
+ private static native void reduce_0(long src_nativeObj, long dst_nativeObj, int dim, int rtype, int dtype);
+ private static native void reduce_1(long src_nativeObj, long dst_nativeObj, int dim, int rtype);
+
+ // C++: void cv::merge(vector_Mat mv, Mat& dst)
+ private static native void merge_0(long mv_mat_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::split(Mat m, vector_Mat& mv)
+ private static native void split_0(long m_nativeObj, long mv_mat_nativeObj);
+
+ // C++: void cv::mixChannels(vector_Mat src, vector_Mat dst, vector_int fromTo)
+ private static native void mixChannels_0(long src_mat_nativeObj, long dst_mat_nativeObj, long fromTo_mat_nativeObj);
+
+ // C++: void cv::extractChannel(Mat src, Mat& dst, int coi)
+ private static native void extractChannel_0(long src_nativeObj, long dst_nativeObj, int coi);
+
+ // C++: void cv::insertChannel(Mat src, Mat& dst, int coi)
+ private static native void insertChannel_0(long src_nativeObj, long dst_nativeObj, int coi);
+
+ // C++: void cv::flip(Mat src, Mat& dst, int flipCode)
+ private static native void flip_0(long src_nativeObj, long dst_nativeObj, int flipCode);
+
+ // C++: void cv::rotate(Mat src, Mat& dst, int rotateCode)
+ private static native void rotate_0(long src_nativeObj, long dst_nativeObj, int rotateCode);
+
+ // C++: void cv::repeat(Mat src, int ny, int nx, Mat& dst)
+ private static native void repeat_0(long src_nativeObj, int ny, int nx, long dst_nativeObj);
+
+ // C++: void cv::hconcat(vector_Mat src, Mat& dst)
+ private static native void hconcat_0(long src_mat_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::vconcat(vector_Mat src, Mat& dst)
+ private static native void vconcat_0(long src_mat_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::bitwise_and(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ private static native void bitwise_and_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void bitwise_and_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::bitwise_or(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ private static native void bitwise_or_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void bitwise_or_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::bitwise_xor(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ private static native void bitwise_xor_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void bitwise_xor_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::bitwise_not(Mat src, Mat& dst, Mat mask = Mat())
+ private static native void bitwise_not_0(long src_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void bitwise_not_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::absdiff(Mat src1, Mat src2, Mat& dst)
+ private static native void absdiff_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::inRange(Mat src, Scalar lowerb, Scalar upperb, Mat& dst)
+ 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);
+
+ // C++: void cv::compare(Mat src1, Mat src2, Mat& dst, int cmpop)
+ private static native void compare_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, int cmpop);
+
+ // C++: void cv::min(Mat src1, Mat src2, Mat& dst)
+ private static native void min_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::max(Mat src1, Mat src2, Mat& dst)
+ private static native void max_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::sqrt(Mat src, Mat& dst)
+ private static native void sqrt_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::pow(Mat src, double power, Mat& dst)
+ private static native void pow_0(long src_nativeObj, double power, long dst_nativeObj);
+
+ // C++: void cv::exp(Mat src, Mat& dst)
+ private static native void exp_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::log(Mat src, Mat& dst)
+ private static native void log_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::polarToCart(Mat magnitude, Mat angle, Mat& x, Mat& y, bool angleInDegrees = false)
+ private static native void polarToCart_0(long magnitude_nativeObj, long angle_nativeObj, long x_nativeObj, long y_nativeObj, boolean angleInDegrees);
+ private static native void polarToCart_1(long magnitude_nativeObj, long angle_nativeObj, long x_nativeObj, long y_nativeObj);
+
+ // C++: void cv::cartToPolar(Mat x, Mat y, Mat& magnitude, Mat& angle, bool angleInDegrees = false)
+ private static native void cartToPolar_0(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj, long angle_nativeObj, boolean angleInDegrees);
+ private static native void cartToPolar_1(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj, long angle_nativeObj);
+
+ // C++: void cv::phase(Mat x, Mat y, Mat& angle, bool angleInDegrees = false)
+ private static native void phase_0(long x_nativeObj, long y_nativeObj, long angle_nativeObj, boolean angleInDegrees);
+ private static native void phase_1(long x_nativeObj, long y_nativeObj, long angle_nativeObj);
+
+ // C++: void cv::magnitude(Mat x, Mat y, Mat& magnitude)
+ private static native void magnitude_0(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj);
+
+ // C++: bool cv::checkRange(Mat a, bool quiet = true, _hidden_ * pos = 0, double minVal = -DBL_MAX, double maxVal = DBL_MAX)
+ private static native boolean checkRange_0(long a_nativeObj, boolean quiet, double minVal, double maxVal);
+ private static native boolean checkRange_1(long a_nativeObj, boolean quiet, double minVal);
+ private static native boolean checkRange_2(long a_nativeObj, boolean quiet);
+ private static native boolean checkRange_4(long a_nativeObj);
+
+ // C++: void cv::patchNaNs(Mat& a, double val = 0)
+ private static native void patchNaNs_0(long a_nativeObj, double val);
+ private static native void patchNaNs_1(long a_nativeObj);
+
+ // C++: void cv::gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat& dst, int flags = 0)
+ private static native void gemm_0(long src1_nativeObj, long src2_nativeObj, double alpha, long src3_nativeObj, double beta, long dst_nativeObj, int flags);
+ private static native void gemm_1(long src1_nativeObj, long src2_nativeObj, double alpha, long src3_nativeObj, double beta, long dst_nativeObj);
+
+ // C++: void cv::mulTransposed(Mat src, Mat& dst, bool aTa, Mat delta = Mat(), double scale = 1, int dtype = -1)
+ private static native void mulTransposed_0(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj, double scale, int dtype);
+ private static native void mulTransposed_1(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj, double scale);
+ private static native void mulTransposed_2(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj);
+ private static native void mulTransposed_3(long src_nativeObj, long dst_nativeObj, boolean aTa);
+
+ // C++: void cv::transpose(Mat src, Mat& dst)
+ private static native void transpose_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::transform(Mat src, Mat& dst, Mat m)
+ private static native void transform_0(long src_nativeObj, long dst_nativeObj, long m_nativeObj);
+
+ // C++: void cv::perspectiveTransform(Mat src, Mat& dst, Mat m)
+ private static native void perspectiveTransform_0(long src_nativeObj, long dst_nativeObj, long m_nativeObj);
+
+ // C++: void cv::completeSymm(Mat& m, bool lowerToUpper = false)
+ private static native void completeSymm_0(long m_nativeObj, boolean lowerToUpper);
+ private static native void completeSymm_1(long m_nativeObj);
+
+ // C++: void cv::setIdentity(Mat& mtx, Scalar s = Scalar(1))
+ private static native void setIdentity_0(long mtx_nativeObj, double s_val0, double s_val1, double s_val2, double s_val3);
+ private static native void setIdentity_1(long mtx_nativeObj);
+
+ // C++: double cv::determinant(Mat mtx)
+ private static native double determinant_0(long mtx_nativeObj);
+
+ // C++: Scalar cv::trace(Mat mtx)
+ private static native double[] trace_0(long mtx_nativeObj);
+
+ // C++: double cv::invert(Mat src, Mat& dst, int flags = DECOMP_LU)
+ private static native double invert_0(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native double invert_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: bool cv::solve(Mat src1, Mat src2, Mat& dst, int flags = DECOMP_LU)
+ private static native boolean solve_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, int flags);
+ private static native boolean solve_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::sort(Mat src, Mat& dst, int flags)
+ private static native void sort_0(long src_nativeObj, long dst_nativeObj, int flags);
+
+ // C++: void cv::sortIdx(Mat src, Mat& dst, int flags)
+ private static native void sortIdx_0(long src_nativeObj, long dst_nativeObj, int flags);
+
+ // C++: int cv::solveCubic(Mat coeffs, Mat& roots)
+ private static native int solveCubic_0(long coeffs_nativeObj, long roots_nativeObj);
+
+ // C++: double cv::solvePoly(Mat coeffs, Mat& roots, int maxIters = 300)
+ private static native double solvePoly_0(long coeffs_nativeObj, long roots_nativeObj, int maxIters);
+ private static native double solvePoly_1(long coeffs_nativeObj, long roots_nativeObj);
+
+ // C++: bool cv::eigen(Mat src, Mat& eigenvalues, Mat& eigenvectors = Mat())
+ private static native boolean eigen_0(long src_nativeObj, long eigenvalues_nativeObj, long eigenvectors_nativeObj);
+ private static native boolean eigen_1(long src_nativeObj, long eigenvalues_nativeObj);
+
+ // C++: void cv::eigenNonSymmetric(Mat src, Mat& eigenvalues, Mat& eigenvectors)
+ private static native void eigenNonSymmetric_0(long src_nativeObj, long eigenvalues_nativeObj, long eigenvectors_nativeObj);
+
+ // C++: void cv::calcCovarMatrix(Mat samples, Mat& covar, Mat& mean, int flags, int ctype = CV_64F)
+ private static native void calcCovarMatrix_0(long samples_nativeObj, long covar_nativeObj, long mean_nativeObj, int flags, int ctype);
+ private static native void calcCovarMatrix_1(long samples_nativeObj, long covar_nativeObj, long mean_nativeObj, int flags);
+
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, int maxComponents = 0)
+ private static native void PCACompute_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, int maxComponents);
+ private static native void PCACompute_1(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj);
+
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, int maxComponents = 0)
+ private static native void PCACompute2_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj, int maxComponents);
+ private static native void PCACompute2_1(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj);
+
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, double retainedVariance)
+ private static native void PCACompute_2(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, double retainedVariance);
+
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, double retainedVariance)
+ private static native void PCACompute2_2(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj, double retainedVariance);
+
+ // C++: void cv::PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
+ private static native void PCAProject_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long result_nativeObj);
+
+ // C++: void cv::PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
+ private static native void PCABackProject_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long result_nativeObj);
+
+ // C++: void cv::SVDecomp(Mat src, Mat& w, Mat& u, Mat& vt, int flags = 0)
+ private static native void SVDecomp_0(long src_nativeObj, long w_nativeObj, long u_nativeObj, long vt_nativeObj, int flags);
+ private static native void SVDecomp_1(long src_nativeObj, long w_nativeObj, long u_nativeObj, long vt_nativeObj);
+
+ // C++: void cv::SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat& dst)
+ private static native void SVBackSubst_0(long w_nativeObj, long u_nativeObj, long vt_nativeObj, long rhs_nativeObj, long dst_nativeObj);
+
+ // C++: double cv::Mahalanobis(Mat v1, Mat v2, Mat icovar)
+ private static native double Mahalanobis_0(long v1_nativeObj, long v2_nativeObj, long icovar_nativeObj);
+
+ // C++: void cv::dft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
+ private static native void dft_0(long src_nativeObj, long dst_nativeObj, int flags, int nonzeroRows);
+ private static native void dft_1(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native void dft_2(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::idft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
+ private static native void idft_0(long src_nativeObj, long dst_nativeObj, int flags, int nonzeroRows);
+ private static native void idft_1(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native void idft_2(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::dct(Mat src, Mat& dst, int flags = 0)
+ private static native void dct_0(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native void dct_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::idct(Mat src, Mat& dst, int flags = 0)
+ private static native void idct_0(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native void idct_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::mulSpectrums(Mat a, Mat b, Mat& c, int flags, bool conjB = false)
+ private static native void mulSpectrums_0(long a_nativeObj, long b_nativeObj, long c_nativeObj, int flags, boolean conjB);
+ private static native void mulSpectrums_1(long a_nativeObj, long b_nativeObj, long c_nativeObj, int flags);
+
+ // C++: int cv::getOptimalDFTSize(int vecsize)
+ private static native int getOptimalDFTSize_0(int vecsize);
+
+ // C++: void cv::setRNGSeed(int seed)
+ private static native void setRNGSeed_0(int seed);
+
+ // C++: void cv::randu(Mat& dst, double low, double high)
+ private static native void randu_0(long dst_nativeObj, double low, double high);
+
+ // C++: void cv::randn(Mat& dst, double mean, double stddev)
+ private static native void randn_0(long dst_nativeObj, double mean, double stddev);
+
+ // C++: void cv::randShuffle(Mat& dst, double iterFactor = 1., RNG* rng = 0)
+ private static native void randShuffle_0(long dst_nativeObj, double iterFactor);
+ private static native void randShuffle_2(long dst_nativeObj);
+
+ // C++: double cv::kmeans(Mat data, int K, Mat& bestLabels, TermCriteria criteria, int attempts, int flags, Mat& centers = Mat())
+ 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);
+ 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);
+
+ // C++: void cv::setNumThreads(int nthreads)
+ private static native void setNumThreads_0(int nthreads);
+
+ // C++: int cv::getNumThreads()
+ private static native int getNumThreads_0();
+
+ // C++: int cv::getThreadNum()
+ private static native int getThreadNum_0();
+
+ // C++: String cv::getBuildInformation()
+ private static native String getBuildInformation_0();
+
+ // C++: String cv::getVersionString()
+ private static native String getVersionString_0();
+
+ // C++: int cv::getVersionMajor()
+ private static native int getVersionMajor_0();
+
+ // C++: int cv::getVersionMinor()
+ private static native int getVersionMinor_0();
+
+ // C++: int cv::getVersionRevision()
+ private static native int getVersionRevision_0();
+
+ // C++: int64 cv::getTickCount()
+ private static native long getTickCount_0();
+
+ // C++: double cv::getTickFrequency()
+ private static native double getTickFrequency_0();
+
+ // C++: int64 cv::getCPUTickCount()
+ private static native long getCPUTickCount_0();
+
+ // C++: String cv::getHardwareFeatureName(int feature)
+ private static native String getHardwareFeatureName_0(int feature);
+
+ // C++: int cv::getNumberOfCPUs()
+ private static native int getNumberOfCPUs_0();
+
+ // C++: String cv::samples::findFile(String relative_path, bool required = true, bool silentMode = false)
+ private static native String findFile_0(String relative_path, boolean required, boolean silentMode);
+ private static native String findFile_1(String relative_path, boolean required);
+ private static native String findFile_2(String relative_path);
+
+ // C++: String cv::samples::findFileOrKeep(String relative_path, bool silentMode = false)
+ private static native String findFileOrKeep_0(String relative_path, boolean silentMode);
+ private static native String findFileOrKeep_1(String relative_path);
+
+ // C++: void cv::samples::addSamplesDataSearchPath(String path)
+ private static native void addSamplesDataSearchPath_0(String path);
+
+ // C++: void cv::samples::addSamplesDataSearchSubDirectory(String subdir)
+ private static native void addSamplesDataSearchSubDirectory_0(String subdir);
+
+ // C++: void cv::setErrorVerbosity(bool verbose)
+ private static native void setErrorVerbosity_0(boolean verbose);
+
+ // C++: void cv::add(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ 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);
+ 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);
+ private static native void add_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::subtract(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ 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);
+ 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);
+ private static native void subtract_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::multiply(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
+ 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);
+ 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);
+ private static native void multiply_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::divide(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
+ 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);
+ 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);
+ private static native void divide_7(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::absdiff(Mat src1, Scalar src2, Mat& dst)
+ private static native void absdiff_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::compare(Mat src1, Scalar src2, Mat& dst, int cmpop)
+ 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);
+
+ // C++: void cv::min(Mat src1, Scalar src2, Mat& dst)
+ private static native void min_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::max(Mat src1, Scalar src2, Mat& dst)
+ private static native void max_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+private static native double[] n_minMaxLocManual(long src_nativeObj, long mask_nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/CvException.java b/openCVLibrary3413/src/main/java/org/opencv/core/CvException.java
new file mode 100644
index 0000000..e9241e6
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/CvException.java
@@ -0,0 +1,15 @@
+package org.opencv.core;
+
+public class CvException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public CvException(String msg) {
+ super(msg);
+ }
+
+ @Override
+ public String toString() {
+ return "CvException [" + super.toString() + "]";
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/CvType.java b/openCVLibrary3413/src/main/java/org/opencv/core/CvType.java
new file mode 100644
index 0000000..3b19679
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/CvType.java
@@ -0,0 +1,136 @@
+package org.opencv.core;
+
+public final class CvType {
+
+ // type depth constants
+ public static final int
+ CV_8U = 0, CV_8S = 1,
+ CV_16U = 2, CV_16S = 3,
+ CV_32S = 4,
+ CV_32F = 5,
+ CV_64F = 6,
+ CV_USRTYPE1 = 7;
+
+ // predefined type constants
+ public static final int
+ CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
+ CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
+ CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
+ CV_16SC1 = CV_16SC(1), CV_16SC2 = CV_16SC(2), CV_16SC3 = CV_16SC(3), CV_16SC4 = CV_16SC(4),
+ CV_32SC1 = CV_32SC(1), CV_32SC2 = CV_32SC(2), CV_32SC3 = CV_32SC(3), CV_32SC4 = CV_32SC(4),
+ CV_32FC1 = CV_32FC(1), CV_32FC2 = CV_32FC(2), CV_32FC3 = CV_32FC(3), CV_32FC4 = CV_32FC(4),
+ CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4);
+
+ private static final int CV_CN_MAX = 512, CV_CN_SHIFT = 3, CV_DEPTH_MAX = (1 << CV_CN_SHIFT);
+
+ public static final int makeType(int depth, int channels) {
+ if (channels <= 0 || channels >= CV_CN_MAX) {
+ throw new UnsupportedOperationException(
+ "Channels count should be 1.." + (CV_CN_MAX - 1));
+ }
+ if (depth < 0 || depth >= CV_DEPTH_MAX) {
+ throw new UnsupportedOperationException(
+ "Data type depth should be 0.." + (CV_DEPTH_MAX - 1));
+ }
+ return (depth & (CV_DEPTH_MAX - 1)) + ((channels - 1) << CV_CN_SHIFT);
+ }
+
+ public static final int CV_8UC(int ch) {
+ return makeType(CV_8U, ch);
+ }
+
+ public static final int CV_8SC(int ch) {
+ return makeType(CV_8S, ch);
+ }
+
+ public static final int CV_16UC(int ch) {
+ return makeType(CV_16U, ch);
+ }
+
+ public static final int CV_16SC(int ch) {
+ return makeType(CV_16S, ch);
+ }
+
+ public static final int CV_32SC(int ch) {
+ return makeType(CV_32S, ch);
+ }
+
+ public static final int CV_32FC(int ch) {
+ return makeType(CV_32F, ch);
+ }
+
+ public static final int CV_64FC(int ch) {
+ return makeType(CV_64F, ch);
+ }
+
+ public static final int channels(int type) {
+ return (type >> CV_CN_SHIFT) + 1;
+ }
+
+ public static final int depth(int type) {
+ return type & (CV_DEPTH_MAX - 1);
+ }
+
+ public static final boolean isInteger(int type) {
+ return depth(type) < CV_32F;
+ }
+
+ public static final int ELEM_SIZE(int type) {
+ switch (depth(type)) {
+ case CV_8U:
+ case CV_8S:
+ return channels(type);
+ case CV_16U:
+ case CV_16S:
+ return 2 * channels(type);
+ case CV_32S:
+ case CV_32F:
+ return 4 * channels(type);
+ case CV_64F:
+ return 8 * channels(type);
+ default:
+ throw new UnsupportedOperationException(
+ "Unsupported CvType value: " + type);
+ }
+ }
+
+ public static final String typeToString(int type) {
+ String s;
+ switch (depth(type)) {
+ case CV_8U:
+ s = "CV_8U";
+ break;
+ case CV_8S:
+ s = "CV_8S";
+ break;
+ case CV_16U:
+ s = "CV_16U";
+ break;
+ case CV_16S:
+ s = "CV_16S";
+ break;
+ case CV_32S:
+ s = "CV_32S";
+ break;
+ case CV_32F:
+ s = "CV_32F";
+ break;
+ case CV_64F:
+ s = "CV_64F";
+ break;
+ case CV_USRTYPE1:
+ s = "CV_USRTYPE1";
+ break;
+ default:
+ throw new UnsupportedOperationException(
+ "Unsupported CvType value: " + type);
+ }
+
+ int ch = channels(type);
+ if (ch <= 4)
+ return s + "C" + ch;
+ else
+ return s + "C(" + ch + ")";
+ }
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/DMatch.java b/openCVLibrary3413/src/main/java/org/opencv/core/DMatch.java
new file mode 100644
index 0000000..db44d9a
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/DMatch.java
@@ -0,0 +1,58 @@
+package org.opencv.core;
+
+//C++: class DMatch
+
+/**
+ * Structure for matching: query descriptor index, train descriptor index, train
+ * image index and distance between descriptors.
+ */
+public class DMatch {
+
+ /**
+ * Query descriptor index.
+ */
+ public int queryIdx;
+ /**
+ * Train descriptor index.
+ */
+ public int trainIdx;
+ /**
+ * Train image index.
+ */
+ public int imgIdx;
+
+ // javadoc: DMatch::distance
+ public float distance;
+
+ // javadoc: DMatch::DMatch()
+ public DMatch() {
+ this(-1, -1, Float.MAX_VALUE);
+ }
+
+ // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _distance)
+ public DMatch(int _queryIdx, int _trainIdx, float _distance) {
+ queryIdx = _queryIdx;
+ trainIdx = _trainIdx;
+ imgIdx = -1;
+ distance = _distance;
+ }
+
+ // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _imgIdx, _distance)
+ public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) {
+ queryIdx = _queryIdx;
+ trainIdx = _trainIdx;
+ imgIdx = _imgIdx;
+ distance = _distance;
+ }
+
+ public boolean lessThan(DMatch it) {
+ return distance < it.distance;
+ }
+
+ @Override
+ public String toString() {
+ return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx
+ + ", imgIdx=" + imgIdx + ", distance=" + distance + "]";
+ }
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/KeyPoint.java b/openCVLibrary3413/src/main/java/org/opencv/core/KeyPoint.java
new file mode 100644
index 0000000..e34d6f1
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/KeyPoint.java
@@ -0,0 +1,77 @@
+package org.opencv.core;
+
+import org.opencv.core.Point;
+
+//javadoc: KeyPoint
+public class KeyPoint {
+
+ /**
+ * Coordinates of the keypoint.
+ */
+ public Point pt;
+ /**
+ * Diameter of the useful keypoint adjacent area.
+ */
+ public float size;
+ /**
+ * Computed orientation of the keypoint (-1 if not applicable).
+ */
+ public float angle;
+ /**
+ * The response, by which the strongest keypoints have been selected. Can
+ * be used for further sorting or subsampling.
+ */
+ public float response;
+ /**
+ * Octave (pyramid layer), from which the keypoint has been extracted.
+ */
+ public int octave;
+ /**
+ * Object ID, that can be used to cluster keypoints by an object they
+ * belong to.
+ */
+ public int class_id;
+
+ // javadoc:KeyPoint::KeyPoint(x,y,_size,_angle,_response,_octave,_class_id)
+ public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) {
+ pt = new Point(x, y);
+ size = _size;
+ angle = _angle;
+ response = _response;
+ octave = _octave;
+ class_id = _class_id;
+ }
+
+ // javadoc: KeyPoint::KeyPoint()
+ public KeyPoint() {
+ this(0, 0, 0, -1, 0, 0, -1);
+ }
+
+ // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response, _octave)
+ public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave) {
+ this(x, y, _size, _angle, _response, _octave, -1);
+ }
+
+ // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response)
+ public KeyPoint(float x, float y, float _size, float _angle, float _response) {
+ this(x, y, _size, _angle, _response, 0, -1);
+ }
+
+ // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle)
+ public KeyPoint(float x, float y, float _size, float _angle) {
+ this(x, y, _size, _angle, 0, 0, -1);
+ }
+
+ // javadoc: KeyPoint::KeyPoint(x, y, _size)
+ public KeyPoint(float x, float y, float _size) {
+ this(x, y, _size, -1, 0, 0, -1);
+ }
+
+ @Override
+ public String toString() {
+ return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle
+ + ", response=" + response + ", octave=" + octave
+ + ", class_id=" + class_id + "]";
+ }
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Mat.java b/openCVLibrary3413/src/main/java/org/opencv/core/Mat.java
new file mode 100644
index 0000000..641d9f8
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Mat.java
@@ -0,0 +1,1416 @@
+package org.opencv.core;
+
+import java.nio.ByteBuffer;
+
+// C++: class Mat
+//javadoc: Mat
+public class Mat {
+
+ public final long nativeObj;
+
+ public Mat(long addr) {
+ if (addr == 0)
+ throw new UnsupportedOperationException("Native object address is NULL");
+ nativeObj = addr;
+ }
+
+ //
+ // C++: Mat::Mat()
+ //
+
+ // javadoc: Mat::Mat()
+ public Mat() {
+ nativeObj = n_Mat();
+ }
+
+ //
+ // C++: Mat::Mat(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::Mat(rows, cols, type)
+ public Mat(int rows, int cols, int type) {
+ nativeObj = n_Mat(rows, cols, type);
+ }
+
+ //
+ // C++: Mat::Mat(int rows, int cols, int type, void* data)
+ //
+
+ // javadoc: Mat::Mat(rows, cols, type, data)
+ public Mat(int rows, int cols, int type, ByteBuffer data) {
+ nativeObj = n_Mat(rows, cols, type, data);
+ }
+
+ //
+ // C++: Mat::Mat(int rows, int cols, int type, void* data, size_t step)
+ //
+
+ // javadoc: Mat::Mat(rows, cols, type, data, step)
+ public Mat(int rows, int cols, int type, ByteBuffer data, long step) {
+ nativeObj = n_Mat(rows, cols, type, data, step);
+ }
+
+ //
+ // C++: Mat::Mat(Size size, int type)
+ //
+
+ // javadoc: Mat::Mat(size, type)
+ public Mat(Size size, int type) {
+ nativeObj = n_Mat(size.width, size.height, type);
+ }
+
+ //
+ // C++: Mat::Mat(int ndims, const int* sizes, int type)
+ //
+
+ // javadoc: Mat::Mat(sizes, type)
+ public Mat(int[] sizes, int type) {
+ nativeObj = n_Mat(sizes.length, sizes, type);
+ }
+
+ //
+ // C++: Mat::Mat(int rows, int cols, int type, Scalar s)
+ //
+
+ // javadoc: Mat::Mat(rows, cols, type, s)
+ public Mat(int rows, int cols, int type, Scalar s) {
+ nativeObj = n_Mat(rows, cols, type, s.val[0], s.val[1], s.val[2], s.val[3]);
+ }
+
+ //
+ // C++: Mat::Mat(Size size, int type, Scalar s)
+ //
+
+ // javadoc: Mat::Mat(size, type, s)
+ public Mat(Size size, int type, Scalar s) {
+ nativeObj = n_Mat(size.width, size.height, type, s.val[0], s.val[1], s.val[2], s.val[3]);
+ }
+
+ //
+ // C++: Mat::Mat(int ndims, const int* sizes, int type, Scalar s)
+ //
+
+ // javadoc: Mat::Mat(sizes, type, s)
+ public Mat(int[] sizes, int type, Scalar s) {
+ nativeObj = n_Mat(sizes.length, sizes, type, s.val[0], s.val[1], s.val[2], s.val[3]);
+ }
+
+ //
+ // C++: Mat::Mat(Mat m, Range rowRange, Range colRange = Range::all())
+ //
+
+ // javadoc: Mat::Mat(m, rowRange, colRange)
+ public Mat(Mat m, Range rowRange, Range colRange) {
+ nativeObj = n_Mat(m.nativeObj, rowRange.start, rowRange.end, colRange.start, colRange.end);
+ }
+
+ // javadoc: Mat::Mat(m, rowRange)
+ public Mat(Mat m, Range rowRange) {
+ nativeObj = n_Mat(m.nativeObj, rowRange.start, rowRange.end);
+ }
+
+ //
+ // C++: Mat::Mat(const Mat& m, const std::vector& ranges)
+ //
+
+ // javadoc: Mat::Mat(m, ranges)
+ public Mat(Mat m, Range[] ranges) {
+ nativeObj = n_Mat(m.nativeObj, ranges);
+ }
+
+ //
+ // C++: Mat::Mat(Mat m, Rect roi)
+ //
+
+ // javadoc: Mat::Mat(m, roi)
+ public Mat(Mat m, Rect roi) {
+ nativeObj = n_Mat(m.nativeObj, roi.y, roi.y + roi.height, roi.x, roi.x + roi.width);
+ }
+
+ //
+ // C++: Mat Mat::adjustROI(int dtop, int dbottom, int dleft, int dright)
+ //
+
+ // javadoc: Mat::adjustROI(dtop, dbottom, dleft, dright)
+ public Mat adjustROI(int dtop, int dbottom, int dleft, int dright) {
+ return new Mat(n_adjustROI(nativeObj, dtop, dbottom, dleft, dright));
+ }
+
+ //
+ // C++: void Mat::assignTo(Mat m, int type = -1)
+ //
+
+ // javadoc: Mat::assignTo(m, type)
+ public void assignTo(Mat m, int type) {
+ n_assignTo(nativeObj, m.nativeObj, type);
+ }
+
+ // javadoc: Mat::assignTo(m)
+ public void assignTo(Mat m) {
+ n_assignTo(nativeObj, m.nativeObj);
+ }
+
+ //
+ // C++: int Mat::channels()
+ //
+
+ // javadoc: Mat::channels()
+ public int channels() {
+ return n_channels(nativeObj);
+ }
+
+ //
+ // C++: int Mat::checkVector(int elemChannels, int depth = -1, bool
+ // requireContinuous = true)
+ //
+
+ // javadoc: Mat::checkVector(elemChannels, depth, requireContinuous)
+ public int checkVector(int elemChannels, int depth, boolean requireContinuous) {
+ return n_checkVector(nativeObj, elemChannels, depth, requireContinuous);
+ }
+
+ // javadoc: Mat::checkVector(elemChannels, depth)
+ public int checkVector(int elemChannels, int depth) {
+ return n_checkVector(nativeObj, elemChannels, depth);
+ }
+
+ // javadoc: Mat::checkVector(elemChannels)
+ public int checkVector(int elemChannels) {
+ return n_checkVector(nativeObj, elemChannels);
+ }
+
+ //
+ // C++: Mat Mat::clone()
+ //
+
+ // javadoc: Mat::clone()
+ public Mat clone() {
+ return new Mat(n_clone(nativeObj));
+ }
+
+ //
+ // C++: Mat Mat::col(int x)
+ //
+
+ // javadoc: Mat::col(x)
+ public Mat col(int x) {
+ return new Mat(n_col(nativeObj, x));
+ }
+
+ //
+ // C++: Mat Mat::colRange(int startcol, int endcol)
+ //
+
+ // javadoc: Mat::colRange(startcol, endcol)
+ public Mat colRange(int startcol, int endcol) {
+ return new Mat(n_colRange(nativeObj, startcol, endcol));
+ }
+
+ //
+ // C++: Mat Mat::colRange(Range r)
+ //
+
+ // javadoc: Mat::colRange(r)
+ public Mat colRange(Range r) {
+ return new Mat(n_colRange(nativeObj, r.start, r.end));
+ }
+
+ //
+ // C++: int Mat::dims()
+ //
+
+ // javadoc: Mat::dims()
+ public int dims() {
+ return n_dims(nativeObj);
+ }
+
+ //
+ // C++: int Mat::cols()
+ //
+
+ // javadoc: Mat::cols()
+ public int cols() {
+ return n_cols(nativeObj);
+ }
+
+ //
+ // C++: void Mat::convertTo(Mat& m, int rtype, double alpha = 1, double beta
+ // = 0)
+ //
+
+ // javadoc: Mat::convertTo(m, rtype, alpha, beta)
+ public void convertTo(Mat m, int rtype, double alpha, double beta) {
+ n_convertTo(nativeObj, m.nativeObj, rtype, alpha, beta);
+ }
+
+ // javadoc: Mat::convertTo(m, rtype, alpha)
+ public void convertTo(Mat m, int rtype, double alpha) {
+ n_convertTo(nativeObj, m.nativeObj, rtype, alpha);
+ }
+
+ // javadoc: Mat::convertTo(m, rtype)
+ public void convertTo(Mat m, int rtype) {
+ n_convertTo(nativeObj, m.nativeObj, rtype);
+ }
+
+ //
+ // C++: void Mat::copyTo(Mat& m)
+ //
+
+ // javadoc: Mat::copyTo(m)
+ public void copyTo(Mat m) {
+ n_copyTo(nativeObj, m.nativeObj);
+ }
+
+ //
+ // C++: void Mat::copyTo(Mat& m, Mat mask)
+ //
+
+ // javadoc: Mat::copyTo(m, mask)
+ public void copyTo(Mat m, Mat mask) {
+ n_copyTo(nativeObj, m.nativeObj, mask.nativeObj);
+ }
+
+ //
+ // C++: void Mat::create(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::create(rows, cols, type)
+ public void create(int rows, int cols, int type) {
+ n_create(nativeObj, rows, cols, type);
+ }
+
+ //
+ // C++: void Mat::create(Size size, int type)
+ //
+
+ // javadoc: Mat::create(size, type)
+ public void create(Size size, int type) {
+ n_create(nativeObj, size.width, size.height, type);
+ }
+
+ //
+ // C++: void Mat::create(int ndims, const int* sizes, int type)
+ //
+
+ // javadoc: Mat::create(sizes, type)
+ public void create(int[] sizes, int type) {
+ n_create(nativeObj, sizes.length, sizes, type);
+ }
+
+ //
+ // C++: void Mat::copySize(const Mat& m);
+ //
+
+ // javadoc: Mat::copySize(m)
+ public void copySize(Mat m) {
+ n_copySize(nativeObj, m.nativeObj);
+ }
+
+ //
+ // C++: Mat Mat::cross(Mat m)
+ //
+
+ // javadoc: Mat::cross(m)
+ public Mat cross(Mat m) {
+ return new Mat(n_cross(nativeObj, m.nativeObj));
+ }
+
+ //
+ // C++: long Mat::dataAddr()
+ //
+
+ // javadoc: Mat::dataAddr()
+ public long dataAddr() {
+ return n_dataAddr(nativeObj);
+ }
+
+ //
+ // C++: int Mat::depth()
+ //
+
+ // javadoc: Mat::depth()
+ public int depth() {
+ return n_depth(nativeObj);
+ }
+
+ //
+ // C++: Mat Mat::diag(int d = 0)
+ //
+
+ // javadoc: Mat::diag(d)
+ public Mat diag(int d) {
+ return new Mat(n_diag(nativeObj, d));
+ }
+
+ // javadoc: Mat::diag()
+ public Mat diag() {
+ return new Mat(n_diag(nativeObj, 0));
+ }
+
+ //
+ // C++: static Mat Mat::diag(Mat d)
+ //
+
+ // javadoc: Mat::diag(d)
+ public static Mat diag(Mat d) {
+ return new Mat(n_diag(d.nativeObj));
+ }
+
+ //
+ // C++: double Mat::dot(Mat m)
+ //
+
+ // javadoc: Mat::dot(m)
+ public double dot(Mat m) {
+ return n_dot(nativeObj, m.nativeObj);
+ }
+
+ //
+ // C++: size_t Mat::elemSize()
+ //
+
+ // javadoc: Mat::elemSize()
+ public long elemSize() {
+ return n_elemSize(nativeObj);
+ }
+
+ //
+ // C++: size_t Mat::elemSize1()
+ //
+
+ // javadoc: Mat::elemSize1()
+ public long elemSize1() {
+ return n_elemSize1(nativeObj);
+ }
+
+ //
+ // C++: bool Mat::empty()
+ //
+
+ // javadoc: Mat::empty()
+ public boolean empty() {
+ return n_empty(nativeObj);
+ }
+
+ //
+ // C++: static Mat Mat::eye(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::eye(rows, cols, type)
+ public static Mat eye(int rows, int cols, int type) {
+ return new Mat(n_eye(rows, cols, type));
+ }
+
+ //
+ // C++: static Mat Mat::eye(Size size, int type)
+ //
+
+ // javadoc: Mat::eye(size, type)
+ public static Mat eye(Size size, int type) {
+ return new Mat(n_eye(size.width, size.height, type));
+ }
+
+ //
+ // C++: Mat Mat::inv(int method = DECOMP_LU)
+ //
+
+ // javadoc: Mat::inv(method)
+ public Mat inv(int method) {
+ return new Mat(n_inv(nativeObj, method));
+ }
+
+ // javadoc: Mat::inv()
+ public Mat inv() {
+ return new Mat(n_inv(nativeObj));
+ }
+
+ //
+ // C++: bool Mat::isContinuous()
+ //
+
+ // javadoc: Mat::isContinuous()
+ public boolean isContinuous() {
+ return n_isContinuous(nativeObj);
+ }
+
+ //
+ // C++: bool Mat::isSubmatrix()
+ //
+
+ // javadoc: Mat::isSubmatrix()
+ public boolean isSubmatrix() {
+ return n_isSubmatrix(nativeObj);
+ }
+
+ //
+ // C++: void Mat::locateROI(Size wholeSize, Point ofs)
+ //
+
+ // javadoc: Mat::locateROI(wholeSize, ofs)
+ public void locateROI(Size wholeSize, Point ofs) {
+ double[] wholeSize_out = new double[2];
+ double[] ofs_out = new double[2];
+ locateROI_0(nativeObj, wholeSize_out, ofs_out);
+ if (wholeSize != null) {
+ wholeSize.width = wholeSize_out[0];
+ wholeSize.height = wholeSize_out[1];
+ }
+ if (ofs != null) {
+ ofs.x = ofs_out[0];
+ ofs.y = ofs_out[1];
+ }
+ }
+
+ //
+ // C++: Mat Mat::mul(Mat m, double scale = 1)
+ //
+
+ // javadoc: Mat::mul(m, scale)
+ public Mat mul(Mat m, double scale) {
+ return new Mat(n_mul(nativeObj, m.nativeObj, scale));
+ }
+
+ // javadoc: Mat::mul(m)
+ public Mat mul(Mat m) {
+ return new Mat(n_mul(nativeObj, m.nativeObj));
+ }
+
+ //
+ // C++: static Mat Mat::ones(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::ones(rows, cols, type)
+ public static Mat ones(int rows, int cols, int type) {
+ return new Mat(n_ones(rows, cols, type));
+ }
+
+ //
+ // C++: static Mat Mat::ones(Size size, int type)
+ //
+
+ // javadoc: Mat::ones(size, type)
+ public static Mat ones(Size size, int type) {
+ return new Mat(n_ones(size.width, size.height, type));
+ }
+
+ //
+ // C++: static Mat Mat::ones(int ndims, const int* sizes, int type)
+ //
+
+ // javadoc: Mat::ones(sizes, type)
+ public static Mat ones(int[] sizes, int type) {
+ return new Mat(n_ones(sizes.length, sizes, type));
+ }
+
+ //
+ // C++: void Mat::push_back(Mat m)
+ //
+
+ // javadoc: Mat::push_back(m)
+ public void push_back(Mat m) {
+ n_push_back(nativeObj, m.nativeObj);
+ }
+
+ //
+ // C++: void Mat::release()
+ //
+
+ // javadoc: Mat::release()
+ public void release() {
+ n_release(nativeObj);
+ }
+
+ //
+ // C++: Mat Mat::reshape(int cn, int rows = 0)
+ //
+
+ // javadoc: Mat::reshape(cn, rows)
+ public Mat reshape(int cn, int rows) {
+ return new Mat(n_reshape(nativeObj, cn, rows));
+ }
+
+ // javadoc: Mat::reshape(cn)
+ public Mat reshape(int cn) {
+ return new Mat(n_reshape(nativeObj, cn));
+ }
+
+ //
+ // C++: Mat Mat::reshape(int cn, int newndims, const int* newsz)
+ //
+
+ // javadoc: Mat::reshape(cn, newshape)
+ public Mat reshape(int cn, int[] newshape) {
+ return new Mat(n_reshape_1(nativeObj, cn, newshape.length, newshape));
+ }
+
+ //
+ // C++: Mat Mat::row(int y)
+ //
+
+ // javadoc: Mat::row(y)
+ public Mat row(int y) {
+ return new Mat(n_row(nativeObj, y));
+ }
+
+ //
+ // C++: Mat Mat::rowRange(int startrow, int endrow)
+ //
+
+ // javadoc: Mat::rowRange(startrow, endrow)
+ public Mat rowRange(int startrow, int endrow) {
+ return new Mat(n_rowRange(nativeObj, startrow, endrow));
+ }
+
+ //
+ // C++: Mat Mat::rowRange(Range r)
+ //
+
+ // javadoc: Mat::rowRange(r)
+ public Mat rowRange(Range r) {
+ return new Mat(n_rowRange(nativeObj, r.start, r.end));
+ }
+
+ //
+ // C++: int Mat::rows()
+ //
+
+ // javadoc: Mat::rows()
+ public int rows() {
+ return n_rows(nativeObj);
+ }
+
+ //
+ // C++: Mat Mat::operator =(Scalar s)
+ //
+
+ // javadoc: Mat::operator =(s)
+ public Mat setTo(Scalar s) {
+ return new Mat(n_setTo(nativeObj, s.val[0], s.val[1], s.val[2], s.val[3]));
+ }
+
+ //
+ // C++: Mat Mat::setTo(Scalar value, Mat mask = Mat())
+ //
+
+ // javadoc: Mat::setTo(value, mask)
+ public Mat setTo(Scalar value, Mat mask) {
+ return new Mat(n_setTo(nativeObj, value.val[0], value.val[1], value.val[2], value.val[3], mask.nativeObj));
+ }
+
+ //
+ // C++: Mat Mat::setTo(Mat value, Mat mask = Mat())
+ //
+
+ // javadoc: Mat::setTo(value, mask)
+ public Mat setTo(Mat value, Mat mask) {
+ return new Mat(n_setTo(nativeObj, value.nativeObj, mask.nativeObj));
+ }
+
+ // javadoc: Mat::setTo(value)
+ public Mat setTo(Mat value) {
+ return new Mat(n_setTo(nativeObj, value.nativeObj));
+ }
+
+ //
+ // C++: Size Mat::size()
+ //
+
+ // javadoc: Mat::size()
+ public Size size() {
+ return new Size(n_size(nativeObj));
+ }
+
+ //
+ // C++: int Mat::size(int i)
+ //
+
+ // javadoc: Mat::size(int i)
+ public int size(int i) {
+ return n_size_i(nativeObj, i);
+ }
+
+ //
+ // C++: size_t Mat::step1(int i = 0)
+ //
+
+ // javadoc: Mat::step1(i)
+ public long step1(int i) {
+ return n_step1(nativeObj, i);
+ }
+
+ // javadoc: Mat::step1()
+ public long step1() {
+ return n_step1(nativeObj);
+ }
+
+ //
+ // C++: Mat Mat::operator()(int rowStart, int rowEnd, int colStart, int
+ // colEnd)
+ //
+
+ // javadoc: Mat::operator()(rowStart, rowEnd, colStart, colEnd)
+ public Mat submat(int rowStart, int rowEnd, int colStart, int colEnd) {
+ return new Mat(n_submat_rr(nativeObj, rowStart, rowEnd, colStart, colEnd));
+ }
+
+ //
+ // C++: Mat Mat::operator()(Range rowRange, Range colRange)
+ //
+
+ // javadoc: Mat::operator()(rowRange, colRange)
+ public Mat submat(Range rowRange, Range colRange) {
+ return new Mat(n_submat_rr(nativeObj, rowRange.start, rowRange.end, colRange.start, colRange.end));
+ }
+
+ //
+ // C++: Mat Mat::operator()(const std::vector& ranges)
+ //
+
+ // javadoc: Mat::operator()(ranges[])
+ public Mat submat(Range[] ranges) {
+ return new Mat(n_submat_ranges(nativeObj, ranges));
+ }
+
+ //
+ // C++: Mat Mat::operator()(Rect roi)
+ //
+
+ // javadoc: Mat::operator()(roi)
+ public Mat submat(Rect roi) {
+ return new Mat(n_submat(nativeObj, roi.x, roi.y, roi.width, roi.height));
+ }
+
+ //
+ // C++: Mat Mat::t()
+ //
+
+ // javadoc: Mat::t()
+ public Mat t() {
+ return new Mat(n_t(nativeObj));
+ }
+
+ //
+ // C++: size_t Mat::total()
+ //
+
+ // javadoc: Mat::total()
+ public long total() {
+ return n_total(nativeObj);
+ }
+
+ //
+ // C++: int Mat::type()
+ //
+
+ // javadoc: Mat::type()
+ public int type() {
+ return n_type(nativeObj);
+ }
+
+ //
+ // C++: static Mat Mat::zeros(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::zeros(rows, cols, type)
+ public static Mat zeros(int rows, int cols, int type) {
+ return new Mat(n_zeros(rows, cols, type));
+ }
+
+ //
+ // C++: static Mat Mat::zeros(Size size, int type)
+ //
+
+ // javadoc: Mat::zeros(size, type)
+ public static Mat zeros(Size size, int type) {
+ return new Mat(n_zeros(size.width, size.height, type));
+ }
+
+ //
+ // C++: static Mat Mat::zeros(int ndims, const int* sizes, int type)
+ //
+
+ // javadoc: Mat::zeros(sizes, type)
+ public static Mat zeros(int[] sizes, int type) {
+ return new Mat(n_zeros(sizes.length, sizes, type));
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ n_delete(nativeObj);
+ super.finalize();
+ }
+
+ // javadoc:Mat::toString()
+ @Override
+ public String toString() {
+ String _dims = (dims() > 0) ? "" : "-1*-1*";
+ for (int i=0; i& ranges)
+ private static native long n_Mat(long m_nativeObj, Range[] ranges);
+
+ // C++: Mat Mat::adjustROI(int dtop, int dbottom, int dleft, int dright)
+ private static native long n_adjustROI(long nativeObj, int dtop, int dbottom, int dleft, int dright);
+
+ // C++: void Mat::assignTo(Mat m, int type = -1)
+ private static native void n_assignTo(long nativeObj, long m_nativeObj, int type);
+
+ private static native void n_assignTo(long nativeObj, long m_nativeObj);
+
+ // C++: int Mat::channels()
+ private static native int n_channels(long nativeObj);
+
+ // C++: int Mat::checkVector(int elemChannels, int depth = -1, bool
+ // requireContinuous = true)
+ private static native int n_checkVector(long nativeObj, int elemChannels, int depth, boolean requireContinuous);
+
+ private static native int n_checkVector(long nativeObj, int elemChannels, int depth);
+
+ private static native int n_checkVector(long nativeObj, int elemChannels);
+
+ // C++: Mat Mat::clone()
+ private static native long n_clone(long nativeObj);
+
+ // C++: Mat Mat::col(int x)
+ private static native long n_col(long nativeObj, int x);
+
+ // C++: Mat Mat::colRange(int startcol, int endcol)
+ private static native long n_colRange(long nativeObj, int startcol, int endcol);
+
+ // C++: int Mat::dims()
+ private static native int n_dims(long nativeObj);
+
+ // C++: int Mat::cols()
+ private static native int n_cols(long nativeObj);
+
+ // C++: void Mat::convertTo(Mat& m, int rtype, double alpha = 1, double beta
+ // = 0)
+ private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype, double alpha, double beta);
+
+ private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype, double alpha);
+
+ private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype);
+
+ // C++: void Mat::copyTo(Mat& m)
+ private static native void n_copyTo(long nativeObj, long m_nativeObj);
+
+ // C++: void Mat::copyTo(Mat& m, Mat mask)
+ private static native void n_copyTo(long nativeObj, long m_nativeObj, long mask_nativeObj);
+
+ // C++: void Mat::create(int rows, int cols, int type)
+ private static native void n_create(long nativeObj, int rows, int cols, int type);
+
+ // C++: void Mat::create(Size size, int type)
+ private static native void n_create(long nativeObj, double size_width, double size_height, int type);
+
+ // C++: void Mat::create(int ndims, const int* sizes, int type)
+ private static native void n_create(long nativeObj, int ndims, int[] sizes, int type);
+
+ // C++: void Mat::copySize(const Mat& m)
+ private static native void n_copySize(long nativeObj, long m_nativeObj);
+
+ // C++: Mat Mat::cross(Mat m)
+ private static native long n_cross(long nativeObj, long m_nativeObj);
+
+ // C++: long Mat::dataAddr()
+ private static native long n_dataAddr(long nativeObj);
+
+ // C++: int Mat::depth()
+ private static native int n_depth(long nativeObj);
+
+ // C++: Mat Mat::diag(int d = 0)
+ private static native long n_diag(long nativeObj, int d);
+
+ // C++: static Mat Mat::diag(Mat d)
+ private static native long n_diag(long d_nativeObj);
+
+ // C++: double Mat::dot(Mat m)
+ private static native double n_dot(long nativeObj, long m_nativeObj);
+
+ // C++: size_t Mat::elemSize()
+ private static native long n_elemSize(long nativeObj);
+
+ // C++: size_t Mat::elemSize1()
+ private static native long n_elemSize1(long nativeObj);
+
+ // C++: bool Mat::empty()
+ private static native boolean n_empty(long nativeObj);
+
+ // C++: static Mat Mat::eye(int rows, int cols, int type)
+ private static native long n_eye(int rows, int cols, int type);
+
+ // C++: static Mat Mat::eye(Size size, int type)
+ private static native long n_eye(double size_width, double size_height, int type);
+
+ // C++: Mat Mat::inv(int method = DECOMP_LU)
+ private static native long n_inv(long nativeObj, int method);
+
+ private static native long n_inv(long nativeObj);
+
+ // C++: bool Mat::isContinuous()
+ private static native boolean n_isContinuous(long nativeObj);
+
+ // C++: bool Mat::isSubmatrix()
+ private static native boolean n_isSubmatrix(long nativeObj);
+
+ // C++: void Mat::locateROI(Size wholeSize, Point ofs)
+ private static native void locateROI_0(long nativeObj, double[] wholeSize_out, double[] ofs_out);
+
+ // C++: Mat Mat::mul(Mat m, double scale = 1)
+ private static native long n_mul(long nativeObj, long m_nativeObj, double scale);
+
+ private static native long n_mul(long nativeObj, long m_nativeObj);
+
+ // C++: static Mat Mat::ones(int rows, int cols, int type)
+ private static native long n_ones(int rows, int cols, int type);
+
+ // C++: static Mat Mat::ones(Size size, int type)
+ private static native long n_ones(double size_width, double size_height, int type);
+
+ // C++: static Mat Mat::ones(int ndims, const int* sizes, int type)
+ private static native long n_ones(int ndims, int[] sizes, int type);
+
+ // C++: void Mat::push_back(Mat m)
+ private static native void n_push_back(long nativeObj, long m_nativeObj);
+
+ // C++: void Mat::release()
+ private static native void n_release(long nativeObj);
+
+ // C++: Mat Mat::reshape(int cn, int rows = 0)
+ private static native long n_reshape(long nativeObj, int cn, int rows);
+
+ private static native long n_reshape(long nativeObj, int cn);
+
+ // C++: Mat Mat::reshape(int cn, int newndims, const int* newsz)
+ private static native long n_reshape_1(long nativeObj, int cn, int newndims, int[] newsz);
+
+ // C++: Mat Mat::row(int y)
+ private static native long n_row(long nativeObj, int y);
+
+ // C++: Mat Mat::rowRange(int startrow, int endrow)
+ private static native long n_rowRange(long nativeObj, int startrow, int endrow);
+
+ // C++: int Mat::rows()
+ private static native int n_rows(long nativeObj);
+
+ // C++: Mat Mat::operator =(Scalar s)
+ private static native long n_setTo(long nativeObj, double s_val0, double s_val1, double s_val2, double s_val3);
+
+ // C++: Mat Mat::setTo(Scalar value, Mat mask = Mat())
+ private static native long n_setTo(long nativeObj, double s_val0, double s_val1, double s_val2, double s_val3, long mask_nativeObj);
+
+ // C++: Mat Mat::setTo(Mat value, Mat mask = Mat())
+ private static native long n_setTo(long nativeObj, long value_nativeObj, long mask_nativeObj);
+
+ private static native long n_setTo(long nativeObj, long value_nativeObj);
+
+ // C++: Size Mat::size()
+ private static native double[] n_size(long nativeObj);
+
+ // C++: int Mat::size(int i)
+ private static native int n_size_i(long nativeObj, int i);
+
+ // C++: size_t Mat::step1(int i = 0)
+ private static native long n_step1(long nativeObj, int i);
+
+ private static native long n_step1(long nativeObj);
+
+ // C++: Mat Mat::operator()(Range rowRange, Range colRange)
+ private static native long n_submat_rr(long nativeObj, int rowRange_start, int rowRange_end, int colRange_start, int colRange_end);
+
+ // C++: Mat Mat::operator()(const std::vector& ranges)
+ private static native long n_submat_ranges(long nativeObj, Range[] ranges);
+
+ // C++: Mat Mat::operator()(Rect roi)
+ private static native long n_submat(long nativeObj, int roi_x, int roi_y, int roi_width, int roi_height);
+
+ // C++: Mat Mat::t()
+ private static native long n_t(long nativeObj);
+
+ // C++: size_t Mat::total()
+ private static native long n_total(long nativeObj);
+
+ // C++: int Mat::type()
+ private static native int n_type(long nativeObj);
+
+ // C++: static Mat Mat::zeros(int rows, int cols, int type)
+ private static native long n_zeros(int rows, int cols, int type);
+
+ // C++: static Mat Mat::zeros(Size size, int type)
+ private static native long n_zeros(double size_width, double size_height, int type);
+
+ // C++: static Mat Mat::zeros(int ndims, const int* sizes, int type)
+ private static native long n_zeros(int ndims, int[] sizes, int type);
+
+ // native support for java finalize()
+ private static native void n_delete(long nativeObj);
+
+ private static native int nPutD(long self, int row, int col, int count, double[] data);
+
+ private static native int nPutDIdx(long self, int[] idx, int count, double[] data);
+
+ private static native int nPutF(long self, int row, int col, int count, float[] data);
+
+ private static native int nPutFIdx(long self, int[] idx, int count, float[] data);
+
+ private static native int nPutI(long self, int row, int col, int count, int[] data);
+
+ private static native int nPutIIdx(long self, int[] idx, int count, int[] data);
+
+ private static native int nPutS(long self, int row, int col, int count, short[] data);
+
+ private static native int nPutSIdx(long self, int[] idx, int count, short[] data);
+
+ private static native int nPutB(long self, int row, int col, int count, byte[] data);
+
+ private static native int nPutBIdx(long self, int[] idx, int count, byte[] data);
+
+ private static native int nPutBwOffset(long self, int row, int col, int count, int offset, byte[] data);
+
+ private static native int nPutBwIdxOffset(long self, int[] idx, int count, int offset, byte[] data);
+
+ private static native int nGetB(long self, int row, int col, int count, byte[] vals);
+
+ private static native int nGetBIdx(long self, int[] idx, int count, byte[] vals);
+
+ private static native int nGetS(long self, int row, int col, int count, short[] vals);
+
+ private static native int nGetSIdx(long self, int[] idx, int count, short[] vals);
+
+ private static native int nGetI(long self, int row, int col, int count, int[] vals);
+
+ private static native int nGetIIdx(long self, int[] idx, int count, int[] vals);
+
+ private static native int nGetF(long self, int row, int col, int count, float[] vals);
+
+ private static native int nGetFIdx(long self, int[] idx, int count, float[] vals);
+
+ private static native int nGetD(long self, int row, int col, int count, double[] vals);
+
+ private static native int nGetDIdx(long self, int[] idx, int count, double[] vals);
+
+ private static native double[] nGet(long self, int row, int col);
+
+ private static native double[] nGetIdx(long self, int[] idx);
+
+ private static native String nDump(long self);
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfByte.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfByte.java
new file mode 100644
index 0000000..eb928fb
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfByte.java
@@ -0,0 +1,98 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MatOfByte extends Mat {
+ // 8UC(x)
+ private static final int _depth = CvType.CV_8U;
+ private static final int _channels = 1;
+
+ public MatOfByte() {
+ super();
+ }
+
+ protected MatOfByte(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfByte fromNativeAddr(long addr) {
+ return new MatOfByte(addr);
+ }
+
+ public MatOfByte(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfByte(byte...a) {
+ super();
+ fromArray(a);
+ }
+
+ public MatOfByte(int offset, int length, byte...a) {
+ super();
+ fromArray(offset, length, a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(byte...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length / _channels;
+ alloc(num);
+ put(0, 0, a); //TODO: check ret val!
+ }
+
+ public void fromArray(int offset, int length, byte...a) {
+ if (offset < 0)
+ throw new IllegalArgumentException("offset < 0");
+ if (a == null)
+ throw new NullPointerException();
+ if (length < 0 || length + offset > a.length)
+ throw new IllegalArgumentException("invalid 'length' parameter: " + Integer.toString(length));
+ if (a.length == 0)
+ return;
+ int num = length / _channels;
+ alloc(num);
+ put(0, 0, a, offset, length); //TODO: check ret val!
+ }
+
+ public byte[] toArray() {
+ int num = checkVector(_channels, _depth);
+ if(num < 0)
+ throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
+ byte[] a = new byte[num * _channels];
+ if(num == 0)
+ return a;
+ get(0, 0, a); //TODO: check ret val!
+ return a;
+ }
+
+ public void fromList(List lb) {
+ if(lb==null || lb.size()==0)
+ return;
+ Byte ab[] = lb.toArray(new Byte[0]);
+ byte a[] = new byte[ab.length];
+ for(int i=0; i toList() {
+ byte[] a = toArray();
+ Byte ab[] = new Byte[a.length];
+ for(int i=0; i0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+
+ public void fromArray(DMatch...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ float buff[] = new float[num * _channels];
+ for(int i=0; i ldm) {
+ DMatch adm[] = ldm.toArray(new DMatch[0]);
+ fromArray(adm);
+ }
+
+ public List toList() {
+ DMatch[] adm = toArray();
+ return Arrays.asList(adm);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfDouble.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfDouble.java
new file mode 100644
index 0000000..1a8e23c
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfDouble.java
@@ -0,0 +1,79 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MatOfDouble extends Mat {
+ // 64FC(x)
+ private static final int _depth = CvType.CV_64F;
+ private static final int _channels = 1;
+
+ public MatOfDouble() {
+ super();
+ }
+
+ protected MatOfDouble(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfDouble fromNativeAddr(long addr) {
+ return new MatOfDouble(addr);
+ }
+
+ public MatOfDouble(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfDouble(double...a) {
+ super();
+ fromArray(a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(double...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length / _channels;
+ alloc(num);
+ put(0, 0, a); //TODO: check ret val!
+ }
+
+ public double[] toArray() {
+ int num = checkVector(_channels, _depth);
+ if(num < 0)
+ throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
+ double[] a = new double[num * _channels];
+ if(num == 0)
+ return a;
+ get(0, 0, a); //TODO: check ret val!
+ return a;
+ }
+
+ public void fromList(List lb) {
+ if(lb==null || lb.size()==0)
+ return;
+ Double ab[] = lb.toArray(new Double[0]);
+ double a[] = new double[ab.length];
+ for(int i=0; i toList() {
+ double[] a = toArray();
+ Double ab[] = new Double[a.length];
+ for(int i=0; i0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(float...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length / _channels;
+ alloc(num);
+ put(0, 0, a); //TODO: check ret val!
+ }
+
+ public float[] toArray() {
+ int num = checkVector(_channels, _depth);
+ if(num < 0)
+ throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
+ float[] a = new float[num * _channels];
+ if(num == 0)
+ return a;
+ get(0, 0, a); //TODO: check ret val!
+ return a;
+ }
+
+ public void fromList(List lb) {
+ if(lb==null || lb.size()==0)
+ return;
+ Float ab[] = lb.toArray(new Float[0]);
+ float a[] = new float[ab.length];
+ for(int i=0; i toList() {
+ float[] a = toArray();
+ Float ab[] = new Float[a.length];
+ for(int i=0; i0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(float...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length / _channels;
+ alloc(num);
+ put(0, 0, a); //TODO: check ret val!
+ }
+
+ public float[] toArray() {
+ int num = checkVector(_channels, _depth);
+ if(num < 0)
+ throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
+ float[] a = new float[num * _channels];
+ if(num == 0)
+ return a;
+ get(0, 0, a); //TODO: check ret val!
+ return a;
+ }
+
+ public void fromList(List lb) {
+ if(lb==null || lb.size()==0)
+ return;
+ Float ab[] = lb.toArray(new Float[0]);
+ float a[] = new float[ab.length];
+ for(int i=0; i toList() {
+ float[] a = toArray();
+ Float ab[] = new Float[a.length];
+ for(int i=0; i0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(float...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length / _channels;
+ alloc(num);
+ put(0, 0, a); //TODO: check ret val!
+ }
+
+ public float[] toArray() {
+ int num = checkVector(_channels, _depth);
+ if(num < 0)
+ throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
+ float[] a = new float[num * _channels];
+ if(num == 0)
+ return a;
+ get(0, 0, a); //TODO: check ret val!
+ return a;
+ }
+
+ public void fromList(List lb) {
+ if(lb==null || lb.size()==0)
+ return;
+ Float ab[] = lb.toArray(new Float[0]);
+ float a[] = new float[ab.length];
+ for(int i=0; i toList() {
+ float[] a = toArray();
+ Float ab[] = new Float[a.length];
+ for(int i=0; i0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(int...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length / _channels;
+ alloc(num);
+ put(0, 0, a); //TODO: check ret val!
+ }
+
+ public int[] toArray() {
+ int num = checkVector(_channels, _depth);
+ if(num < 0)
+ throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
+ int[] a = new int[num * _channels];
+ if(num == 0)
+ return a;
+ get(0, 0, a); //TODO: check ret val!
+ return a;
+ }
+
+ public void fromList(List lb) {
+ if(lb==null || lb.size()==0)
+ return;
+ Integer ab[] = lb.toArray(new Integer[0]);
+ int a[] = new int[ab.length];
+ for(int i=0; i toList() {
+ int[] a = toArray();
+ Integer ab[] = new Integer[a.length];
+ for(int i=0; i0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(int...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length / _channels;
+ alloc(num);
+ put(0, 0, a); //TODO: check ret val!
+ }
+
+ public int[] toArray() {
+ int num = checkVector(_channels, _depth);
+ if(num < 0)
+ throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
+ int[] a = new int[num * _channels];
+ if(num == 0)
+ return a;
+ get(0, 0, a); //TODO: check ret val!
+ return a;
+ }
+
+ public void fromList(List lb) {
+ if(lb==null || lb.size()==0)
+ return;
+ Integer ab[] = lb.toArray(new Integer[0]);
+ int a[] = new int[ab.length];
+ for(int i=0; i toList() {
+ int[] a = toArray();
+ Integer ab[] = new Integer[a.length];
+ for(int i=0; i0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(KeyPoint...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ float buff[] = new float[num * _channels];
+ for(int i=0; i lkp) {
+ KeyPoint akp[] = lkp.toArray(new KeyPoint[0]);
+ fromArray(akp);
+ }
+
+ public List toList() {
+ KeyPoint[] akp = toArray();
+ return Arrays.asList(akp);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint.java
new file mode 100644
index 0000000..f4d573b
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint.java
@@ -0,0 +1,78 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MatOfPoint extends Mat {
+ // 32SC2
+ private static final int _depth = CvType.CV_32S;
+ private static final int _channels = 2;
+
+ public MatOfPoint() {
+ super();
+ }
+
+ protected MatOfPoint(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfPoint fromNativeAddr(long addr) {
+ return new MatOfPoint(addr);
+ }
+
+ public MatOfPoint(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfPoint(Point...a) {
+ super();
+ fromArray(a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(Point...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ int buff[] = new int[num * _channels];
+ for(int i=0; i lp) {
+ Point ap[] = lp.toArray(new Point[0]);
+ fromArray(ap);
+ }
+
+ public List toList() {
+ Point[] ap = toArray();
+ return Arrays.asList(ap);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint2f.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint2f.java
new file mode 100644
index 0000000..4b8c926
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint2f.java
@@ -0,0 +1,78 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MatOfPoint2f extends Mat {
+ // 32FC2
+ private static final int _depth = CvType.CV_32F;
+ private static final int _channels = 2;
+
+ public MatOfPoint2f() {
+ super();
+ }
+
+ protected MatOfPoint2f(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfPoint2f fromNativeAddr(long addr) {
+ return new MatOfPoint2f(addr);
+ }
+
+ public MatOfPoint2f(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfPoint2f(Point...a) {
+ super();
+ fromArray(a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(Point...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ float buff[] = new float[num * _channels];
+ for(int i=0; i lp) {
+ Point ap[] = lp.toArray(new Point[0]);
+ fromArray(ap);
+ }
+
+ public List toList() {
+ Point[] ap = toArray();
+ return Arrays.asList(ap);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint3.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint3.java
new file mode 100644
index 0000000..3b50561
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint3.java
@@ -0,0 +1,79 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MatOfPoint3 extends Mat {
+ // 32SC3
+ private static final int _depth = CvType.CV_32S;
+ private static final int _channels = 3;
+
+ public MatOfPoint3() {
+ super();
+ }
+
+ protected MatOfPoint3(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfPoint3 fromNativeAddr(long addr) {
+ return new MatOfPoint3(addr);
+ }
+
+ public MatOfPoint3(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfPoint3(Point3...a) {
+ super();
+ fromArray(a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(Point3...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ int buff[] = new int[num * _channels];
+ for(int i=0; i lp) {
+ Point3 ap[] = lp.toArray(new Point3[0]);
+ fromArray(ap);
+ }
+
+ public List toList() {
+ Point3[] ap = toArray();
+ return Arrays.asList(ap);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint3f.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint3f.java
new file mode 100644
index 0000000..fc5fee4
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfPoint3f.java
@@ -0,0 +1,79 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MatOfPoint3f extends Mat {
+ // 32FC3
+ private static final int _depth = CvType.CV_32F;
+ private static final int _channels = 3;
+
+ public MatOfPoint3f() {
+ super();
+ }
+
+ protected MatOfPoint3f(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfPoint3f fromNativeAddr(long addr) {
+ return new MatOfPoint3f(addr);
+ }
+
+ public MatOfPoint3f(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfPoint3f(Point3...a) {
+ super();
+ fromArray(a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(Point3...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ float buff[] = new float[num * _channels];
+ for(int i=0; i lp) {
+ Point3 ap[] = lp.toArray(new Point3[0]);
+ fromArray(ap);
+ }
+
+ public List toList() {
+ Point3[] ap = toArray();
+ return Arrays.asList(ap);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRect.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRect.java
new file mode 100644
index 0000000..ec0fb01
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRect.java
@@ -0,0 +1,81 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+
+public class MatOfRect extends Mat {
+ // 32SC4
+ private static final int _depth = CvType.CV_32S;
+ private static final int _channels = 4;
+
+ public MatOfRect() {
+ super();
+ }
+
+ protected MatOfRect(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfRect fromNativeAddr(long addr) {
+ return new MatOfRect(addr);
+ }
+
+ public MatOfRect(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfRect(Rect...a) {
+ super();
+ fromArray(a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(Rect...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ int buff[] = new int[num * _channels];
+ for(int i=0; i lr) {
+ Rect ap[] = lr.toArray(new Rect[0]);
+ fromArray(ap);
+ }
+
+ public List toList() {
+ Rect[] ar = toArray();
+ return Arrays.asList(ar);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRect2d.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRect2d.java
new file mode 100644
index 0000000..71c4b1a
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRect2d.java
@@ -0,0 +1,81 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+
+public class MatOfRect2d extends Mat {
+ // 64FC4
+ private static final int _depth = CvType.CV_64F;
+ private static final int _channels = 4;
+
+ public MatOfRect2d() {
+ super();
+ }
+
+ protected MatOfRect2d(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfRect2d fromNativeAddr(long addr) {
+ return new MatOfRect2d(addr);
+ }
+
+ public MatOfRect2d(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfRect2d(Rect2d...a) {
+ super();
+ fromArray(a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(Rect2d...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ double buff[] = new double[num * _channels];
+ for(int i=0; i lr) {
+ Rect2d ap[] = lr.toArray(new Rect2d[0]);
+ fromArray(ap);
+ }
+
+ public List toList() {
+ Rect2d[] ar = toArray();
+ return Arrays.asList(ar);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRotatedRect.java b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRotatedRect.java
new file mode 100644
index 0000000..6f36e6c
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/MatOfRotatedRect.java
@@ -0,0 +1,86 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.opencv.core.RotatedRect;
+
+
+
+public class MatOfRotatedRect extends Mat {
+ // 32FC5
+ private static final int _depth = CvType.CV_32F;
+ private static final int _channels = 5;
+
+ public MatOfRotatedRect() {
+ super();
+ }
+
+ protected MatOfRotatedRect(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfRotatedRect fromNativeAddr(long addr) {
+ return new MatOfRotatedRect(addr);
+ }
+
+ public MatOfRotatedRect(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfRotatedRect(RotatedRect...a) {
+ super();
+ fromArray(a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(RotatedRect...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length;
+ alloc(num);
+ float buff[] = new float[num * _channels];
+ for(int i=0; i lr) {
+ RotatedRect ap[] = lr.toArray(new RotatedRect[0]);
+ fromArray(ap);
+ }
+
+ public List toList() {
+ RotatedRect[] ar = toArray();
+ return Arrays.asList(ar);
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Point.java b/openCVLibrary3413/src/main/java/org/opencv/core/Point.java
new file mode 100644
index 0000000..ce493d7
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Point.java
@@ -0,0 +1,68 @@
+package org.opencv.core;
+
+//javadoc:Point_
+public class Point {
+
+ public double x, y;
+
+ public Point(double x, double y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public Point() {
+ this(0, 0);
+ }
+
+ public Point(double[] vals) {
+ this();
+ set(vals);
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ x = vals.length > 0 ? vals[0] : 0;
+ y = vals.length > 1 ? vals[1] : 0;
+ } else {
+ x = 0;
+ y = 0;
+ }
+ }
+
+ public Point clone() {
+ return new Point(x, y);
+ }
+
+ public double dot(Point p) {
+ return x * p.x + y * p.y;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(x);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(y);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof Point)) return false;
+ Point it = (Point) obj;
+ return x == it.x && y == it.y;
+ }
+
+ public boolean inside(Rect r) {
+ return r.contains(this);
+ }
+
+ @Override
+ public String toString() {
+ return "{" + x + ", " + y + "}";
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Point3.java b/openCVLibrary3413/src/main/java/org/opencv/core/Point3.java
new file mode 100644
index 0000000..14b91c6
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Point3.java
@@ -0,0 +1,79 @@
+package org.opencv.core;
+
+//javadoc:Point3_
+public class Point3 {
+
+ public double x, y, z;
+
+ public Point3(double x, double y, double z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public Point3() {
+ this(0, 0, 0);
+ }
+
+ public Point3(Point p) {
+ x = p.x;
+ y = p.y;
+ z = 0;
+ }
+
+ public Point3(double[] vals) {
+ this();
+ set(vals);
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ x = vals.length > 0 ? vals[0] : 0;
+ y = vals.length > 1 ? vals[1] : 0;
+ z = vals.length > 2 ? vals[2] : 0;
+ } else {
+ x = 0;
+ y = 0;
+ z = 0;
+ }
+ }
+
+ public Point3 clone() {
+ return new Point3(x, y, z);
+ }
+
+ public double dot(Point3 p) {
+ return x * p.x + y * p.y + z * p.z;
+ }
+
+ public Point3 cross(Point3 p) {
+ return new Point3(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(x);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(y);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(z);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof Point3)) return false;
+ Point3 it = (Point3) obj;
+ return x == it.x && y == it.y && z == it.z;
+ }
+
+ @Override
+ public String toString() {
+ return "{" + x + ", " + y + ", " + z + "}";
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Range.java b/openCVLibrary3413/src/main/java/org/opencv/core/Range.java
new file mode 100644
index 0000000..f7eee4d
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Range.java
@@ -0,0 +1,82 @@
+package org.opencv.core;
+
+//javadoc:Range
+public class Range {
+
+ public int start, end;
+
+ public Range(int s, int e) {
+ this.start = s;
+ this.end = e;
+ }
+
+ public Range() {
+ this(0, 0);
+ }
+
+ public Range(double[] vals) {
+ set(vals);
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ start = vals.length > 0 ? (int) vals[0] : 0;
+ end = vals.length > 1 ? (int) vals[1] : 0;
+ } else {
+ start = 0;
+ end = 0;
+ }
+
+ }
+
+ public int size() {
+ return empty() ? 0 : end - start;
+ }
+
+ public boolean empty() {
+ return end <= start;
+ }
+
+ public static Range all() {
+ return new Range(Integer.MIN_VALUE, Integer.MAX_VALUE);
+ }
+
+ public Range intersection(Range r1) {
+ Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
+ r.end = Math.max(r.end, r.start);
+ return r;
+ }
+
+ public Range shift(int delta) {
+ return new Range(start + delta, end + delta);
+ }
+
+ public Range clone() {
+ return new Range(start, end);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(start);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(end);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof Range)) return false;
+ Range it = (Range) obj;
+ return start == it.start && end == it.end;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + start + ", " + end + ")";
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Rect.java b/openCVLibrary3413/src/main/java/org/opencv/core/Rect.java
new file mode 100644
index 0000000..c68e818
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Rect.java
@@ -0,0 +1,104 @@
+package org.opencv.core;
+
+//javadoc:Rect_
+public class Rect {
+
+ public int x, y, width, height;
+
+ public Rect(int x, int y, int width, int height) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+
+ public Rect() {
+ this(0, 0, 0, 0);
+ }
+
+ public Rect(Point p1, Point p2) {
+ x = (int) (p1.x < p2.x ? p1.x : p2.x);
+ y = (int) (p1.y < p2.y ? p1.y : p2.y);
+ width = (int) (p1.x > p2.x ? p1.x : p2.x) - x;
+ height = (int) (p1.y > p2.y ? p1.y : p2.y) - y;
+ }
+
+ public Rect(Point p, Size s) {
+ this((int) p.x, (int) p.y, (int) s.width, (int) s.height);
+ }
+
+ public Rect(double[] vals) {
+ set(vals);
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ x = vals.length > 0 ? (int) vals[0] : 0;
+ y = vals.length > 1 ? (int) vals[1] : 0;
+ width = vals.length > 2 ? (int) vals[2] : 0;
+ height = vals.length > 3 ? (int) vals[3] : 0;
+ } else {
+ x = 0;
+ y = 0;
+ width = 0;
+ height = 0;
+ }
+ }
+
+ public Rect clone() {
+ return new Rect(x, y, width, height);
+ }
+
+ public Point tl() {
+ return new Point(x, y);
+ }
+
+ public Point br() {
+ return new Point(x + width, y + height);
+ }
+
+ public Size size() {
+ return new Size(width, height);
+ }
+
+ public double area() {
+ return width * height;
+ }
+
+ public boolean empty() {
+ return width <= 0 || height <= 0;
+ }
+
+ public boolean contains(Point p) {
+ return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(height);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(width);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(x);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(y);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof Rect)) return false;
+ Rect it = (Rect) obj;
+ return x == it.x && y == it.y && width == it.width && height == it.height;
+ }
+
+ @Override
+ public String toString() {
+ return "{" + x + ", " + y + ", " + width + "x" + height + "}";
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Rect2d.java b/openCVLibrary3413/src/main/java/org/opencv/core/Rect2d.java
new file mode 100644
index 0000000..4c27869
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Rect2d.java
@@ -0,0 +1,104 @@
+package org.opencv.core;
+
+//javadoc:Rect2d_
+public class Rect2d {
+
+ public double x, y, width, height;
+
+ public Rect2d(double x, double y, double width, double height) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+
+ public Rect2d() {
+ this(0, 0, 0, 0);
+ }
+
+ public Rect2d(Point p1, Point p2) {
+ x = (double) (p1.x < p2.x ? p1.x : p2.x);
+ y = (double) (p1.y < p2.y ? p1.y : p2.y);
+ width = (double) (p1.x > p2.x ? p1.x : p2.x) - x;
+ height = (double) (p1.y > p2.y ? p1.y : p2.y) - y;
+ }
+
+ public Rect2d(Point p, Size s) {
+ this((double) p.x, (double) p.y, (double) s.width, (double) s.height);
+ }
+
+ public Rect2d(double[] vals) {
+ set(vals);
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ x = vals.length > 0 ? (double) vals[0] : 0;
+ y = vals.length > 1 ? (double) vals[1] : 0;
+ width = vals.length > 2 ? (double) vals[2] : 0;
+ height = vals.length > 3 ? (double) vals[3] : 0;
+ } else {
+ x = 0;
+ y = 0;
+ width = 0;
+ height = 0;
+ }
+ }
+
+ public Rect2d clone() {
+ return new Rect2d(x, y, width, height);
+ }
+
+ public Point tl() {
+ return new Point(x, y);
+ }
+
+ public Point br() {
+ return new Point(x + width, y + height);
+ }
+
+ public Size size() {
+ return new Size(width, height);
+ }
+
+ public double area() {
+ return width * height;
+ }
+
+ public boolean empty() {
+ return width <= 0 || height <= 0;
+ }
+
+ public boolean contains(Point p) {
+ return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(height);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(width);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(x);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(y);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof Rect2d)) return false;
+ Rect2d it = (Rect2d) obj;
+ return x == it.x && y == it.y && width == it.width && height == it.height;
+ }
+
+ @Override
+ public String toString() {
+ return "{" + x + ", " + y + ", " + width + "x" + height + "}";
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/RotatedRect.java b/openCVLibrary3413/src/main/java/org/opencv/core/RotatedRect.java
new file mode 100644
index 0000000..05ee381
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/RotatedRect.java
@@ -0,0 +1,113 @@
+package org.opencv.core;
+
+//javadoc:RotatedRect_
+public class RotatedRect {
+
+ public Point center;
+ public Size size;
+ public double angle;
+
+ public RotatedRect() {
+ this.center = new Point();
+ this.size = new Size();
+ this.angle = 0;
+ }
+
+ public RotatedRect(Point c, Size s, double a) {
+ this.center = c.clone();
+ this.size = s.clone();
+ this.angle = a;
+ }
+
+ public RotatedRect(double[] vals) {
+ this();
+ set(vals);
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ center.x = vals.length > 0 ? (double) vals[0] : 0;
+ center.y = vals.length > 1 ? (double) vals[1] : 0;
+ size.width = vals.length > 2 ? (double) vals[2] : 0;
+ size.height = vals.length > 3 ? (double) vals[3] : 0;
+ angle = vals.length > 4 ? (double) vals[4] : 0;
+ } else {
+ center.x = 0;
+ center.y = 0;
+ size.width = 0;
+ size.height = 0;
+ angle = 0;
+ }
+ }
+
+ public void points(Point pt[])
+ {
+ double _angle = angle * Math.PI / 180.0;
+ double b = (double) Math.cos(_angle) * 0.5f;
+ double a = (double) Math.sin(_angle) * 0.5f;
+
+ pt[0] = new Point(
+ center.x - a * size.height - b * size.width,
+ center.y + b * size.height - a * size.width);
+
+ pt[1] = new Point(
+ center.x + a * size.height - b * size.width,
+ center.y - b * size.height - a * size.width);
+
+ pt[2] = new Point(
+ 2 * center.x - pt[0].x,
+ 2 * center.y - pt[0].y);
+
+ pt[3] = new Point(
+ 2 * center.x - pt[1].x,
+ 2 * center.y - pt[1].y);
+ }
+
+ public Rect boundingRect()
+ {
+ Point pt[] = new Point[4];
+ points(pt);
+ Rect r = new Rect((int) Math.floor(Math.min(Math.min(Math.min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
+ (int) Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
+ (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
+ (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
+ r.width -= r.x - 1;
+ r.height -= r.y - 1;
+ return r;
+ }
+
+ public RotatedRect clone() {
+ return new RotatedRect(center, size, angle);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(center.x);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(center.y);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(size.width);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(size.height);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(angle);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof RotatedRect)) return false;
+ RotatedRect it = (RotatedRect) obj;
+ return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
+ }
+
+ @Override
+ public String toString() {
+ return "{ " + center + " " + size + " * " + angle + " }";
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Scalar.java b/openCVLibrary3413/src/main/java/org/opencv/core/Scalar.java
new file mode 100644
index 0000000..01676e4
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Scalar.java
@@ -0,0 +1,90 @@
+package org.opencv.core;
+
+//javadoc:Scalar_
+public class Scalar {
+
+ public double val[];
+
+ public Scalar(double v0, double v1, double v2, double v3) {
+ val = new double[] { v0, v1, v2, v3 };
+ }
+
+ public Scalar(double v0, double v1, double v2) {
+ val = new double[] { v0, v1, v2, 0 };
+ }
+
+ public Scalar(double v0, double v1) {
+ val = new double[] { v0, v1, 0, 0 };
+ }
+
+ public Scalar(double v0) {
+ val = new double[] { v0, 0, 0, 0 };
+ }
+
+ public Scalar(double[] vals) {
+ if (vals != null && vals.length == 4)
+ val = vals.clone();
+ else {
+ val = new double[4];
+ set(vals);
+ }
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ val[0] = vals.length > 0 ? vals[0] : 0;
+ val[1] = vals.length > 1 ? vals[1] : 0;
+ val[2] = vals.length > 2 ? vals[2] : 0;
+ val[3] = vals.length > 3 ? vals[3] : 0;
+ } else
+ val[0] = val[1] = val[2] = val[3] = 0;
+ }
+
+ public static Scalar all(double v) {
+ return new Scalar(v, v, v, v);
+ }
+
+ public Scalar clone() {
+ return new Scalar(val);
+ }
+
+ public Scalar mul(Scalar it, double scale) {
+ return new Scalar(val[0] * it.val[0] * scale, val[1] * it.val[1] * scale,
+ val[2] * it.val[2] * scale, val[3] * it.val[3] * scale);
+ }
+
+ public Scalar mul(Scalar it) {
+ return mul(it, 1);
+ }
+
+ public Scalar conj() {
+ return new Scalar(val[0], -val[1], -val[2], -val[3]);
+ }
+
+ public boolean isReal() {
+ return val[1] == 0 && val[2] == 0 && val[3] == 0;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + java.util.Arrays.hashCode(val);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof Scalar)) return false;
+ Scalar it = (Scalar) obj;
+ if (!java.util.Arrays.equals(val, it.val)) return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + val[0] + ", " + val[1] + ", " + val[2] + ", " + val[3] + "]";
+ }
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/Size.java b/openCVLibrary3413/src/main/java/org/opencv/core/Size.java
new file mode 100644
index 0000000..f7d69f3
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/Size.java
@@ -0,0 +1,73 @@
+package org.opencv.core;
+
+//javadoc:Size_
+public class Size {
+
+ public double width, height;
+
+ public Size(double width, double height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ public Size() {
+ this(0, 0);
+ }
+
+ public Size(Point p) {
+ width = p.x;
+ height = p.y;
+ }
+
+ public Size(double[] vals) {
+ set(vals);
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ width = vals.length > 0 ? vals[0] : 0;
+ height = vals.length > 1 ? vals[1] : 0;
+ } else {
+ width = 0;
+ height = 0;
+ }
+ }
+
+ public double area() {
+ return width * height;
+ }
+
+ public boolean empty() {
+ return width <= 0 || height <= 0;
+ }
+
+ public Size clone() {
+ return new Size(width, height);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(height);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(width);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof Size)) return false;
+ Size it = (Size) obj;
+ return width == it.width && height == it.height;
+ }
+
+ @Override
+ public String toString() {
+ return (int)width + "x" + (int)height;
+ }
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/TermCriteria.java b/openCVLibrary3413/src/main/java/org/opencv/core/TermCriteria.java
new file mode 100644
index 0000000..c67e51e
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/TermCriteria.java
@@ -0,0 +1,92 @@
+package org.opencv.core;
+
+//javadoc:TermCriteria
+public class TermCriteria {
+
+ /**
+ * The maximum number of iterations or elements to compute
+ */
+ public static final int COUNT = 1;
+ /**
+ * The maximum number of iterations or elements to compute
+ */
+ public static final int MAX_ITER = COUNT;
+ /**
+ * The desired accuracy threshold or change in parameters at which the iterative algorithm is terminated.
+ */
+ public static final int EPS = 2;
+
+ public int type;
+ public int maxCount;
+ public double epsilon;
+
+ /**
+ * Termination criteria for iterative algorithms.
+ *
+ * @param type
+ * the type of termination criteria: COUNT, EPS or COUNT + EPS.
+ * @param maxCount
+ * the maximum number of iterations/elements.
+ * @param epsilon
+ * the desired accuracy.
+ */
+ public TermCriteria(int type, int maxCount, double epsilon) {
+ this.type = type;
+ this.maxCount = maxCount;
+ this.epsilon = epsilon;
+ }
+
+ /**
+ * Termination criteria for iterative algorithms.
+ */
+ public TermCriteria() {
+ this(0, 0, 0.0);
+ }
+
+ public TermCriteria(double[] vals) {
+ set(vals);
+ }
+
+ public void set(double[] vals) {
+ if (vals != null) {
+ type = vals.length > 0 ? (int) vals[0] : 0;
+ maxCount = vals.length > 1 ? (int) vals[1] : 0;
+ epsilon = vals.length > 2 ? (double) vals[2] : 0;
+ } else {
+ type = 0;
+ maxCount = 0;
+ epsilon = 0;
+ }
+ }
+
+ public TermCriteria clone() {
+ return new TermCriteria(type, maxCount, epsilon);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(type);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(maxCount);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(epsilon);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof TermCriteria)) return false;
+ TermCriteria it = (TermCriteria) obj;
+ return type == it.type && maxCount == it.maxCount && epsilon == it.epsilon;
+ }
+
+ @Override
+ public String toString() {
+ return "{ type: " + type + ", maxCount: " + maxCount + ", epsilon: " + epsilon + "}";
+ }
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/core/TickMeter.java b/openCVLibrary3413/src/main/java/org/opencv/core/TickMeter.java
new file mode 100644
index 0000000..4f6d459
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/core/TickMeter.java
@@ -0,0 +1,185 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.core;
+
+
+
+// C++: class TickMeter
+/**
+ * a Class to measure passing time.
+ *
+ * The class computes passing time by counting the number of ticks per second. That is, the following code computes the
+ * execution time in seconds:
+ * SNIPPET: snippets/core_various.cpp TickMeter_total
+ *
+ * It is also possible to compute the average time over multiple runs:
+ * SNIPPET: snippets/core_various.cpp TickMeter_average
+ *
+ * SEE: getTickCount, getTickFrequency
+ */
+public class TickMeter {
+
+ protected final long nativeObj;
+ protected TickMeter(long addr) { nativeObj = addr; }
+
+ public long getNativeObjAddr() { return nativeObj; }
+
+ // internal usage only
+ public static TickMeter __fromPtr__(long addr) { return new TickMeter(addr); }
+
+ //
+ // C++: cv::TickMeter::TickMeter()
+ //
+
+ public TickMeter() {
+ nativeObj = TickMeter_0();
+ }
+
+
+ //
+ // C++: void cv::TickMeter::start()
+ //
+
+ public void start() {
+ start_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::TickMeter::stop()
+ //
+
+ public void stop() {
+ stop_0(nativeObj);
+ }
+
+
+ //
+ // C++: int64 cv::TickMeter::getTimeTicks()
+ //
+
+ public long getTimeTicks() {
+ return getTimeTicks_0(nativeObj);
+ }
+
+
+ //
+ // C++: double cv::TickMeter::getTimeMicro()
+ //
+
+ public double getTimeMicro() {
+ return getTimeMicro_0(nativeObj);
+ }
+
+
+ //
+ // C++: double cv::TickMeter::getTimeMilli()
+ //
+
+ public double getTimeMilli() {
+ return getTimeMilli_0(nativeObj);
+ }
+
+
+ //
+ // C++: double cv::TickMeter::getTimeSec()
+ //
+
+ public double getTimeSec() {
+ return getTimeSec_0(nativeObj);
+ }
+
+
+ //
+ // C++: int64 cv::TickMeter::getCounter()
+ //
+
+ public long getCounter() {
+ return getCounter_0(nativeObj);
+ }
+
+
+ //
+ // C++: double cv::TickMeter::getFPS()
+ //
+
+ public double getFPS() {
+ return getFPS_0(nativeObj);
+ }
+
+
+ //
+ // C++: double cv::TickMeter::getAvgTimeSec()
+ //
+
+ public double getAvgTimeSec() {
+ return getAvgTimeSec_0(nativeObj);
+ }
+
+
+ //
+ // C++: double cv::TickMeter::getAvgTimeMilli()
+ //
+
+ public double getAvgTimeMilli() {
+ return getAvgTimeMilli_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::TickMeter::reset()
+ //
+
+ public void reset() {
+ reset_0(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: cv::TickMeter::TickMeter()
+ private static native long TickMeter_0();
+
+ // C++: void cv::TickMeter::start()
+ private static native void start_0(long nativeObj);
+
+ // C++: void cv::TickMeter::stop()
+ private static native void stop_0(long nativeObj);
+
+ // C++: int64 cv::TickMeter::getTimeTicks()
+ private static native long getTimeTicks_0(long nativeObj);
+
+ // C++: double cv::TickMeter::getTimeMicro()
+ private static native double getTimeMicro_0(long nativeObj);
+
+ // C++: double cv::TickMeter::getTimeMilli()
+ private static native double getTimeMilli_0(long nativeObj);
+
+ // C++: double cv::TickMeter::getTimeSec()
+ private static native double getTimeSec_0(long nativeObj);
+
+ // C++: int64 cv::TickMeter::getCounter()
+ private static native long getCounter_0(long nativeObj);
+
+ // C++: double cv::TickMeter::getFPS()
+ private static native double getFPS_0(long nativeObj);
+
+ // C++: double cv::TickMeter::getAvgTimeSec()
+ private static native double getAvgTimeSec_0(long nativeObj);
+
+ // C++: double cv::TickMeter::getAvgTimeMilli()
+ private static native double getAvgTimeMilli_0(long nativeObj);
+
+ // C++: void cv::TickMeter::reset()
+ private static native void reset_0(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/dnn/DictValue.java b/openCVLibrary3413/src/main/java/org/opencv/dnn/DictValue.java
new file mode 100644
index 0000000..8ed692a
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/dnn/DictValue.java
@@ -0,0 +1,156 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.dnn;
+
+
+
+// C++: class DictValue
+/**
+ * This struct stores the scalar value (or array) of one of the following type: double, cv::String or int64.
+ * TODO: Maybe int64 is useless because double type exactly stores at least 2^52 integers.
+ */
+public class DictValue {
+
+ protected final long nativeObj;
+ protected DictValue(long addr) { nativeObj = addr; }
+
+ public long getNativeObjAddr() { return nativeObj; }
+
+ // internal usage only
+ public static DictValue __fromPtr__(long addr) { return new DictValue(addr); }
+
+ //
+ // C++: cv::dnn::DictValue::DictValue(int i)
+ //
+
+ public DictValue(int i) {
+ nativeObj = DictValue_0(i);
+ }
+
+
+ //
+ // C++: cv::dnn::DictValue::DictValue(double p)
+ //
+
+ public DictValue(double p) {
+ nativeObj = DictValue_1(p);
+ }
+
+
+ //
+ // C++: cv::dnn::DictValue::DictValue(String s)
+ //
+
+ public DictValue(String s) {
+ nativeObj = DictValue_2(s);
+ }
+
+
+ //
+ // C++: bool cv::dnn::DictValue::isInt()
+ //
+
+ public boolean isInt() {
+ return isInt_0(nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::dnn::DictValue::isString()
+ //
+
+ public boolean isString() {
+ return isString_0(nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::dnn::DictValue::isReal()
+ //
+
+ public boolean isReal() {
+ return isReal_0(nativeObj);
+ }
+
+
+ //
+ // C++: int cv::dnn::DictValue::getIntValue(int idx = -1)
+ //
+
+ public int getIntValue(int idx) {
+ return getIntValue_0(nativeObj, idx);
+ }
+
+ public int getIntValue() {
+ return getIntValue_1(nativeObj);
+ }
+
+
+ //
+ // C++: double cv::dnn::DictValue::getRealValue(int idx = -1)
+ //
+
+ public double getRealValue(int idx) {
+ return getRealValue_0(nativeObj, idx);
+ }
+
+ public double getRealValue() {
+ return getRealValue_1(nativeObj);
+ }
+
+
+ //
+ // C++: String cv::dnn::DictValue::getStringValue(int idx = -1)
+ //
+
+ public String getStringValue(int idx) {
+ return getStringValue_0(nativeObj, idx);
+ }
+
+ public String getStringValue() {
+ return getStringValue_1(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: cv::dnn::DictValue::DictValue(int i)
+ private static native long DictValue_0(int i);
+
+ // C++: cv::dnn::DictValue::DictValue(double p)
+ private static native long DictValue_1(double p);
+
+ // C++: cv::dnn::DictValue::DictValue(String s)
+ private static native long DictValue_2(String s);
+
+ // C++: bool cv::dnn::DictValue::isInt()
+ private static native boolean isInt_0(long nativeObj);
+
+ // C++: bool cv::dnn::DictValue::isString()
+ private static native boolean isString_0(long nativeObj);
+
+ // C++: bool cv::dnn::DictValue::isReal()
+ private static native boolean isReal_0(long nativeObj);
+
+ // C++: int cv::dnn::DictValue::getIntValue(int idx = -1)
+ private static native int getIntValue_0(long nativeObj, int idx);
+ private static native int getIntValue_1(long nativeObj);
+
+ // C++: double cv::dnn::DictValue::getRealValue(int idx = -1)
+ private static native double getRealValue_0(long nativeObj, int idx);
+ private static native double getRealValue_1(long nativeObj);
+
+ // C++: String cv::dnn::DictValue::getStringValue(int idx = -1)
+ private static native String getStringValue_0(long nativeObj, int idx);
+ private static native String getStringValue_1(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/dnn/Dnn.java b/openCVLibrary3413/src/main/java/org/opencv/dnn/Dnn.java
new file mode 100644
index 0000000..730afd2
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/dnn/Dnn.java
@@ -0,0 +1,1137 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.dnn;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfByte;
+import org.opencv.core.MatOfFloat;
+import org.opencv.core.MatOfInt;
+import org.opencv.core.MatOfRect2d;
+import org.opencv.core.MatOfRotatedRect;
+import org.opencv.core.Scalar;
+import org.opencv.core.Size;
+import org.opencv.dnn.Net;
+import org.opencv.utils.Converters;
+
+// C++: class Dnn
+
+public class Dnn {
+
+ // C++: enum Backend (cv.dnn.Backend)
+ public static final int
+ DNN_BACKEND_DEFAULT = 0,
+ DNN_BACKEND_HALIDE = 0+1,
+ DNN_BACKEND_INFERENCE_ENGINE = 0+2,
+ DNN_BACKEND_OPENCV = 0+3;
+
+
+ // C++: enum Target (cv.dnn.Target)
+ public static final int
+ DNN_TARGET_CPU = 0,
+ DNN_TARGET_OPENCL = 0+1,
+ DNN_TARGET_OPENCL_FP16 = 0+2,
+ DNN_TARGET_MYRIAD = 0+3,
+ DNN_TARGET_FPGA = 0+4;
+
+
+ //
+ // C++: vector_Target cv::dnn::getAvailableTargets(dnn_Backend be)
+ //
+
+ public static List getAvailableTargets(int be) {
+ return getAvailableTargets_0(be);
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromDarknet(String cfgFile, String darknetModel = String())
+ //
+
+ /**
+ * Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
+ * @param cfgFile path to the .cfg file with text description of the network architecture.
+ * @param darknetModel path to the .weights file with learned network.
+ * @return Network object that ready to do forward, throw an exception in failure cases.
+ * @return Net object.
+ */
+ public static Net readNetFromDarknet(String cfgFile, String darknetModel) {
+ return new Net(readNetFromDarknet_0(cfgFile, darknetModel));
+ }
+
+ /**
+ * Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
+ * @param cfgFile path to the .cfg file with text description of the network architecture.
+ * @return Network object that ready to do forward, throw an exception in failure cases.
+ * @return Net object.
+ */
+ public static Net readNetFromDarknet(String cfgFile) {
+ return new Net(readNetFromDarknet_1(cfgFile));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromDarknet(vector_uchar bufferCfg, vector_uchar bufferModel = std::vector())
+ //
+
+ /**
+ * Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
+ * @param bufferCfg A buffer contains a content of .cfg file with text description of the network architecture.
+ * @param bufferModel A buffer contains a content of .weights file with learned network.
+ * @return Net object.
+ */
+ public static Net readNetFromDarknet(MatOfByte bufferCfg, MatOfByte bufferModel) {
+ Mat bufferCfg_mat = bufferCfg;
+ Mat bufferModel_mat = bufferModel;
+ return new Net(readNetFromDarknet_2(bufferCfg_mat.nativeObj, bufferModel_mat.nativeObj));
+ }
+
+ /**
+ * Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
+ * @param bufferCfg A buffer contains a content of .cfg file with text description of the network architecture.
+ * @return Net object.
+ */
+ public static Net readNetFromDarknet(MatOfByte bufferCfg) {
+ Mat bufferCfg_mat = bufferCfg;
+ return new Net(readNetFromDarknet_3(bufferCfg_mat.nativeObj));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromCaffe(String prototxt, String caffeModel = String())
+ //
+
+ /**
+ * Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.
+ * @param prototxt path to the .prototxt file with text description of the network architecture.
+ * @param caffeModel path to the .caffemodel file with learned network.
+ * @return Net object.
+ */
+ public static Net readNetFromCaffe(String prototxt, String caffeModel) {
+ return new Net(readNetFromCaffe_0(prototxt, caffeModel));
+ }
+
+ /**
+ * Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.
+ * @param prototxt path to the .prototxt file with text description of the network architecture.
+ * @return Net object.
+ */
+ public static Net readNetFromCaffe(String prototxt) {
+ return new Net(readNetFromCaffe_1(prototxt));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromCaffe(vector_uchar bufferProto, vector_uchar bufferModel = std::vector())
+ //
+
+ /**
+ * Reads a network model stored in Caffe model in memory.
+ * @param bufferProto buffer containing the content of the .prototxt file
+ * @param bufferModel buffer containing the content of the .caffemodel file
+ * @return Net object.
+ */
+ public static Net readNetFromCaffe(MatOfByte bufferProto, MatOfByte bufferModel) {
+ Mat bufferProto_mat = bufferProto;
+ Mat bufferModel_mat = bufferModel;
+ return new Net(readNetFromCaffe_2(bufferProto_mat.nativeObj, bufferModel_mat.nativeObj));
+ }
+
+ /**
+ * Reads a network model stored in Caffe model in memory.
+ * @param bufferProto buffer containing the content of the .prototxt file
+ * @return Net object.
+ */
+ public static Net readNetFromCaffe(MatOfByte bufferProto) {
+ Mat bufferProto_mat = bufferProto;
+ return new Net(readNetFromCaffe_3(bufferProto_mat.nativeObj));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromTensorflow(String model, String config = String())
+ //
+
+ /**
+ * Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
+ * @param model path to the .pb file with binary protobuf description of the network architecture
+ * @param config path to the .pbtxt file that contains text graph definition in protobuf format.
+ * Resulting Net object is built by text graph using weights from a binary one that
+ * let us make it more flexible.
+ * @return Net object.
+ */
+ public static Net readNetFromTensorflow(String model, String config) {
+ return new Net(readNetFromTensorflow_0(model, config));
+ }
+
+ /**
+ * Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
+ * @param model path to the .pb file with binary protobuf description of the network architecture
+ * Resulting Net object is built by text graph using weights from a binary one that
+ * let us make it more flexible.
+ * @return Net object.
+ */
+ public static Net readNetFromTensorflow(String model) {
+ return new Net(readNetFromTensorflow_1(model));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromTensorflow(vector_uchar bufferModel, vector_uchar bufferConfig = std::vector())
+ //
+
+ /**
+ * Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
+ * @param bufferModel buffer containing the content of the pb file
+ * @param bufferConfig buffer containing the content of the pbtxt file
+ * @return Net object.
+ */
+ public static Net readNetFromTensorflow(MatOfByte bufferModel, MatOfByte bufferConfig) {
+ Mat bufferModel_mat = bufferModel;
+ Mat bufferConfig_mat = bufferConfig;
+ return new Net(readNetFromTensorflow_2(bufferModel_mat.nativeObj, bufferConfig_mat.nativeObj));
+ }
+
+ /**
+ * Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
+ * @param bufferModel buffer containing the content of the pb file
+ * @return Net object.
+ */
+ public static Net readNetFromTensorflow(MatOfByte bufferModel) {
+ Mat bufferModel_mat = bufferModel;
+ return new Net(readNetFromTensorflow_3(bufferModel_mat.nativeObj));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromTorch(String model, bool isBinary = true, bool evaluate = true)
+ //
+
+ /**
+ * Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
+ * @param model path to the file, dumped from Torch by using torch.save() function.
+ * @param isBinary specifies whether the network was serialized in ascii mode or binary.
+ * @param evaluate specifies testing phase of network. If true, it's similar to evaluate() method in Torch.
+ * @return Net object.
+ *
+ * Note: Ascii mode of Torch serializer is more preferable, because binary mode extensively use {@code long} type of C language,
+ * which has various bit-length on different systems.
+ *
+ * The loading file must contain serialized <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> object
+ * with importing network. Try to eliminate a custom objects from serialazing data to avoid importing errors.
+ *
+ * List of supported layers (i.e. object instances derived from Torch nn.Module class):
+ * - nn.Sequential
+ * - nn.Parallel
+ * - nn.Concat
+ * - nn.Linear
+ * - nn.SpatialConvolution
+ * - nn.SpatialMaxPooling, nn.SpatialAveragePooling
+ * - nn.ReLU, nn.TanH, nn.Sigmoid
+ * - nn.Reshape
+ * - nn.SoftMax, nn.LogSoftMax
+ *
+ * Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.
+ */
+ public static Net readNetFromTorch(String model, boolean isBinary, boolean evaluate) {
+ return new Net(readNetFromTorch_0(model, isBinary, evaluate));
+ }
+
+ /**
+ * Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
+ * @param model path to the file, dumped from Torch by using torch.save() function.
+ * @param isBinary specifies whether the network was serialized in ascii mode or binary.
+ * @return Net object.
+ *
+ * Note: Ascii mode of Torch serializer is more preferable, because binary mode extensively use {@code long} type of C language,
+ * which has various bit-length on different systems.
+ *
+ * The loading file must contain serialized <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> object
+ * with importing network. Try to eliminate a custom objects from serialazing data to avoid importing errors.
+ *
+ * List of supported layers (i.e. object instances derived from Torch nn.Module class):
+ * - nn.Sequential
+ * - nn.Parallel
+ * - nn.Concat
+ * - nn.Linear
+ * - nn.SpatialConvolution
+ * - nn.SpatialMaxPooling, nn.SpatialAveragePooling
+ * - nn.ReLU, nn.TanH, nn.Sigmoid
+ * - nn.Reshape
+ * - nn.SoftMax, nn.LogSoftMax
+ *
+ * Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.
+ */
+ public static Net readNetFromTorch(String model, boolean isBinary) {
+ return new Net(readNetFromTorch_1(model, isBinary));
+ }
+
+ /**
+ * Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
+ * @param model path to the file, dumped from Torch by using torch.save() function.
+ * @return Net object.
+ *
+ * Note: Ascii mode of Torch serializer is more preferable, because binary mode extensively use {@code long} type of C language,
+ * which has various bit-length on different systems.
+ *
+ * The loading file must contain serialized <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> object
+ * with importing network. Try to eliminate a custom objects from serialazing data to avoid importing errors.
+ *
+ * List of supported layers (i.e. object instances derived from Torch nn.Module class):
+ * - nn.Sequential
+ * - nn.Parallel
+ * - nn.Concat
+ * - nn.Linear
+ * - nn.SpatialConvolution
+ * - nn.SpatialMaxPooling, nn.SpatialAveragePooling
+ * - nn.ReLU, nn.TanH, nn.Sigmoid
+ * - nn.Reshape
+ * - nn.SoftMax, nn.LogSoftMax
+ *
+ * Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.
+ */
+ public static Net readNetFromTorch(String model) {
+ return new Net(readNetFromTorch_2(model));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNet(String model, String config = "", String framework = "")
+ //
+
+ /**
+ * Read deep learning network represented in one of the supported formats.
+ * @param model Binary file contains trained weights. The following file
+ * extensions are expected for models from different frameworks:
+ * * {@code *.caffemodel} (Caffe, http://caffe.berkeleyvision.org/)
+ * * {@code *.pb} (TensorFlow, https://www.tensorflow.org/)
+ * * {@code *.t7} | {@code *.net} (Torch, http://torch.ch/)
+ * * {@code *.weights} (Darknet, https://pjreddie.com/darknet/)
+ * * {@code *.bin} (DLDT, https://software.intel.com/openvino-toolkit)
+ * * {@code *.onnx} (ONNX, https://onnx.ai/)
+ * @param config Text file contains network configuration. It could be a
+ * file with the following extensions:
+ * * {@code *.prototxt} (Caffe, http://caffe.berkeleyvision.org/)
+ * * {@code *.pbtxt} (TensorFlow, https://www.tensorflow.org/)
+ * * {@code *.cfg} (Darknet, https://pjreddie.com/darknet/)
+ * * {@code *.xml} (DLDT, https://software.intel.com/openvino-toolkit)
+ * @param framework Explicit framework name tag to determine a format.
+ * @return Net object.
+ *
+ * This function automatically detects an origin framework of trained model
+ * and calls an appropriate function such REF: readNetFromCaffe, REF: readNetFromTensorflow,
+ * REF: readNetFromTorch or REF: readNetFromDarknet. An order of {@code model} and {@code config}
+ * arguments does not matter.
+ */
+ public static Net readNet(String model, String config, String framework) {
+ return new Net(readNet_0(model, config, framework));
+ }
+
+ /**
+ * Read deep learning network represented in one of the supported formats.
+ * @param model Binary file contains trained weights. The following file
+ * extensions are expected for models from different frameworks:
+ * * {@code *.caffemodel} (Caffe, http://caffe.berkeleyvision.org/)
+ * * {@code *.pb} (TensorFlow, https://www.tensorflow.org/)
+ * * {@code *.t7} | {@code *.net} (Torch, http://torch.ch/)
+ * * {@code *.weights} (Darknet, https://pjreddie.com/darknet/)
+ * * {@code *.bin} (DLDT, https://software.intel.com/openvino-toolkit)
+ * * {@code *.onnx} (ONNX, https://onnx.ai/)
+ * @param config Text file contains network configuration. It could be a
+ * file with the following extensions:
+ * * {@code *.prototxt} (Caffe, http://caffe.berkeleyvision.org/)
+ * * {@code *.pbtxt} (TensorFlow, https://www.tensorflow.org/)
+ * * {@code *.cfg} (Darknet, https://pjreddie.com/darknet/)
+ * * {@code *.xml} (DLDT, https://software.intel.com/openvino-toolkit)
+ * @return Net object.
+ *
+ * This function automatically detects an origin framework of trained model
+ * and calls an appropriate function such REF: readNetFromCaffe, REF: readNetFromTensorflow,
+ * REF: readNetFromTorch or REF: readNetFromDarknet. An order of {@code model} and {@code config}
+ * arguments does not matter.
+ */
+ public static Net readNet(String model, String config) {
+ return new Net(readNet_1(model, config));
+ }
+
+ /**
+ * Read deep learning network represented in one of the supported formats.
+ * @param model Binary file contains trained weights. The following file
+ * extensions are expected for models from different frameworks:
+ * * {@code *.caffemodel} (Caffe, http://caffe.berkeleyvision.org/)
+ * * {@code *.pb} (TensorFlow, https://www.tensorflow.org/)
+ * * {@code *.t7} | {@code *.net} (Torch, http://torch.ch/)
+ * * {@code *.weights} (Darknet, https://pjreddie.com/darknet/)
+ * * {@code *.bin} (DLDT, https://software.intel.com/openvino-toolkit)
+ * * {@code *.onnx} (ONNX, https://onnx.ai/)
+ * file with the following extensions:
+ * * {@code *.prototxt} (Caffe, http://caffe.berkeleyvision.org/)
+ * * {@code *.pbtxt} (TensorFlow, https://www.tensorflow.org/)
+ * * {@code *.cfg} (Darknet, https://pjreddie.com/darknet/)
+ * * {@code *.xml} (DLDT, https://software.intel.com/openvino-toolkit)
+ * @return Net object.
+ *
+ * This function automatically detects an origin framework of trained model
+ * and calls an appropriate function such REF: readNetFromCaffe, REF: readNetFromTensorflow,
+ * REF: readNetFromTorch or REF: readNetFromDarknet. An order of {@code model} and {@code config}
+ * arguments does not matter.
+ */
+ public static Net readNet(String model) {
+ return new Net(readNet_2(model));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNet(String framework, vector_uchar bufferModel, vector_uchar bufferConfig = std::vector())
+ //
+
+ /**
+ * Read deep learning network represented in one of the supported formats.
+ * This is an overloaded member function, provided for convenience.
+ * It differs from the above function only in what argument(s) it accepts.
+ * @param framework Name of origin framework.
+ * @param bufferModel A buffer with a content of binary file with weights
+ * @param bufferConfig A buffer with a content of text file contains network configuration.
+ * @return Net object.
+ */
+ public static Net readNet(String framework, MatOfByte bufferModel, MatOfByte bufferConfig) {
+ Mat bufferModel_mat = bufferModel;
+ Mat bufferConfig_mat = bufferConfig;
+ return new Net(readNet_3(framework, bufferModel_mat.nativeObj, bufferConfig_mat.nativeObj));
+ }
+
+ /**
+ * Read deep learning network represented in one of the supported formats.
+ * This is an overloaded member function, provided for convenience.
+ * It differs from the above function only in what argument(s) it accepts.
+ * @param framework Name of origin framework.
+ * @param bufferModel A buffer with a content of binary file with weights
+ * @return Net object.
+ */
+ public static Net readNet(String framework, MatOfByte bufferModel) {
+ Mat bufferModel_mat = bufferModel;
+ return new Net(readNet_4(framework, bufferModel_mat.nativeObj));
+ }
+
+
+ //
+ // C++: Mat cv::dnn::readTorchBlob(String filename, bool isBinary = true)
+ //
+
+ /**
+ * Loads blob which was serialized as torch.Tensor object of Torch7 framework.
+ * WARNING: This function has the same limitations as readNetFromTorch().
+ * @param filename automatically generated
+ * @param isBinary automatically generated
+ * @return automatically generated
+ */
+ public static Mat readTorchBlob(String filename, boolean isBinary) {
+ return new Mat(readTorchBlob_0(filename, isBinary));
+ }
+
+ /**
+ * Loads blob which was serialized as torch.Tensor object of Torch7 framework.
+ * WARNING: This function has the same limitations as readNetFromTorch().
+ * @param filename automatically generated
+ * @return automatically generated
+ */
+ public static Mat readTorchBlob(String filename) {
+ return new Mat(readTorchBlob_1(filename));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromModelOptimizer(String xml, String bin)
+ //
+
+ /**
+ * Load a network from Intel's Model Optimizer intermediate representation.
+ * @param xml XML configuration file with network's topology.
+ * @param bin Binary file with trained weights.
+ * @return Net object.
+ * Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine
+ * backend.
+ */
+ public static Net readNetFromModelOptimizer(String xml, String bin) {
+ return new Net(readNetFromModelOptimizer_0(xml, bin));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromModelOptimizer(vector_uchar bufferModelConfig, vector_uchar bufferWeights)
+ //
+
+ /**
+ * Load a network from Intel's Model Optimizer intermediate representation.
+ * @param bufferModelConfig Buffer contains XML configuration with network's topology.
+ * @param bufferWeights Buffer contains binary data with trained weights.
+ * @return Net object.
+ * Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine
+ * backend.
+ */
+ public static Net readNetFromModelOptimizer(MatOfByte bufferModelConfig, MatOfByte bufferWeights) {
+ Mat bufferModelConfig_mat = bufferModelConfig;
+ Mat bufferWeights_mat = bufferWeights;
+ return new Net(readNetFromModelOptimizer_1(bufferModelConfig_mat.nativeObj, bufferWeights_mat.nativeObj));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromONNX(String onnxFile)
+ //
+
+ /**
+ * Reads a network model <a href="https://onnx.ai/">ONNX</a>.
+ * @param onnxFile path to the .onnx file with text description of the network architecture.
+ * @return Network object that ready to do forward, throw an exception in failure cases.
+ */
+ public static Net readNetFromONNX(String onnxFile) {
+ return new Net(readNetFromONNX_0(onnxFile));
+ }
+
+
+ //
+ // C++: Net cv::dnn::readNetFromONNX(vector_uchar buffer)
+ //
+
+ /**
+ * Reads a network model from <a href="https://onnx.ai/">ONNX</a>
+ * in-memory buffer.
+ * @param buffer in-memory buffer that stores the ONNX model bytes.
+ * @return Network object that ready to do forward, throw an exception
+ * in failure cases.
+ */
+ public static Net readNetFromONNX(MatOfByte buffer) {
+ Mat buffer_mat = buffer;
+ return new Net(readNetFromONNX_1(buffer_mat.nativeObj));
+ }
+
+
+ //
+ // C++: Mat cv::dnn::readTensorFromONNX(String path)
+ //
+
+ /**
+ * Creates blob from .pb file.
+ * @param path to the .pb file with input tensor.
+ * @return Mat.
+ */
+ public static Mat readTensorFromONNX(String path) {
+ return new Mat(readTensorFromONNX_0(path));
+ }
+
+
+ //
+ // C++: Mat cv::dnn::blobFromImage(Mat image, double scalefactor = 1.0, Size size = Size(), Scalar mean = Scalar(), bool swapRB = false, bool crop = false, int ddepth = CV_32F)
+ //
+
+ /**
+ * Creates 4-dimensional blob from image. Optionally resizes and crops {@code image} from center,
+ * subtract {@code mean} values, scales values by {@code scalefactor}, swap Blue and Red channels.
+ * @param image input image (with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * @param mean scalar with mean values which are subtracted from channels. Values are intended
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code image} values.
+ * @param swapRB flag which indicates that swap first and last channels
+ * in 3-channel image is necessary.
+ * @param crop flag which indicates whether image will be cropped after resize or not
+ * @param ddepth Depth of output blob. Choose CV_32F or CV_8U.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop, int ddepth) {
+ return new Mat(blobFromImage_0(image.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3], swapRB, crop, ddepth));
+ }
+
+ /**
+ * Creates 4-dimensional blob from image. Optionally resizes and crops {@code image} from center,
+ * subtract {@code mean} values, scales values by {@code scalefactor}, swap Blue and Red channels.
+ * @param image input image (with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * @param mean scalar with mean values which are subtracted from channels. Values are intended
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code image} values.
+ * @param swapRB flag which indicates that swap first and last channels
+ * in 3-channel image is necessary.
+ * @param crop flag which indicates whether image will be cropped after resize or not
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop) {
+ return new Mat(blobFromImage_1(image.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3], swapRB, crop));
+ }
+
+ /**
+ * Creates 4-dimensional blob from image. Optionally resizes and crops {@code image} from center,
+ * subtract {@code mean} values, scales values by {@code scalefactor}, swap Blue and Red channels.
+ * @param image input image (with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * @param mean scalar with mean values which are subtracted from channels. Values are intended
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code image} values.
+ * @param swapRB flag which indicates that swap first and last channels
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB) {
+ return new Mat(blobFromImage_2(image.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3], swapRB));
+ }
+
+ /**
+ * Creates 4-dimensional blob from image. Optionally resizes and crops {@code image} from center,
+ * subtract {@code mean} values, scales values by {@code scalefactor}, swap Blue and Red channels.
+ * @param image input image (with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * @param mean scalar with mean values which are subtracted from channels. Values are intended
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code image} values.
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean) {
+ return new Mat(blobFromImage_3(image.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3]));
+ }
+
+ /**
+ * Creates 4-dimensional blob from image. Optionally resizes and crops {@code image} from center,
+ * subtract {@code mean} values, scales values by {@code scalefactor}, swap Blue and Red channels.
+ * @param image input image (with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code image} values.
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImage(Mat image, double scalefactor, Size size) {
+ return new Mat(blobFromImage_4(image.nativeObj, scalefactor, size.width, size.height));
+ }
+
+ /**
+ * Creates 4-dimensional blob from image. Optionally resizes and crops {@code image} from center,
+ * subtract {@code mean} values, scales values by {@code scalefactor}, swap Blue and Red channels.
+ * @param image input image (with 1-, 3- or 4-channels).
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code image} values.
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImage(Mat image, double scalefactor) {
+ return new Mat(blobFromImage_5(image.nativeObj, scalefactor));
+ }
+
+ /**
+ * Creates 4-dimensional blob from image. Optionally resizes and crops {@code image} from center,
+ * subtract {@code mean} values, scales values by {@code scalefactor}, swap Blue and Red channels.
+ * @param image input image (with 1-, 3- or 4-channels).
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImage(Mat image) {
+ return new Mat(blobFromImage_6(image.nativeObj));
+ }
+
+
+ //
+ // C++: Mat cv::dnn::blobFromImages(vector_Mat images, double scalefactor = 1.0, Size size = Size(), Scalar mean = Scalar(), bool swapRB = false, bool crop = false, int ddepth = CV_32F)
+ //
+
+ /**
+ * Creates 4-dimensional blob from series of images. Optionally resizes and
+ * crops {@code images} from center, subtract {@code mean} values, scales values by {@code scalefactor},
+ * swap Blue and Red channels.
+ * @param images input images (all with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * @param mean scalar with mean values which are subtracted from channels. Values are intended
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code images} values.
+ * @param swapRB flag which indicates that swap first and last channels
+ * in 3-channel image is necessary.
+ * @param crop flag which indicates whether image will be cropped after resize or not
+ * @param ddepth Depth of output blob. Choose CV_32F or CV_8U.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImages(List images, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop, int ddepth) {
+ Mat images_mat = Converters.vector_Mat_to_Mat(images);
+ return new Mat(blobFromImages_0(images_mat.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3], swapRB, crop, ddepth));
+ }
+
+ /**
+ * Creates 4-dimensional blob from series of images. Optionally resizes and
+ * crops {@code images} from center, subtract {@code mean} values, scales values by {@code scalefactor},
+ * swap Blue and Red channels.
+ * @param images input images (all with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * @param mean scalar with mean values which are subtracted from channels. Values are intended
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code images} values.
+ * @param swapRB flag which indicates that swap first and last channels
+ * in 3-channel image is necessary.
+ * @param crop flag which indicates whether image will be cropped after resize or not
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImages(List images, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop) {
+ Mat images_mat = Converters.vector_Mat_to_Mat(images);
+ return new Mat(blobFromImages_1(images_mat.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3], swapRB, crop));
+ }
+
+ /**
+ * Creates 4-dimensional blob from series of images. Optionally resizes and
+ * crops {@code images} from center, subtract {@code mean} values, scales values by {@code scalefactor},
+ * swap Blue and Red channels.
+ * @param images input images (all with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * @param mean scalar with mean values which are subtracted from channels. Values are intended
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code images} values.
+ * @param swapRB flag which indicates that swap first and last channels
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImages(List images, double scalefactor, Size size, Scalar mean, boolean swapRB) {
+ Mat images_mat = Converters.vector_Mat_to_Mat(images);
+ return new Mat(blobFromImages_2(images_mat.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3], swapRB));
+ }
+
+ /**
+ * Creates 4-dimensional blob from series of images. Optionally resizes and
+ * crops {@code images} from center, subtract {@code mean} values, scales values by {@code scalefactor},
+ * swap Blue and Red channels.
+ * @param images input images (all with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * @param mean scalar with mean values which are subtracted from channels. Values are intended
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code images} values.
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImages(List images, double scalefactor, Size size, Scalar mean) {
+ Mat images_mat = Converters.vector_Mat_to_Mat(images);
+ return new Mat(blobFromImages_3(images_mat.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3]));
+ }
+
+ /**
+ * Creates 4-dimensional blob from series of images. Optionally resizes and
+ * crops {@code images} from center, subtract {@code mean} values, scales values by {@code scalefactor},
+ * swap Blue and Red channels.
+ * @param images input images (all with 1-, 3- or 4-channels).
+ * @param size spatial size for output image
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code images} values.
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImages(List images, double scalefactor, Size size) {
+ Mat images_mat = Converters.vector_Mat_to_Mat(images);
+ return new Mat(blobFromImages_4(images_mat.nativeObj, scalefactor, size.width, size.height));
+ }
+
+ /**
+ * Creates 4-dimensional blob from series of images. Optionally resizes and
+ * crops {@code images} from center, subtract {@code mean} values, scales values by {@code scalefactor},
+ * swap Blue and Red channels.
+ * @param images input images (all with 1-, 3- or 4-channels).
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * @param scalefactor multiplier for {@code images} values.
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImages(List images, double scalefactor) {
+ Mat images_mat = Converters.vector_Mat_to_Mat(images);
+ return new Mat(blobFromImages_5(images_mat.nativeObj, scalefactor));
+ }
+
+ /**
+ * Creates 4-dimensional blob from series of images. Optionally resizes and
+ * crops {@code images} from center, subtract {@code mean} values, scales values by {@code scalefactor},
+ * swap Blue and Red channels.
+ * @param images input images (all with 1-, 3- or 4-channels).
+ * to be in (mean-R, mean-G, mean-B) order if {@code image} has BGR ordering and {@code swapRB} is true.
+ * in 3-channel image is necessary.
+ * if {@code crop} is true, input image is resized so one side after resize is equal to corresponding
+ * dimension in {@code size} and another one is equal or larger. Then, crop from the center is performed.
+ * If {@code crop} is false, direct resize without cropping and preserving aspect ratio is performed.
+ * @return 4-dimensional Mat with NCHW dimensions order.
+ */
+ public static Mat blobFromImages(List images) {
+ Mat images_mat = Converters.vector_Mat_to_Mat(images);
+ return new Mat(blobFromImages_6(images_mat.nativeObj));
+ }
+
+
+ //
+ // C++: void cv::dnn::imagesFromBlob(Mat blob_, vector_Mat& images_)
+ //
+
+ /**
+ * Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure
+ * (std::vector<cv::Mat>).
+ * @param blob_ 4 dimensional array (images, channels, height, width) in floating point precision (CV_32F) from
+ * which you would like to extract the images.
+ * @param images_ array of 2D Mat containing the images extracted from the blob in floating point precision
+ * (CV_32F). They are non normalized neither mean added. The number of returned images equals the first dimension
+ * of the blob (batch size). Every image has a number of channels equals to the second dimension of the blob (depth).
+ */
+ public static void imagesFromBlob(Mat blob_, List images_) {
+ Mat images__mat = new Mat();
+ imagesFromBlob_0(blob_.nativeObj, images__mat.nativeObj);
+ Converters.Mat_to_vector_Mat(images__mat, images_);
+ images__mat.release();
+ }
+
+
+ //
+ // C++: void cv::dnn::shrinkCaffeModel(String src, String dst, vector_String layersTypes = std::vector())
+ //
+
+ /**
+ * Convert all weights of Caffe network to half precision floating point.
+ * @param src Path to origin model from Caffe framework contains single
+ * precision floating point weights (usually has {@code .caffemodel} extension).
+ * @param dst Path to destination model with updated weights.
+ * @param layersTypes Set of layers types which parameters will be converted.
+ * By default, converts only Convolutional and Fully-Connected layers'
+ * weights.
+ *
+ * Note: Shrinked model has no origin float32 weights so it can't be used
+ * in origin Caffe framework anymore. However the structure of data
+ * is taken from NVidia's Caffe fork: https://github.com/NVIDIA/caffe.
+ * So the resulting model may be used there.
+ */
+ public static void shrinkCaffeModel(String src, String dst, List layersTypes) {
+ shrinkCaffeModel_0(src, dst, layersTypes);
+ }
+
+ /**
+ * Convert all weights of Caffe network to half precision floating point.
+ * @param src Path to origin model from Caffe framework contains single
+ * precision floating point weights (usually has {@code .caffemodel} extension).
+ * @param dst Path to destination model with updated weights.
+ * By default, converts only Convolutional and Fully-Connected layers'
+ * weights.
+ *
+ * Note: Shrinked model has no origin float32 weights so it can't be used
+ * in origin Caffe framework anymore. However the structure of data
+ * is taken from NVidia's Caffe fork: https://github.com/NVIDIA/caffe.
+ * So the resulting model may be used there.
+ */
+ public static void shrinkCaffeModel(String src, String dst) {
+ shrinkCaffeModel_1(src, dst);
+ }
+
+
+ //
+ // C++: void cv::dnn::writeTextGraph(String model, String output)
+ //
+
+ /**
+ * Create a text representation for a binary network stored in protocol buffer format.
+ * @param model A path to binary network.
+ * @param output A path to output text file to be created.
+ *
+ * Note: To reduce output file size, trained weights are not included.
+ */
+ public static void writeTextGraph(String model, String output) {
+ writeTextGraph_0(model, output);
+ }
+
+
+ //
+ // C++: void cv::dnn::NMSBoxes(vector_Rect2d bboxes, vector_float scores, float score_threshold, float nms_threshold, vector_int& indices, float eta = 1.f, int top_k = 0)
+ //
+
+ /**
+ * Performs non maximum suppression given boxes and corresponding scores.
+ *
+ * @param bboxes a set of bounding boxes to apply NMS.
+ * @param scores a set of corresponding confidences.
+ * @param score_threshold a threshold used to filter boxes by score.
+ * @param nms_threshold a threshold used in non maximum suppression.
+ * @param indices the kept indices of bboxes after NMS.
+ * @param eta a coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
+ * @param top_k if {@code >0}, keep at most {@code top_k} picked indices.
+ */
+ public static void NMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k) {
+ Mat bboxes_mat = bboxes;
+ Mat scores_mat = scores;
+ Mat indices_mat = indices;
+ NMSBoxes_0(bboxes_mat.nativeObj, scores_mat.nativeObj, score_threshold, nms_threshold, indices_mat.nativeObj, eta, top_k);
+ }
+
+ /**
+ * Performs non maximum suppression given boxes and corresponding scores.
+ *
+ * @param bboxes a set of bounding boxes to apply NMS.
+ * @param scores a set of corresponding confidences.
+ * @param score_threshold a threshold used to filter boxes by score.
+ * @param nms_threshold a threshold used in non maximum suppression.
+ * @param indices the kept indices of bboxes after NMS.
+ * @param eta a coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
+ */
+ public static void NMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta) {
+ Mat bboxes_mat = bboxes;
+ Mat scores_mat = scores;
+ Mat indices_mat = indices;
+ NMSBoxes_1(bboxes_mat.nativeObj, scores_mat.nativeObj, score_threshold, nms_threshold, indices_mat.nativeObj, eta);
+ }
+
+ /**
+ * Performs non maximum suppression given boxes and corresponding scores.
+ *
+ * @param bboxes a set of bounding boxes to apply NMS.
+ * @param scores a set of corresponding confidences.
+ * @param score_threshold a threshold used to filter boxes by score.
+ * @param nms_threshold a threshold used in non maximum suppression.
+ * @param indices the kept indices of bboxes after NMS.
+ */
+ public static void NMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices) {
+ Mat bboxes_mat = bboxes;
+ Mat scores_mat = scores;
+ Mat indices_mat = indices;
+ NMSBoxes_2(bboxes_mat.nativeObj, scores_mat.nativeObj, score_threshold, nms_threshold, indices_mat.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::dnn::NMSBoxes(vector_RotatedRect bboxes, vector_float scores, float score_threshold, float nms_threshold, vector_int& indices, float eta = 1.f, int top_k = 0)
+ //
+
+ public static void NMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k) {
+ Mat bboxes_mat = bboxes;
+ Mat scores_mat = scores;
+ Mat indices_mat = indices;
+ NMSBoxesRotated_0(bboxes_mat.nativeObj, scores_mat.nativeObj, score_threshold, nms_threshold, indices_mat.nativeObj, eta, top_k);
+ }
+
+ public static void NMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta) {
+ Mat bboxes_mat = bboxes;
+ Mat scores_mat = scores;
+ Mat indices_mat = indices;
+ NMSBoxesRotated_1(bboxes_mat.nativeObj, scores_mat.nativeObj, score_threshold, nms_threshold, indices_mat.nativeObj, eta);
+ }
+
+ public static void NMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices) {
+ Mat bboxes_mat = bboxes;
+ Mat scores_mat = scores;
+ Mat indices_mat = indices;
+ NMSBoxesRotated_2(bboxes_mat.nativeObj, scores_mat.nativeObj, score_threshold, nms_threshold, indices_mat.nativeObj);
+ }
+
+
+ //
+ // C++: String cv::dnn::getInferenceEngineBackendType()
+ //
+
+ /**
+ * Returns Inference Engine internal backend API.
+ *
+ * See values of {@code CV_DNN_BACKEND_INFERENCE_ENGINE_*} macros.
+ *
+ * Default value is controlled through {@code OPENCV_DNN_BACKEND_INFERENCE_ENGINE_TYPE} runtime parameter (environment variable).
+ * @return automatically generated
+ */
+ public static String getInferenceEngineBackendType() {
+ return getInferenceEngineBackendType_0();
+ }
+
+
+ //
+ // C++: String cv::dnn::setInferenceEngineBackendType(String newBackendType)
+ //
+
+ /**
+ * Specify Inference Engine internal backend API.
+ *
+ * See values of {@code CV_DNN_BACKEND_INFERENCE_ENGINE_*} macros.
+ *
+ * @return previous value of internal backend API
+ * @param newBackendType automatically generated
+ */
+ public static String setInferenceEngineBackendType(String newBackendType) {
+ return setInferenceEngineBackendType_0(newBackendType);
+ }
+
+
+ //
+ // C++: void cv::dnn::resetMyriadDevice()
+ //
+
+ /**
+ * Release a Myriad device (binded by OpenCV).
+ *
+ * Single Myriad device cannot be shared across multiple processes which uses
+ * Inference Engine's Myriad plugin.
+ */
+ public static void resetMyriadDevice() {
+ resetMyriadDevice_0();
+ }
+
+
+ //
+ // C++: String cv::dnn::getInferenceEngineVPUType()
+ //
+
+ /**
+ * Returns Inference Engine VPU type.
+ *
+ * See values of {@code CV_DNN_INFERENCE_ENGINE_VPU_TYPE_*} macros.
+ * @return automatically generated
+ */
+ public static String getInferenceEngineVPUType() {
+ return getInferenceEngineVPUType_0();
+ }
+
+
+
+
+ // C++: vector_Target cv::dnn::getAvailableTargets(dnn_Backend be)
+ private static native List getAvailableTargets_0(int be);
+
+ // C++: Net cv::dnn::readNetFromDarknet(String cfgFile, String darknetModel = String())
+ private static native long readNetFromDarknet_0(String cfgFile, String darknetModel);
+ private static native long readNetFromDarknet_1(String cfgFile);
+
+ // C++: Net cv::dnn::readNetFromDarknet(vector_uchar bufferCfg, vector_uchar bufferModel = std::vector())
+ private static native long readNetFromDarknet_2(long bufferCfg_mat_nativeObj, long bufferModel_mat_nativeObj);
+ private static native long readNetFromDarknet_3(long bufferCfg_mat_nativeObj);
+
+ // C++: Net cv::dnn::readNetFromCaffe(String prototxt, String caffeModel = String())
+ private static native long readNetFromCaffe_0(String prototxt, String caffeModel);
+ private static native long readNetFromCaffe_1(String prototxt);
+
+ // C++: Net cv::dnn::readNetFromCaffe(vector_uchar bufferProto, vector_uchar bufferModel = std::vector())
+ private static native long readNetFromCaffe_2(long bufferProto_mat_nativeObj, long bufferModel_mat_nativeObj);
+ private static native long readNetFromCaffe_3(long bufferProto_mat_nativeObj);
+
+ // C++: Net cv::dnn::readNetFromTensorflow(String model, String config = String())
+ private static native long readNetFromTensorflow_0(String model, String config);
+ private static native long readNetFromTensorflow_1(String model);
+
+ // C++: Net cv::dnn::readNetFromTensorflow(vector_uchar bufferModel, vector_uchar bufferConfig = std::vector())
+ private static native long readNetFromTensorflow_2(long bufferModel_mat_nativeObj, long bufferConfig_mat_nativeObj);
+ private static native long readNetFromTensorflow_3(long bufferModel_mat_nativeObj);
+
+ // C++: Net cv::dnn::readNetFromTorch(String model, bool isBinary = true, bool evaluate = true)
+ private static native long readNetFromTorch_0(String model, boolean isBinary, boolean evaluate);
+ private static native long readNetFromTorch_1(String model, boolean isBinary);
+ private static native long readNetFromTorch_2(String model);
+
+ // C++: Net cv::dnn::readNet(String model, String config = "", String framework = "")
+ private static native long readNet_0(String model, String config, String framework);
+ private static native long readNet_1(String model, String config);
+ private static native long readNet_2(String model);
+
+ // C++: Net cv::dnn::readNet(String framework, vector_uchar bufferModel, vector_uchar bufferConfig = std::vector())
+ private static native long readNet_3(String framework, long bufferModel_mat_nativeObj, long bufferConfig_mat_nativeObj);
+ private static native long readNet_4(String framework, long bufferModel_mat_nativeObj);
+
+ // C++: Mat cv::dnn::readTorchBlob(String filename, bool isBinary = true)
+ private static native long readTorchBlob_0(String filename, boolean isBinary);
+ private static native long readTorchBlob_1(String filename);
+
+ // C++: Net cv::dnn::readNetFromModelOptimizer(String xml, String bin)
+ private static native long readNetFromModelOptimizer_0(String xml, String bin);
+
+ // C++: Net cv::dnn::readNetFromModelOptimizer(vector_uchar bufferModelConfig, vector_uchar bufferWeights)
+ private static native long readNetFromModelOptimizer_1(long bufferModelConfig_mat_nativeObj, long bufferWeights_mat_nativeObj);
+
+ // C++: Net cv::dnn::readNetFromONNX(String onnxFile)
+ private static native long readNetFromONNX_0(String onnxFile);
+
+ // C++: Net cv::dnn::readNetFromONNX(vector_uchar buffer)
+ private static native long readNetFromONNX_1(long buffer_mat_nativeObj);
+
+ // C++: Mat cv::dnn::readTensorFromONNX(String path)
+ private static native long readTensorFromONNX_0(String path);
+
+ // C++: Mat cv::dnn::blobFromImage(Mat image, double scalefactor = 1.0, Size size = Size(), Scalar mean = Scalar(), bool swapRB = false, bool crop = false, int ddepth = CV_32F)
+ private static native long blobFromImage_0(long image_nativeObj, double scalefactor, double size_width, double size_height, double mean_val0, double mean_val1, double mean_val2, double mean_val3, boolean swapRB, boolean crop, int ddepth);
+ private static native long blobFromImage_1(long image_nativeObj, double scalefactor, double size_width, double size_height, double mean_val0, double mean_val1, double mean_val2, double mean_val3, boolean swapRB, boolean crop);
+ private static native long blobFromImage_2(long image_nativeObj, double scalefactor, double size_width, double size_height, double mean_val0, double mean_val1, double mean_val2, double mean_val3, boolean swapRB);
+ private static native long blobFromImage_3(long image_nativeObj, double scalefactor, double size_width, double size_height, double mean_val0, double mean_val1, double mean_val2, double mean_val3);
+ private static native long blobFromImage_4(long image_nativeObj, double scalefactor, double size_width, double size_height);
+ private static native long blobFromImage_5(long image_nativeObj, double scalefactor);
+ private static native long blobFromImage_6(long image_nativeObj);
+
+ // C++: Mat cv::dnn::blobFromImages(vector_Mat images, double scalefactor = 1.0, Size size = Size(), Scalar mean = Scalar(), bool swapRB = false, bool crop = false, int ddepth = CV_32F)
+ private static native long blobFromImages_0(long images_mat_nativeObj, double scalefactor, double size_width, double size_height, double mean_val0, double mean_val1, double mean_val2, double mean_val3, boolean swapRB, boolean crop, int ddepth);
+ private static native long blobFromImages_1(long images_mat_nativeObj, double scalefactor, double size_width, double size_height, double mean_val0, double mean_val1, double mean_val2, double mean_val3, boolean swapRB, boolean crop);
+ private static native long blobFromImages_2(long images_mat_nativeObj, double scalefactor, double size_width, double size_height, double mean_val0, double mean_val1, double mean_val2, double mean_val3, boolean swapRB);
+ private static native long blobFromImages_3(long images_mat_nativeObj, double scalefactor, double size_width, double size_height, double mean_val0, double mean_val1, double mean_val2, double mean_val3);
+ private static native long blobFromImages_4(long images_mat_nativeObj, double scalefactor, double size_width, double size_height);
+ private static native long blobFromImages_5(long images_mat_nativeObj, double scalefactor);
+ private static native long blobFromImages_6(long images_mat_nativeObj);
+
+ // C++: void cv::dnn::imagesFromBlob(Mat blob_, vector_Mat& images_)
+ private static native void imagesFromBlob_0(long blob__nativeObj, long images__mat_nativeObj);
+
+ // C++: void cv::dnn::shrinkCaffeModel(String src, String dst, vector_String layersTypes = std::vector())
+ private static native void shrinkCaffeModel_0(String src, String dst, List layersTypes);
+ private static native void shrinkCaffeModel_1(String src, String dst);
+
+ // C++: void cv::dnn::writeTextGraph(String model, String output)
+ private static native void writeTextGraph_0(String model, String output);
+
+ // C++: void cv::dnn::NMSBoxes(vector_Rect2d bboxes, vector_float scores, float score_threshold, float nms_threshold, vector_int& indices, float eta = 1.f, int top_k = 0)
+ private static native void NMSBoxes_0(long bboxes_mat_nativeObj, long scores_mat_nativeObj, float score_threshold, float nms_threshold, long indices_mat_nativeObj, float eta, int top_k);
+ private static native void NMSBoxes_1(long bboxes_mat_nativeObj, long scores_mat_nativeObj, float score_threshold, float nms_threshold, long indices_mat_nativeObj, float eta);
+ private static native void NMSBoxes_2(long bboxes_mat_nativeObj, long scores_mat_nativeObj, float score_threshold, float nms_threshold, long indices_mat_nativeObj);
+
+ // C++: void cv::dnn::NMSBoxes(vector_RotatedRect bboxes, vector_float scores, float score_threshold, float nms_threshold, vector_int& indices, float eta = 1.f, int top_k = 0)
+ private static native void NMSBoxesRotated_0(long bboxes_mat_nativeObj, long scores_mat_nativeObj, float score_threshold, float nms_threshold, long indices_mat_nativeObj, float eta, int top_k);
+ private static native void NMSBoxesRotated_1(long bboxes_mat_nativeObj, long scores_mat_nativeObj, float score_threshold, float nms_threshold, long indices_mat_nativeObj, float eta);
+ private static native void NMSBoxesRotated_2(long bboxes_mat_nativeObj, long scores_mat_nativeObj, float score_threshold, float nms_threshold, long indices_mat_nativeObj);
+
+ // C++: String cv::dnn::getInferenceEngineBackendType()
+ private static native String getInferenceEngineBackendType_0();
+
+ // C++: String cv::dnn::setInferenceEngineBackendType(String newBackendType)
+ private static native String setInferenceEngineBackendType_0(String newBackendType);
+
+ // C++: void cv::dnn::resetMyriadDevice()
+ private static native void resetMyriadDevice_0();
+
+ // C++: String cv::dnn::getInferenceEngineVPUType()
+ private static native String getInferenceEngineVPUType_0();
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/dnn/Layer.java b/openCVLibrary3413/src/main/java/org/opencv/dnn/Layer.java
new file mode 100644
index 0000000..07918bf
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/dnn/Layer.java
@@ -0,0 +1,169 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.dnn;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Algorithm;
+import org.opencv.core.Mat;
+import org.opencv.utils.Converters;
+
+// C++: class Layer
+/**
+ * This interface class allows to build new Layers - are building blocks of networks.
+ *
+ * Each class, derived from Layer, must implement allocate() methods to declare own outputs and forward() to compute outputs.
+ * Also before using the new layer into networks you must register your layer by using one of REF: dnnLayerFactory "LayerFactory" macros.
+ */
+public class Layer extends Algorithm {
+
+ protected Layer(long addr) { super(addr); }
+
+ // internal usage only
+ public static Layer __fromPtr__(long addr) { return new Layer(addr); }
+
+ //
+ // C++: void cv::dnn::Layer::finalize(vector_Mat inputs, vector_Mat& outputs)
+ //
+
+ /**
+ * Computes and sets internal parameters according to inputs, outputs and blobs.
+ * @param outputs vector of already allocated output blobs
+ *
+ * If this method is called after network has allocated all memory for input and output blobs
+ * and before inferencing.
+ * @param inputs automatically generated
+ */
+ public void finalize(List inputs, List outputs) {
+ Mat inputs_mat = Converters.vector_Mat_to_Mat(inputs);
+ Mat outputs_mat = new Mat();
+ finalize_0(nativeObj, inputs_mat.nativeObj, outputs_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(outputs_mat, outputs);
+ outputs_mat.release();
+ }
+
+
+ //
+ // C++: void cv::dnn::Layer::run(vector_Mat inputs, vector_Mat& outputs, vector_Mat& internals)
+ //
+
+ /**
+ * Allocates layer and computes output.
+ * @deprecated This method will be removed in the future release.
+ * @param inputs automatically generated
+ * @param outputs automatically generated
+ * @param internals automatically generated
+ */
+ @Deprecated
+ public void run(List inputs, List outputs, List internals) {
+ Mat inputs_mat = Converters.vector_Mat_to_Mat(inputs);
+ Mat outputs_mat = new Mat();
+ Mat internals_mat = Converters.vector_Mat_to_Mat(internals);
+ run_0(nativeObj, inputs_mat.nativeObj, outputs_mat.nativeObj, internals_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(outputs_mat, outputs);
+ outputs_mat.release();
+ Converters.Mat_to_vector_Mat(internals_mat, internals);
+ internals_mat.release();
+ }
+
+
+ //
+ // C++: int cv::dnn::Layer::outputNameToIndex(String outputName)
+ //
+
+ /**
+ * Returns index of output blob in output array.
+ * SEE: inputNameToIndex()
+ * @param outputName automatically generated
+ * @return automatically generated
+ */
+ public int outputNameToIndex(String outputName) {
+ return outputNameToIndex_0(nativeObj, outputName);
+ }
+
+
+ //
+ // C++: vector_Mat Layer::blobs
+ //
+
+ public List get_blobs() {
+ List retVal = new ArrayList();
+ Mat retValMat = new Mat(get_blobs_0(nativeObj));
+ Converters.Mat_to_vector_Mat(retValMat, retVal);
+ return retVal;
+ }
+
+
+ //
+ // C++: void Layer::blobs
+ //
+
+ public void set_blobs(List blobs) {
+ Mat blobs_mat = Converters.vector_Mat_to_Mat(blobs);
+ set_blobs_0(nativeObj, blobs_mat.nativeObj);
+ }
+
+
+ //
+ // C++: String Layer::name
+ //
+
+ public String get_name() {
+ return get_name_0(nativeObj);
+ }
+
+
+ //
+ // C++: String Layer::type
+ //
+
+ public String get_type() {
+ return get_type_0(nativeObj);
+ }
+
+
+ //
+ // C++: int Layer::preferableTarget
+ //
+
+ public int get_preferableTarget() {
+ return get_preferableTarget_0(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: void cv::dnn::Layer::finalize(vector_Mat inputs, vector_Mat& outputs)
+ private static native void finalize_0(long nativeObj, long inputs_mat_nativeObj, long outputs_mat_nativeObj);
+
+ // C++: void cv::dnn::Layer::run(vector_Mat inputs, vector_Mat& outputs, vector_Mat& internals)
+ private static native void run_0(long nativeObj, long inputs_mat_nativeObj, long outputs_mat_nativeObj, long internals_mat_nativeObj);
+
+ // C++: int cv::dnn::Layer::outputNameToIndex(String outputName)
+ private static native int outputNameToIndex_0(long nativeObj, String outputName);
+
+ // C++: vector_Mat Layer::blobs
+ private static native long get_blobs_0(long nativeObj);
+
+ // C++: void Layer::blobs
+ private static native void set_blobs_0(long nativeObj, long blobs_mat_nativeObj);
+
+ // C++: String Layer::name
+ private static native String get_name_0(long nativeObj);
+
+ // C++: String Layer::type
+ private static native String get_type_0(long nativeObj);
+
+ // C++: int Layer::preferableTarget
+ private static native int get_preferableTarget_0(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/dnn/Net.java b/openCVLibrary3413/src/main/java/org/opencv/dnn/Net.java
new file mode 100644
index 0000000..29ea8b2
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/dnn/Net.java
@@ -0,0 +1,766 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.dnn;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfByte;
+import org.opencv.core.MatOfDouble;
+import org.opencv.core.MatOfInt;
+import org.opencv.core.Scalar;
+import org.opencv.dnn.DictValue;
+import org.opencv.dnn.Layer;
+import org.opencv.dnn.Net;
+import org.opencv.utils.Converters;
+
+// C++: class Net
+/**
+ * This class allows to create and manipulate comprehensive artificial neural networks.
+ *
+ * Neural network is presented as directed acyclic graph (DAG), where vertices are Layer instances,
+ * and edges specify relationships between layers inputs and outputs.
+ *
+ * Each network layer has unique integer id and unique string name inside its network.
+ * LayerId can store either layer name or layer id.
+ *
+ * This class supports reference counting of its instances, i. e. copies point to the same instance.
+ */
+public class Net {
+
+ protected final long nativeObj;
+ protected Net(long addr) { nativeObj = addr; }
+
+ public long getNativeObjAddr() { return nativeObj; }
+
+ // internal usage only
+ public static Net __fromPtr__(long addr) { return new Net(addr); }
+
+ //
+ // C++: cv::dnn::Net::Net()
+ //
+
+ public Net() {
+ nativeObj = Net_0();
+ }
+
+
+ //
+ // C++: static Net cv::dnn::Net::readFromModelOptimizer(String xml, String bin)
+ //
+
+ /**
+ * Create a network from Intel's Model Optimizer intermediate representation (IR).
+ * @param xml XML configuration file with network's topology.
+ * @param bin Binary file with trained weights.
+ * Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine
+ * backend.
+ * @return automatically generated
+ */
+ public static Net readFromModelOptimizer(String xml, String bin) {
+ return new Net(readFromModelOptimizer_0(xml, bin));
+ }
+
+
+ //
+ // C++: static Net cv::dnn::Net::readFromModelOptimizer(vector_uchar bufferModelConfig, vector_uchar bufferWeights)
+ //
+
+ /**
+ * Create a network from Intel's Model Optimizer in-memory buffers with intermediate representation (IR).
+ * @param bufferModelConfig buffer with model's configuration.
+ * @param bufferWeights buffer with model's trained weights.
+ * @return Net object.
+ */
+ public static Net readFromModelOptimizer(MatOfByte bufferModelConfig, MatOfByte bufferWeights) {
+ Mat bufferModelConfig_mat = bufferModelConfig;
+ Mat bufferWeights_mat = bufferWeights;
+ return new Net(readFromModelOptimizer_1(bufferModelConfig_mat.nativeObj, bufferWeights_mat.nativeObj));
+ }
+
+
+ //
+ // C++: bool cv::dnn::Net::empty()
+ //
+
+ /**
+ * Returns true if there are no layers in the network.
+ * @return automatically generated
+ */
+ public boolean empty() {
+ return empty_0(nativeObj);
+ }
+
+
+ //
+ // C++: String cv::dnn::Net::dump()
+ //
+
+ /**
+ * Dump net to String
+ * @return String with structure, hyperparameters, backend, target and fusion
+ * Call method after setInput(). To see correct backend, target and fusion run after forward().
+ */
+ public String dump() {
+ return dump_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::dumpToFile(String path)
+ //
+
+ /**
+ * Dump net structure, hyperparameters, backend, target and fusion to dot file
+ * @param path path to output file with .dot extension
+ * SEE: dump()
+ */
+ public void dumpToFile(String path) {
+ dumpToFile_0(nativeObj, path);
+ }
+
+
+ //
+ // C++: int cv::dnn::Net::getLayerId(String layer)
+ //
+
+ /**
+ * Converts string name of the layer to the integer identifier.
+ * @return id of the layer, or -1 if the layer wasn't found.
+ * @param layer automatically generated
+ */
+ public int getLayerId(String layer) {
+ return getLayerId_0(nativeObj, layer);
+ }
+
+
+ //
+ // C++: vector_String cv::dnn::Net::getLayerNames()
+ //
+
+ public List getLayerNames() {
+ return getLayerNames_0(nativeObj);
+ }
+
+
+ //
+ // C++: Ptr_Layer cv::dnn::Net::getLayer(LayerId layerId)
+ //
+
+ /**
+ * Returns pointer to layer with specified id or name which the network use.
+ * @param layerId automatically generated
+ * @return automatically generated
+ */
+ public Layer getLayer(DictValue layerId) {
+ return Layer.__fromPtr__(getLayer_0(nativeObj, layerId.getNativeObjAddr()));
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::connect(String outPin, String inpPin)
+ //
+
+ /**
+ * Connects output of the first layer to input of the second layer.
+ * @param outPin descriptor of the first layer output.
+ * @param inpPin descriptor of the second layer input.
+ *
+ * Descriptors have the following template <DFN><layer_name>[.input_number]</DFN>:
+ * - the first part of the template <DFN>layer_name</DFN> is string name of the added layer.
+ * If this part is empty then the network input pseudo layer will be used;
+ * - the second optional part of the template <DFN>input_number</DFN>
+ * is either number of the layer input, either label one.
+ * If this part is omitted then the first layer input will be used.
+ *
+ * SEE: setNetInputs(), Layer::inputNameToIndex(), Layer::outputNameToIndex()
+ */
+ public void connect(String outPin, String inpPin) {
+ connect_0(nativeObj, outPin, inpPin);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::setInputsNames(vector_String inputBlobNames)
+ //
+
+ /**
+ * Sets outputs names of the network input pseudo layer.
+ *
+ * Each net always has special own the network input pseudo layer with id=0.
+ * This layer stores the user blobs only and don't make any computations.
+ * In fact, this layer provides the only way to pass user data into the network.
+ * As any other layer, this layer can label its outputs and this function provides an easy way to do this.
+ * @param inputBlobNames automatically generated
+ */
+ public void setInputsNames(List inputBlobNames) {
+ setInputsNames_0(nativeObj, inputBlobNames);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::setInputShape(String inputName, MatShape shape)
+ //
+
+ /**
+ * Specify shape of network input.
+ * @param inputName automatically generated
+ * @param shape automatically generated
+ */
+ public void setInputShape(String inputName, MatOfInt shape) {
+ Mat shape_mat = shape;
+ setInputShape_0(nativeObj, inputName, shape_mat.nativeObj);
+ }
+
+
+ //
+ // C++: Mat cv::dnn::Net::forward(String outputName = String())
+ //
+
+ /**
+ * Runs forward pass to compute output of layer with name {@code outputName}.
+ * @param outputName name for layer which output is needed to get
+ * @return blob for first output of specified layer.
+ * By default runs forward pass for the whole network.
+ */
+ public Mat forward(String outputName) {
+ return new Mat(forward_0(nativeObj, outputName));
+ }
+
+ /**
+ * Runs forward pass to compute output of layer with name {@code outputName}.
+ * @return blob for first output of specified layer.
+ * By default runs forward pass for the whole network.
+ */
+ public Mat forward() {
+ return new Mat(forward_1(nativeObj));
+ }
+
+
+ //
+ // C++: AsyncArray cv::dnn::Net::forwardAsync(String outputName = String())
+ //
+
+ // Return type 'AsyncArray' is not supported, skipping the function
+
+
+ //
+ // C++: void cv::dnn::Net::forward(vector_Mat& outputBlobs, String outputName = String())
+ //
+
+ /**
+ * Runs forward pass to compute output of layer with name {@code outputName}.
+ * @param outputBlobs contains all output blobs for specified layer.
+ * @param outputName name for layer which output is needed to get
+ * If {@code outputName} is empty, runs forward pass for the whole network.
+ */
+ public void forward(List outputBlobs, String outputName) {
+ Mat outputBlobs_mat = new Mat();
+ forward_2(nativeObj, outputBlobs_mat.nativeObj, outputName);
+ Converters.Mat_to_vector_Mat(outputBlobs_mat, outputBlobs);
+ outputBlobs_mat.release();
+ }
+
+ /**
+ * Runs forward pass to compute output of layer with name {@code outputName}.
+ * @param outputBlobs contains all output blobs for specified layer.
+ * If {@code outputName} is empty, runs forward pass for the whole network.
+ */
+ public void forward(List outputBlobs) {
+ Mat outputBlobs_mat = new Mat();
+ forward_3(nativeObj, outputBlobs_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(outputBlobs_mat, outputBlobs);
+ outputBlobs_mat.release();
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::forward(vector_Mat& outputBlobs, vector_String outBlobNames)
+ //
+
+ /**
+ * Runs forward pass to compute outputs of layers listed in {@code outBlobNames}.
+ * @param outputBlobs contains blobs for first outputs of specified layers.
+ * @param outBlobNames names for layers which outputs are needed to get
+ */
+ public void forward(List outputBlobs, List outBlobNames) {
+ Mat outputBlobs_mat = new Mat();
+ forward_4(nativeObj, outputBlobs_mat.nativeObj, outBlobNames);
+ Converters.Mat_to_vector_Mat(outputBlobs_mat, outputBlobs);
+ outputBlobs_mat.release();
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::forward(vector_vector_Mat& outputBlobs, vector_String outBlobNames)
+ //
+
+ // Unknown type 'vector_vector_Mat' (O), skipping the function
+
+
+ //
+ // C++: void cv::dnn::Net::setHalideScheduler(String scheduler)
+ //
+
+ /**
+ * Compile Halide layers.
+ * @param scheduler Path to YAML file with scheduling directives.
+ * SEE: setPreferableBackend
+ *
+ * Schedule layers that support Halide backend. Then compile them for
+ * specific target. For layers that not represented in scheduling file
+ * or if no manual scheduling used at all, automatic scheduling will be applied.
+ */
+ public void setHalideScheduler(String scheduler) {
+ setHalideScheduler_0(nativeObj, scheduler);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::setPreferableBackend(int backendId)
+ //
+
+ /**
+ * Ask network to use specific computation backend where it supported.
+ * @param backendId backend identifier.
+ * SEE: Backend
+ *
+ * If OpenCV is compiled with Intel's Inference Engine library, DNN_BACKEND_DEFAULT
+ * means DNN_BACKEND_INFERENCE_ENGINE. Otherwise it equals to DNN_BACKEND_OPENCV.
+ */
+ public void setPreferableBackend(int backendId) {
+ setPreferableBackend_0(nativeObj, backendId);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::setPreferableTarget(int targetId)
+ //
+
+ /**
+ * Ask network to make computations on specific target device.
+ * @param targetId target identifier.
+ * SEE: Target
+ *
+ * List of supported combinations backend / target:
+ * | | DNN_BACKEND_OPENCV | DNN_BACKEND_INFERENCE_ENGINE | DNN_BACKEND_HALIDE |
+ * |------------------------|--------------------|------------------------------|--------------------|
+ * | DNN_TARGET_CPU | + | + | + |
+ * | DNN_TARGET_OPENCL | + | + | + |
+ * | DNN_TARGET_OPENCL_FP16 | + | + | |
+ * | DNN_TARGET_MYRIAD | | + | |
+ * | DNN_TARGET_FPGA | | + | |
+ */
+ public void setPreferableTarget(int targetId) {
+ setPreferableTarget_0(nativeObj, targetId);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::setInput(Mat blob, String name = "", double scalefactor = 1.0, Scalar mean = Scalar())
+ //
+
+ /**
+ * Sets the new input value for the network
+ * @param blob A new blob. Should have CV_32F or CV_8U depth.
+ * @param name A name of input layer.
+ * @param scalefactor An optional normalization scale.
+ * @param mean An optional mean subtraction values.
+ * SEE: connect(String, String) to know format of the descriptor.
+ *
+ * If scale or mean values are specified, a final input blob is computed
+ * as:
+ * \(input(n,c,h,w) = scalefactor \times (blob(n,c,h,w) - mean_c)\)
+ */
+ public void setInput(Mat blob, String name, double scalefactor, Scalar mean) {
+ setInput_0(nativeObj, blob.nativeObj, name, scalefactor, mean.val[0], mean.val[1], mean.val[2], mean.val[3]);
+ }
+
+ /**
+ * Sets the new input value for the network
+ * @param blob A new blob. Should have CV_32F or CV_8U depth.
+ * @param name A name of input layer.
+ * @param scalefactor An optional normalization scale.
+ * SEE: connect(String, String) to know format of the descriptor.
+ *
+ * If scale or mean values are specified, a final input blob is computed
+ * as:
+ * \(input(n,c,h,w) = scalefactor \times (blob(n,c,h,w) - mean_c)\)
+ */
+ public void setInput(Mat blob, String name, double scalefactor) {
+ setInput_1(nativeObj, blob.nativeObj, name, scalefactor);
+ }
+
+ /**
+ * Sets the new input value for the network
+ * @param blob A new blob. Should have CV_32F or CV_8U depth.
+ * @param name A name of input layer.
+ * SEE: connect(String, String) to know format of the descriptor.
+ *
+ * If scale or mean values are specified, a final input blob is computed
+ * as:
+ * \(input(n,c,h,w) = scalefactor \times (blob(n,c,h,w) - mean_c)\)
+ */
+ public void setInput(Mat blob, String name) {
+ setInput_2(nativeObj, blob.nativeObj, name);
+ }
+
+ /**
+ * Sets the new input value for the network
+ * @param blob A new blob. Should have CV_32F or CV_8U depth.
+ * SEE: connect(String, String) to know format of the descriptor.
+ *
+ * If scale or mean values are specified, a final input blob is computed
+ * as:
+ * \(input(n,c,h,w) = scalefactor \times (blob(n,c,h,w) - mean_c)\)
+ */
+ public void setInput(Mat blob) {
+ setInput_3(nativeObj, blob.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::setParam(LayerId layer, int numParam, Mat blob)
+ //
+
+ /**
+ * Sets the new value for the learned param of the layer.
+ * @param layer name or id of the layer.
+ * @param numParam index of the layer parameter in the Layer::blobs array.
+ * @param blob the new value.
+ * SEE: Layer::blobs
+ * Note: If shape of the new blob differs from the previous shape,
+ * then the following forward pass may fail.
+ */
+ public void setParam(DictValue layer, int numParam, Mat blob) {
+ setParam_0(nativeObj, layer.getNativeObjAddr(), numParam, blob.nativeObj);
+ }
+
+
+ //
+ // C++: Mat cv::dnn::Net::getParam(LayerId layer, int numParam = 0)
+ //
+
+ /**
+ * Returns parameter blob of the layer.
+ * @param layer name or id of the layer.
+ * @param numParam index of the layer parameter in the Layer::blobs array.
+ * SEE: Layer::blobs
+ * @return automatically generated
+ */
+ public Mat getParam(DictValue layer, int numParam) {
+ return new Mat(getParam_0(nativeObj, layer.getNativeObjAddr(), numParam));
+ }
+
+ /**
+ * Returns parameter blob of the layer.
+ * @param layer name or id of the layer.
+ * SEE: Layer::blobs
+ * @return automatically generated
+ */
+ public Mat getParam(DictValue layer) {
+ return new Mat(getParam_1(nativeObj, layer.getNativeObjAddr()));
+ }
+
+
+ //
+ // C++: vector_int cv::dnn::Net::getUnconnectedOutLayers()
+ //
+
+ /**
+ * Returns indexes of layers with unconnected outputs.
+ * @return automatically generated
+ */
+ public MatOfInt getUnconnectedOutLayers() {
+ return MatOfInt.fromNativeAddr(getUnconnectedOutLayers_0(nativeObj));
+ }
+
+
+ //
+ // C++: vector_String cv::dnn::Net::getUnconnectedOutLayersNames()
+ //
+
+ /**
+ * Returns names of layers with unconnected outputs.
+ * @return automatically generated
+ */
+ public List getUnconnectedOutLayersNames() {
+ return getUnconnectedOutLayersNames_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::getLayersShapes(vector_MatShape netInputShapes, vector_int& layersIds, vector_vector_MatShape& inLayersShapes, vector_vector_MatShape& outLayersShapes)
+ //
+
+ // Unknown type 'vector_vector_MatShape' (O), skipping the function
+
+
+ //
+ // C++: void cv::dnn::Net::getLayersShapes(MatShape netInputShape, vector_int& layersIds, vector_vector_MatShape& inLayersShapes, vector_vector_MatShape& outLayersShapes)
+ //
+
+ // Unknown type 'vector_vector_MatShape' (O), skipping the function
+
+
+ //
+ // C++: int64 cv::dnn::Net::getFLOPS(vector_MatShape netInputShapes)
+ //
+
+ /**
+ * Computes FLOP for whole loaded model with specified input shapes.
+ * @param netInputShapes vector of shapes for all net inputs.
+ * @return computed FLOP.
+ */
+ public long getFLOPS(List netInputShapes) {
+ return getFLOPS_0(nativeObj, netInputShapes);
+ }
+
+
+ //
+ // C++: int64 cv::dnn::Net::getFLOPS(MatShape netInputShape)
+ //
+
+ public long getFLOPS(MatOfInt netInputShape) {
+ Mat netInputShape_mat = netInputShape;
+ return getFLOPS_1(nativeObj, netInputShape_mat.nativeObj);
+ }
+
+
+ //
+ // C++: int64 cv::dnn::Net::getFLOPS(int layerId, vector_MatShape netInputShapes)
+ //
+
+ public long getFLOPS(int layerId, List netInputShapes) {
+ return getFLOPS_2(nativeObj, layerId, netInputShapes);
+ }
+
+
+ //
+ // C++: int64 cv::dnn::Net::getFLOPS(int layerId, MatShape netInputShape)
+ //
+
+ public long getFLOPS(int layerId, MatOfInt netInputShape) {
+ Mat netInputShape_mat = netInputShape;
+ return getFLOPS_3(nativeObj, layerId, netInputShape_mat.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::getLayerTypes(vector_String& layersTypes)
+ //
+
+ /**
+ * Returns list of types for layer used in model.
+ * @param layersTypes output parameter for returning types.
+ */
+ public void getLayerTypes(List layersTypes) {
+ getLayerTypes_0(nativeObj, layersTypes);
+ }
+
+
+ //
+ // C++: int cv::dnn::Net::getLayersCount(String layerType)
+ //
+
+ /**
+ * Returns count of layers of specified type.
+ * @param layerType type.
+ * @return count of layers
+ */
+ public int getLayersCount(String layerType) {
+ return getLayersCount_0(nativeObj, layerType);
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::getMemoryConsumption(MatShape netInputShape, size_t& weights, size_t& blobs)
+ //
+
+ public void getMemoryConsumption(MatOfInt netInputShape, long[] weights, long[] blobs) {
+ Mat netInputShape_mat = netInputShape;
+ double[] weights_out = new double[1];
+ double[] blobs_out = new double[1];
+ getMemoryConsumption_0(nativeObj, netInputShape_mat.nativeObj, weights_out, blobs_out);
+ if(weights!=null) weights[0] = (long)weights_out[0];
+ if(blobs!=null) blobs[0] = (long)blobs_out[0];
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::getMemoryConsumption(int layerId, vector_MatShape netInputShapes, size_t& weights, size_t& blobs)
+ //
+
+ public void getMemoryConsumption(int layerId, List netInputShapes, long[] weights, long[] blobs) {
+ double[] weights_out = new double[1];
+ double[] blobs_out = new double[1];
+ getMemoryConsumption_1(nativeObj, layerId, netInputShapes, weights_out, blobs_out);
+ if(weights!=null) weights[0] = (long)weights_out[0];
+ if(blobs!=null) blobs[0] = (long)blobs_out[0];
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::getMemoryConsumption(int layerId, MatShape netInputShape, size_t& weights, size_t& blobs)
+ //
+
+ public void getMemoryConsumption(int layerId, MatOfInt netInputShape, long[] weights, long[] blobs) {
+ Mat netInputShape_mat = netInputShape;
+ double[] weights_out = new double[1];
+ double[] blobs_out = new double[1];
+ getMemoryConsumption_2(nativeObj, layerId, netInputShape_mat.nativeObj, weights_out, blobs_out);
+ if(weights!=null) weights[0] = (long)weights_out[0];
+ if(blobs!=null) blobs[0] = (long)blobs_out[0];
+ }
+
+
+ //
+ // C++: void cv::dnn::Net::enableFusion(bool fusion)
+ //
+
+ /**
+ * Enables or disables layer fusion in the network.
+ * @param fusion true to enable the fusion, false to disable. The fusion is enabled by default.
+ */
+ public void enableFusion(boolean fusion) {
+ enableFusion_0(nativeObj, fusion);
+ }
+
+
+ //
+ // C++: int64 cv::dnn::Net::getPerfProfile(vector_double& timings)
+ //
+
+ /**
+ * Returns overall time for inference and timings (in ticks) for layers.
+ * Indexes in returned vector correspond to layers ids. Some layers can be fused with others,
+ * in this case zero ticks count will be return for that skipped layers.
+ * @param timings vector for tick timings for all layers.
+ * @return overall ticks for model inference.
+ */
+ public long getPerfProfile(MatOfDouble timings) {
+ Mat timings_mat = timings;
+ return getPerfProfile_0(nativeObj, timings_mat.nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: cv::dnn::Net::Net()
+ private static native long Net_0();
+
+ // C++: static Net cv::dnn::Net::readFromModelOptimizer(String xml, String bin)
+ private static native long readFromModelOptimizer_0(String xml, String bin);
+
+ // C++: static Net cv::dnn::Net::readFromModelOptimizer(vector_uchar bufferModelConfig, vector_uchar bufferWeights)
+ private static native long readFromModelOptimizer_1(long bufferModelConfig_mat_nativeObj, long bufferWeights_mat_nativeObj);
+
+ // C++: bool cv::dnn::Net::empty()
+ private static native boolean empty_0(long nativeObj);
+
+ // C++: String cv::dnn::Net::dump()
+ private static native String dump_0(long nativeObj);
+
+ // C++: void cv::dnn::Net::dumpToFile(String path)
+ private static native void dumpToFile_0(long nativeObj, String path);
+
+ // C++: int cv::dnn::Net::getLayerId(String layer)
+ private static native int getLayerId_0(long nativeObj, String layer);
+
+ // C++: vector_String cv::dnn::Net::getLayerNames()
+ private static native List getLayerNames_0(long nativeObj);
+
+ // C++: Ptr_Layer cv::dnn::Net::getLayer(LayerId layerId)
+ private static native long getLayer_0(long nativeObj, long layerId_nativeObj);
+
+ // C++: void cv::dnn::Net::connect(String outPin, String inpPin)
+ private static native void connect_0(long nativeObj, String outPin, String inpPin);
+
+ // C++: void cv::dnn::Net::setInputsNames(vector_String inputBlobNames)
+ private static native void setInputsNames_0(long nativeObj, List inputBlobNames);
+
+ // C++: void cv::dnn::Net::setInputShape(String inputName, MatShape shape)
+ private static native void setInputShape_0(long nativeObj, String inputName, long shape_mat_nativeObj);
+
+ // C++: Mat cv::dnn::Net::forward(String outputName = String())
+ private static native long forward_0(long nativeObj, String outputName);
+ private static native long forward_1(long nativeObj);
+
+ // C++: void cv::dnn::Net::forward(vector_Mat& outputBlobs, String outputName = String())
+ private static native void forward_2(long nativeObj, long outputBlobs_mat_nativeObj, String outputName);
+ private static native void forward_3(long nativeObj, long outputBlobs_mat_nativeObj);
+
+ // C++: void cv::dnn::Net::forward(vector_Mat& outputBlobs, vector_String outBlobNames)
+ private static native void forward_4(long nativeObj, long outputBlobs_mat_nativeObj, List outBlobNames);
+
+ // C++: void cv::dnn::Net::setHalideScheduler(String scheduler)
+ private static native void setHalideScheduler_0(long nativeObj, String scheduler);
+
+ // C++: void cv::dnn::Net::setPreferableBackend(int backendId)
+ private static native void setPreferableBackend_0(long nativeObj, int backendId);
+
+ // C++: void cv::dnn::Net::setPreferableTarget(int targetId)
+ private static native void setPreferableTarget_0(long nativeObj, int targetId);
+
+ // C++: void cv::dnn::Net::setInput(Mat blob, String name = "", double scalefactor = 1.0, Scalar mean = Scalar())
+ private static native void setInput_0(long nativeObj, long blob_nativeObj, String name, double scalefactor, double mean_val0, double mean_val1, double mean_val2, double mean_val3);
+ private static native void setInput_1(long nativeObj, long blob_nativeObj, String name, double scalefactor);
+ private static native void setInput_2(long nativeObj, long blob_nativeObj, String name);
+ private static native void setInput_3(long nativeObj, long blob_nativeObj);
+
+ // C++: void cv::dnn::Net::setParam(LayerId layer, int numParam, Mat blob)
+ private static native void setParam_0(long nativeObj, long layer_nativeObj, int numParam, long blob_nativeObj);
+
+ // C++: Mat cv::dnn::Net::getParam(LayerId layer, int numParam = 0)
+ private static native long getParam_0(long nativeObj, long layer_nativeObj, int numParam);
+ private static native long getParam_1(long nativeObj, long layer_nativeObj);
+
+ // C++: vector_int cv::dnn::Net::getUnconnectedOutLayers()
+ private static native long getUnconnectedOutLayers_0(long nativeObj);
+
+ // C++: vector_String cv::dnn::Net::getUnconnectedOutLayersNames()
+ private static native List getUnconnectedOutLayersNames_0(long nativeObj);
+
+ // C++: int64 cv::dnn::Net::getFLOPS(vector_MatShape netInputShapes)
+ private static native long getFLOPS_0(long nativeObj, List netInputShapes);
+
+ // C++: int64 cv::dnn::Net::getFLOPS(MatShape netInputShape)
+ private static native long getFLOPS_1(long nativeObj, long netInputShape_mat_nativeObj);
+
+ // C++: int64 cv::dnn::Net::getFLOPS(int layerId, vector_MatShape netInputShapes)
+ private static native long getFLOPS_2(long nativeObj, int layerId, List netInputShapes);
+
+ // C++: int64 cv::dnn::Net::getFLOPS(int layerId, MatShape netInputShape)
+ private static native long getFLOPS_3(long nativeObj, int layerId, long netInputShape_mat_nativeObj);
+
+ // C++: void cv::dnn::Net::getLayerTypes(vector_String& layersTypes)
+ private static native void getLayerTypes_0(long nativeObj, List layersTypes);
+
+ // C++: int cv::dnn::Net::getLayersCount(String layerType)
+ private static native int getLayersCount_0(long nativeObj, String layerType);
+
+ // C++: void cv::dnn::Net::getMemoryConsumption(MatShape netInputShape, size_t& weights, size_t& blobs)
+ private static native void getMemoryConsumption_0(long nativeObj, long netInputShape_mat_nativeObj, double[] weights_out, double[] blobs_out);
+
+ // C++: void cv::dnn::Net::getMemoryConsumption(int layerId, vector_MatShape netInputShapes, size_t& weights, size_t& blobs)
+ private static native void getMemoryConsumption_1(long nativeObj, int layerId, List netInputShapes, double[] weights_out, double[] blobs_out);
+
+ // C++: void cv::dnn::Net::getMemoryConsumption(int layerId, MatShape netInputShape, size_t& weights, size_t& blobs)
+ private static native void getMemoryConsumption_2(long nativeObj, int layerId, long netInputShape_mat_nativeObj, double[] weights_out, double[] blobs_out);
+
+ // C++: void cv::dnn::Net::enableFusion(bool fusion)
+ private static native void enableFusion_0(long nativeObj, boolean fusion);
+
+ // C++: int64 cv::dnn::Net::getPerfProfile(vector_double& timings)
+ private static native long getPerfProfile_0(long nativeObj, long timings_mat_nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/AKAZE.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/AKAZE.java
new file mode 100644
index 0000000..31ad6bc
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/AKAZE.java
@@ -0,0 +1,362 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import org.opencv.features2d.AKAZE;
+import org.opencv.features2d.Feature2D;
+
+// C++: class AKAZE
+/**
+ * Class implementing the AKAZE keypoint detector and descriptor extractor, described in CITE: ANB13.
+ *
+ * AKAZE descriptors can only be used with KAZE or AKAZE keypoints. This class is thread-safe.
+ *
+ * Note: When you need descriptors use Feature2D::detectAndCompute, which
+ * provides better performance. When using Feature2D::detect followed by
+ * Feature2D::compute scale space pyramid is computed twice.
+ *
+ * Note: AKAZE implements T-API. When image is passed as UMat some parts of the algorithm
+ * will use OpenCL.
+ *
+ * Note: [ANB13] Fast Explicit Diffusion for Accelerated Features in Nonlinear
+ * Scale Spaces. Pablo F. Alcantarilla, Jesús Nuevo and Adrien Bartoli. In
+ * British Machine Vision Conference (BMVC), Bristol, UK, September 2013.
+ */
+public class AKAZE extends Feature2D {
+
+ protected AKAZE(long addr) { super(addr); }
+
+ // internal usage only
+ public static AKAZE __fromPtr__(long addr) { return new AKAZE(addr); }
+
+ // C++: enum
+ public static final int
+ DESCRIPTOR_KAZE_UPRIGHT = 2,
+ DESCRIPTOR_KAZE = 3,
+ DESCRIPTOR_MLDB_UPRIGHT = 4,
+ DESCRIPTOR_MLDB = 5;
+
+
+ //
+ // C++: static Ptr_AKAZE cv::AKAZE::create(int descriptor_type = AKAZE::DESCRIPTOR_MLDB, int descriptor_size = 0, int descriptor_channels = 3, float threshold = 0.001f, int nOctaves = 4, int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2)
+ //
+
+ /**
+ * The AKAZE constructor
+ *
+ * @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+ * DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+ * @param descriptor_size Size of the descriptor in bits. 0 -> Full size
+ * @param descriptor_channels Number of channels in the descriptor (1, 2, 3)
+ * @param threshold Detector response threshold to accept point
+ * @param nOctaves Maximum octave evolution of the image
+ * @param nOctaveLayers Default number of sublevels per scale level
+ * @param diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or
+ * DIFF_CHARBONNIER
+ * @return automatically generated
+ */
+ public static AKAZE create(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold, int nOctaves, int nOctaveLayers, int diffusivity) {
+ return AKAZE.__fromPtr__(create_0(descriptor_type, descriptor_size, descriptor_channels, threshold, nOctaves, nOctaveLayers, diffusivity));
+ }
+
+ /**
+ * The AKAZE constructor
+ *
+ * @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+ * DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+ * @param descriptor_size Size of the descriptor in bits. 0 -> Full size
+ * @param descriptor_channels Number of channels in the descriptor (1, 2, 3)
+ * @param threshold Detector response threshold to accept point
+ * @param nOctaves Maximum octave evolution of the image
+ * @param nOctaveLayers Default number of sublevels per scale level
+ * DIFF_CHARBONNIER
+ * @return automatically generated
+ */
+ public static AKAZE create(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold, int nOctaves, int nOctaveLayers) {
+ return AKAZE.__fromPtr__(create_1(descriptor_type, descriptor_size, descriptor_channels, threshold, nOctaves, nOctaveLayers));
+ }
+
+ /**
+ * The AKAZE constructor
+ *
+ * @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+ * DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+ * @param descriptor_size Size of the descriptor in bits. 0 -> Full size
+ * @param descriptor_channels Number of channels in the descriptor (1, 2, 3)
+ * @param threshold Detector response threshold to accept point
+ * @param nOctaves Maximum octave evolution of the image
+ * DIFF_CHARBONNIER
+ * @return automatically generated
+ */
+ public static AKAZE create(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold, int nOctaves) {
+ return AKAZE.__fromPtr__(create_2(descriptor_type, descriptor_size, descriptor_channels, threshold, nOctaves));
+ }
+
+ /**
+ * The AKAZE constructor
+ *
+ * @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+ * DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+ * @param descriptor_size Size of the descriptor in bits. 0 -> Full size
+ * @param descriptor_channels Number of channels in the descriptor (1, 2, 3)
+ * @param threshold Detector response threshold to accept point
+ * DIFF_CHARBONNIER
+ * @return automatically generated
+ */
+ public static AKAZE create(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold) {
+ return AKAZE.__fromPtr__(create_3(descriptor_type, descriptor_size, descriptor_channels, threshold));
+ }
+
+ /**
+ * The AKAZE constructor
+ *
+ * @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+ * DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+ * @param descriptor_size Size of the descriptor in bits. 0 -> Full size
+ * @param descriptor_channels Number of channels in the descriptor (1, 2, 3)
+ * DIFF_CHARBONNIER
+ * @return automatically generated
+ */
+ public static AKAZE create(int descriptor_type, int descriptor_size, int descriptor_channels) {
+ return AKAZE.__fromPtr__(create_4(descriptor_type, descriptor_size, descriptor_channels));
+ }
+
+ /**
+ * The AKAZE constructor
+ *
+ * @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+ * DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+ * @param descriptor_size Size of the descriptor in bits. 0 -> Full size
+ * DIFF_CHARBONNIER
+ * @return automatically generated
+ */
+ public static AKAZE create(int descriptor_type, int descriptor_size) {
+ return AKAZE.__fromPtr__(create_5(descriptor_type, descriptor_size));
+ }
+
+ /**
+ * The AKAZE constructor
+ *
+ * @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+ * DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+ * DIFF_CHARBONNIER
+ * @return automatically generated
+ */
+ public static AKAZE create(int descriptor_type) {
+ return AKAZE.__fromPtr__(create_6(descriptor_type));
+ }
+
+ /**
+ * The AKAZE constructor
+ *
+ * DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+ * DIFF_CHARBONNIER
+ * @return automatically generated
+ */
+ public static AKAZE create() {
+ return AKAZE.__fromPtr__(create_7());
+ }
+
+
+ //
+ // C++: void cv::AKAZE::setDescriptorType(int dtype)
+ //
+
+ public void setDescriptorType(int dtype) {
+ setDescriptorType_0(nativeObj, dtype);
+ }
+
+
+ //
+ // C++: int cv::AKAZE::getDescriptorType()
+ //
+
+ public int getDescriptorType() {
+ return getDescriptorType_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AKAZE::setDescriptorSize(int dsize)
+ //
+
+ public void setDescriptorSize(int dsize) {
+ setDescriptorSize_0(nativeObj, dsize);
+ }
+
+
+ //
+ // C++: int cv::AKAZE::getDescriptorSize()
+ //
+
+ public int getDescriptorSize() {
+ return getDescriptorSize_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AKAZE::setDescriptorChannels(int dch)
+ //
+
+ public void setDescriptorChannels(int dch) {
+ setDescriptorChannels_0(nativeObj, dch);
+ }
+
+
+ //
+ // C++: int cv::AKAZE::getDescriptorChannels()
+ //
+
+ public int getDescriptorChannels() {
+ return getDescriptorChannels_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AKAZE::setThreshold(double threshold)
+ //
+
+ public void setThreshold(double threshold) {
+ setThreshold_0(nativeObj, threshold);
+ }
+
+
+ //
+ // C++: double cv::AKAZE::getThreshold()
+ //
+
+ public double getThreshold() {
+ return getThreshold_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AKAZE::setNOctaves(int octaves)
+ //
+
+ public void setNOctaves(int octaves) {
+ setNOctaves_0(nativeObj, octaves);
+ }
+
+
+ //
+ // C++: int cv::AKAZE::getNOctaves()
+ //
+
+ public int getNOctaves() {
+ return getNOctaves_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AKAZE::setNOctaveLayers(int octaveLayers)
+ //
+
+ public void setNOctaveLayers(int octaveLayers) {
+ setNOctaveLayers_0(nativeObj, octaveLayers);
+ }
+
+
+ //
+ // C++: int cv::AKAZE::getNOctaveLayers()
+ //
+
+ public int getNOctaveLayers() {
+ return getNOctaveLayers_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AKAZE::setDiffusivity(int diff)
+ //
+
+ public void setDiffusivity(int diff) {
+ setDiffusivity_0(nativeObj, diff);
+ }
+
+
+ //
+ // C++: int cv::AKAZE::getDiffusivity()
+ //
+
+ public int getDiffusivity() {
+ return getDiffusivity_0(nativeObj);
+ }
+
+
+ //
+ // C++: String cv::AKAZE::getDefaultName()
+ //
+
+ public String getDefaultName() {
+ return getDefaultName_0(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: static Ptr_AKAZE cv::AKAZE::create(int descriptor_type = AKAZE::DESCRIPTOR_MLDB, int descriptor_size = 0, int descriptor_channels = 3, float threshold = 0.001f, int nOctaves = 4, int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2)
+ private static native long create_0(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold, int nOctaves, int nOctaveLayers, int diffusivity);
+ private static native long create_1(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold, int nOctaves, int nOctaveLayers);
+ private static native long create_2(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold, int nOctaves);
+ private static native long create_3(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold);
+ private static native long create_4(int descriptor_type, int descriptor_size, int descriptor_channels);
+ private static native long create_5(int descriptor_type, int descriptor_size);
+ private static native long create_6(int descriptor_type);
+ private static native long create_7();
+
+ // C++: void cv::AKAZE::setDescriptorType(int dtype)
+ private static native void setDescriptorType_0(long nativeObj, int dtype);
+
+ // C++: int cv::AKAZE::getDescriptorType()
+ private static native int getDescriptorType_0(long nativeObj);
+
+ // C++: void cv::AKAZE::setDescriptorSize(int dsize)
+ private static native void setDescriptorSize_0(long nativeObj, int dsize);
+
+ // C++: int cv::AKAZE::getDescriptorSize()
+ private static native int getDescriptorSize_0(long nativeObj);
+
+ // C++: void cv::AKAZE::setDescriptorChannels(int dch)
+ private static native void setDescriptorChannels_0(long nativeObj, int dch);
+
+ // C++: int cv::AKAZE::getDescriptorChannels()
+ private static native int getDescriptorChannels_0(long nativeObj);
+
+ // C++: void cv::AKAZE::setThreshold(double threshold)
+ private static native void setThreshold_0(long nativeObj, double threshold);
+
+ // C++: double cv::AKAZE::getThreshold()
+ private static native double getThreshold_0(long nativeObj);
+
+ // C++: void cv::AKAZE::setNOctaves(int octaves)
+ private static native void setNOctaves_0(long nativeObj, int octaves);
+
+ // C++: int cv::AKAZE::getNOctaves()
+ private static native int getNOctaves_0(long nativeObj);
+
+ // C++: void cv::AKAZE::setNOctaveLayers(int octaveLayers)
+ private static native void setNOctaveLayers_0(long nativeObj, int octaveLayers);
+
+ // C++: int cv::AKAZE::getNOctaveLayers()
+ private static native int getNOctaveLayers_0(long nativeObj);
+
+ // C++: void cv::AKAZE::setDiffusivity(int diff)
+ private static native void setDiffusivity_0(long nativeObj, int diff);
+
+ // C++: int cv::AKAZE::getDiffusivity()
+ private static native int getDiffusivity_0(long nativeObj);
+
+ // C++: String cv::AKAZE::getDefaultName()
+ private static native String getDefaultName_0(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/AffineFeature.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/AffineFeature.java
new file mode 100644
index 0000000..53fcc56
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/AffineFeature.java
@@ -0,0 +1,138 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfFloat;
+import org.opencv.features2d.AffineFeature;
+import org.opencv.features2d.Feature2D;
+import org.opencv.utils.Converters;
+
+// C++: class AffineFeature
+/**
+ * Class for implementing the wrapper which makes detectors and extractors to be affine invariant,
+ * described as ASIFT in CITE: YM11 .
+ */
+public class AffineFeature extends Feature2D {
+
+ protected AffineFeature(long addr) { super(addr); }
+
+ // internal usage only
+ public static AffineFeature __fromPtr__(long addr) { return new AffineFeature(addr); }
+
+ //
+ // C++: static Ptr_AffineFeature cv::AffineFeature::create(Ptr_Feature2D backend, int maxTilt = 5, int minTilt = 0, float tiltStep = 1.4142135623730951f, float rotateStepBase = 72)
+ //
+
+ /**
+ * @param backend The detector/extractor you want to use as backend.
+ * @param maxTilt The highest power index of tilt factor. 5 is used in the paper as tilt sampling range n.
+ * @param minTilt The lowest power index of tilt factor. 0 is used in the paper.
+ * @param tiltStep Tilt sampling step \(\delta_t\) in Algorithm 1 in the paper.
+ * @param rotateStepBase Rotation sampling step factor b in Algorithm 1 in the paper.
+ * @return automatically generated
+ */
+ public static AffineFeature create(Feature2D backend, int maxTilt, int minTilt, float tiltStep, float rotateStepBase) {
+ return AffineFeature.__fromPtr__(create_0(backend.getNativeObjAddr(), maxTilt, minTilt, tiltStep, rotateStepBase));
+ }
+
+ /**
+ * @param backend The detector/extractor you want to use as backend.
+ * @param maxTilt The highest power index of tilt factor. 5 is used in the paper as tilt sampling range n.
+ * @param minTilt The lowest power index of tilt factor. 0 is used in the paper.
+ * @param tiltStep Tilt sampling step \(\delta_t\) in Algorithm 1 in the paper.
+ * @return automatically generated
+ */
+ public static AffineFeature create(Feature2D backend, int maxTilt, int minTilt, float tiltStep) {
+ return AffineFeature.__fromPtr__(create_1(backend.getNativeObjAddr(), maxTilt, minTilt, tiltStep));
+ }
+
+ /**
+ * @param backend The detector/extractor you want to use as backend.
+ * @param maxTilt The highest power index of tilt factor. 5 is used in the paper as tilt sampling range n.
+ * @param minTilt The lowest power index of tilt factor. 0 is used in the paper.
+ * @return automatically generated
+ */
+ public static AffineFeature create(Feature2D backend, int maxTilt, int minTilt) {
+ return AffineFeature.__fromPtr__(create_2(backend.getNativeObjAddr(), maxTilt, minTilt));
+ }
+
+ /**
+ * @param backend The detector/extractor you want to use as backend.
+ * @param maxTilt The highest power index of tilt factor. 5 is used in the paper as tilt sampling range n.
+ * @return automatically generated
+ */
+ public static AffineFeature create(Feature2D backend, int maxTilt) {
+ return AffineFeature.__fromPtr__(create_3(backend.getNativeObjAddr(), maxTilt));
+ }
+
+ /**
+ * @param backend The detector/extractor you want to use as backend.
+ * @return automatically generated
+ */
+ public static AffineFeature create(Feature2D backend) {
+ return AffineFeature.__fromPtr__(create_4(backend.getNativeObjAddr()));
+ }
+
+
+ //
+ // C++: void cv::AffineFeature::setViewParams(vector_float tilts, vector_float rolls)
+ //
+
+ public void setViewParams(MatOfFloat tilts, MatOfFloat rolls) {
+ Mat tilts_mat = tilts;
+ Mat rolls_mat = rolls;
+ setViewParams_0(nativeObj, tilts_mat.nativeObj, rolls_mat.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AffineFeature::getViewParams(vector_float tilts, vector_float rolls)
+ //
+
+ public void getViewParams(MatOfFloat tilts, MatOfFloat rolls) {
+ Mat tilts_mat = tilts;
+ Mat rolls_mat = rolls;
+ getViewParams_0(nativeObj, tilts_mat.nativeObj, rolls_mat.nativeObj);
+ }
+
+
+ //
+ // C++: String cv::AffineFeature::getDefaultName()
+ //
+
+ public String getDefaultName() {
+ return getDefaultName_0(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: static Ptr_AffineFeature cv::AffineFeature::create(Ptr_Feature2D backend, int maxTilt = 5, int minTilt = 0, float tiltStep = 1.4142135623730951f, float rotateStepBase = 72)
+ private static native long create_0(long backend_nativeObj, int maxTilt, int minTilt, float tiltStep, float rotateStepBase);
+ private static native long create_1(long backend_nativeObj, int maxTilt, int minTilt, float tiltStep);
+ private static native long create_2(long backend_nativeObj, int maxTilt, int minTilt);
+ private static native long create_3(long backend_nativeObj, int maxTilt);
+ private static native long create_4(long backend_nativeObj);
+
+ // C++: void cv::AffineFeature::setViewParams(vector_float tilts, vector_float rolls)
+ private static native void setViewParams_0(long nativeObj, long tilts_mat_nativeObj, long rolls_mat_nativeObj);
+
+ // C++: void cv::AffineFeature::getViewParams(vector_float tilts, vector_float rolls)
+ private static native void getViewParams_0(long nativeObj, long tilts_mat_nativeObj, long rolls_mat_nativeObj);
+
+ // C++: String cv::AffineFeature::getDefaultName()
+ private static native String getDefaultName_0(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/AgastFeatureDetector.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/AgastFeatureDetector.java
new file mode 100644
index 0000000..07600ff
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/AgastFeatureDetector.java
@@ -0,0 +1,151 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import org.opencv.features2d.AgastFeatureDetector;
+import org.opencv.features2d.Feature2D;
+
+// C++: class AgastFeatureDetector
+/**
+ * Wrapping class for feature detection using the AGAST method. :
+ */
+public class AgastFeatureDetector extends Feature2D {
+
+ protected AgastFeatureDetector(long addr) { super(addr); }
+
+ // internal usage only
+ public static AgastFeatureDetector __fromPtr__(long addr) { return new AgastFeatureDetector(addr); }
+
+ // C++: enum
+ public static final int
+ AGAST_5_8 = 0,
+ AGAST_7_12d = 1,
+ AGAST_7_12s = 2,
+ OAST_9_16 = 3,
+ THRESHOLD = 10000,
+ NONMAX_SUPPRESSION = 10001;
+
+
+ //
+ // C++: static Ptr_AgastFeatureDetector cv::AgastFeatureDetector::create(int threshold = 10, bool nonmaxSuppression = true, int type = AgastFeatureDetector::OAST_9_16)
+ //
+
+ public static AgastFeatureDetector create(int threshold, boolean nonmaxSuppression, int type) {
+ return AgastFeatureDetector.__fromPtr__(create_0(threshold, nonmaxSuppression, type));
+ }
+
+ public static AgastFeatureDetector create(int threshold, boolean nonmaxSuppression) {
+ return AgastFeatureDetector.__fromPtr__(create_1(threshold, nonmaxSuppression));
+ }
+
+ public static AgastFeatureDetector create(int threshold) {
+ return AgastFeatureDetector.__fromPtr__(create_2(threshold));
+ }
+
+ public static AgastFeatureDetector create() {
+ return AgastFeatureDetector.__fromPtr__(create_3());
+ }
+
+
+ //
+ // C++: void cv::AgastFeatureDetector::setThreshold(int threshold)
+ //
+
+ public void setThreshold(int threshold) {
+ setThreshold_0(nativeObj, threshold);
+ }
+
+
+ //
+ // C++: int cv::AgastFeatureDetector::getThreshold()
+ //
+
+ public int getThreshold() {
+ return getThreshold_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AgastFeatureDetector::setNonmaxSuppression(bool f)
+ //
+
+ public void setNonmaxSuppression(boolean f) {
+ setNonmaxSuppression_0(nativeObj, f);
+ }
+
+
+ //
+ // C++: bool cv::AgastFeatureDetector::getNonmaxSuppression()
+ //
+
+ public boolean getNonmaxSuppression() {
+ return getNonmaxSuppression_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::AgastFeatureDetector::setType(int type)
+ //
+
+ public void setType(int type) {
+ setType_0(nativeObj, type);
+ }
+
+
+ //
+ // C++: int cv::AgastFeatureDetector::getType()
+ //
+
+ public int getType() {
+ return getType_0(nativeObj);
+ }
+
+
+ //
+ // C++: String cv::AgastFeatureDetector::getDefaultName()
+ //
+
+ public String getDefaultName() {
+ return getDefaultName_0(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: static Ptr_AgastFeatureDetector cv::AgastFeatureDetector::create(int threshold = 10, bool nonmaxSuppression = true, int type = AgastFeatureDetector::OAST_9_16)
+ private static native long create_0(int threshold, boolean nonmaxSuppression, int type);
+ private static native long create_1(int threshold, boolean nonmaxSuppression);
+ private static native long create_2(int threshold);
+ private static native long create_3();
+
+ // C++: void cv::AgastFeatureDetector::setThreshold(int threshold)
+ private static native void setThreshold_0(long nativeObj, int threshold);
+
+ // C++: int cv::AgastFeatureDetector::getThreshold()
+ private static native int getThreshold_0(long nativeObj);
+
+ // C++: void cv::AgastFeatureDetector::setNonmaxSuppression(bool f)
+ private static native void setNonmaxSuppression_0(long nativeObj, boolean f);
+
+ // C++: bool cv::AgastFeatureDetector::getNonmaxSuppression()
+ private static native boolean getNonmaxSuppression_0(long nativeObj);
+
+ // C++: void cv::AgastFeatureDetector::setType(int type)
+ private static native void setType_0(long nativeObj, int type);
+
+ // C++: int cv::AgastFeatureDetector::getType()
+ private static native int getType_0(long nativeObj);
+
+ // C++: String cv::AgastFeatureDetector::getDefaultName()
+ private static native String getDefaultName_0(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/BFMatcher.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/BFMatcher.java
new file mode 100644
index 0000000..a6ca928
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/BFMatcher.java
@@ -0,0 +1,135 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import org.opencv.features2d.BFMatcher;
+import org.opencv.features2d.DescriptorMatcher;
+
+// C++: class BFMatcher
+/**
+ * Brute-force descriptor matcher.
+ *
+ * For each descriptor in the first set, this matcher finds the closest descriptor in the second set
+ * by trying each one. This descriptor matcher supports masking permissible matches of descriptor
+ * sets.
+ */
+public class BFMatcher extends DescriptorMatcher {
+
+ protected BFMatcher(long addr) { super(addr); }
+
+ // internal usage only
+ public static BFMatcher __fromPtr__(long addr) { return new BFMatcher(addr); }
+
+ //
+ // C++: cv::BFMatcher::BFMatcher(int normType = NORM_L2, bool crossCheck = false)
+ //
+
+ /**
+ * Brute-force matcher constructor (obsolete). Please use BFMatcher.create()
+ *
+ *
+ * @param normType automatically generated
+ * @param crossCheck automatically generated
+ */
+ public BFMatcher(int normType, boolean crossCheck) {
+ super(BFMatcher_0(normType, crossCheck));
+ }
+
+ /**
+ * Brute-force matcher constructor (obsolete). Please use BFMatcher.create()
+ *
+ *
+ * @param normType automatically generated
+ */
+ public BFMatcher(int normType) {
+ super(BFMatcher_1(normType));
+ }
+
+ /**
+ * Brute-force matcher constructor (obsolete). Please use BFMatcher.create()
+ *
+ *
+ */
+ public BFMatcher() {
+ super(BFMatcher_2());
+ }
+
+
+ //
+ // C++: static Ptr_BFMatcher cv::BFMatcher::create(int normType = NORM_L2, bool crossCheck = false)
+ //
+
+ /**
+ * Brute-force matcher create method.
+ * @param normType One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are
+ * preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and
+ * BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor
+ * description).
+ * @param crossCheck If it is false, this is will be default BFMatcher behaviour when it finds the k
+ * nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with
+ * k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the
+ * matcher's collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent
+ * pairs. Such technique usually produces best results with minimal number of outliers when there are
+ * enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
+ * @return automatically generated
+ */
+ public static BFMatcher create(int normType, boolean crossCheck) {
+ return BFMatcher.__fromPtr__(create_0(normType, crossCheck));
+ }
+
+ /**
+ * Brute-force matcher create method.
+ * @param normType One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are
+ * preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and
+ * BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor
+ * description).
+ * nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with
+ * k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the
+ * matcher's collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent
+ * pairs. Such technique usually produces best results with minimal number of outliers when there are
+ * enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
+ * @return automatically generated
+ */
+ public static BFMatcher create(int normType) {
+ return BFMatcher.__fromPtr__(create_1(normType));
+ }
+
+ /**
+ * Brute-force matcher create method.
+ * preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and
+ * BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor
+ * description).
+ * nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with
+ * k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the
+ * matcher's collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent
+ * pairs. Such technique usually produces best results with minimal number of outliers when there are
+ * enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
+ * @return automatically generated
+ */
+ public static BFMatcher create() {
+ return BFMatcher.__fromPtr__(create_2());
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: cv::BFMatcher::BFMatcher(int normType = NORM_L2, bool crossCheck = false)
+ private static native long BFMatcher_0(int normType, boolean crossCheck);
+ private static native long BFMatcher_1(int normType);
+ private static native long BFMatcher_2();
+
+ // C++: static Ptr_BFMatcher cv::BFMatcher::create(int normType = NORM_L2, bool crossCheck = false)
+ private static native long create_0(int normType, boolean crossCheck);
+ private static native long create_1(int normType);
+ private static native long create_2();
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWImgDescriptorExtractor.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWImgDescriptorExtractor.java
new file mode 100644
index 0000000..1a50f80
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWImgDescriptorExtractor.java
@@ -0,0 +1,138 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfKeyPoint;
+import org.opencv.utils.Converters;
+
+// C++: class BOWImgDescriptorExtractor
+/**
+ * Class to compute an image descriptor using the *bag of visual words*.
+ *
+ * Such a computation consists of the following steps:
+ *
+ * 1. Compute descriptors for a given image and its keypoints set.
+ * 2. Find the nearest visual words from the vocabulary for each keypoint descriptor.
+ * 3. Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words
+ * encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the
+ * vocabulary in the given image.
+ */
+public class BOWImgDescriptorExtractor {
+
+ protected final long nativeObj;
+ protected BOWImgDescriptorExtractor(long addr) { nativeObj = addr; }
+
+ public long getNativeObjAddr() { return nativeObj; }
+
+ // internal usage only
+ public static BOWImgDescriptorExtractor __fromPtr__(long addr) { return new BOWImgDescriptorExtractor(addr); }
+
+ //
+ // C++: cv::BOWImgDescriptorExtractor::BOWImgDescriptorExtractor(Ptr_DescriptorExtractor dextractor, Ptr_DescriptorMatcher dmatcher)
+ //
+
+ // Unknown type 'Ptr_DescriptorExtractor' (I), skipping the function
+
+
+ //
+ // C++: void cv::BOWImgDescriptorExtractor::setVocabulary(Mat vocabulary)
+ //
+
+ /**
+ * Sets a visual vocabulary.
+ *
+ * @param vocabulary Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the
+ * vocabulary is a visual word (cluster center).
+ */
+ public void setVocabulary(Mat vocabulary) {
+ setVocabulary_0(nativeObj, vocabulary.nativeObj);
+ }
+
+
+ //
+ // C++: Mat cv::BOWImgDescriptorExtractor::getVocabulary()
+ //
+
+ /**
+ * Returns the set vocabulary.
+ * @return automatically generated
+ */
+ public Mat getVocabulary() {
+ return new Mat(getVocabulary_0(nativeObj));
+ }
+
+
+ //
+ // C++: void cv::BOWImgDescriptorExtractor::compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor)
+ //
+
+ /**
+ *
+ * @param imgDescriptor Computed output image descriptor.
+ * pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary)
+ * returned if it is non-zero.
+ * @param image automatically generated
+ * @param keypoints automatically generated
+ */
+ public void compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor) {
+ Mat keypoints_mat = keypoints;
+ compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, imgDescriptor.nativeObj);
+ }
+
+
+ //
+ // C++: int cv::BOWImgDescriptorExtractor::descriptorSize()
+ //
+
+ /**
+ * Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.
+ * @return automatically generated
+ */
+ public int descriptorSize() {
+ return descriptorSize_0(nativeObj);
+ }
+
+
+ //
+ // C++: int cv::BOWImgDescriptorExtractor::descriptorType()
+ //
+
+ /**
+ * Returns an image descriptor type.
+ * @return automatically generated
+ */
+ public int descriptorType() {
+ return descriptorType_0(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: void cv::BOWImgDescriptorExtractor::setVocabulary(Mat vocabulary)
+ private static native void setVocabulary_0(long nativeObj, long vocabulary_nativeObj);
+
+ // C++: Mat cv::BOWImgDescriptorExtractor::getVocabulary()
+ private static native long getVocabulary_0(long nativeObj);
+
+ // C++: void cv::BOWImgDescriptorExtractor::compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor)
+ private static native void compute_0(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj, long imgDescriptor_nativeObj);
+
+ // C++: int cv::BOWImgDescriptorExtractor::descriptorSize()
+ private static native int descriptorSize_0(long nativeObj);
+
+ // C++: int cv::BOWImgDescriptorExtractor::descriptorType()
+ private static native int descriptorType_0(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWKMeansTrainer.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWKMeansTrainer.java
new file mode 100644
index 0000000..dbf69ee
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWKMeansTrainer.java
@@ -0,0 +1,112 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import org.opencv.core.Mat;
+import org.opencv.core.TermCriteria;
+import org.opencv.features2d.BOWTrainer;
+
+// C++: class BOWKMeansTrainer
+/**
+ * kmeans -based class to train visual vocabulary using the *bag of visual words* approach. :
+ */
+public class BOWKMeansTrainer extends BOWTrainer {
+
+ protected BOWKMeansTrainer(long addr) { super(addr); }
+
+ // internal usage only
+ public static BOWKMeansTrainer __fromPtr__(long addr) { return new BOWKMeansTrainer(addr); }
+
+ //
+ // C++: cv::BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS)
+ //
+
+ /**
+ * The constructor.
+ *
+ * SEE: cv::kmeans
+ * @param clusterCount automatically generated
+ * @param termcrit automatically generated
+ * @param attempts automatically generated
+ * @param flags automatically generated
+ */
+ public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts, int flags) {
+ super(BOWKMeansTrainer_0(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts, flags));
+ }
+
+ /**
+ * The constructor.
+ *
+ * SEE: cv::kmeans
+ * @param clusterCount automatically generated
+ * @param termcrit automatically generated
+ * @param attempts automatically generated
+ */
+ public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts) {
+ super(BOWKMeansTrainer_1(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts));
+ }
+
+ /**
+ * The constructor.
+ *
+ * SEE: cv::kmeans
+ * @param clusterCount automatically generated
+ * @param termcrit automatically generated
+ */
+ public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit) {
+ super(BOWKMeansTrainer_2(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon));
+ }
+
+ /**
+ * The constructor.
+ *
+ * SEE: cv::kmeans
+ * @param clusterCount automatically generated
+ */
+ public BOWKMeansTrainer(int clusterCount) {
+ super(BOWKMeansTrainer_3(clusterCount));
+ }
+
+
+ //
+ // C++: Mat cv::BOWKMeansTrainer::cluster()
+ //
+
+ public Mat cluster() {
+ return new Mat(cluster_0(nativeObj));
+ }
+
+
+ //
+ // C++: Mat cv::BOWKMeansTrainer::cluster(Mat descriptors)
+ //
+
+ public Mat cluster(Mat descriptors) {
+ return new Mat(cluster_1(nativeObj, descriptors.nativeObj));
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: cv::BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS)
+ private static native long BOWKMeansTrainer_0(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon, int attempts, int flags);
+ private static native long BOWKMeansTrainer_1(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon, int attempts);
+ private static native long BOWKMeansTrainer_2(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon);
+ private static native long BOWKMeansTrainer_3(int clusterCount);
+
+ // C++: Mat cv::BOWKMeansTrainer::cluster()
+ private static native long cluster_0(long nativeObj);
+
+ // C++: Mat cv::BOWKMeansTrainer::cluster(Mat descriptors)
+ private static native long cluster_1(long nativeObj, long descriptors_nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWTrainer.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWTrainer.java
new file mode 100644
index 0000000..ade247e
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/BOWTrainer.java
@@ -0,0 +1,140 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.utils.Converters;
+
+// C++: class BOWTrainer
+/**
+ * Abstract base class for training the *bag of visual words* vocabulary from a set of descriptors.
+ *
+ * For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka,
+ * Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :
+ */
+public class BOWTrainer {
+
+ protected final long nativeObj;
+ protected BOWTrainer(long addr) { nativeObj = addr; }
+
+ public long getNativeObjAddr() { return nativeObj; }
+
+ // internal usage only
+ public static BOWTrainer __fromPtr__(long addr) { return new BOWTrainer(addr); }
+
+ //
+ // C++: void cv::BOWTrainer::add(Mat descriptors)
+ //
+
+ /**
+ * Adds descriptors to a training set.
+ *
+ * @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a
+ * descriptor.
+ *
+ * The training set is clustered using clustermethod to construct the vocabulary.
+ */
+ public void add(Mat descriptors) {
+ add_0(nativeObj, descriptors.nativeObj);
+ }
+
+
+ //
+ // C++: vector_Mat cv::BOWTrainer::getDescriptors()
+ //
+
+ /**
+ * Returns a training set of descriptors.
+ * @return automatically generated
+ */
+ public List getDescriptors() {
+ List retVal = new ArrayList();
+ Mat retValMat = new Mat(getDescriptors_0(nativeObj));
+ Converters.Mat_to_vector_Mat(retValMat, retVal);
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::BOWTrainer::descriptorsCount()
+ //
+
+ /**
+ * Returns the count of all descriptors stored in the training set.
+ * @return automatically generated
+ */
+ public int descriptorsCount() {
+ return descriptorsCount_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::BOWTrainer::clear()
+ //
+
+ public void clear() {
+ clear_0(nativeObj);
+ }
+
+
+ //
+ // C++: Mat cv::BOWTrainer::cluster()
+ //
+
+ public Mat cluster() {
+ return new Mat(cluster_0(nativeObj));
+ }
+
+
+ //
+ // C++: Mat cv::BOWTrainer::cluster(Mat descriptors)
+ //
+
+ /**
+ * Clusters train descriptors.
+ *
+ * @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor.
+ * Descriptors are not added to the inner train descriptor set.
+ *
+ * The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first
+ * variant of the method, train descriptors stored in the object are clustered. In the second variant,
+ * input descriptors are clustered.
+ * @return automatically generated
+ */
+ public Mat cluster(Mat descriptors) {
+ return new Mat(cluster_1(nativeObj, descriptors.nativeObj));
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: void cv::BOWTrainer::add(Mat descriptors)
+ private static native void add_0(long nativeObj, long descriptors_nativeObj);
+
+ // C++: vector_Mat cv::BOWTrainer::getDescriptors()
+ private static native long getDescriptors_0(long nativeObj);
+
+ // C++: int cv::BOWTrainer::descriptorsCount()
+ private static native int descriptorsCount_0(long nativeObj);
+
+ // C++: void cv::BOWTrainer::clear()
+ private static native void clear_0(long nativeObj);
+
+ // C++: Mat cv::BOWTrainer::cluster()
+ private static native long cluster_0(long nativeObj);
+
+ // C++: Mat cv::BOWTrainer::cluster(Mat descriptors)
+ private static native long cluster_1(long nativeObj, long descriptors_nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/BRISK.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/BRISK.java
new file mode 100644
index 0000000..7fd629d
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/BRISK.java
@@ -0,0 +1,285 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfFloat;
+import org.opencv.core.MatOfInt;
+import org.opencv.features2d.BRISK;
+import org.opencv.features2d.Feature2D;
+import org.opencv.utils.Converters;
+
+// C++: class BRISK
+/**
+ * Class implementing the BRISK keypoint detector and descriptor extractor, described in CITE: LCS11 .
+ */
+public class BRISK extends Feature2D {
+
+ protected BRISK(long addr) { super(addr); }
+
+ // internal usage only
+ public static BRISK __fromPtr__(long addr) { return new BRISK(addr); }
+
+ //
+ // C++: static Ptr_BRISK cv::BRISK::create(int thresh = 30, int octaves = 3, float patternScale = 1.0f)
+ //
+
+ /**
+ * The BRISK constructor
+ *
+ * @param thresh AGAST detection threshold score.
+ * @param octaves detection octaves. Use 0 to do single scale.
+ * @param patternScale apply this scale to the pattern used for sampling the neighbourhood of a
+ * keypoint.
+ * @return automatically generated
+ */
+ public static BRISK create(int thresh, int octaves, float patternScale) {
+ return BRISK.__fromPtr__(create_0(thresh, octaves, patternScale));
+ }
+
+ /**
+ * The BRISK constructor
+ *
+ * @param thresh AGAST detection threshold score.
+ * @param octaves detection octaves. Use 0 to do single scale.
+ * keypoint.
+ * @return automatically generated
+ */
+ public static BRISK create(int thresh, int octaves) {
+ return BRISK.__fromPtr__(create_1(thresh, octaves));
+ }
+
+ /**
+ * The BRISK constructor
+ *
+ * @param thresh AGAST detection threshold score.
+ * keypoint.
+ * @return automatically generated
+ */
+ public static BRISK create(int thresh) {
+ return BRISK.__fromPtr__(create_2(thresh));
+ }
+
+ /**
+ * The BRISK constructor
+ *
+ * keypoint.
+ * @return automatically generated
+ */
+ public static BRISK create() {
+ return BRISK.__fromPtr__(create_3());
+ }
+
+
+ //
+ // C++: static Ptr_BRISK cv::BRISK::create(vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector())
+ //
+
+ /**
+ * The BRISK constructor for a custom pattern
+ *
+ * @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+ * keypoint scale 1).
+ * @param numberList defines the number of sampling points on the sampling circle. Must be the same
+ * size as radiusList..
+ * @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
+ * scale 1).
+ * @param dMin threshold for the long pairings used for orientation determination (in pixels for
+ * keypoint scale 1).
+ * @param indexChange index remapping of the bits.
+ * @return automatically generated
+ */
+ public static BRISK create(MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin, MatOfInt indexChange) {
+ Mat radiusList_mat = radiusList;
+ Mat numberList_mat = numberList;
+ Mat indexChange_mat = indexChange;
+ return BRISK.__fromPtr__(create_4(radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin, indexChange_mat.nativeObj));
+ }
+
+ /**
+ * The BRISK constructor for a custom pattern
+ *
+ * @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+ * keypoint scale 1).
+ * @param numberList defines the number of sampling points on the sampling circle. Must be the same
+ * size as radiusList..
+ * @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
+ * scale 1).
+ * @param dMin threshold for the long pairings used for orientation determination (in pixels for
+ * keypoint scale 1).
+ * @return automatically generated
+ */
+ public static BRISK create(MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin) {
+ Mat radiusList_mat = radiusList;
+ Mat numberList_mat = numberList;
+ return BRISK.__fromPtr__(create_5(radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin));
+ }
+
+ /**
+ * The BRISK constructor for a custom pattern
+ *
+ * @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+ * keypoint scale 1).
+ * @param numberList defines the number of sampling points on the sampling circle. Must be the same
+ * size as radiusList..
+ * @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
+ * scale 1).
+ * keypoint scale 1).
+ * @return automatically generated
+ */
+ public static BRISK create(MatOfFloat radiusList, MatOfInt numberList, float dMax) {
+ Mat radiusList_mat = radiusList;
+ Mat numberList_mat = numberList;
+ return BRISK.__fromPtr__(create_6(radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax));
+ }
+
+ /**
+ * The BRISK constructor for a custom pattern
+ *
+ * @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+ * keypoint scale 1).
+ * @param numberList defines the number of sampling points on the sampling circle. Must be the same
+ * size as radiusList..
+ * scale 1).
+ * keypoint scale 1).
+ * @return automatically generated
+ */
+ public static BRISK create(MatOfFloat radiusList, MatOfInt numberList) {
+ Mat radiusList_mat = radiusList;
+ Mat numberList_mat = numberList;
+ return BRISK.__fromPtr__(create_7(radiusList_mat.nativeObj, numberList_mat.nativeObj));
+ }
+
+
+ //
+ // C++: static Ptr_BRISK cv::BRISK::create(int thresh, int octaves, vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector())
+ //
+
+ /**
+ * The BRISK constructor for a custom pattern, detection threshold and octaves
+ *
+ * @param thresh AGAST detection threshold score.
+ * @param octaves detection octaves. Use 0 to do single scale.
+ * @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+ * keypoint scale 1).
+ * @param numberList defines the number of sampling points on the sampling circle. Must be the same
+ * size as radiusList..
+ * @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
+ * scale 1).
+ * @param dMin threshold for the long pairings used for orientation determination (in pixels for
+ * keypoint scale 1).
+ * @param indexChange index remapping of the bits.
+ * @return automatically generated
+ */
+ public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin, MatOfInt indexChange) {
+ Mat radiusList_mat = radiusList;
+ Mat numberList_mat = numberList;
+ Mat indexChange_mat = indexChange;
+ return BRISK.__fromPtr__(create_8(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin, indexChange_mat.nativeObj));
+ }
+
+ /**
+ * The BRISK constructor for a custom pattern, detection threshold and octaves
+ *
+ * @param thresh AGAST detection threshold score.
+ * @param octaves detection octaves. Use 0 to do single scale.
+ * @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+ * keypoint scale 1).
+ * @param numberList defines the number of sampling points on the sampling circle. Must be the same
+ * size as radiusList..
+ * @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
+ * scale 1).
+ * @param dMin threshold for the long pairings used for orientation determination (in pixels for
+ * keypoint scale 1).
+ * @return automatically generated
+ */
+ public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin) {
+ Mat radiusList_mat = radiusList;
+ Mat numberList_mat = numberList;
+ return BRISK.__fromPtr__(create_9(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin));
+ }
+
+ /**
+ * The BRISK constructor for a custom pattern, detection threshold and octaves
+ *
+ * @param thresh AGAST detection threshold score.
+ * @param octaves detection octaves. Use 0 to do single scale.
+ * @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+ * keypoint scale 1).
+ * @param numberList defines the number of sampling points on the sampling circle. Must be the same
+ * size as radiusList..
+ * @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
+ * scale 1).
+ * keypoint scale 1).
+ * @return automatically generated
+ */
+ public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList, float dMax) {
+ Mat radiusList_mat = radiusList;
+ Mat numberList_mat = numberList;
+ return BRISK.__fromPtr__(create_10(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax));
+ }
+
+ /**
+ * The BRISK constructor for a custom pattern, detection threshold and octaves
+ *
+ * @param thresh AGAST detection threshold score.
+ * @param octaves detection octaves. Use 0 to do single scale.
+ * @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+ * keypoint scale 1).
+ * @param numberList defines the number of sampling points on the sampling circle. Must be the same
+ * size as radiusList..
+ * scale 1).
+ * keypoint scale 1).
+ * @return automatically generated
+ */
+ public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList) {
+ Mat radiusList_mat = radiusList;
+ Mat numberList_mat = numberList;
+ return BRISK.__fromPtr__(create_11(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj));
+ }
+
+
+ //
+ // C++: String cv::BRISK::getDefaultName()
+ //
+
+ public String getDefaultName() {
+ return getDefaultName_0(nativeObj);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: static Ptr_BRISK cv::BRISK::create(int thresh = 30, int octaves = 3, float patternScale = 1.0f)
+ private static native long create_0(int thresh, int octaves, float patternScale);
+ private static native long create_1(int thresh, int octaves);
+ private static native long create_2(int thresh);
+ private static native long create_3();
+
+ // C++: static Ptr_BRISK cv::BRISK::create(vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector())
+ private static native long create_4(long radiusList_mat_nativeObj, long numberList_mat_nativeObj, float dMax, float dMin, long indexChange_mat_nativeObj);
+ private static native long create_5(long radiusList_mat_nativeObj, long numberList_mat_nativeObj, float dMax, float dMin);
+ private static native long create_6(long radiusList_mat_nativeObj, long numberList_mat_nativeObj, float dMax);
+ private static native long create_7(long radiusList_mat_nativeObj, long numberList_mat_nativeObj);
+
+ // C++: static Ptr_BRISK cv::BRISK::create(int thresh, int octaves, vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector())
+ private static native long create_8(int thresh, int octaves, long radiusList_mat_nativeObj, long numberList_mat_nativeObj, float dMax, float dMin, long indexChange_mat_nativeObj);
+ private static native long create_9(int thresh, int octaves, long radiusList_mat_nativeObj, long numberList_mat_nativeObj, float dMax, float dMin);
+ private static native long create_10(int thresh, int octaves, long radiusList_mat_nativeObj, long numberList_mat_nativeObj, float dMax);
+ private static native long create_11(int thresh, int octaves, long radiusList_mat_nativeObj, long numberList_mat_nativeObj);
+
+ // C++: String cv::BRISK::getDefaultName()
+ private static native String getDefaultName_0(long nativeObj);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/DescriptorExtractor.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/DescriptorExtractor.java
new file mode 100644
index 0000000..009dbfc
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/DescriptorExtractor.java
@@ -0,0 +1,165 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfKeyPoint;
+import org.opencv.features2d.DescriptorExtractor;
+import org.opencv.utils.Converters;
+
+// C++: class javaDescriptorExtractor
+/**
+ * @deprecated
+ */
+@Deprecated
+public class DescriptorExtractor {
+
+ protected final long nativeObj;
+ protected DescriptorExtractor(long addr) { nativeObj = addr; }
+
+ public long getNativeObjAddr() { return nativeObj; }
+
+ // internal usage only
+ public static DescriptorExtractor __fromPtr__(long addr) { return new DescriptorExtractor(addr); }
+
+ private static final int
+ OPPONENTEXTRACTOR = 1000;
+
+
+ // C++: enum
+ public static final int
+ SIFT = 1,
+ SURF = 2,
+ ORB = 3,
+ BRIEF = 4,
+ BRISK = 5,
+ FREAK = 6,
+ AKAZE = 7,
+ OPPONENT_SIFT = OPPONENTEXTRACTOR + SIFT,
+ OPPONENT_SURF = OPPONENTEXTRACTOR + SURF,
+ OPPONENT_ORB = OPPONENTEXTRACTOR + ORB,
+ OPPONENT_BRIEF = OPPONENTEXTRACTOR + BRIEF,
+ OPPONENT_BRISK = OPPONENTEXTRACTOR + BRISK,
+ OPPONENT_FREAK = OPPONENTEXTRACTOR + FREAK,
+ OPPONENT_AKAZE = OPPONENTEXTRACTOR + AKAZE;
+
+
+ //
+ // C++: void cv::javaDescriptorExtractor::compute(Mat image, vector_KeyPoint& keypoints, Mat descriptors)
+ //
+
+ public void compute(Mat image, MatOfKeyPoint keypoints, Mat descriptors) {
+ Mat keypoints_mat = keypoints;
+ compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, descriptors.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::javaDescriptorExtractor::compute(vector_Mat images, vector_vector_KeyPoint& keypoints, vector_Mat& descriptors)
+ //
+
+ public void compute(List images, List keypoints, List descriptors) {
+ Mat images_mat = Converters.vector_Mat_to_Mat(images);
+ List keypoints_tmplm = new ArrayList((keypoints != null) ? keypoints.size() : 0);
+ Mat keypoints_mat = Converters.vector_vector_KeyPoint_to_Mat(keypoints, keypoints_tmplm);
+ Mat descriptors_mat = new Mat();
+ compute_1(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj, descriptors_mat.nativeObj);
+ Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
+ keypoints_mat.release();
+ Converters.Mat_to_vector_Mat(descriptors_mat, descriptors);
+ descriptors_mat.release();
+ }
+
+
+ //
+ // C++: int cv::javaDescriptorExtractor::descriptorSize()
+ //
+
+ public int descriptorSize() {
+ return descriptorSize_0(nativeObj);
+ }
+
+
+ //
+ // C++: int cv::javaDescriptorExtractor::descriptorType()
+ //
+
+ public int descriptorType() {
+ return descriptorType_0(nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::javaDescriptorExtractor::empty()
+ //
+
+ public boolean empty() {
+ return empty_0(nativeObj);
+ }
+
+
+ //
+ // C++: static Ptr_javaDescriptorExtractor cv::javaDescriptorExtractor::create(int extractorType)
+ //
+
+ public static DescriptorExtractor create(int extractorType) {
+ return DescriptorExtractor.__fromPtr__(create_0(extractorType));
+ }
+
+
+ //
+ // C++: void cv::javaDescriptorExtractor::write(String fileName)
+ //
+
+ public void write(String fileName) {
+ write_0(nativeObj, fileName);
+ }
+
+
+ //
+ // C++: void cv::javaDescriptorExtractor::read(String fileName)
+ //
+
+ public void read(String fileName) {
+ read_0(nativeObj, fileName);
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: void cv::javaDescriptorExtractor::compute(Mat image, vector_KeyPoint& keypoints, Mat descriptors)
+ private static native void compute_0(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj, long descriptors_nativeObj);
+
+ // C++: void cv::javaDescriptorExtractor::compute(vector_Mat images, vector_vector_KeyPoint& keypoints, vector_Mat& descriptors)
+ private static native void compute_1(long nativeObj, long images_mat_nativeObj, long keypoints_mat_nativeObj, long descriptors_mat_nativeObj);
+
+ // C++: int cv::javaDescriptorExtractor::descriptorSize()
+ private static native int descriptorSize_0(long nativeObj);
+
+ // C++: int cv::javaDescriptorExtractor::descriptorType()
+ private static native int descriptorType_0(long nativeObj);
+
+ // C++: bool cv::javaDescriptorExtractor::empty()
+ private static native boolean empty_0(long nativeObj);
+
+ // C++: static Ptr_javaDescriptorExtractor cv::javaDescriptorExtractor::create(int extractorType)
+ private static native long create_0(int extractorType);
+
+ // C++: void cv::javaDescriptorExtractor::write(String fileName)
+ private static native void write_0(long nativeObj, String fileName);
+
+ // C++: void cv::javaDescriptorExtractor::read(String fileName)
+ private static native void read_0(long nativeObj, String fileName);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3413/src/main/java/org/opencv/features2d/DescriptorMatcher.java b/openCVLibrary3413/src/main/java/org/opencv/features2d/DescriptorMatcher.java
new file mode 100644
index 0000000..12f81f4
--- /dev/null
+++ b/openCVLibrary3413/src/main/java/org/opencv/features2d/DescriptorMatcher.java
@@ -0,0 +1,670 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.features2d;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Algorithm;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfDMatch;
+import org.opencv.features2d.DescriptorMatcher;
+import org.opencv.utils.Converters;
+
+// C++: class DescriptorMatcher
+/**
+ * Abstract base class for matching keypoint descriptors.
+ *
+ * It has two groups of match methods: for matching descriptors of an image with another image or with
+ * an image set.
+ */
+public class DescriptorMatcher extends Algorithm {
+
+ protected DescriptorMatcher(long addr) { super(addr); }
+
+ // internal usage only
+ public static DescriptorMatcher __fromPtr__(long addr) { return new DescriptorMatcher(addr); }
+
+ // C++: enum
+ public static final int
+ FLANNBASED = 1,
+ BRUTEFORCE = 2,
+ BRUTEFORCE_L1 = 3,
+ BRUTEFORCE_HAMMING = 4,
+ BRUTEFORCE_HAMMINGLUT = 5,
+ BRUTEFORCE_SL2 = 6;
+
+
+ //
+ // C++: void cv::DescriptorMatcher::add(vector_Mat descriptors)
+ //
+
+ /**
+ * Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor
+ * collection.
+ *
+ * If the collection is not empty, the new descriptors are added to existing train descriptors.
+ *
+ * @param descriptors Descriptors to add. Each descriptors[i] is a set of descriptors from the same
+ * train image.
+ */
+ public void add(List descriptors) {
+ Mat descriptors_mat = Converters.vector_Mat_to_Mat(descriptors);
+ add_0(nativeObj, descriptors_mat.nativeObj);
+ }
+
+
+ //
+ // C++: vector_Mat cv::DescriptorMatcher::getTrainDescriptors()
+ //
+
+ /**
+ * Returns a constant link to the train descriptor collection trainDescCollection .
+ * @return automatically generated
+ */
+ public List getTrainDescriptors() {
+ List retVal = new ArrayList();
+ Mat retValMat = new Mat(getTrainDescriptors_0(nativeObj));
+ Converters.Mat_to_vector_Mat(retValMat, retVal);
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::DescriptorMatcher::clear()
+ //
+
+ /**
+ * Clears the train descriptor collections.
+ */
+ public void clear() {
+ clear_0(nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::DescriptorMatcher::empty()
+ //
+
+ /**
+ * Returns true if there are no train descriptors in the both collections.
+ * @return automatically generated
+ */
+ public boolean empty() {
+ return empty_0(nativeObj);
+ }
+
+
+ //
+ // C++: bool cv::DescriptorMatcher::isMaskSupported()
+ //
+
+ /**
+ * Returns true if the descriptor matcher supports masking permissible matches.
+ * @return automatically generated
+ */
+ public boolean isMaskSupported() {
+ return isMaskSupported_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::DescriptorMatcher::train()
+ //
+
+ /**
+ * Trains a descriptor matcher
+ *
+ * Trains a descriptor matcher (for example, the flann index). In all methods to match, the method
+ * train() is run every time before matching. Some descriptor matchers (for example, BruteForceMatcher)
+ * have an empty implementation of this method. Other matchers really train their inner structures (for
+ * example, FlannBasedMatcher trains flann::Index ).
+ */
+ public void train() {
+ train_0(nativeObj);
+ }
+
+
+ //
+ // C++: void cv::DescriptorMatcher::match(Mat queryDescriptors, Mat trainDescriptors, vector_DMatch& matches, Mat mask = Mat())
+ //
+
+ /**
+ * Finds the best match for each descriptor from a query set.
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+ * collection stored in the class object.
+ * @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
+ * descriptor. So, matches size may be smaller than the query descriptors count.
+ * @param mask Mask specifying permissible matches between an input query and train matrices of
+ * descriptors.
+ *
+ * In the first variant of this method, the train descriptors are passed as an input argument. In the
+ * second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is
+ * used. Optional mask (or masks) can be passed to specify which query and training descriptors can be
+ * matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if
+ * mask.at<uchar>(i,j) is non-zero.
+ */
+ public void match(Mat queryDescriptors, Mat trainDescriptors, MatOfDMatch matches, Mat mask) {
+ Mat matches_mat = matches;
+ match_0(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, mask.nativeObj);
+ }
+
+ /**
+ * Finds the best match for each descriptor from a query set.
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+ * collection stored in the class object.
+ * @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
+ * descriptor. So, matches size may be smaller than the query descriptors count.
+ * descriptors.
+ *
+ * In the first variant of this method, the train descriptors are passed as an input argument. In the
+ * second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is
+ * used. Optional mask (or masks) can be passed to specify which query and training descriptors can be
+ * matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if
+ * mask.at<uchar>(i,j) is non-zero.
+ */
+ public void match(Mat queryDescriptors, Mat trainDescriptors, MatOfDMatch matches) {
+ Mat matches_mat = matches;
+ match_1(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::DescriptorMatcher::knnMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, int k, Mat mask = Mat(), bool compactResult = false)
+ //
+
+ /**
+ * Finds the k best matches for each descriptor from a query set.
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+ * collection stored in the class object.
+ * @param mask Mask specifying permissible matches between an input query and train matrices of
+ * descriptors.
+ * @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+ * @param k Count of best matches found per each query descriptor or less if a query descriptor has
+ * less than k possible matches in total.
+ * @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+ * false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+ * the matches vector does not contain matches for fully masked-out query descriptors.
+ *
+ * These extended variants of DescriptorMatcher::match methods find several best matches for each query
+ * descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match
+ * for the details about query and train descriptors.
+ */
+ public void knnMatch(Mat queryDescriptors, Mat trainDescriptors, List matches, int k, Mat mask, boolean compactResult) {
+ Mat matches_mat = new Mat();
+ knnMatch_0(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, k, mask.nativeObj, compactResult);
+ Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
+ matches_mat.release();
+ }
+
+ /**
+ * Finds the k best matches for each descriptor from a query set.
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+ * collection stored in the class object.
+ * @param mask Mask specifying permissible matches between an input query and train matrices of
+ * descriptors.
+ * @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+ * @param k Count of best matches found per each query descriptor or less if a query descriptor has
+ * less than k possible matches in total.
+ * false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+ * the matches vector does not contain matches for fully masked-out query descriptors.
+ *
+ * These extended variants of DescriptorMatcher::match methods find several best matches for each query
+ * descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match
+ * for the details about query and train descriptors.
+ */
+ public void knnMatch(Mat queryDescriptors, Mat trainDescriptors, List matches, int k, Mat mask) {
+ Mat matches_mat = new Mat();
+ knnMatch_1(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, k, mask.nativeObj);
+ Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
+ matches_mat.release();
+ }
+
+ /**
+ * Finds the k best matches for each descriptor from a query set.
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+ * collection stored in the class object.
+ * descriptors.
+ * @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+ * @param k Count of best matches found per each query descriptor or less if a query descriptor has
+ * less than k possible matches in total.
+ * false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+ * the matches vector does not contain matches for fully masked-out query descriptors.
+ *
+ * These extended variants of DescriptorMatcher::match methods find several best matches for each query
+ * descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match
+ * for the details about query and train descriptors.
+ */
+ public void knnMatch(Mat queryDescriptors, Mat trainDescriptors, List matches, int k) {
+ Mat matches_mat = new Mat();
+ knnMatch_2(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, k);
+ Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
+ matches_mat.release();
+ }
+
+
+ //
+ // C++: void cv::DescriptorMatcher::radiusMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, float maxDistance, Mat mask = Mat(), bool compactResult = false)
+ //
+
+ /**
+ * For each query descriptor, finds the training descriptors not farther than the specified distance.
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+ * collection stored in the class object.
+ * @param matches Found matches.
+ * @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+ * false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+ * the matches vector does not contain matches for fully masked-out query descriptors.
+ * @param maxDistance Threshold for the distance between matched descriptors. Distance means here
+ * metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured
+ * in Pixels)!
+ * @param mask Mask specifying permissible matches between an input query and train matrices of
+ * descriptors.
+ *
+ * For each query descriptor, the methods find such training descriptors that the distance between the
+ * query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are
+ * returned in the distance increasing order.
+ */
+ public void radiusMatch(Mat queryDescriptors, Mat trainDescriptors, List matches, float maxDistance, Mat mask, boolean compactResult) {
+ Mat matches_mat = new Mat();
+ radiusMatch_0(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, maxDistance, mask.nativeObj, compactResult);
+ Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
+ matches_mat.release();
+ }
+
+ /**
+ * For each query descriptor, finds the training descriptors not farther than the specified distance.
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+ * collection stored in the class object.
+ * @param matches Found matches.
+ * false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+ * the matches vector does not contain matches for fully masked-out query descriptors.
+ * @param maxDistance Threshold for the distance between matched descriptors. Distance means here
+ * metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured
+ * in Pixels)!
+ * @param mask Mask specifying permissible matches between an input query and train matrices of
+ * descriptors.
+ *
+ * For each query descriptor, the methods find such training descriptors that the distance between the
+ * query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are
+ * returned in the distance increasing order.
+ */
+ public void radiusMatch(Mat queryDescriptors, Mat trainDescriptors, List matches, float maxDistance, Mat mask) {
+ Mat matches_mat = new Mat();
+ radiusMatch_1(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, maxDistance, mask.nativeObj);
+ Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
+ matches_mat.release();
+ }
+
+ /**
+ * For each query descriptor, finds the training descriptors not farther than the specified distance.
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+ * collection stored in the class object.
+ * @param matches Found matches.
+ * false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+ * the matches vector does not contain matches for fully masked-out query descriptors.
+ * @param maxDistance Threshold for the distance between matched descriptors. Distance means here
+ * metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured
+ * in Pixels)!
+ * descriptors.
+ *
+ * For each query descriptor, the methods find such training descriptors that the distance between the
+ * query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are
+ * returned in the distance increasing order.
+ */
+ public void radiusMatch(Mat queryDescriptors, Mat trainDescriptors, List matches, float maxDistance) {
+ Mat matches_mat = new Mat();
+ radiusMatch_2(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, maxDistance);
+ Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
+ matches_mat.release();
+ }
+
+
+ //
+ // C++: void cv::DescriptorMatcher::match(Mat queryDescriptors, vector_DMatch& matches, vector_Mat masks = vector_Mat())
+ //
+
+ /**
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
+ * descriptor. So, matches size may be smaller than the query descriptors count.
+ * @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+ * descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+ */
+ public void match(Mat queryDescriptors, MatOfDMatch matches, List masks) {
+ Mat matches_mat = matches;
+ Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
+ match_2(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, masks_mat.nativeObj);
+ }
+
+ /**
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
+ * descriptor. So, matches size may be smaller than the query descriptors count.
+ * descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+ */
+ public void match(Mat queryDescriptors, MatOfDMatch matches) {
+ Mat matches_mat = matches;
+ match_3(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj);
+ }
+
+
+ //
+ // C++: void cv::DescriptorMatcher::knnMatch(Mat queryDescriptors, vector_vector_DMatch& matches, int k, vector_Mat masks = vector_Mat(), bool compactResult = false)
+ //
+
+ /**
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+ * @param k Count of best matches found per each query descriptor or less if a query descriptor has
+ * less than k possible matches in total.
+ * @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+ * descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+ * @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+ * false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+ * the matches vector does not contain matches for fully masked-out query descriptors.
+ */
+ public void knnMatch(Mat queryDescriptors, List matches, int k, List masks, boolean compactResult) {
+ Mat matches_mat = new Mat();
+ Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
+ knnMatch_3(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, k, masks_mat.nativeObj, compactResult);
+ Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
+ matches_mat.release();
+ }
+
+ /**
+ *
+ * @param queryDescriptors Query set of descriptors.
+ * @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+ * @param k Count of best matches found per each query descriptor or less if a query descriptor has
+ * less than k possible matches in total.
+ * @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+ * descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+ * false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+ * the matches vector does not contain matches for fully masked-out query descriptors.
+ */
+ public void knnMatch(Mat queryDescriptors, List matches, int k, List