补充提交
This commit is contained in:
+391
@@ -0,0 +1,391 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.engine.OpenCVEngineInterface;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.net.Uri;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
class AsyncServiceHelper
|
||||
{
|
||||
public static boolean initOpenCV(String Version, final Context AppContext,
|
||||
final LoaderCallbackInterface Callback)
|
||||
{
|
||||
AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback);
|
||||
Intent intent = new Intent("org.opencv.engine.BIND");
|
||||
intent.setPackage("org.opencv.engine");
|
||||
if (AppContext.bindService(intent, helper.mServiceConnection, Context.BIND_AUTO_CREATE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AppContext.unbindService(helper.mServiceConnection);
|
||||
InstallService(AppContext, Callback);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected AsyncServiceHelper(String Version, Context AppContext, LoaderCallbackInterface Callback)
|
||||
{
|
||||
mOpenCVersion = Version;
|
||||
mUserAppCallback = Callback;
|
||||
mAppContext = AppContext;
|
||||
}
|
||||
|
||||
protected static final String TAG = "OpenCVManager/Helper";
|
||||
protected static final int MINIMUM_ENGINE_VERSION = 2;
|
||||
protected OpenCVEngineInterface mEngineService;
|
||||
protected LoaderCallbackInterface mUserAppCallback;
|
||||
protected String mOpenCVersion;
|
||||
protected Context mAppContext;
|
||||
protected static boolean mServiceInstallationProgress = false;
|
||||
protected static boolean mLibraryInstallationProgress = false;
|
||||
|
||||
protected static boolean InstallServiceQuiet(Context context)
|
||||
{
|
||||
boolean result = true;
|
||||
try
|
||||
{
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(OPEN_CV_SERVICE_URL));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static void InstallService(final Context AppContext, final LoaderCallbackInterface Callback)
|
||||
{
|
||||
if (!mServiceInstallationProgress)
|
||||
{
|
||||
Log.d(TAG, "Request new service installation");
|
||||
InstallCallbackInterface InstallQuery = new InstallCallbackInterface() {
|
||||
private LoaderCallbackInterface mUserAppCallback = Callback;
|
||||
public String getPackageName()
|
||||
{
|
||||
return "OpenCV Manager";
|
||||
}
|
||||
public void install() {
|
||||
Log.d(TAG, "Trying to install OpenCV Manager via Google Play");
|
||||
|
||||
boolean result = InstallServiceQuiet(AppContext);
|
||||
if (result)
|
||||
{
|
||||
mServiceInstallationProgress = true;
|
||||
Log.d(TAG, "Package installation started");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(TAG, "OpenCV package was not installed!");
|
||||
int Status = LoaderCallbackInterface.MARKET_ERROR;
|
||||
Log.d(TAG, "Init finished with status " + Status);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(Status);
|
||||
}
|
||||
}
|
||||
|
||||
public void cancel()
|
||||
{
|
||||
Log.d(TAG, "OpenCV library installation was canceled");
|
||||
int Status = LoaderCallbackInterface.INSTALL_CANCELED;
|
||||
Log.d(TAG, "Init finished with status " + Status);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(Status);
|
||||
}
|
||||
|
||||
public void wait_install()
|
||||
{
|
||||
Log.e(TAG, "Installation was not started! Nothing to wait!");
|
||||
}
|
||||
};
|
||||
|
||||
Callback.onPackageInstall(InstallCallbackInterface.NEW_INSTALLATION, InstallQuery);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(TAG, "Waiting current installation process");
|
||||
InstallCallbackInterface WaitQuery = new InstallCallbackInterface() {
|
||||
private LoaderCallbackInterface mUserAppCallback = Callback;
|
||||
public String getPackageName()
|
||||
{
|
||||
return "OpenCV Manager";
|
||||
}
|
||||
public void install()
|
||||
{
|
||||
Log.e(TAG, "Nothing to install we just wait current installation");
|
||||
}
|
||||
public void cancel()
|
||||
{
|
||||
Log.d(TAG, "Waiting for OpenCV canceled by user");
|
||||
mServiceInstallationProgress = false;
|
||||
int Status = LoaderCallbackInterface.INSTALL_CANCELED;
|
||||
Log.d(TAG, "Init finished with status " + Status);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(Status);
|
||||
}
|
||||
public void wait_install()
|
||||
{
|
||||
InstallServiceQuiet(AppContext);
|
||||
}
|
||||
};
|
||||
|
||||
Callback.onPackageInstall(InstallCallbackInterface.INSTALLATION_PROGRESS, WaitQuery);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* URL of OpenCV Manager page on Google Play Market.
|
||||
*/
|
||||
protected static final String OPEN_CV_SERVICE_URL = "market://details?id=org.opencv.engine";
|
||||
|
||||
protected ServiceConnection mServiceConnection = new ServiceConnection()
|
||||
{
|
||||
public void onServiceConnected(ComponentName className, IBinder service)
|
||||
{
|
||||
Log.d(TAG, "Service connection created");
|
||||
mEngineService = OpenCVEngineInterface.Stub.asInterface(service);
|
||||
if (null == mEngineService)
|
||||
{
|
||||
Log.d(TAG, "OpenCV Manager Service connection fails. May be service was not installed?");
|
||||
InstallService(mAppContext, mUserAppCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
mServiceInstallationProgress = false;
|
||||
try
|
||||
{
|
||||
if (mEngineService.getEngineVersion() < MINIMUM_ENGINE_VERSION)
|
||||
{
|
||||
Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INCOMPATIBLE_MANAGER_VERSION);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INCOMPATIBLE_MANAGER_VERSION);
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d(TAG, "Trying to get library path");
|
||||
String path = mEngineService.getLibPathByVersion(mOpenCVersion);
|
||||
if ((null == path) || (path.length() == 0))
|
||||
{
|
||||
if (!mLibraryInstallationProgress)
|
||||
{
|
||||
InstallCallbackInterface InstallQuery = new InstallCallbackInterface() {
|
||||
public String getPackageName()
|
||||
{
|
||||
return "OpenCV library";
|
||||
}
|
||||
public void install() {
|
||||
Log.d(TAG, "Trying to install OpenCV lib via Google Play");
|
||||
try
|
||||
{
|
||||
if (mEngineService.installVersion(mOpenCVersion))
|
||||
{
|
||||
mLibraryInstallationProgress = true;
|
||||
Log.d(TAG, "Package installation started");
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(TAG, "OpenCV package was not installed!");
|
||||
Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.MARKET_ERROR);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(LoaderCallbackInterface.MARKET_ERROR);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();;
|
||||
Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INIT_FAILED);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INIT_FAILED);
|
||||
}
|
||||
}
|
||||
public void cancel() {
|
||||
Log.d(TAG, "OpenCV library installation was canceled");
|
||||
Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INSTALL_CANCELED);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INSTALL_CANCELED);
|
||||
}
|
||||
public void wait_install() {
|
||||
Log.e(TAG, "Installation was not started! Nothing to wait!");
|
||||
}
|
||||
};
|
||||
|
||||
mUserAppCallback.onPackageInstall(InstallCallbackInterface.NEW_INSTALLATION, InstallQuery);
|
||||
}
|
||||
else
|
||||
{
|
||||
InstallCallbackInterface WaitQuery = new InstallCallbackInterface() {
|
||||
public String getPackageName()
|
||||
{
|
||||
return "OpenCV library";
|
||||
}
|
||||
|
||||
public void install() {
|
||||
Log.e(TAG, "Nothing to install we just wait current installation");
|
||||
}
|
||||
public void cancel()
|
||||
{
|
||||
Log.d(TAG, "OpenCV library installation was canceled");
|
||||
mLibraryInstallationProgress = false;
|
||||
Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INSTALL_CANCELED);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INSTALL_CANCELED);
|
||||
}
|
||||
public void wait_install() {
|
||||
Log.d(TAG, "Waiting for current installation");
|
||||
try
|
||||
{
|
||||
if (!mEngineService.installVersion(mOpenCVersion))
|
||||
{
|
||||
Log.d(TAG, "OpenCV package was not installed!");
|
||||
Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.MARKET_ERROR);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(LoaderCallbackInterface.MARKET_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(TAG, "Wating for package installation");
|
||||
}
|
||||
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INIT_FAILED);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INIT_FAILED);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mUserAppCallback.onPackageInstall(InstallCallbackInterface.INSTALLATION_PROGRESS, WaitQuery);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(TAG, "Trying to get library list");
|
||||
mLibraryInstallationProgress = false;
|
||||
String libs = mEngineService.getLibraryList(mOpenCVersion);
|
||||
Log.d(TAG, "Library list: \"" + libs + "\"");
|
||||
Log.d(TAG, "First attempt to load libs");
|
||||
int status;
|
||||
if (initOpenCVLibs(path, 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);
|
||||
|
||||
status = LoaderCallbackInterface.SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(TAG, "First attempt to load libs fails");
|
||||
status = LoaderCallbackInterface.INIT_FAILED;
|
||||
}
|
||||
|
||||
Log.d(TAG, "Init finished with status " + status);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(status);
|
||||
}
|
||||
}
|
||||
catch (RemoteException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INIT_FAILED);
|
||||
Log.d(TAG, "Unbind from service");
|
||||
mAppContext.unbindService(mServiceConnection);
|
||||
Log.d(TAG, "Calling using callback");
|
||||
mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INIT_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onServiceDisconnected(ComponentName className)
|
||||
{
|
||||
mEngineService = null;
|
||||
}
|
||||
};
|
||||
|
||||
private boolean loadLibrary(String AbsPath)
|
||||
{
|
||||
boolean result = true;
|
||||
|
||||
Log.d(TAG, "Trying to load library " + AbsPath);
|
||||
try
|
||||
{
|
||||
System.load(AbsPath);
|
||||
Log.d(TAG, "OpenCV libs init was ok!");
|
||||
}
|
||||
catch(UnsatisfiedLinkError e)
|
||||
{
|
||||
Log.d(TAG, "Cannot load library \"" + AbsPath + "\"");
|
||||
e.printStackTrace();
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean initOpenCVLibs(String Path, String Libs)
|
||||
{
|
||||
Log.d(TAG, "Trying to init OpenCV libs");
|
||||
if ((null != Path) && (Path.length() != 0))
|
||||
{
|
||||
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())
|
||||
{
|
||||
String AbsLibraryPath = Path + File.separator + splitter.nextToken();
|
||||
result &= loadLibrary(AbsLibraryPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the dependencies list is not defined or empty.
|
||||
String AbsLibraryPath = Path + File.separator + "libopencv_java3.so";
|
||||
result = loadLibrary(AbsLibraryPath);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(TAG, "Library path \"" + Path + "\" is empty");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Basic implementation of LoaderCallbackInterface.
|
||||
*/
|
||||
public abstract class BaseLoaderCallback implements LoaderCallbackInterface {
|
||||
|
||||
public BaseLoaderCallback(Context AppContext) {
|
||||
mAppContext = AppContext;
|
||||
}
|
||||
|
||||
public void onManagerConnected(int status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
/** OpenCV initialization was successful. **/
|
||||
case LoaderCallbackInterface.SUCCESS:
|
||||
{
|
||||
/** Application must override this method to handle successful library initialization. **/
|
||||
} break;
|
||||
/** OpenCV loader can not start Google Play Market. **/
|
||||
case LoaderCallbackInterface.MARKET_ERROR:
|
||||
{
|
||||
Log.e(TAG, "Package installation failed!");
|
||||
AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
|
||||
MarketErrorMessage.setTitle("OpenCV Manager");
|
||||
MarketErrorMessage.setMessage("Package installation failed!");
|
||||
MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
|
||||
MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
MarketErrorMessage.show();
|
||||
} break;
|
||||
/** Package installation has been canceled. **/
|
||||
case LoaderCallbackInterface.INSTALL_CANCELED:
|
||||
{
|
||||
Log.d(TAG, "OpenCV library installation was canceled by user");
|
||||
finish();
|
||||
} break;
|
||||
/** Application is incompatible with this version of OpenCV Manager. Possibly, a service update is required. **/
|
||||
case LoaderCallbackInterface.INCOMPATIBLE_MANAGER_VERSION:
|
||||
{
|
||||
Log.d(TAG, "OpenCV Manager Service is uncompatible with this app!");
|
||||
AlertDialog IncomatibilityMessage = new AlertDialog.Builder(mAppContext).create();
|
||||
IncomatibilityMessage.setTitle("OpenCV Manager");
|
||||
IncomatibilityMessage.setMessage("OpenCV Manager service is incompatible with this app. Try to update it via Google Play.");
|
||||
IncomatibilityMessage.setCancelable(false); // This blocks the 'BACK' button
|
||||
IncomatibilityMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
IncomatibilityMessage.show();
|
||||
} break;
|
||||
/** Other status, i.e. INIT_FAILED. **/
|
||||
default:
|
||||
{
|
||||
Log.e(TAG, "OpenCV loading failed!");
|
||||
AlertDialog InitFailedDialog = new AlertDialog.Builder(mAppContext).create();
|
||||
InitFailedDialog.setTitle("OpenCV error");
|
||||
InitFailedDialog.setMessage("OpenCV was not initialised correctly. Application will be shut down");
|
||||
InitFailedDialog.setCancelable(false); // This blocks the 'BACK' button
|
||||
InitFailedDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() {
|
||||
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
InitFailedDialog.show();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onPackageInstall(final int operation, final InstallCallbackInterface callback)
|
||||
{
|
||||
switch (operation)
|
||||
{
|
||||
case InstallCallbackInterface.NEW_INSTALLATION:
|
||||
{
|
||||
AlertDialog InstallMessage = new AlertDialog.Builder(mAppContext).create();
|
||||
InstallMessage.setTitle("Package not found");
|
||||
InstallMessage.setMessage(callback.getPackageName() + " package was not found! Try to install it?");
|
||||
InstallMessage.setCancelable(false); // This blocks the 'BACK' button
|
||||
InstallMessage.setButton(AlertDialog.BUTTON_POSITIVE, "Yes", new OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
callback.install();
|
||||
}
|
||||
});
|
||||
|
||||
InstallMessage.setButton(AlertDialog.BUTTON_NEGATIVE, "No", new OnClickListener() {
|
||||
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
callback.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
InstallMessage.show();
|
||||
} break;
|
||||
case InstallCallbackInterface.INSTALLATION_PROGRESS:
|
||||
{
|
||||
AlertDialog WaitMessage = new AlertDialog.Builder(mAppContext).create();
|
||||
WaitMessage.setTitle("OpenCV is not ready");
|
||||
WaitMessage.setMessage("Installation is in progress. Wait or exit?");
|
||||
WaitMessage.setCancelable(false); // This blocks the 'BACK' button
|
||||
WaitMessage.setButton(AlertDialog.BUTTON_POSITIVE, "Wait", new OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
callback.wait_install();
|
||||
}
|
||||
});
|
||||
WaitMessage.setButton(AlertDialog.BUTTON_NEGATIVE, "Exit", new OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
callback.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
WaitMessage.show();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void finish()
|
||||
{
|
||||
((Activity) mAppContext).finish();
|
||||
}
|
||||
|
||||
protected Context mAppContext;
|
||||
private final static String TAG = "OpenCVLoader/BaseLoaderCallback";
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.SurfaceTexture;
|
||||
import android.hardware.camera2.CameraAccessException;
|
||||
import android.hardware.camera2.CameraCaptureSession;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
import android.hardware.camera2.CameraDevice;
|
||||
import android.hardware.camera2.CameraManager;
|
||||
import android.hardware.camera2.CaptureRequest;
|
||||
import android.hardware.camera2.params.StreamConfigurationMap;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.util.Log;
|
||||
import android.util.Size;
|
||||
import android.view.Surface;
|
||||
|
||||
@TargetApi(21)
|
||||
public class Camera2Renderer extends CameraGLRendererBase {
|
||||
|
||||
protected final String LOGTAG = "Camera2Renderer";
|
||||
private CameraDevice mCameraDevice;
|
||||
private CameraCaptureSession mCaptureSession;
|
||||
private CaptureRequest.Builder mPreviewRequestBuilder;
|
||||
private String mCameraID;
|
||||
private Size mPreviewSize = new Size(-1, -1);
|
||||
|
||||
private HandlerThread mBackgroundThread;
|
||||
private Handler mBackgroundHandler;
|
||||
private Semaphore mCameraOpenCloseLock = new Semaphore(1);
|
||||
|
||||
Camera2Renderer(CameraGLSurfaceView view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStart() {
|
||||
Log.d(LOGTAG, "doStart");
|
||||
startBackgroundThread();
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doStop() {
|
||||
Log.d(LOGTAG, "doStop");
|
||||
super.doStop();
|
||||
stopBackgroundThread();
|
||||
}
|
||||
|
||||
boolean cacPreviewSize(final int width, final int height) {
|
||||
Log.i(LOGTAG, "cacPreviewSize: "+width+"x"+height);
|
||||
if(mCameraID == null) {
|
||||
Log.e(LOGTAG, "Camera isn't initialized!");
|
||||
return false;
|
||||
}
|
||||
CameraManager manager = (CameraManager) mView.getContext()
|
||||
.getSystemService(Context.CAMERA_SERVICE);
|
||||
try {
|
||||
CameraCharacteristics characteristics = manager
|
||||
.getCameraCharacteristics(mCameraID);
|
||||
StreamConfigurationMap map = characteristics
|
||||
.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
|
||||
int bestWidth = 0, bestHeight = 0;
|
||||
float aspect = (float)width / height;
|
||||
for (Size psize : map.getOutputSizes(SurfaceTexture.class)) {
|
||||
int w = psize.getWidth(), h = psize.getHeight();
|
||||
Log.d(LOGTAG, "trying size: "+w+"x"+h);
|
||||
if ( width >= w && height >= h &&
|
||||
bestWidth <= w && bestHeight <= h &&
|
||||
Math.abs(aspect - (float)w/h) < 0.2 ) {
|
||||
bestWidth = w;
|
||||
bestHeight = h;
|
||||
}
|
||||
}
|
||||
Log.i(LOGTAG, "best size: "+bestWidth+"x"+bestHeight);
|
||||
if( bestWidth == 0 || bestHeight == 0 ||
|
||||
mPreviewSize.getWidth() == bestWidth &&
|
||||
mPreviewSize.getHeight() == bestHeight )
|
||||
return false;
|
||||
else {
|
||||
mPreviewSize = new Size(bestWidth, bestHeight);
|
||||
return true;
|
||||
}
|
||||
} catch (CameraAccessException e) {
|
||||
Log.e(LOGTAG, "cacPreviewSize - Camera Access Exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(LOGTAG, "cacPreviewSize - Illegal Argument Exception");
|
||||
} catch (SecurityException e) {
|
||||
Log.e(LOGTAG, "cacPreviewSize - Security Exception");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void openCamera(int id) {
|
||||
Log.i(LOGTAG, "openCamera");
|
||||
CameraManager manager = (CameraManager) mView.getContext().getSystemService(Context.CAMERA_SERVICE);
|
||||
try {
|
||||
String camList[] = manager.getCameraIdList();
|
||||
if(camList.length == 0) {
|
||||
Log.e(LOGTAG, "Error: camera isn't detected.");
|
||||
return;
|
||||
}
|
||||
if(id == CameraBridgeViewBase.CAMERA_ID_ANY) {
|
||||
mCameraID = camList[0];
|
||||
} else {
|
||||
for (String cameraID : camList) {
|
||||
CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraID);
|
||||
if( id == CameraBridgeViewBase.CAMERA_ID_BACK &&
|
||||
characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK ||
|
||||
id == CameraBridgeViewBase.CAMERA_ID_FRONT &&
|
||||
characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT) {
|
||||
mCameraID = cameraID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mCameraID != null) {
|
||||
if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
|
||||
throw new RuntimeException(
|
||||
"Time out waiting to lock camera opening.");
|
||||
}
|
||||
Log.i(LOGTAG, "Opening camera: " + mCameraID);
|
||||
manager.openCamera(mCameraID, mStateCallback, mBackgroundHandler);
|
||||
}
|
||||
} catch (CameraAccessException e) {
|
||||
Log.e(LOGTAG, "OpenCamera - Camera Access Exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(LOGTAG, "OpenCamera - Illegal Argument Exception");
|
||||
} catch (SecurityException e) {
|
||||
Log.e(LOGTAG, "OpenCamera - Security Exception");
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(LOGTAG, "OpenCamera - Interrupted Exception");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void closeCamera() {
|
||||
Log.i(LOGTAG, "closeCamera");
|
||||
try {
|
||||
mCameraOpenCloseLock.acquire();
|
||||
if (null != mCaptureSession) {
|
||||
mCaptureSession.close();
|
||||
mCaptureSession = null;
|
||||
}
|
||||
if (null != mCameraDevice) {
|
||||
mCameraDevice.close();
|
||||
mCameraDevice = null;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException("Interrupted while trying to lock camera closing.", e);
|
||||
} finally {
|
||||
mCameraOpenCloseLock.release();
|
||||
}
|
||||
}
|
||||
|
||||
private final CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback() {
|
||||
|
||||
@Override
|
||||
public void onOpened(CameraDevice cameraDevice) {
|
||||
mCameraDevice = cameraDevice;
|
||||
mCameraOpenCloseLock.release();
|
||||
createCameraPreviewSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected(CameraDevice cameraDevice) {
|
||||
cameraDevice.close();
|
||||
mCameraDevice = null;
|
||||
mCameraOpenCloseLock.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(CameraDevice cameraDevice, int error) {
|
||||
cameraDevice.close();
|
||||
mCameraDevice = null;
|
||||
mCameraOpenCloseLock.release();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private void createCameraPreviewSession() {
|
||||
int w=mPreviewSize.getWidth(), h=mPreviewSize.getHeight();
|
||||
Log.i(LOGTAG, "createCameraPreviewSession("+w+"x"+h+")");
|
||||
if(w<0 || h<0)
|
||||
return;
|
||||
try {
|
||||
mCameraOpenCloseLock.acquire();
|
||||
if (null == mCameraDevice) {
|
||||
mCameraOpenCloseLock.release();
|
||||
Log.e(LOGTAG, "createCameraPreviewSession: camera isn't opened");
|
||||
return;
|
||||
}
|
||||
if (null != mCaptureSession) {
|
||||
mCameraOpenCloseLock.release();
|
||||
Log.e(LOGTAG, "createCameraPreviewSession: mCaptureSession is already started");
|
||||
return;
|
||||
}
|
||||
if(null == mSTexture) {
|
||||
mCameraOpenCloseLock.release();
|
||||
Log.e(LOGTAG, "createCameraPreviewSession: preview SurfaceTexture is null");
|
||||
return;
|
||||
}
|
||||
mSTexture.setDefaultBufferSize(w, h);
|
||||
|
||||
Surface surface = new Surface(mSTexture);
|
||||
|
||||
mPreviewRequestBuilder = mCameraDevice
|
||||
.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
|
||||
mPreviewRequestBuilder.addTarget(surface);
|
||||
|
||||
mCameraDevice.createCaptureSession(Arrays.asList(surface),
|
||||
new CameraCaptureSession.StateCallback() {
|
||||
@Override
|
||||
public void onConfigured( CameraCaptureSession cameraCaptureSession) {
|
||||
mCaptureSession = cameraCaptureSession;
|
||||
try {
|
||||
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
|
||||
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
|
||||
|
||||
mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), null, mBackgroundHandler);
|
||||
Log.i(LOGTAG, "CameraPreviewSession has been started");
|
||||
} catch (CameraAccessException e) {
|
||||
Log.e(LOGTAG, "createCaptureSession failed");
|
||||
}
|
||||
mCameraOpenCloseLock.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigureFailed(
|
||||
CameraCaptureSession cameraCaptureSession) {
|
||||
Log.e(LOGTAG, "createCameraPreviewSession failed");
|
||||
mCameraOpenCloseLock.release();
|
||||
}
|
||||
}, mBackgroundHandler);
|
||||
} catch (CameraAccessException e) {
|
||||
Log.e(LOGTAG, "createCameraPreviewSession");
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(
|
||||
"Interrupted while createCameraPreviewSession", e);
|
||||
}
|
||||
finally {
|
||||
//mCameraOpenCloseLock.release();
|
||||
}
|
||||
}
|
||||
|
||||
private void startBackgroundThread() {
|
||||
Log.i(LOGTAG, "startBackgroundThread");
|
||||
stopBackgroundThread();
|
||||
mBackgroundThread = new HandlerThread("CameraBackground");
|
||||
mBackgroundThread.start();
|
||||
mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
|
||||
}
|
||||
|
||||
private void stopBackgroundThread() {
|
||||
Log.i(LOGTAG, "stopBackgroundThread");
|
||||
if(mBackgroundThread == null)
|
||||
return;
|
||||
mBackgroundThread.quitSafely();
|
||||
try {
|
||||
mBackgroundThread.join();
|
||||
mBackgroundThread = null;
|
||||
mBackgroundHandler = null;
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(LOGTAG, "stopBackgroundThread");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setCameraPreviewSize(int width, int height) {
|
||||
Log.i(LOGTAG, "setCameraPreviewSize("+width+"x"+height+")");
|
||||
if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth;
|
||||
if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight;
|
||||
try {
|
||||
mCameraOpenCloseLock.acquire();
|
||||
|
||||
boolean needReconfig = cacPreviewSize(width, height);
|
||||
mCameraWidth = mPreviewSize.getWidth();
|
||||
mCameraHeight = mPreviewSize.getHeight();
|
||||
|
||||
if( !needReconfig ) {
|
||||
mCameraOpenCloseLock.release();
|
||||
return;
|
||||
}
|
||||
if (null != mCaptureSession) {
|
||||
Log.d(LOGTAG, "closing existing previewSession");
|
||||
mCaptureSession.close();
|
||||
mCaptureSession = null;
|
||||
}
|
||||
mCameraOpenCloseLock.release();
|
||||
createCameraPreviewSession();
|
||||
} catch (InterruptedException e) {
|
||||
mCameraOpenCloseLock.release();
|
||||
throw new RuntimeException("Interrupted while setCameraPreviewSize.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+495
@@ -0,0 +1,495 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.opencv.BuildConfig;
|
||||
import org.opencv.R;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
/**
|
||||
* This is a basic class, implementing the interaction with Camera and OpenCV library.
|
||||
* The main responsibility of it - is to control when camera can be enabled, process the frame,
|
||||
* call external listener to make any adjustments to the frame and then draw the resulting
|
||||
* frame to the screen.
|
||||
* The clients shall implement CvCameraViewListener.
|
||||
*/
|
||||
public abstract class CameraBridgeViewBase extends SurfaceView implements SurfaceHolder.Callback {
|
||||
|
||||
private static final String TAG = "CameraBridge";
|
||||
private static final int MAX_UNSPECIFIED = -1;
|
||||
private static final int STOPPED = 0;
|
||||
private static final int STARTED = 1;
|
||||
|
||||
private int mState = STOPPED;
|
||||
private Bitmap mCacheBitmap;
|
||||
private CvCameraViewListener2 mListener;
|
||||
private boolean mSurfaceExist;
|
||||
private final Object mSyncObject = new Object();
|
||||
|
||||
protected int mFrameWidth;
|
||||
protected int mFrameHeight;
|
||||
protected int mMaxHeight;
|
||||
protected int mMaxWidth;
|
||||
protected float mScale = 0;
|
||||
protected int mPreviewFormat = RGBA;
|
||||
protected int mCameraIndex = CAMERA_ID_ANY;
|
||||
protected boolean mEnabled;
|
||||
protected FpsMeter mFpsMeter = null;
|
||||
|
||||
public static final int CAMERA_ID_ANY = -1;
|
||||
public static final int CAMERA_ID_BACK = 99;
|
||||
public static final int CAMERA_ID_FRONT = 98;
|
||||
public static final int RGBA = 1;
|
||||
public static final int GRAY = 2;
|
||||
|
||||
public CameraBridgeViewBase(Context context, int cameraId) {
|
||||
super(context);
|
||||
mCameraIndex = cameraId;
|
||||
getHolder().addCallback(this);
|
||||
mMaxWidth = MAX_UNSPECIFIED;
|
||||
mMaxHeight = MAX_UNSPECIFIED;
|
||||
}
|
||||
|
||||
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
int count = attrs.getAttributeCount();
|
||||
Log.d(TAG, "Attr count: " + Integer.valueOf(count));
|
||||
|
||||
TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
|
||||
if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
|
||||
enableFpsMeter();
|
||||
|
||||
mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);
|
||||
|
||||
getHolder().addCallback(this);
|
||||
mMaxWidth = MAX_UNSPECIFIED;
|
||||
mMaxHeight = MAX_UNSPECIFIED;
|
||||
styledAttrs.recycle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the camera index
|
||||
* @param cameraIndex new camera index
|
||||
*/
|
||||
public void setCameraIndex(int cameraIndex) {
|
||||
this.mCameraIndex = cameraIndex;
|
||||
}
|
||||
|
||||
public interface CvCameraViewListener {
|
||||
/**
|
||||
* This method is invoked when camera preview has started. After this method is invoked
|
||||
* the frames will start to be delivered to client via the onCameraFrame() callback.
|
||||
* @param width - the width of the frames that will be delivered
|
||||
* @param height - the height of the frames that will be delivered
|
||||
*/
|
||||
public void onCameraViewStarted(int width, int height);
|
||||
|
||||
/**
|
||||
* This method is invoked when camera preview has been stopped for some reason.
|
||||
* No frames will be delivered via onCameraFrame() callback after this method is called.
|
||||
*/
|
||||
public void onCameraViewStopped();
|
||||
|
||||
/**
|
||||
* This method is invoked when delivery of the frame needs to be done.
|
||||
* The returned values - is a modified frame which needs to be displayed on the screen.
|
||||
* TODO: pass the parameters specifying the format of the frame (BPP, YUV or RGB and etc)
|
||||
*/
|
||||
public Mat onCameraFrame(Mat inputFrame);
|
||||
}
|
||||
|
||||
public interface CvCameraViewListener2 {
|
||||
/**
|
||||
* This method is invoked when camera preview has started. After this method is invoked
|
||||
* the frames will start to be delivered to client via the onCameraFrame() callback.
|
||||
* @param width - the width of the frames that will be delivered
|
||||
* @param height - the height of the frames that will be delivered
|
||||
*/
|
||||
public void onCameraViewStarted(int width, int height);
|
||||
|
||||
/**
|
||||
* This method is invoked when camera preview has been stopped for some reason.
|
||||
* No frames will be delivered via onCameraFrame() callback after this method is called.
|
||||
*/
|
||||
public void onCameraViewStopped();
|
||||
|
||||
/**
|
||||
* This method is invoked when delivery of the frame needs to be done.
|
||||
* The returned values - is a modified frame which needs to be displayed on the screen.
|
||||
* TODO: pass the parameters specifying the format of the frame (BPP, YUV or RGB and etc)
|
||||
*/
|
||||
public Mat onCameraFrame(CvCameraViewFrame inputFrame);
|
||||
};
|
||||
|
||||
protected class CvCameraViewListenerAdapter implements CvCameraViewListener2 {
|
||||
public CvCameraViewListenerAdapter(CvCameraViewListener oldStypeListener) {
|
||||
mOldStyleListener = oldStypeListener;
|
||||
}
|
||||
|
||||
public void onCameraViewStarted(int width, int height) {
|
||||
mOldStyleListener.onCameraViewStarted(width, height);
|
||||
}
|
||||
|
||||
public void onCameraViewStopped() {
|
||||
mOldStyleListener.onCameraViewStopped();
|
||||
}
|
||||
|
||||
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
|
||||
Mat result = null;
|
||||
switch (mPreviewFormat) {
|
||||
case RGBA:
|
||||
result = mOldStyleListener.onCameraFrame(inputFrame.rgba());
|
||||
break;
|
||||
case GRAY:
|
||||
result = mOldStyleListener.onCameraFrame(inputFrame.gray());
|
||||
break;
|
||||
default:
|
||||
Log.e(TAG, "Invalid frame format! Only RGBA and Gray Scale are supported!");
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setFrameFormat(int format) {
|
||||
mPreviewFormat = format;
|
||||
}
|
||||
|
||||
private int mPreviewFormat = RGBA;
|
||||
private CvCameraViewListener mOldStyleListener;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class interface is abstract representation of single frame from camera for onCameraFrame callback
|
||||
* Attention: Do not use objects, that represents this interface out of onCameraFrame callback!
|
||||
*/
|
||||
public interface CvCameraViewFrame {
|
||||
|
||||
/**
|
||||
* This method returns RGBA Mat with frame
|
||||
*/
|
||||
public Mat rgba();
|
||||
|
||||
/**
|
||||
* This method returns single channel gray scale Mat with frame
|
||||
*/
|
||||
public Mat gray();
|
||||
};
|
||||
|
||||
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
|
||||
Log.d(TAG, "call surfaceChanged event");
|
||||
synchronized(mSyncObject) {
|
||||
if (!mSurfaceExist) {
|
||||
mSurfaceExist = true;
|
||||
checkCurrentState();
|
||||
} else {
|
||||
/** Surface changed. We need to stop camera and restart with new parameters */
|
||||
/* Pretend that old surface has been destroyed */
|
||||
mSurfaceExist = false;
|
||||
checkCurrentState();
|
||||
/* Now use new surface. Say we have it now */
|
||||
mSurfaceExist = true;
|
||||
checkCurrentState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
/* Do nothing. Wait until surfaceChanged delivered */
|
||||
}
|
||||
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
synchronized(mSyncObject) {
|
||||
mSurfaceExist = false;
|
||||
checkCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is provided for clients, so they can enable the camera connection.
|
||||
* The actual onCameraViewStarted callback will be delivered only after both this method is called and surface is available
|
||||
*/
|
||||
public void enableView() {
|
||||
synchronized(mSyncObject) {
|
||||
mEnabled = true;
|
||||
checkCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is provided for clients, so they can disable camera connection and stop
|
||||
* the delivery of frames even though the surface view itself is not destroyed and still stays on the scren
|
||||
*/
|
||||
public void disableView() {
|
||||
synchronized(mSyncObject) {
|
||||
mEnabled = false;
|
||||
checkCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method enables label with fps value on the screen
|
||||
*/
|
||||
public void enableFpsMeter() {
|
||||
if (mFpsMeter == null) {
|
||||
mFpsMeter = new FpsMeter();
|
||||
mFpsMeter.setResolution(mFrameWidth, mFrameHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public void disableFpsMeter() {
|
||||
mFpsMeter = null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
|
||||
public void setCvCameraViewListener(CvCameraViewListener2 listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public void setCvCameraViewListener(CvCameraViewListener listener) {
|
||||
CvCameraViewListenerAdapter adapter = new CvCameraViewListenerAdapter(listener);
|
||||
adapter.setFrameFormat(mPreviewFormat);
|
||||
mListener = adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the maximum size that camera frame is allowed to be. When selecting
|
||||
* size - the biggest size which less or equal the size set will be selected.
|
||||
* As an example - we set setMaxFrameSize(200,200) and we have 176x152 and 320x240 sizes. The
|
||||
* preview frame will be selected with 176x152 size.
|
||||
* This method is useful when need to restrict the size of preview frame for some reason (for example for video recording)
|
||||
* @param maxWidth - the maximum width allowed for camera frame.
|
||||
* @param maxHeight - the maximum height allowed for camera frame
|
||||
*/
|
||||
public void setMaxFrameSize(int maxWidth, int maxHeight) {
|
||||
mMaxWidth = maxWidth;
|
||||
mMaxHeight = maxHeight;
|
||||
}
|
||||
|
||||
public void SetCaptureFormat(int format)
|
||||
{
|
||||
mPreviewFormat = format;
|
||||
if (mListener instanceof CvCameraViewListenerAdapter) {
|
||||
CvCameraViewListenerAdapter adapter = (CvCameraViewListenerAdapter) mListener;
|
||||
adapter.setFrameFormat(mPreviewFormat);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when mSyncObject lock is held
|
||||
*/
|
||||
private void checkCurrentState() {
|
||||
Log.d(TAG, "call checkCurrentState");
|
||||
int targetState;
|
||||
|
||||
if (mEnabled && mSurfaceExist && getVisibility() == VISIBLE) {
|
||||
targetState = STARTED;
|
||||
} else {
|
||||
targetState = STOPPED;
|
||||
}
|
||||
|
||||
if (targetState != mState) {
|
||||
/* The state change detected. Need to exit the current state and enter target state */
|
||||
processExitState(mState);
|
||||
mState = targetState;
|
||||
processEnterState(mState);
|
||||
}
|
||||
}
|
||||
|
||||
private void processEnterState(int state) {
|
||||
Log.d(TAG, "call processEnterState: " + state);
|
||||
switch(state) {
|
||||
case STARTED:
|
||||
onEnterStartedState();
|
||||
if (mListener != null) {
|
||||
mListener.onCameraViewStarted(mFrameWidth, mFrameHeight);
|
||||
}
|
||||
break;
|
||||
case STOPPED:
|
||||
onEnterStoppedState();
|
||||
if (mListener != null) {
|
||||
mListener.onCameraViewStopped();
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
private void processExitState(int state) {
|
||||
Log.d(TAG, "call processExitState: " + state);
|
||||
switch(state) {
|
||||
case STARTED:
|
||||
onExitStartedState();
|
||||
break;
|
||||
case STOPPED:
|
||||
onExitStoppedState();
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
private void onEnterStoppedState() {
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
private void onExitStoppedState() {
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
// NOTE: The order of bitmap constructor and camera connection is important for android 4.1.x
|
||||
// Bitmap must be constructed before surface
|
||||
private void onEnterStartedState() {
|
||||
Log.d(TAG, "call onEnterStartedState");
|
||||
/* Connect camera */
|
||||
if (!connectCamera(getWidth(), getHeight())) {
|
||||
AlertDialog ad = new AlertDialog.Builder(getContext()).create();
|
||||
ad.setCancelable(false); // This blocks the 'BACK' button
|
||||
ad.setMessage("It seems that you device does not support camera (or it is locked). Application will be closed.");
|
||||
ad.setButton(DialogInterface.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
((Activity) getContext()).finish();
|
||||
}
|
||||
});
|
||||
ad.show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void onExitStartedState() {
|
||||
disconnectCamera();
|
||||
if (mCacheBitmap != null) {
|
||||
mCacheBitmap.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method shall be called by the subclasses when they have valid
|
||||
* object and want it to be delivered to external client (via callback) and
|
||||
* then displayed on the screen.
|
||||
* @param frame - the current frame to be delivered
|
||||
*/
|
||||
protected void deliverAndDrawFrame(CvCameraViewFrame frame) {
|
||||
Mat modified;
|
||||
|
||||
if (mListener != null) {
|
||||
modified = mListener.onCameraFrame(frame);
|
||||
} else {
|
||||
modified = frame.rgba();
|
||||
}
|
||||
|
||||
boolean bmpValid = true;
|
||||
if (modified != null) {
|
||||
try {
|
||||
Utils.matToBitmap(modified, mCacheBitmap);
|
||||
} catch(Exception e) {
|
||||
Log.e(TAG, "Mat type: " + modified);
|
||||
Log.e(TAG, "Bitmap type: " + mCacheBitmap.getWidth() + "*" + mCacheBitmap.getHeight());
|
||||
Log.e(TAG, "Utils.matToBitmap() throws an exception: " + e.getMessage());
|
||||
bmpValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (bmpValid && mCacheBitmap != null) {
|
||||
Canvas canvas = getHolder().lockCanvas();
|
||||
if (canvas != null) {
|
||||
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "mStretch value: " + mScale);
|
||||
|
||||
if (mScale != 0) {
|
||||
canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
|
||||
new Rect((int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2),
|
||||
(int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2),
|
||||
(int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2 + mScale*mCacheBitmap.getWidth()),
|
||||
(int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2 + mScale*mCacheBitmap.getHeight())), null);
|
||||
} else {
|
||||
canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
|
||||
new Rect((canvas.getWidth() - mCacheBitmap.getWidth()) / 2,
|
||||
(canvas.getHeight() - mCacheBitmap.getHeight()) / 2,
|
||||
(canvas.getWidth() - mCacheBitmap.getWidth()) / 2 + mCacheBitmap.getWidth(),
|
||||
(canvas.getHeight() - mCacheBitmap.getHeight()) / 2 + mCacheBitmap.getHeight()), null);
|
||||
}
|
||||
|
||||
if (mFpsMeter != null) {
|
||||
mFpsMeter.measure();
|
||||
mFpsMeter.draw(canvas, 20, 30);
|
||||
}
|
||||
getHolder().unlockCanvasAndPost(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is invoked shall perform concrete operation to initialize the camera.
|
||||
* CONTRACT: as a result of this method variables mFrameWidth and mFrameHeight MUST be
|
||||
* initialized with the size of the Camera frames that will be delivered to external processor.
|
||||
* @param width - the width of this SurfaceView
|
||||
* @param height - the height of this SurfaceView
|
||||
*/
|
||||
protected abstract boolean connectCamera(int width, int height);
|
||||
|
||||
/**
|
||||
* Disconnects and release the particular camera object being connected to this surface view.
|
||||
* Called when syncObject lock is held
|
||||
*/
|
||||
protected abstract void disconnectCamera();
|
||||
|
||||
// NOTE: On Android 4.1.x the function must be called before SurfaceTexture constructor!
|
||||
protected void AllocateCache()
|
||||
{
|
||||
mCacheBitmap = Bitmap.createBitmap(mFrameWidth, mFrameHeight, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
public interface ListItemAccessor {
|
||||
public int getWidth(Object obj);
|
||||
public int getHeight(Object obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* This helper method can be called by subclasses to select camera preview size.
|
||||
* It goes over the list of the supported preview sizes and selects the maximum one which
|
||||
* fits both values set via setMaxFrameSize() and surface frame allocated for this view
|
||||
* @param supportedSizes
|
||||
* @param surfaceWidth
|
||||
* @param surfaceHeight
|
||||
* @return optimal frame size
|
||||
*/
|
||||
protected Size calculateCameraFrameSize(List<?> supportedSizes, ListItemAccessor accessor, int surfaceWidth, int surfaceHeight) {
|
||||
int calcWidth = 0;
|
||||
int calcHeight = 0;
|
||||
|
||||
int maxAllowedWidth = (mMaxWidth != MAX_UNSPECIFIED && mMaxWidth < surfaceWidth)? mMaxWidth : surfaceWidth;
|
||||
int maxAllowedHeight = (mMaxHeight != MAX_UNSPECIFIED && mMaxHeight < surfaceHeight)? mMaxHeight : surfaceHeight;
|
||||
|
||||
for (Object size : supportedSizes) {
|
||||
int width = accessor.getWidth(size);
|
||||
int height = accessor.getHeight(size);
|
||||
|
||||
if (width <= maxAllowedWidth && height <= maxAllowedHeight) {
|
||||
if (width >= calcWidth && height >= calcHeight) {
|
||||
calcWidth = (int) width;
|
||||
calcHeight = (int) height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Size(calcWidth, calcHeight);
|
||||
}
|
||||
}
|
||||
+440
@@ -0,0 +1,440 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import org.opencv.android.CameraGLSurfaceView.CameraTextureListener;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.SurfaceTexture;
|
||||
import android.opengl.GLES11Ext;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
@TargetApi(15)
|
||||
public abstract class CameraGLRendererBase implements GLSurfaceView.Renderer, SurfaceTexture.OnFrameAvailableListener {
|
||||
|
||||
protected final String LOGTAG = "CameraGLRendererBase";
|
||||
|
||||
// shaders
|
||||
private final String vss = ""
|
||||
+ "attribute vec2 vPosition;\n"
|
||||
+ "attribute vec2 vTexCoord;\n" + "varying vec2 texCoord;\n"
|
||||
+ "void main() {\n" + " texCoord = vTexCoord;\n"
|
||||
+ " gl_Position = vec4 ( vPosition.x, vPosition.y, 0.0, 1.0 );\n"
|
||||
+ "}";
|
||||
|
||||
private final String fssOES = ""
|
||||
+ "#extension GL_OES_EGL_image_external : require\n"
|
||||
+ "precision mediump float;\n"
|
||||
+ "uniform samplerExternalOES sTexture;\n"
|
||||
+ "varying vec2 texCoord;\n"
|
||||
+ "void main() {\n"
|
||||
+ " gl_FragColor = texture2D(sTexture,texCoord);\n" + "}";
|
||||
|
||||
private final String fss2D = ""
|
||||
+ "precision mediump float;\n"
|
||||
+ "uniform sampler2D sTexture;\n"
|
||||
+ "varying vec2 texCoord;\n"
|
||||
+ "void main() {\n"
|
||||
+ " gl_FragColor = texture2D(sTexture,texCoord);\n" + "}";
|
||||
|
||||
// coord-s
|
||||
private final float vertices[] = {
|
||||
-1, -1,
|
||||
-1, 1,
|
||||
1, -1,
|
||||
1, 1 };
|
||||
private final float texCoordOES[] = {
|
||||
0, 1,
|
||||
0, 0,
|
||||
1, 1,
|
||||
1, 0 };
|
||||
private final float texCoord2D[] = {
|
||||
0, 0,
|
||||
0, 1,
|
||||
1, 0,
|
||||
1, 1 };
|
||||
|
||||
private int[] texCamera = {0}, texFBO = {0}, texDraw = {0};
|
||||
private int[] FBO = {0};
|
||||
private int progOES = -1, prog2D = -1;
|
||||
private int vPosOES, vTCOES, vPos2D, vTC2D;
|
||||
|
||||
private FloatBuffer vert, texOES, tex2D;
|
||||
|
||||
protected int mCameraWidth = -1, mCameraHeight = -1;
|
||||
protected int mFBOWidth = -1, mFBOHeight = -1;
|
||||
protected int mMaxCameraWidth = -1, mMaxCameraHeight = -1;
|
||||
protected int mCameraIndex = CameraBridgeViewBase.CAMERA_ID_ANY;
|
||||
|
||||
protected SurfaceTexture mSTexture;
|
||||
|
||||
protected boolean mHaveSurface = false;
|
||||
protected boolean mHaveFBO = false;
|
||||
protected boolean mUpdateST = false;
|
||||
protected boolean mEnabled = true;
|
||||
protected boolean mIsStarted = false;
|
||||
|
||||
protected CameraGLSurfaceView mView;
|
||||
|
||||
protected abstract void openCamera(int id);
|
||||
protected abstract void closeCamera();
|
||||
protected abstract void setCameraPreviewSize(int width, int height); // updates mCameraWidth & mCameraHeight
|
||||
|
||||
public CameraGLRendererBase(CameraGLSurfaceView view) {
|
||||
mView = view;
|
||||
int bytes = vertices.length * Float.SIZE / Byte.SIZE;
|
||||
vert = ByteBuffer.allocateDirect(bytes).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
||||
texOES = ByteBuffer.allocateDirect(bytes).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
||||
tex2D = ByteBuffer.allocateDirect(bytes).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
||||
vert.put(vertices).position(0);
|
||||
texOES.put(texCoordOES).position(0);
|
||||
tex2D.put(texCoord2D).position(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onFrameAvailable(SurfaceTexture surfaceTexture) {
|
||||
//Log.i(LOGTAG, "onFrameAvailable");
|
||||
mUpdateST = true;
|
||||
mView.requestRender();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
//Log.i(LOGTAG, "onDrawFrame start");
|
||||
|
||||
if (!mHaveFBO)
|
||||
return;
|
||||
|
||||
synchronized(this) {
|
||||
if (mUpdateST) {
|
||||
mSTexture.updateTexImage();
|
||||
mUpdateST = false;
|
||||
}
|
||||
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
CameraTextureListener texListener = mView.getCameraTextureListener();
|
||||
if(texListener != null) {
|
||||
//Log.d(LOGTAG, "haveUserCallback");
|
||||
// texCamera(OES) -> texFBO
|
||||
drawTex(texCamera[0], true, FBO[0]);
|
||||
|
||||
// call user code (texFBO -> texDraw)
|
||||
boolean modified = texListener.onCameraTexture(texFBO[0], texDraw[0], mCameraWidth, mCameraHeight);
|
||||
|
||||
if(modified) {
|
||||
// texDraw -> screen
|
||||
drawTex(texDraw[0], false, 0);
|
||||
} else {
|
||||
// texFBO -> screen
|
||||
drawTex(texFBO[0], false, 0);
|
||||
}
|
||||
} else {
|
||||
Log.d(LOGTAG, "texCamera(OES) -> screen");
|
||||
// texCamera(OES) -> screen
|
||||
drawTex(texCamera[0], true, 0);
|
||||
}
|
||||
//Log.i(LOGTAG, "onDrawFrame end");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceChanged(GL10 gl, int surfaceWidth, int surfaceHeight) {
|
||||
Log.i(LOGTAG, "onSurfaceChanged("+surfaceWidth+"x"+surfaceHeight+")");
|
||||
mHaveSurface = true;
|
||||
updateState();
|
||||
setPreviewSize(surfaceWidth, surfaceHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
Log.i(LOGTAG, "onSurfaceCreated");
|
||||
initShaders();
|
||||
}
|
||||
|
||||
private void initShaders() {
|
||||
String strGLVersion = GLES20.glGetString(GLES20.GL_VERSION);
|
||||
if (strGLVersion != null)
|
||||
Log.i(LOGTAG, "OpenGL ES version: " + strGLVersion);
|
||||
|
||||
GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
progOES = loadShader(vss, fssOES);
|
||||
vPosOES = GLES20.glGetAttribLocation(progOES, "vPosition");
|
||||
vTCOES = GLES20.glGetAttribLocation(progOES, "vTexCoord");
|
||||
GLES20.glEnableVertexAttribArray(vPosOES);
|
||||
GLES20.glEnableVertexAttribArray(vTCOES);
|
||||
|
||||
prog2D = loadShader(vss, fss2D);
|
||||
vPos2D = GLES20.glGetAttribLocation(prog2D, "vPosition");
|
||||
vTC2D = GLES20.glGetAttribLocation(prog2D, "vTexCoord");
|
||||
GLES20.glEnableVertexAttribArray(vPos2D);
|
||||
GLES20.glEnableVertexAttribArray(vTC2D);
|
||||
}
|
||||
|
||||
private void initSurfaceTexture() {
|
||||
Log.d(LOGTAG, "initSurfaceTexture");
|
||||
deleteSurfaceTexture();
|
||||
initTexOES(texCamera);
|
||||
mSTexture = new SurfaceTexture(texCamera[0]);
|
||||
mSTexture.setOnFrameAvailableListener(this);
|
||||
}
|
||||
|
||||
private void deleteSurfaceTexture() {
|
||||
Log.d(LOGTAG, "deleteSurfaceTexture");
|
||||
if(mSTexture != null) {
|
||||
mSTexture.release();
|
||||
mSTexture = null;
|
||||
deleteTex(texCamera);
|
||||
}
|
||||
}
|
||||
|
||||
private void initTexOES(int[] tex) {
|
||||
if(tex.length == 1) {
|
||||
GLES20.glGenTextures(1, tex, 0);
|
||||
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex[0]);
|
||||
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
||||
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
||||
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
|
||||
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteTex(int[] tex) {
|
||||
if(tex.length == 1) {
|
||||
GLES20.glDeleteTextures(1, tex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static int loadShader(String vss, String fss) {
|
||||
Log.d("CameraGLRendererBase", "loadShader");
|
||||
int vshader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
|
||||
GLES20.glShaderSource(vshader, vss);
|
||||
GLES20.glCompileShader(vshader);
|
||||
int[] status = new int[1];
|
||||
GLES20.glGetShaderiv(vshader, GLES20.GL_COMPILE_STATUS, status, 0);
|
||||
if (status[0] == 0) {
|
||||
Log.e("CameraGLRendererBase", "Could not compile vertex shader: "+GLES20.glGetShaderInfoLog(vshader));
|
||||
GLES20.glDeleteShader(vshader);
|
||||
vshader = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fshader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
|
||||
GLES20.glShaderSource(fshader, fss);
|
||||
GLES20.glCompileShader(fshader);
|
||||
GLES20.glGetShaderiv(fshader, GLES20.GL_COMPILE_STATUS, status, 0);
|
||||
if (status[0] == 0) {
|
||||
Log.e("CameraGLRendererBase", "Could not compile fragment shader:"+GLES20.glGetShaderInfoLog(fshader));
|
||||
GLES20.glDeleteShader(vshader);
|
||||
GLES20.glDeleteShader(fshader);
|
||||
fshader = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int program = GLES20.glCreateProgram();
|
||||
GLES20.glAttachShader(program, vshader);
|
||||
GLES20.glAttachShader(program, fshader);
|
||||
GLES20.glLinkProgram(program);
|
||||
GLES20.glDeleteShader(vshader);
|
||||
GLES20.glDeleteShader(fshader);
|
||||
GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, status, 0);
|
||||
if (status[0] == 0) {
|
||||
Log.e("CameraGLRendererBase", "Could not link shader program: "+GLES20.glGetProgramInfoLog(program));
|
||||
program = 0;
|
||||
return 0;
|
||||
}
|
||||
GLES20.glValidateProgram(program);
|
||||
GLES20.glGetProgramiv(program, GLES20.GL_VALIDATE_STATUS, status, 0);
|
||||
if (status[0] == 0)
|
||||
{
|
||||
Log.e("CameraGLRendererBase", "Shader program validation error: "+GLES20.glGetProgramInfoLog(program));
|
||||
GLES20.glDeleteProgram(program);
|
||||
program = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Log.d("CameraGLRendererBase", "Shader program is built OK");
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
private void deleteFBO()
|
||||
{
|
||||
Log.d(LOGTAG, "deleteFBO("+mFBOWidth+"x"+mFBOHeight+")");
|
||||
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
|
||||
GLES20.glDeleteFramebuffers(1, FBO, 0);
|
||||
|
||||
deleteTex(texFBO);
|
||||
deleteTex(texDraw);
|
||||
mFBOWidth = mFBOHeight = 0;
|
||||
}
|
||||
|
||||
private void initFBO(int width, int height)
|
||||
{
|
||||
Log.d(LOGTAG, "initFBO("+width+"x"+height+")");
|
||||
|
||||
deleteFBO();
|
||||
|
||||
GLES20.glGenTextures(1, texDraw, 0);
|
||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texDraw[0]);
|
||||
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
|
||||
|
||||
GLES20.glGenTextures(1, texFBO, 0);
|
||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texFBO[0]);
|
||||
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
|
||||
|
||||
//int hFBO;
|
||||
GLES20.glGenFramebuffers(1, FBO, 0);
|
||||
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, FBO[0]);
|
||||
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texFBO[0], 0);
|
||||
Log.d(LOGTAG, "initFBO error status: " + GLES20.glGetError());
|
||||
|
||||
int FBOstatus = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
|
||||
if (FBOstatus != GLES20.GL_FRAMEBUFFER_COMPLETE)
|
||||
Log.e(LOGTAG, "initFBO failed, status: " + FBOstatus);
|
||||
|
||||
mFBOWidth = width;
|
||||
mFBOHeight = height;
|
||||
}
|
||||
|
||||
// draw texture to FBO or to screen if fbo == 0
|
||||
private void drawTex(int tex, boolean isOES, int fbo)
|
||||
{
|
||||
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo);
|
||||
|
||||
if(fbo == 0)
|
||||
GLES20.glViewport(0, 0, mView.getWidth(), mView.getHeight());
|
||||
else
|
||||
GLES20.glViewport(0, 0, mFBOWidth, mFBOHeight);
|
||||
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if(isOES) {
|
||||
GLES20.glUseProgram(progOES);
|
||||
GLES20.glVertexAttribPointer(vPosOES, 2, GLES20.GL_FLOAT, false, 4*2, vert);
|
||||
GLES20.glVertexAttribPointer(vTCOES, 2, GLES20.GL_FLOAT, false, 4*2, texOES);
|
||||
} else {
|
||||
GLES20.glUseProgram(prog2D);
|
||||
GLES20.glVertexAttribPointer(vPos2D, 2, GLES20.GL_FLOAT, false, 4*2, vert);
|
||||
GLES20.glVertexAttribPointer(vTC2D, 2, GLES20.GL_FLOAT, false, 4*2, tex2D);
|
||||
}
|
||||
|
||||
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
||||
|
||||
if(isOES) {
|
||||
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex);
|
||||
GLES20.glUniform1i(GLES20.glGetUniformLocation(progOES, "sTexture"), 0);
|
||||
} else {
|
||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex);
|
||||
GLES20.glUniform1i(GLES20.glGetUniformLocation(prog2D, "sTexture"), 0);
|
||||
}
|
||||
|
||||
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
|
||||
GLES20.glFlush();
|
||||
}
|
||||
|
||||
public synchronized void enableView() {
|
||||
Log.d(LOGTAG, "enableView");
|
||||
mEnabled = true;
|
||||
updateState();
|
||||
}
|
||||
|
||||
public synchronized void disableView() {
|
||||
Log.d(LOGTAG, "disableView");
|
||||
mEnabled = false;
|
||||
updateState();
|
||||
}
|
||||
|
||||
protected void updateState() {
|
||||
Log.d(LOGTAG, "updateState");
|
||||
Log.d(LOGTAG, "mEnabled="+mEnabled+", mHaveSurface="+mHaveSurface);
|
||||
boolean willStart = mEnabled && mHaveSurface && mView.getVisibility() == View.VISIBLE;
|
||||
if (willStart != mIsStarted) {
|
||||
if(willStart) doStart();
|
||||
else doStop();
|
||||
} else {
|
||||
Log.d(LOGTAG, "keeping State unchanged");
|
||||
}
|
||||
Log.d(LOGTAG, "updateState end");
|
||||
}
|
||||
|
||||
protected synchronized void doStart() {
|
||||
Log.d(LOGTAG, "doStart");
|
||||
initSurfaceTexture();
|
||||
openCamera(mCameraIndex);
|
||||
mIsStarted = true;
|
||||
if(mCameraWidth>0 && mCameraHeight>0)
|
||||
setPreviewSize(mCameraWidth, mCameraHeight); // start preview and call listener.onCameraViewStarted()
|
||||
}
|
||||
|
||||
|
||||
protected void doStop() {
|
||||
Log.d(LOGTAG, "doStop");
|
||||
synchronized(this) {
|
||||
mUpdateST = false;
|
||||
mIsStarted = false;
|
||||
mHaveFBO = false;
|
||||
closeCamera();
|
||||
deleteSurfaceTexture();
|
||||
}
|
||||
CameraTextureListener listener = mView.getCameraTextureListener();
|
||||
if(listener != null) listener.onCameraViewStopped();
|
||||
|
||||
}
|
||||
|
||||
protected void setPreviewSize(int width, int height) {
|
||||
synchronized(this) {
|
||||
mHaveFBO = false;
|
||||
mCameraWidth = width;
|
||||
mCameraHeight = height;
|
||||
setCameraPreviewSize(width, height); // can change mCameraWidth & mCameraHeight
|
||||
initFBO(mCameraWidth, mCameraHeight);
|
||||
mHaveFBO = true;
|
||||
}
|
||||
|
||||
CameraTextureListener listener = mView.getCameraTextureListener();
|
||||
if(listener != null) listener.onCameraViewStarted(mCameraWidth, mCameraHeight);
|
||||
}
|
||||
|
||||
public void setCameraIndex(int cameraIndex) {
|
||||
disableView();
|
||||
mCameraIndex = cameraIndex;
|
||||
enableView();
|
||||
}
|
||||
|
||||
public void setMaxCameraPreviewSize(int maxWidth, int maxHeight) {
|
||||
disableView();
|
||||
mMaxCameraWidth = maxWidth;
|
||||
mMaxCameraHeight = maxHeight;
|
||||
enableView();
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
Log.i(LOGTAG, "onResume");
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
Log.i(LOGTAG, "onPause");
|
||||
mHaveSurface = false;
|
||||
updateState();
|
||||
mCameraWidth = mCameraHeight = -1;
|
||||
}
|
||||
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import org.opencv.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
public class CameraGLSurfaceView extends GLSurfaceView {
|
||||
|
||||
private static final String LOGTAG = "CameraGLSurfaceView";
|
||||
|
||||
public interface CameraTextureListener {
|
||||
/**
|
||||
* This method is invoked when camera preview has started. After this method is invoked
|
||||
* the frames will start to be delivered to client via the onCameraFrame() callback.
|
||||
* @param width - the width of the frames that will be delivered
|
||||
* @param height - the height of the frames that will be delivered
|
||||
*/
|
||||
public void onCameraViewStarted(int width, int height);
|
||||
|
||||
/**
|
||||
* This method is invoked when camera preview has been stopped for some reason.
|
||||
* No frames will be delivered via onCameraFrame() callback after this method is called.
|
||||
*/
|
||||
public void onCameraViewStopped();
|
||||
|
||||
/**
|
||||
* This method is invoked when a new preview frame from Camera is ready.
|
||||
* @param texIn - the OpenGL texture ID that contains frame in RGBA format
|
||||
* @param texOut - the OpenGL texture ID that can be used to store modified frame image t display
|
||||
* @param width - the width of the frame
|
||||
* @param height - the height of the frame
|
||||
* @return `true` if `texOut` should be displayed, `false` - to show `texIn`
|
||||
*/
|
||||
public boolean onCameraTexture(int texIn, int texOut, int width, int height);
|
||||
};
|
||||
|
||||
private CameraTextureListener mTexListener;
|
||||
private CameraGLRendererBase mRenderer;
|
||||
|
||||
public CameraGLSurfaceView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
|
||||
int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);
|
||||
styledAttrs.recycle();
|
||||
|
||||
if(android.os.Build.VERSION.SDK_INT >= 21)
|
||||
mRenderer = new Camera2Renderer(this);
|
||||
else
|
||||
mRenderer = new CameraRenderer(this);
|
||||
|
||||
setCameraIndex(cameraIndex);
|
||||
|
||||
setEGLContextClientVersion(2);
|
||||
setRenderer(mRenderer);
|
||||
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
|
||||
}
|
||||
|
||||
public void setCameraTextureListener(CameraTextureListener texListener)
|
||||
{
|
||||
mTexListener = texListener;
|
||||
}
|
||||
|
||||
public CameraTextureListener getCameraTextureListener()
|
||||
{
|
||||
return mTexListener;
|
||||
}
|
||||
|
||||
public void setCameraIndex(int cameraIndex) {
|
||||
mRenderer.setCameraIndex(cameraIndex);
|
||||
}
|
||||
|
||||
public void setMaxCameraPreviewSize(int maxWidth, int maxHeight) {
|
||||
mRenderer.setMaxCameraPreviewSize(maxWidth, maxHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
super.surfaceCreated(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
mRenderer.mHaveSurface = false;
|
||||
super.surfaceDestroyed(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
|
||||
super.surfaceChanged(holder, format, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
Log.i(LOGTAG, "onResume");
|
||||
super.onResume();
|
||||
mRenderer.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Log.i(LOGTAG, "onPause");
|
||||
mRenderer.onPause();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
public void enableView() {
|
||||
mRenderer.enableView();
|
||||
}
|
||||
|
||||
public void disableView() {
|
||||
mRenderer.disableView();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.Size;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
@TargetApi(15)
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CameraRenderer extends CameraGLRendererBase {
|
||||
|
||||
public static final String LOGTAG = "CameraRenderer";
|
||||
|
||||
private Camera mCamera;
|
||||
private boolean mPreviewStarted = false;
|
||||
|
||||
CameraRenderer(CameraGLSurfaceView view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void closeCamera() {
|
||||
Log.i(LOGTAG, "closeCamera");
|
||||
if(mCamera != null) {
|
||||
mCamera.stopPreview();
|
||||
mPreviewStarted = false;
|
||||
mCamera.release();
|
||||
mCamera = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void openCamera(int id) {
|
||||
Log.i(LOGTAG, "openCamera");
|
||||
closeCamera();
|
||||
if (id == CameraBridgeViewBase.CAMERA_ID_ANY) {
|
||||
Log.d(LOGTAG, "Trying to open camera with old open()");
|
||||
try {
|
||||
mCamera = Camera.open();
|
||||
}
|
||||
catch (Exception e){
|
||||
Log.e(LOGTAG, "Camera is not available (in use or does not exist): " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
if(mCamera == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||
boolean connected = false;
|
||||
for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
|
||||
Log.d(LOGTAG, "Trying to open camera with new open(" + camIdx + ")");
|
||||
try {
|
||||
mCamera = Camera.open(camIdx);
|
||||
connected = true;
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(LOGTAG, "Camera #" + camIdx + "failed to open: " + e.getLocalizedMessage());
|
||||
}
|
||||
if (connected) break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||
int localCameraIndex = mCameraIndex;
|
||||
if (mCameraIndex == CameraBridgeViewBase.CAMERA_ID_BACK) {
|
||||
Log.i(LOGTAG, "Trying to open BACK camera");
|
||||
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
|
||||
for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
|
||||
Camera.getCameraInfo( camIdx, cameraInfo );
|
||||
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
|
||||
localCameraIndex = camIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mCameraIndex == CameraBridgeViewBase.CAMERA_ID_FRONT) {
|
||||
Log.i(LOGTAG, "Trying to open FRONT camera");
|
||||
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
|
||||
for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
|
||||
Camera.getCameraInfo( camIdx, cameraInfo );
|
||||
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
|
||||
localCameraIndex = camIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (localCameraIndex == CameraBridgeViewBase.CAMERA_ID_BACK) {
|
||||
Log.e(LOGTAG, "Back camera not found!");
|
||||
} else if (localCameraIndex == CameraBridgeViewBase.CAMERA_ID_FRONT) {
|
||||
Log.e(LOGTAG, "Front camera not found!");
|
||||
} else {
|
||||
Log.d(LOGTAG, "Trying to open camera with new open(" + localCameraIndex + ")");
|
||||
try {
|
||||
mCamera = Camera.open(localCameraIndex);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(LOGTAG, "Camera #" + localCameraIndex + "failed to open: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mCamera == null) {
|
||||
Log.e(LOGTAG, "Error: can't open camera");
|
||||
return;
|
||||
}
|
||||
Camera.Parameters params = mCamera.getParameters();
|
||||
List<String> 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);
|
||||
|
||||
try {
|
||||
mCamera.setPreviewTexture(mSTexture);
|
||||
} catch (IOException ioe) {
|
||||
Log.e(LOGTAG, "setPreviewTexture() failed: " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setCameraPreviewSize(int width, int height) {
|
||||
Log.i(LOGTAG, "setCameraPreviewSize: "+width+"x"+height);
|
||||
if(mCamera == null) {
|
||||
Log.e(LOGTAG, "Camera isn't initialized!");
|
||||
return;
|
||||
}
|
||||
|
||||
if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth;
|
||||
if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight;
|
||||
|
||||
Camera.Parameters param = mCamera.getParameters();
|
||||
List<Size> psize = param.getSupportedPreviewSizes();
|
||||
int bestWidth = 0, bestHeight = 0;
|
||||
if (psize.size() > 0) {
|
||||
float aspect = (float)width / height;
|
||||
for (Size size : psize) {
|
||||
int w = size.width, h = size.height;
|
||||
Log.d(LOGTAG, "checking camera preview size: "+w+"x"+h);
|
||||
if ( w <= width && h <= height &&
|
||||
w >= bestWidth && h >= bestHeight &&
|
||||
Math.abs(aspect - (float)w/h) < 0.2 ) {
|
||||
bestWidth = w;
|
||||
bestHeight = h;
|
||||
}
|
||||
}
|
||||
if(bestWidth <= 0 || bestHeight <= 0) {
|
||||
bestWidth = psize.get(0).width;
|
||||
bestHeight = psize.get(0).height;
|
||||
Log.e(LOGTAG, "Error: best size was not selected, using "+bestWidth+" x "+bestHeight);
|
||||
} else {
|
||||
Log.i(LOGTAG, "Selected best size: "+bestWidth+" x "+bestHeight);
|
||||
}
|
||||
|
||||
if(mPreviewStarted) {
|
||||
mCamera.stopPreview();
|
||||
mPreviewStarted = false;
|
||||
}
|
||||
mCameraWidth = bestWidth;
|
||||
mCameraHeight = bestHeight;
|
||||
param.setPreviewSize(bestWidth, bestHeight);
|
||||
}
|
||||
param.set("orientation", "landscape");
|
||||
mCamera.setParameters(param);
|
||||
mCamera.startPreview();
|
||||
mPreviewStarted = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.opencv.core.Core;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.util.Log;
|
||||
|
||||
public class FpsMeter {
|
||||
private static final String TAG = "FpsMeter";
|
||||
private static final int STEP = 20;
|
||||
private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00");
|
||||
|
||||
private int mFramesCouner;
|
||||
private double mFrequency;
|
||||
private long mprevFrameTime;
|
||||
private String mStrfps;
|
||||
Paint mPaint;
|
||||
boolean mIsInitialized = false;
|
||||
int mWidth = 0;
|
||||
int mHeight = 0;
|
||||
|
||||
public void init() {
|
||||
mFramesCouner = 0;
|
||||
mFrequency = Core.getTickFrequency();
|
||||
mprevFrameTime = Core.getTickCount();
|
||||
mStrfps = "";
|
||||
|
||||
mPaint = new Paint();
|
||||
mPaint.setColor(Color.BLUE);
|
||||
mPaint.setTextSize(20);
|
||||
}
|
||||
|
||||
public void measure() {
|
||||
if (!mIsInitialized) {
|
||||
init();
|
||||
mIsInitialized = true;
|
||||
} else {
|
||||
mFramesCouner++;
|
||||
if (mFramesCouner % STEP == 0) {
|
||||
long time = Core.getTickCount();
|
||||
double fps = STEP * mFrequency / (time - mprevFrameTime);
|
||||
mprevFrameTime = time;
|
||||
if (mWidth != 0 && mHeight != 0)
|
||||
mStrfps = FPS_FORMAT.format(fps) + " FPS@" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight);
|
||||
else
|
||||
mStrfps = FPS_FORMAT.format(fps) + " FPS";
|
||||
Log.i(TAG, mStrfps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setResolution(int width, int height) {
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas, float offsetx, float offsety) {
|
||||
Log.d(TAG, mStrfps);
|
||||
canvas.drawText(mStrfps, offsetx, offsety, mPaint);
|
||||
}
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package org.opencv.android;
|
||||
|
||||
/**
|
||||
* Installation callback interface.
|
||||
*/
|
||||
public interface InstallCallbackInterface
|
||||
{
|
||||
/**
|
||||
* New package installation is required.
|
||||
*/
|
||||
static final int NEW_INSTALLATION = 0;
|
||||
/**
|
||||
* Current package installation is in progress.
|
||||
*/
|
||||
static final int INSTALLATION_PROGRESS = 1;
|
||||
|
||||
/**
|
||||
* Target package name.
|
||||
* @return Return target package name.
|
||||
*/
|
||||
public String getPackageName();
|
||||
/**
|
||||
* Installation is approved.
|
||||
*/
|
||||
public void install();
|
||||
/**
|
||||
* Installation is canceled.
|
||||
*/
|
||||
public void cancel();
|
||||
/**
|
||||
* Wait for package installation.
|
||||
*/
|
||||
public void wait_install();
|
||||
};
|
||||
@@ -0,0 +1,374 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.ImageFormat;
|
||||
import android.hardware.camera2.CameraAccessException;
|
||||
import android.hardware.camera2.CameraCaptureSession;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
import android.hardware.camera2.CameraDevice;
|
||||
import android.hardware.camera2.CameraManager;
|
||||
import android.hardware.camera2.CaptureRequest;
|
||||
import android.hardware.camera2.params.StreamConfigurationMap;
|
||||
import android.media.Image;
|
||||
import android.media.ImageReader;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.Surface;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
|
||||
/**
|
||||
* This class is an implementation of the Bridge View between OpenCV and Java Camera.
|
||||
* This class relays on the functionality available in base class and only implements
|
||||
* required functions:
|
||||
* connectCamera - opens Java camera and sets the PreviewCallback to be delivered.
|
||||
* disconnectCamera - closes the camera and stops preview.
|
||||
* When frame is delivered via callback from Camera - it processed via OpenCV to be
|
||||
* converted to RGBA32 and then passed to the external callback for modifications if required.
|
||||
*/
|
||||
|
||||
@TargetApi(21)
|
||||
public class JavaCamera2View extends CameraBridgeViewBase {
|
||||
|
||||
private static final String LOGTAG = "JavaCamera2View";
|
||||
|
||||
private ImageReader mImageReader;
|
||||
private int mPreviewFormat = ImageFormat.YUV_420_888;
|
||||
|
||||
private CameraDevice mCameraDevice;
|
||||
private CameraCaptureSession mCaptureSession;
|
||||
private CaptureRequest.Builder mPreviewRequestBuilder;
|
||||
private String mCameraID;
|
||||
private android.util.Size mPreviewSize = new android.util.Size(-1, -1);
|
||||
|
||||
private HandlerThread mBackgroundThread;
|
||||
private Handler mBackgroundHandler;
|
||||
|
||||
public JavaCamera2View(Context context, int cameraId) {
|
||||
super(context, cameraId);
|
||||
}
|
||||
|
||||
public JavaCamera2View(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
private void startBackgroundThread() {
|
||||
Log.i(LOGTAG, "startBackgroundThread");
|
||||
stopBackgroundThread();
|
||||
mBackgroundThread = new HandlerThread("OpenCVCameraBackground");
|
||||
mBackgroundThread.start();
|
||||
mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
|
||||
}
|
||||
|
||||
private void stopBackgroundThread() {
|
||||
Log.i(LOGTAG, "stopBackgroundThread");
|
||||
if (mBackgroundThread == null)
|
||||
return;
|
||||
mBackgroundThread.quitSafely();
|
||||
try {
|
||||
mBackgroundThread.join();
|
||||
mBackgroundThread = null;
|
||||
mBackgroundHandler = null;
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(LOGTAG, "stopBackgroundThread", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean initializeCamera() {
|
||||
Log.i(LOGTAG, "initializeCamera");
|
||||
CameraManager manager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE);
|
||||
try {
|
||||
String camList[] = manager.getCameraIdList();
|
||||
if (camList.length == 0) {
|
||||
Log.e(LOGTAG, "Error: camera isn't detected.");
|
||||
return false;
|
||||
}
|
||||
if (mCameraIndex == CameraBridgeViewBase.CAMERA_ID_ANY) {
|
||||
mCameraID = camList[0];
|
||||
} else {
|
||||
for (String cameraID : camList) {
|
||||
CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraID);
|
||||
if ((mCameraIndex == CameraBridgeViewBase.CAMERA_ID_BACK &&
|
||||
characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK) ||
|
||||
(mCameraIndex == CameraBridgeViewBase.CAMERA_ID_FRONT &&
|
||||
characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT)
|
||||
) {
|
||||
mCameraID = cameraID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mCameraID != null) {
|
||||
Log.i(LOGTAG, "Opening camera: " + mCameraID);
|
||||
manager.openCamera(mCameraID, mStateCallback, mBackgroundHandler);
|
||||
}
|
||||
return true;
|
||||
} catch (CameraAccessException e) {
|
||||
Log.e(LOGTAG, "OpenCamera - Camera Access Exception", e);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(LOGTAG, "OpenCamera - Illegal Argument Exception", e);
|
||||
} catch (SecurityException e) {
|
||||
Log.e(LOGTAG, "OpenCamera - Security Exception", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback() {
|
||||
|
||||
@Override
|
||||
public void onOpened(CameraDevice cameraDevice) {
|
||||
mCameraDevice = cameraDevice;
|
||||
createCameraPreviewSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected(CameraDevice cameraDevice) {
|
||||
cameraDevice.close();
|
||||
mCameraDevice = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(CameraDevice cameraDevice, int error) {
|
||||
cameraDevice.close();
|
||||
mCameraDevice = null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private void createCameraPreviewSession() {
|
||||
final int w = mPreviewSize.getWidth(), h = mPreviewSize.getHeight();
|
||||
Log.i(LOGTAG, "createCameraPreviewSession(" + w + "x" + h + ")");
|
||||
if (w < 0 || h < 0)
|
||||
return;
|
||||
try {
|
||||
if (null == mCameraDevice) {
|
||||
Log.e(LOGTAG, "createCameraPreviewSession: camera isn't opened");
|
||||
return;
|
||||
}
|
||||
if (null != mCaptureSession) {
|
||||
Log.e(LOGTAG, "createCameraPreviewSession: mCaptureSession is already started");
|
||||
return;
|
||||
}
|
||||
|
||||
mImageReader = ImageReader.newInstance(w, h, mPreviewFormat, 2);
|
||||
mImageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
|
||||
@Override
|
||||
public void onImageAvailable(ImageReader reader) {
|
||||
Image image = reader.acquireLatestImage();
|
||||
if (image == null)
|
||||
return;
|
||||
|
||||
// sanity checks - 3 planes
|
||||
Image.Plane[] planes = image.getPlanes();
|
||||
assert (planes.length == 3);
|
||||
assert (image.getFormat() == mPreviewFormat);
|
||||
|
||||
// see also https://developer.android.com/reference/android/graphics/ImageFormat.html#YUV_420_888
|
||||
// Y plane (0) non-interleaved => stride == 1; U/V plane interleaved => stride == 2
|
||||
assert (planes[0].getPixelStride() == 1);
|
||||
assert (planes[1].getPixelStride() == 2);
|
||||
assert (planes[2].getPixelStride() == 2);
|
||||
|
||||
ByteBuffer y_plane = planes[0].getBuffer();
|
||||
ByteBuffer uv_plane = planes[1].getBuffer();
|
||||
Mat y_mat = new Mat(h, w, CvType.CV_8UC1, y_plane);
|
||||
Mat uv_mat = new Mat(h / 2, w / 2, CvType.CV_8UC2, uv_plane);
|
||||
JavaCamera2Frame tempFrame = new JavaCamera2Frame(y_mat, uv_mat, w, h);
|
||||
deliverAndDrawFrame(tempFrame);
|
||||
tempFrame.release();
|
||||
image.close();
|
||||
}
|
||||
}, mBackgroundHandler);
|
||||
Surface surface = mImageReader.getSurface();
|
||||
|
||||
mPreviewRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
|
||||
mPreviewRequestBuilder.addTarget(surface);
|
||||
|
||||
mCameraDevice.createCaptureSession(Arrays.asList(surface),
|
||||
new CameraCaptureSession.StateCallback() {
|
||||
@Override
|
||||
public void onConfigured(CameraCaptureSession cameraCaptureSession) {
|
||||
Log.i(LOGTAG, "createCaptureSession::onConfigured");
|
||||
if (null == mCameraDevice) {
|
||||
return; // camera is already closed
|
||||
}
|
||||
mCaptureSession = cameraCaptureSession;
|
||||
try {
|
||||
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
|
||||
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
|
||||
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
|
||||
CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
|
||||
|
||||
mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), null, mBackgroundHandler);
|
||||
Log.i(LOGTAG, "CameraPreviewSession has been started");
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "createCaptureSession failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {
|
||||
Log.e(LOGTAG, "createCameraPreviewSession failed");
|
||||
}
|
||||
},
|
||||
null
|
||||
);
|
||||
} catch (CameraAccessException e) {
|
||||
Log.e(LOGTAG, "createCameraPreviewSession", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disconnectCamera() {
|
||||
Log.i(LOGTAG, "closeCamera");
|
||||
try {
|
||||
CameraDevice c = mCameraDevice;
|
||||
mCameraDevice = null;
|
||||
if (null != mCaptureSession) {
|
||||
mCaptureSession.close();
|
||||
mCaptureSession = null;
|
||||
}
|
||||
if (null != c) {
|
||||
c.close();
|
||||
}
|
||||
if (null != mImageReader) {
|
||||
mImageReader.close();
|
||||
mImageReader = null;
|
||||
}
|
||||
} finally {
|
||||
stopBackgroundThread();
|
||||
}
|
||||
}
|
||||
|
||||
boolean calcPreviewSize(final int width, final int height) {
|
||||
Log.i(LOGTAG, "calcPreviewSize: " + width + "x" + height);
|
||||
if (mCameraID == null) {
|
||||
Log.e(LOGTAG, "Camera isn't initialized!");
|
||||
return false;
|
||||
}
|
||||
CameraManager manager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE);
|
||||
try {
|
||||
CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraID);
|
||||
StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
|
||||
int bestWidth = 0, bestHeight = 0;
|
||||
float aspect = (float) width / height;
|
||||
android.util.Size[] sizes = map.getOutputSizes(ImageReader.class);
|
||||
bestWidth = sizes[0].getWidth();
|
||||
bestHeight = sizes[0].getHeight();
|
||||
for (android.util.Size sz : sizes) {
|
||||
int w = sz.getWidth(), h = sz.getHeight();
|
||||
Log.d(LOGTAG, "trying size: " + w + "x" + h);
|
||||
if (width >= w && height >= h && bestWidth <= w && bestHeight <= h
|
||||
&& Math.abs(aspect - (float) w / h) < 0.2) {
|
||||
bestWidth = w;
|
||||
bestHeight = h;
|
||||
}
|
||||
}
|
||||
Log.i(LOGTAG, "best size: " + bestWidth + "x" + bestHeight);
|
||||
assert(!(bestWidth == 0 || bestHeight == 0));
|
||||
if (mPreviewSize.getWidth() == bestWidth && mPreviewSize.getHeight() == bestHeight)
|
||||
return false;
|
||||
else {
|
||||
mPreviewSize = new android.util.Size(bestWidth, bestHeight);
|
||||
return true;
|
||||
}
|
||||
} catch (CameraAccessException e) {
|
||||
Log.e(LOGTAG, "calcPreviewSize - Camera Access Exception", e);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(LOGTAG, "calcPreviewSize - Illegal Argument Exception", e);
|
||||
} catch (SecurityException e) {
|
||||
Log.e(LOGTAG, "calcPreviewSize - Security Exception", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean connectCamera(int width, int height) {
|
||||
Log.i(LOGTAG, "setCameraPreviewSize(" + width + "x" + height + ")");
|
||||
startBackgroundThread();
|
||||
initializeCamera();
|
||||
try {
|
||||
boolean needReconfig = calcPreviewSize(width, height);
|
||||
mFrameWidth = mPreviewSize.getWidth();
|
||||
mFrameHeight = mPreviewSize.getHeight();
|
||||
|
||||
if ((getLayoutParams().width == LayoutParams.MATCH_PARENT) && (getLayoutParams().height == LayoutParams.MATCH_PARENT))
|
||||
mScale = Math.min(((float)height)/mFrameHeight, ((float)width)/mFrameWidth);
|
||||
else
|
||||
mScale = 0;
|
||||
|
||||
AllocateCache();
|
||||
|
||||
if (needReconfig) {
|
||||
if (null != mCaptureSession) {
|
||||
Log.d(LOGTAG, "closing existing previewSession");
|
||||
mCaptureSession.close();
|
||||
mCaptureSession = null;
|
||||
}
|
||||
createCameraPreviewSession();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
throw new RuntimeException("Interrupted while setCameraPreviewSize.", e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private class JavaCamera2Frame 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 if (mPreviewFormat == ImageFormat.YUV_420_888) {
|
||||
assert (mUVFrameData != null);
|
||||
Imgproc.cvtColorTwoPlane(mYuvFrameData, mUVFrameData, mRgba, Imgproc.COLOR_YUV2RGBA_NV21);
|
||||
} else
|
||||
throw new IllegalArgumentException("Preview Format can be NV21 or YV12");
|
||||
|
||||
return mRgba;
|
||||
}
|
||||
|
||||
public JavaCamera2Frame(Mat Yuv420sp, int width, int height) {
|
||||
super();
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
mYuvFrameData = Yuv420sp;
|
||||
mUVFrameData = null;
|
||||
mRgba = new Mat();
|
||||
}
|
||||
|
||||
public JavaCamera2Frame(Mat Y, Mat UV, int width, int height) {
|
||||
super();
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
mYuvFrameData = Y;
|
||||
mUVFrameData = UV;
|
||||
mRgba = new Mat();
|
||||
}
|
||||
|
||||
public void release() {
|
||||
mRgba.release();
|
||||
}
|
||||
|
||||
private Mat mYuvFrameData;
|
||||
private Mat mUVFrameData;
|
||||
private Mat mRgba;
|
||||
private int mWidth;
|
||||
private int mHeight;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
package org.opencv.android;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.ImageFormat;
|
||||
import android.graphics.SurfaceTexture;
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.PreviewCallback;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
import org.opencv.BuildConfig;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
|
||||
/**
|
||||
* This class is an implementation of the Bridge View between OpenCV and Java Camera.
|
||||
* This class relays on the functionality available in base class and only implements
|
||||
* required functions:
|
||||
* connectCamera - opens Java camera and sets the PreviewCallback to be delivered.
|
||||
* disconnectCamera - closes the camera and stops preview.
|
||||
* When frame is delivered via callback from Camera - it processed via OpenCV to be
|
||||
* converted to RGBA32 and then passed to the external callback for modifications if required.
|
||||
*/
|
||||
public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallback {
|
||||
|
||||
private static final int MAGIC_TEXTURE_ID = 10;
|
||||
private static final String TAG = "JavaCameraView";
|
||||
|
||||
private byte mBuffer[];
|
||||
private Mat[] mFrameChain;
|
||||
private int mChainIdx = 0;
|
||||
private Thread mThread;
|
||||
private boolean mStopThread;
|
||||
|
||||
protected Camera mCamera;
|
||||
protected JavaCameraFrame[] mCameraFrame;
|
||||
private SurfaceTexture mSurfaceTexture;
|
||||
private int mPreviewFormat = ImageFormat.NV21;
|
||||
|
||||
public static class JavaCameraSizeAccessor implements ListItemAccessor {
|
||||
|
||||
@Override
|
||||
public int getWidth(Object obj) {
|
||||
Camera.Size size = (Camera.Size) obj;
|
||||
return size.width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight(Object obj) {
|
||||
Camera.Size size = (Camera.Size) obj;
|
||||
return size.height;
|
||||
}
|
||||
}
|
||||
|
||||
public JavaCameraView(Context context, int cameraId) {
|
||||
super(context, cameraId);
|
||||
}
|
||||
|
||||
public JavaCameraView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
protected boolean initializeCamera(int width, int height) {
|
||||
Log.d(TAG, "Initialize java camera");
|
||||
boolean result = true;
|
||||
synchronized (this) {
|
||||
mCamera = null;
|
||||
|
||||
if (mCameraIndex == CAMERA_ID_ANY) {
|
||||
Log.d(TAG, "Trying to open camera with old open()");
|
||||
try {
|
||||
mCamera = Camera.open();
|
||||
}
|
||||
catch (Exception e){
|
||||
Log.e(TAG, "Camera is not available (in use or does not exist): " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
if(mCamera == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||
boolean connected = false;
|
||||
for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
|
||||
Log.d(TAG, "Trying to open camera with new open(" + Integer.valueOf(camIdx) + ")");
|
||||
try {
|
||||
mCamera = Camera.open(camIdx);
|
||||
connected = true;
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Camera #" + camIdx + "failed to open: " + e.getLocalizedMessage());
|
||||
}
|
||||
if (connected) break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||
int localCameraIndex = mCameraIndex;
|
||||
if (mCameraIndex == CAMERA_ID_BACK) {
|
||||
Log.i(TAG, "Trying to open back camera");
|
||||
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
|
||||
for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
|
||||
Camera.getCameraInfo( camIdx, cameraInfo );
|
||||
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
|
||||
localCameraIndex = camIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mCameraIndex == CAMERA_ID_FRONT) {
|
||||
Log.i(TAG, "Trying to open front camera");
|
||||
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
|
||||
for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
|
||||
Camera.getCameraInfo( camIdx, cameraInfo );
|
||||
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
|
||||
localCameraIndex = camIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (localCameraIndex == CAMERA_ID_BACK) {
|
||||
Log.e(TAG, "Back camera not found!");
|
||||
} else if (localCameraIndex == CAMERA_ID_FRONT) {
|
||||
Log.e(TAG, "Front camera not found!");
|
||||
} else {
|
||||
Log.d(TAG, "Trying to open camera with new open(" + Integer.valueOf(localCameraIndex) + ")");
|
||||
try {
|
||||
mCamera = Camera.open(localCameraIndex);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Camera #" + localCameraIndex + "failed to open: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mCamera == null)
|
||||
return false;
|
||||
|
||||
/* Now set camera parameters */
|
||||
try {
|
||||
Camera.Parameters params = mCamera.getParameters();
|
||||
Log.d(TAG, "getSupportedPreviewSizes()");
|
||||
List<android.hardware.Camera.Size> sizes = params.getSupportedPreviewSizes();
|
||||
|
||||
if (sizes != null) {
|
||||
/* Select the size that fits surface considering maximum size allowed */
|
||||
Size frameSize = calculateCameraFrameSize(sizes, new JavaCameraSizeAccessor(), width, height);
|
||||
|
||||
/* Image format NV21 causes issues in the Android emulators */
|
||||
if (Build.FINGERPRINT.startsWith("generic")
|
||||
|| Build.FINGERPRINT.startsWith("unknown")
|
||||
|| Build.MODEL.contains("google_sdk")
|
||||
|| Build.MODEL.contains("Emulator")
|
||||
|| Build.MODEL.contains("Android SDK built for x86")
|
||||
|| Build.MANUFACTURER.contains("Genymotion")
|
||||
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
|
||||
|| "google_sdk".equals(Build.PRODUCT))
|
||||
params.setPreviewFormat(ImageFormat.YV12); // "generic" or "android" = android emulator
|
||||
else
|
||||
params.setPreviewFormat(ImageFormat.NV21);
|
||||
|
||||
mPreviewFormat = params.getPreviewFormat();
|
||||
|
||||
Log.d(TAG, "Set preview size to " + Integer.valueOf((int)frameSize.width) + "x" + Integer.valueOf((int)frameSize.height));
|
||||
params.setPreviewSize((int)frameSize.width, (int)frameSize.height);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && !android.os.Build.MODEL.equals("GT-I9100"))
|
||||
params.setRecordingHint(true);
|
||||
|
||||
List<String> 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -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);
|
||||
};
|
||||
@@ -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.2";
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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.
|
||||
* <p>
|
||||
* This function converts an Android Bitmap image to the OpenCV Mat.
|
||||
* <br>'ARGB_8888' and 'RGB_565' input Bitmap formats are supported.
|
||||
* <br>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.
|
||||
* <br>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 java.lang.IllegalArgumentException("bmp == null");
|
||||
if (mat == null)
|
||||
throw new java.lang.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.
|
||||
* <p>
|
||||
* <br>This function converts an image in the OpenCV Mat representation to the Android Bitmap.
|
||||
* <br>The input Mat object has to be of the types 'CV_8UC1' (gray-scale), 'CV_8UC3' (RGB) or 'CV_8UC4' (RGBA).
|
||||
* <br>The output Bitmap object has to be of the same size as the input Mat and of the types 'ARGB_8888' or 'RGB_565'.
|
||||
* <br>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 java.lang.IllegalArgumentException("mat == null");
|
||||
if (bmp == null)
|
||||
throw new java.lang.IllegalArgumentException("bmp == null");
|
||||
nMatToBitmap2(mat.nativeObj, bmp, premultiplyAlpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* Short form of the <b>matToBitmap(mat, bmp, premultiplyAlpha=false)</b>
|
||||
* @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);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,334 @@
|
||||
//
|
||||
// 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
|
||||
//javadoc: StereoBM
|
||||
|
||||
public class StereoBM extends StereoMatcher {
|
||||
|
||||
protected StereoBM(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static StereoBM __fromPtr__(long addr) { return new StereoBM(addr); }
|
||||
|
||||
public static final int
|
||||
PREFILTER_NORMALIZED_RESPONSE = 0,
|
||||
PREFILTER_XSOBEL = 1;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_StereoBM create(int numDisparities = 0, int blockSize = 21)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::create(numDisparities, blockSize)
|
||||
public static StereoBM create(int numDisparities, int blockSize)
|
||||
{
|
||||
|
||||
StereoBM retVal = StereoBM.__fromPtr__(create_0(numDisparities, blockSize));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: StereoBM::create()
|
||||
public static StereoBM create()
|
||||
{
|
||||
|
||||
StereoBM retVal = StereoBM.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Rect getROI1()
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::getROI1()
|
||||
public Rect getROI1()
|
||||
{
|
||||
|
||||
Rect retVal = new Rect(getROI1_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Rect getROI2()
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::getROI2()
|
||||
public Rect getROI2()
|
||||
{
|
||||
|
||||
Rect retVal = new Rect(getROI2_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getPreFilterCap()
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::getPreFilterCap()
|
||||
public int getPreFilterCap()
|
||||
{
|
||||
|
||||
int retVal = getPreFilterCap_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getPreFilterSize()
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::getPreFilterSize()
|
||||
public int getPreFilterSize()
|
||||
{
|
||||
|
||||
int retVal = getPreFilterSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getPreFilterType()
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::getPreFilterType()
|
||||
public int getPreFilterType()
|
||||
{
|
||||
|
||||
int retVal = getPreFilterType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getSmallerBlockSize()
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::getSmallerBlockSize()
|
||||
public int getSmallerBlockSize()
|
||||
{
|
||||
|
||||
int retVal = getSmallerBlockSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getTextureThreshold()
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::getTextureThreshold()
|
||||
public int getTextureThreshold()
|
||||
{
|
||||
|
||||
int retVal = getTextureThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getUniquenessRatio()
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::getUniquenessRatio()
|
||||
public int getUniquenessRatio()
|
||||
{
|
||||
|
||||
int retVal = getUniquenessRatio_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPreFilterCap(int preFilterCap)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::setPreFilterCap(preFilterCap)
|
||||
public void setPreFilterCap(int preFilterCap)
|
||||
{
|
||||
|
||||
setPreFilterCap_0(nativeObj, preFilterCap);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPreFilterSize(int preFilterSize)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::setPreFilterSize(preFilterSize)
|
||||
public void setPreFilterSize(int preFilterSize)
|
||||
{
|
||||
|
||||
setPreFilterSize_0(nativeObj, preFilterSize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPreFilterType(int preFilterType)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::setPreFilterType(preFilterType)
|
||||
public void setPreFilterType(int preFilterType)
|
||||
{
|
||||
|
||||
setPreFilterType_0(nativeObj, preFilterType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setROI1(Rect roi1)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::setROI1(roi1)
|
||||
public void setROI1(Rect roi1)
|
||||
{
|
||||
|
||||
setROI1_0(nativeObj, roi1.x, roi1.y, roi1.width, roi1.height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setROI2(Rect roi2)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::setROI2(roi2)
|
||||
public void setROI2(Rect roi2)
|
||||
{
|
||||
|
||||
setROI2_0(nativeObj, roi2.x, roi2.y, roi2.width, roi2.height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setSmallerBlockSize(int blockSize)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::setSmallerBlockSize(blockSize)
|
||||
public void setSmallerBlockSize(int blockSize)
|
||||
{
|
||||
|
||||
setSmallerBlockSize_0(nativeObj, blockSize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTextureThreshold(int textureThreshold)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::setTextureThreshold(textureThreshold)
|
||||
public void setTextureThreshold(int textureThreshold)
|
||||
{
|
||||
|
||||
setTextureThreshold_0(nativeObj, textureThreshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setUniquenessRatio(int uniquenessRatio)
|
||||
//
|
||||
|
||||
//javadoc: StereoBM::setUniquenessRatio(uniquenessRatio)
|
||||
public void setUniquenessRatio(int uniquenessRatio)
|
||||
{
|
||||
|
||||
setUniquenessRatio_0(nativeObj, uniquenessRatio);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_StereoBM create(int numDisparities = 0, int blockSize = 21)
|
||||
private static native long create_0(int numDisparities, int blockSize);
|
||||
private static native long create_1();
|
||||
|
||||
// C++: Rect getROI1()
|
||||
private static native double[] getROI1_0(long nativeObj);
|
||||
|
||||
// C++: Rect getROI2()
|
||||
private static native double[] getROI2_0(long nativeObj);
|
||||
|
||||
// C++: int getPreFilterCap()
|
||||
private static native int getPreFilterCap_0(long nativeObj);
|
||||
|
||||
// C++: int getPreFilterSize()
|
||||
private static native int getPreFilterSize_0(long nativeObj);
|
||||
|
||||
// C++: int getPreFilterType()
|
||||
private static native int getPreFilterType_0(long nativeObj);
|
||||
|
||||
// C++: int getSmallerBlockSize()
|
||||
private static native int getSmallerBlockSize_0(long nativeObj);
|
||||
|
||||
// C++: int getTextureThreshold()
|
||||
private static native int getTextureThreshold_0(long nativeObj);
|
||||
|
||||
// C++: int getUniquenessRatio()
|
||||
private static native int getUniquenessRatio_0(long nativeObj);
|
||||
|
||||
// C++: void setPreFilterCap(int preFilterCap)
|
||||
private static native void setPreFilterCap_0(long nativeObj, int preFilterCap);
|
||||
|
||||
// C++: void setPreFilterSize(int preFilterSize)
|
||||
private static native void setPreFilterSize_0(long nativeObj, int preFilterSize);
|
||||
|
||||
// C++: void setPreFilterType(int preFilterType)
|
||||
private static native void setPreFilterType_0(long nativeObj, int preFilterType);
|
||||
|
||||
// C++: void setROI1(Rect roi1)
|
||||
private static native void setROI1_0(long nativeObj, int roi1_x, int roi1_y, int roi1_width, int roi1_height);
|
||||
|
||||
// C++: void setROI2(Rect roi2)
|
||||
private static native void setROI2_0(long nativeObj, int roi2_x, int roi2_y, int roi2_width, int roi2_height);
|
||||
|
||||
// C++: void setSmallerBlockSize(int blockSize)
|
||||
private static native void setSmallerBlockSize_0(long nativeObj, int blockSize);
|
||||
|
||||
// C++: void setTextureThreshold(int textureThreshold)
|
||||
private static native void setTextureThreshold_0(long nativeObj, int textureThreshold);
|
||||
|
||||
// C++: void setUniquenessRatio(int uniquenessRatio)
|
||||
private static native void setUniquenessRatio_0(long nativeObj, int uniquenessRatio);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
//
|
||||
// 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
|
||||
//javadoc: StereoMatcher
|
||||
|
||||
public class StereoMatcher extends Algorithm {
|
||||
|
||||
protected StereoMatcher(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static StereoMatcher __fromPtr__(long addr) { return new StereoMatcher(addr); }
|
||||
|
||||
public static final int
|
||||
DISP_SHIFT = 4,
|
||||
DISP_SCALE = (1 << DISP_SHIFT);
|
||||
|
||||
|
||||
//
|
||||
// C++: int getBlockSize()
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::getBlockSize()
|
||||
public int getBlockSize()
|
||||
{
|
||||
|
||||
int retVal = getBlockSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getDisp12MaxDiff()
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::getDisp12MaxDiff()
|
||||
public int getDisp12MaxDiff()
|
||||
{
|
||||
|
||||
int retVal = getDisp12MaxDiff_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMinDisparity()
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::getMinDisparity()
|
||||
public int getMinDisparity()
|
||||
{
|
||||
|
||||
int retVal = getMinDisparity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNumDisparities()
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::getNumDisparities()
|
||||
public int getNumDisparities()
|
||||
{
|
||||
|
||||
int retVal = getNumDisparities_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getSpeckleRange()
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::getSpeckleRange()
|
||||
public int getSpeckleRange()
|
||||
{
|
||||
|
||||
int retVal = getSpeckleRange_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getSpeckleWindowSize()
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::getSpeckleWindowSize()
|
||||
public int getSpeckleWindowSize()
|
||||
{
|
||||
|
||||
int retVal = getSpeckleWindowSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void compute(Mat left, Mat right, Mat& disparity)
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::compute(left, right, disparity)
|
||||
public void compute(Mat left, Mat right, Mat disparity)
|
||||
{
|
||||
|
||||
compute_0(nativeObj, left.nativeObj, right.nativeObj, disparity.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setBlockSize(int blockSize)
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::setBlockSize(blockSize)
|
||||
public void setBlockSize(int blockSize)
|
||||
{
|
||||
|
||||
setBlockSize_0(nativeObj, blockSize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDisp12MaxDiff(int disp12MaxDiff)
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::setDisp12MaxDiff(disp12MaxDiff)
|
||||
public void setDisp12MaxDiff(int disp12MaxDiff)
|
||||
{
|
||||
|
||||
setDisp12MaxDiff_0(nativeObj, disp12MaxDiff);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMinDisparity(int minDisparity)
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::setMinDisparity(minDisparity)
|
||||
public void setMinDisparity(int minDisparity)
|
||||
{
|
||||
|
||||
setMinDisparity_0(nativeObj, minDisparity);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNumDisparities(int numDisparities)
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::setNumDisparities(numDisparities)
|
||||
public void setNumDisparities(int numDisparities)
|
||||
{
|
||||
|
||||
setNumDisparities_0(nativeObj, numDisparities);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setSpeckleRange(int speckleRange)
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::setSpeckleRange(speckleRange)
|
||||
public void setSpeckleRange(int speckleRange)
|
||||
{
|
||||
|
||||
setSpeckleRange_0(nativeObj, speckleRange);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setSpeckleWindowSize(int speckleWindowSize)
|
||||
//
|
||||
|
||||
//javadoc: StereoMatcher::setSpeckleWindowSize(speckleWindowSize)
|
||||
public void setSpeckleWindowSize(int speckleWindowSize)
|
||||
{
|
||||
|
||||
setSpeckleWindowSize_0(nativeObj, speckleWindowSize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: int getBlockSize()
|
||||
private static native int getBlockSize_0(long nativeObj);
|
||||
|
||||
// C++: int getDisp12MaxDiff()
|
||||
private static native int getDisp12MaxDiff_0(long nativeObj);
|
||||
|
||||
// C++: int getMinDisparity()
|
||||
private static native int getMinDisparity_0(long nativeObj);
|
||||
|
||||
// C++: int getNumDisparities()
|
||||
private static native int getNumDisparities_0(long nativeObj);
|
||||
|
||||
// C++: int getSpeckleRange()
|
||||
private static native int getSpeckleRange_0(long nativeObj);
|
||||
|
||||
// C++: int getSpeckleWindowSize()
|
||||
private static native int getSpeckleWindowSize_0(long nativeObj);
|
||||
|
||||
// C++: void 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++: void setBlockSize(int blockSize)
|
||||
private static native void setBlockSize_0(long nativeObj, int blockSize);
|
||||
|
||||
// C++: void setDisp12MaxDiff(int disp12MaxDiff)
|
||||
private static native void setDisp12MaxDiff_0(long nativeObj, int disp12MaxDiff);
|
||||
|
||||
// C++: void setMinDisparity(int minDisparity)
|
||||
private static native void setMinDisparity_0(long nativeObj, int minDisparity);
|
||||
|
||||
// C++: void setNumDisparities(int numDisparities)
|
||||
private static native void setNumDisparities_0(long nativeObj, int numDisparities);
|
||||
|
||||
// C++: void setSpeckleRange(int speckleRange)
|
||||
private static native void setSpeckleRange_0(long nativeObj, int speckleRange);
|
||||
|
||||
// C++: void setSpeckleWindowSize(int speckleWindowSize)
|
||||
private static native void setSpeckleWindowSize_0(long nativeObj, int speckleWindowSize);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
//
|
||||
// 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
|
||||
//javadoc: StereoSGBM
|
||||
|
||||
public class StereoSGBM extends StereoMatcher {
|
||||
|
||||
protected StereoSGBM(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static StereoSGBM __fromPtr__(long addr) { return new StereoSGBM(addr); }
|
||||
|
||||
public static final int
|
||||
MODE_SGBM = 0,
|
||||
MODE_HH = 1,
|
||||
MODE_SGBM_3WAY = 2,
|
||||
MODE_HH4 = 3;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_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)
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, mode)
|
||||
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)
|
||||
{
|
||||
|
||||
StereoSGBM retVal = StereoSGBM.__fromPtr__(create_0(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, mode));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: StereoSGBM::create()
|
||||
public static StereoSGBM create()
|
||||
{
|
||||
|
||||
StereoSGBM retVal = StereoSGBM.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMode()
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::getMode()
|
||||
public int getMode()
|
||||
{
|
||||
|
||||
int retVal = getMode_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getP1()
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::getP1()
|
||||
public int getP1()
|
||||
{
|
||||
|
||||
int retVal = getP1_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getP2()
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::getP2()
|
||||
public int getP2()
|
||||
{
|
||||
|
||||
int retVal = getP2_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getPreFilterCap()
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::getPreFilterCap()
|
||||
public int getPreFilterCap()
|
||||
{
|
||||
|
||||
int retVal = getPreFilterCap_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getUniquenessRatio()
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::getUniquenessRatio()
|
||||
public int getUniquenessRatio()
|
||||
{
|
||||
|
||||
int retVal = getUniquenessRatio_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMode(int mode)
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::setMode(mode)
|
||||
public void setMode(int mode)
|
||||
{
|
||||
|
||||
setMode_0(nativeObj, mode);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setP1(int P1)
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::setP1(P1)
|
||||
public void setP1(int P1)
|
||||
{
|
||||
|
||||
setP1_0(nativeObj, P1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setP2(int P2)
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::setP2(P2)
|
||||
public void setP2(int P2)
|
||||
{
|
||||
|
||||
setP2_0(nativeObj, P2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPreFilterCap(int preFilterCap)
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::setPreFilterCap(preFilterCap)
|
||||
public void setPreFilterCap(int preFilterCap)
|
||||
{
|
||||
|
||||
setPreFilterCap_0(nativeObj, preFilterCap);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setUniquenessRatio(int uniquenessRatio)
|
||||
//
|
||||
|
||||
//javadoc: StereoSGBM::setUniquenessRatio(uniquenessRatio)
|
||||
public void setUniquenessRatio(int uniquenessRatio)
|
||||
{
|
||||
|
||||
setUniquenessRatio_0(nativeObj, uniquenessRatio);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_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();
|
||||
|
||||
// C++: int getMode()
|
||||
private static native int getMode_0(long nativeObj);
|
||||
|
||||
// C++: int getP1()
|
||||
private static native int getP1_0(long nativeObj);
|
||||
|
||||
// C++: int getP2()
|
||||
private static native int getP2_0(long nativeObj);
|
||||
|
||||
// C++: int getPreFilterCap()
|
||||
private static native int getPreFilterCap_0(long nativeObj);
|
||||
|
||||
// C++: int getUniquenessRatio()
|
||||
private static native int getUniquenessRatio_0(long nativeObj);
|
||||
|
||||
// C++: void setMode(int mode)
|
||||
private static native void setMode_0(long nativeObj, int mode);
|
||||
|
||||
// C++: void setP1(int P1)
|
||||
private static native void setP1_0(long nativeObj, int P1);
|
||||
|
||||
// C++: void setP2(int P2)
|
||||
private static native void setP2_0(long nativeObj, int P2);
|
||||
|
||||
// C++: void setPreFilterCap(int preFilterCap)
|
||||
private static native void setPreFilterCap_0(long nativeObj, int preFilterCap);
|
||||
|
||||
// C++: void setUniquenessRatio(int uniquenessRatio)
|
||||
private static native void setUniquenessRatio_0(long nativeObj, int uniquenessRatio);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.core;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
// C++: class Algorithm
|
||||
//javadoc: 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++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: Algorithm::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool empty()
|
||||
//
|
||||
|
||||
//javadoc: Algorithm::empty()
|
||||
public boolean empty()
|
||||
{
|
||||
|
||||
boolean retVal = empty_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void clear()
|
||||
//
|
||||
|
||||
//javadoc: Algorithm::clear()
|
||||
public void clear()
|
||||
{
|
||||
|
||||
clear_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void read(FileNode fn)
|
||||
//
|
||||
|
||||
// Unknown type 'FileNode' (I), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: void save(String filename)
|
||||
//
|
||||
|
||||
//javadoc: Algorithm::save(filename)
|
||||
public void save(String filename)
|
||||
{
|
||||
|
||||
save_0(nativeObj, filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void write(Ptr_FileStorage fs, String name = String())
|
||||
//
|
||||
|
||||
// Unknown type 'Ptr_FileStorage' (I), skipping the function
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: bool empty()
|
||||
private static native boolean empty_0(long nativeObj);
|
||||
|
||||
// C++: void clear()
|
||||
private static native void clear_0(long nativeObj);
|
||||
|
||||
// C++: void save(String filename)
|
||||
private static native void save_0(long nativeObj, String filename);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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() + "]";
|
||||
}
|
||||
}
|
||||
@@ -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 java.lang.UnsupportedOperationException(
|
||||
"Channels count should be 1.." + (CV_CN_MAX - 1));
|
||||
}
|
||||
if (depth < 0 || depth >= CV_DEPTH_MAX) {
|
||||
throw new java.lang.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 java.lang.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 java.lang.UnsupportedOperationException(
|
||||
"Unsupported CvType value: " + type);
|
||||
}
|
||||
|
||||
int ch = channels(type);
|
||||
if (ch <= 4)
|
||||
return s + "C" + ch;
|
||||
else
|
||||
return s + "C(" + ch + ")";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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<Byte> 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<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Byte> toList() {
|
||||
byte[] a = toArray();
|
||||
Byte ab[] = new Byte[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.opencv.core.DMatch;
|
||||
|
||||
public class MatOfDMatch extends Mat {
|
||||
// 32FC4
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 4;
|
||||
|
||||
public MatOfDMatch() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfDMatch(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat: " + toString());
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfDMatch fromNativeAddr(long addr) {
|
||||
return new MatOfDMatch(addr);
|
||||
}
|
||||
|
||||
public MatOfDMatch(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat: " + toString());
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfDMatch(DMatch...ap) {
|
||||
super();
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
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<num; i++) {
|
||||
DMatch m = a[i];
|
||||
buff[_channels*i+0] = m.queryIdx;
|
||||
buff[_channels*i+1] = m.trainIdx;
|
||||
buff[_channels*i+2] = m.imgIdx;
|
||||
buff[_channels*i+3] = m.distance;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public DMatch[] toArray() {
|
||||
int num = (int) total();
|
||||
DMatch[] a = new DMatch[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
float buff[] = new float[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
a[i] = new DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<DMatch> ldm) {
|
||||
DMatch adm[] = ldm.toArray(new DMatch[0]);
|
||||
fromArray(adm);
|
||||
}
|
||||
|
||||
public List<DMatch> toList() {
|
||||
DMatch[] adm = toArray();
|
||||
return Arrays.asList(adm);
|
||||
}
|
||||
}
|
||||
@@ -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<Double> 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<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Double> toList() {
|
||||
double[] a = toArray();
|
||||
Double ab[] = new Double[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfFloat extends Mat {
|
||||
// 32FC1
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 1;
|
||||
|
||||
public MatOfFloat() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfFloat(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfFloat fromNativeAddr(long addr) {
|
||||
return new MatOfFloat(addr);
|
||||
}
|
||||
|
||||
public MatOfFloat(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfFloat(float...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
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<Float> 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<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Float> toList() {
|
||||
float[] a = toArray();
|
||||
Float ab[] = new Float[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfFloat4 extends Mat {
|
||||
// 32FC4
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 4;
|
||||
|
||||
public MatOfFloat4() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfFloat4(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfFloat4 fromNativeAddr(long addr) {
|
||||
return new MatOfFloat4(addr);
|
||||
}
|
||||
|
||||
public MatOfFloat4(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfFloat4(float...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
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<Float> 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<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Float> toList() {
|
||||
float[] a = toArray();
|
||||
Float ab[] = new Float[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfFloat6 extends Mat {
|
||||
// 32FC6
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 6;
|
||||
|
||||
public MatOfFloat6() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfFloat6(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfFloat6 fromNativeAddr(long addr) {
|
||||
return new MatOfFloat6(addr);
|
||||
}
|
||||
|
||||
public MatOfFloat6(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfFloat6(float...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
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<Float> 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<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Float> toList() {
|
||||
float[] a = toArray();
|
||||
Float ab[] = new Float[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MatOfInt extends Mat {
|
||||
// 32SC1
|
||||
private static final int _depth = CvType.CV_32S;
|
||||
private static final int _channels = 1;
|
||||
|
||||
public MatOfInt() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfInt(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfInt fromNativeAddr(long addr) {
|
||||
return new MatOfInt(addr);
|
||||
}
|
||||
|
||||
public MatOfInt(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfInt(int...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
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<Integer> 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<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Integer> toList() {
|
||||
int[] a = toArray();
|
||||
Integer ab[] = new Integer[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MatOfInt4 extends Mat {
|
||||
// 32SC4
|
||||
private static final int _depth = CvType.CV_32S;
|
||||
private static final int _channels = 4;
|
||||
|
||||
public MatOfInt4() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfInt4(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfInt4 fromNativeAddr(long addr) {
|
||||
return new MatOfInt4(addr);
|
||||
}
|
||||
|
||||
public MatOfInt4(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfInt4(int...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
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<Integer> 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<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Integer> toList() {
|
||||
int[] a = toArray();
|
||||
Integer ab[] = new Integer[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.opencv.core.KeyPoint;
|
||||
|
||||
public class MatOfKeyPoint extends Mat {
|
||||
// 32FC7
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 7;
|
||||
|
||||
public MatOfKeyPoint() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfKeyPoint(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfKeyPoint fromNativeAddr(long addr) {
|
||||
return new MatOfKeyPoint(addr);
|
||||
}
|
||||
|
||||
public MatOfKeyPoint(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfKeyPoint(KeyPoint...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
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<num; i++) {
|
||||
KeyPoint kp = a[i];
|
||||
buff[_channels*i+0] = (float) kp.pt.x;
|
||||
buff[_channels*i+1] = (float) kp.pt.y;
|
||||
buff[_channels*i+2] = kp.size;
|
||||
buff[_channels*i+3] = kp.angle;
|
||||
buff[_channels*i+4] = kp.response;
|
||||
buff[_channels*i+5] = kp.octave;
|
||||
buff[_channels*i+6] = kp.class_id;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public KeyPoint[] toArray() {
|
||||
int num = (int) total();
|
||||
KeyPoint[] a = new KeyPoint[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
float buff[] = new float[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
|
||||
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<KeyPoint> lkp) {
|
||||
KeyPoint akp[] = lkp.toArray(new KeyPoint[0]);
|
||||
fromArray(akp);
|
||||
}
|
||||
|
||||
public List<KeyPoint> toList() {
|
||||
KeyPoint[] akp = toArray();
|
||||
return Arrays.asList(akp);
|
||||
}
|
||||
}
|
||||
@@ -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<num; i++) {
|
||||
Point p = a[i];
|
||||
buff[_channels*i+0] = (int) p.x;
|
||||
buff[_channels*i+1] = (int) p.y;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public Point[] toArray() {
|
||||
int num = (int) total();
|
||||
Point[] ap = new Point[num];
|
||||
if(num == 0)
|
||||
return ap;
|
||||
int buff[] = new int[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
ap[i] = new Point(buff[i*_channels], buff[i*_channels+1]);
|
||||
return ap;
|
||||
}
|
||||
|
||||
public void fromList(List<Point> lp) {
|
||||
Point ap[] = lp.toArray(new Point[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Point> toList() {
|
||||
Point[] ap = toArray();
|
||||
return Arrays.asList(ap);
|
||||
}
|
||||
}
|
||||
@@ -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<num; i++) {
|
||||
Point p = a[i];
|
||||
buff[_channels*i+0] = (float) p.x;
|
||||
buff[_channels*i+1] = (float) p.y;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public Point[] toArray() {
|
||||
int num = (int) total();
|
||||
Point[] ap = new Point[num];
|
||||
if(num == 0)
|
||||
return ap;
|
||||
float buff[] = new float[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
ap[i] = new Point(buff[i*_channels], buff[i*_channels+1]);
|
||||
return ap;
|
||||
}
|
||||
|
||||
public void fromList(List<Point> lp) {
|
||||
Point ap[] = lp.toArray(new Point[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Point> toList() {
|
||||
Point[] ap = toArray();
|
||||
return Arrays.asList(ap);
|
||||
}
|
||||
}
|
||||
@@ -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<num; i++) {
|
||||
Point3 p = a[i];
|
||||
buff[_channels*i+0] = (int) p.x;
|
||||
buff[_channels*i+1] = (int) p.y;
|
||||
buff[_channels*i+2] = (int) p.z;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public Point3[] toArray() {
|
||||
int num = (int) total();
|
||||
Point3[] ap = new Point3[num];
|
||||
if(num == 0)
|
||||
return ap;
|
||||
int buff[] = new int[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
ap[i] = new Point3(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2]);
|
||||
return ap;
|
||||
}
|
||||
|
||||
public void fromList(List<Point3> lp) {
|
||||
Point3 ap[] = lp.toArray(new Point3[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Point3> toList() {
|
||||
Point3[] ap = toArray();
|
||||
return Arrays.asList(ap);
|
||||
}
|
||||
}
|
||||
@@ -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<num; i++) {
|
||||
Point3 p = a[i];
|
||||
buff[_channels*i+0] = (float) p.x;
|
||||
buff[_channels*i+1] = (float) p.y;
|
||||
buff[_channels*i+2] = (float) p.z;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public Point3[] toArray() {
|
||||
int num = (int) total();
|
||||
Point3[] ap = new Point3[num];
|
||||
if(num == 0)
|
||||
return ap;
|
||||
float buff[] = new float[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
ap[i] = new Point3(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2]);
|
||||
return ap;
|
||||
}
|
||||
|
||||
public void fromList(List<Point3> lp) {
|
||||
Point3 ap[] = lp.toArray(new Point3[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Point3> toList() {
|
||||
Point3[] ap = toArray();
|
||||
return Arrays.asList(ap);
|
||||
}
|
||||
}
|
||||
@@ -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<num; i++) {
|
||||
Rect r = a[i];
|
||||
buff[_channels*i+0] = (int) r.x;
|
||||
buff[_channels*i+1] = (int) r.y;
|
||||
buff[_channels*i+2] = (int) r.width;
|
||||
buff[_channels*i+3] = (int) r.height;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
|
||||
public Rect[] toArray() {
|
||||
int num = (int) total();
|
||||
Rect[] a = new Rect[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
int buff[] = new int[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
a[i] = new Rect(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2], buff[i*_channels+3]);
|
||||
return a;
|
||||
}
|
||||
public void fromList(List<Rect> lr) {
|
||||
Rect ap[] = lr.toArray(new Rect[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Rect> toList() {
|
||||
Rect[] ar = toArray();
|
||||
return Arrays.asList(ar);
|
||||
}
|
||||
}
|
||||
@@ -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<num; i++) {
|
||||
Rect2d r = a[i];
|
||||
buff[_channels*i+0] = (double) r.x;
|
||||
buff[_channels*i+1] = (double) r.y;
|
||||
buff[_channels*i+2] = (double) r.width;
|
||||
buff[_channels*i+3] = (double) r.height;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
|
||||
public Rect2d[] toArray() {
|
||||
int num = (int) total();
|
||||
Rect2d[] a = new Rect2d[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
double buff[] = new double[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
a[i] = new Rect2d(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2], buff[i*_channels+3]);
|
||||
return a;
|
||||
}
|
||||
public void fromList(List<Rect2d> lr) {
|
||||
Rect2d ap[] = lr.toArray(new Rect2d[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Rect2d> toList() {
|
||||
Rect2d[] ar = toArray();
|
||||
return Arrays.asList(ar);
|
||||
}
|
||||
}
|
||||
@@ -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 + "}";
|
||||
}
|
||||
}
|
||||
@@ -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 + "}";
|
||||
}
|
||||
}
|
||||
@@ -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 + ")";
|
||||
}
|
||||
}
|
||||
@@ -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 + "}";
|
||||
}
|
||||
}
|
||||
@@ -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 + "}";
|
||||
}
|
||||
}
|
||||
@@ -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.x = 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 + " }";
|
||||
}
|
||||
}
|
||||
@@ -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] + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 + "}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.core;
|
||||
|
||||
|
||||
|
||||
// C++: class TickMeter
|
||||
//javadoc: TickMeter
|
||||
|
||||
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++: TickMeter()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::TickMeter()
|
||||
public TickMeter()
|
||||
{
|
||||
|
||||
nativeObj = TickMeter_0();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getTimeMicro()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::getTimeMicro()
|
||||
public double getTimeMicro()
|
||||
{
|
||||
|
||||
double retVal = getTimeMicro_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getTimeMilli()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::getTimeMilli()
|
||||
public double getTimeMilli()
|
||||
{
|
||||
|
||||
double retVal = getTimeMilli_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getTimeSec()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::getTimeSec()
|
||||
public double getTimeSec()
|
||||
{
|
||||
|
||||
double retVal = getTimeSec_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int64 getCounter()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::getCounter()
|
||||
public long getCounter()
|
||||
{
|
||||
|
||||
long retVal = getCounter_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int64 getTimeTicks()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::getTimeTicks()
|
||||
public long getTimeTicks()
|
||||
{
|
||||
|
||||
long retVal = getTimeTicks_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void reset()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::reset()
|
||||
public void reset()
|
||||
{
|
||||
|
||||
reset_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void start()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::start()
|
||||
public void start()
|
||||
{
|
||||
|
||||
start_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void stop()
|
||||
//
|
||||
|
||||
//javadoc: TickMeter::stop()
|
||||
public void stop()
|
||||
{
|
||||
|
||||
stop_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: TickMeter()
|
||||
private static native long TickMeter_0();
|
||||
|
||||
// C++: double getTimeMicro()
|
||||
private static native double getTimeMicro_0(long nativeObj);
|
||||
|
||||
// C++: double getTimeMilli()
|
||||
private static native double getTimeMilli_0(long nativeObj);
|
||||
|
||||
// C++: double getTimeSec()
|
||||
private static native double getTimeSec_0(long nativeObj);
|
||||
|
||||
// C++: int64 getCounter()
|
||||
private static native long getCounter_0(long nativeObj);
|
||||
|
||||
// C++: int64 getTimeTicks()
|
||||
private static native long getTimeTicks_0(long nativeObj);
|
||||
|
||||
// C++: void reset()
|
||||
private static native void reset_0(long nativeObj);
|
||||
|
||||
// C++: void start()
|
||||
private static native void start_0(long nativeObj);
|
||||
|
||||
// C++: void stop()
|
||||
private static native void stop_0(long nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.dnn;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
// C++: class DictValue
|
||||
//javadoc: DictValue
|
||||
|
||||
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++: DictValue(String s)
|
||||
//
|
||||
|
||||
//javadoc: DictValue::DictValue(s)
|
||||
public DictValue(String s)
|
||||
{
|
||||
|
||||
nativeObj = DictValue_0(s);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: DictValue(double p)
|
||||
//
|
||||
|
||||
//javadoc: DictValue::DictValue(p)
|
||||
public DictValue(double p)
|
||||
{
|
||||
|
||||
nativeObj = DictValue_1(p);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: DictValue(int i)
|
||||
//
|
||||
|
||||
//javadoc: DictValue::DictValue(i)
|
||||
public DictValue(int i)
|
||||
{
|
||||
|
||||
nativeObj = DictValue_2(i);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getStringValue(int idx = -1)
|
||||
//
|
||||
|
||||
//javadoc: DictValue::getStringValue(idx)
|
||||
public String getStringValue(int idx)
|
||||
{
|
||||
|
||||
String retVal = getStringValue_0(nativeObj, idx);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: DictValue::getStringValue()
|
||||
public String getStringValue()
|
||||
{
|
||||
|
||||
String retVal = getStringValue_1(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool isInt()
|
||||
//
|
||||
|
||||
//javadoc: DictValue::isInt()
|
||||
public boolean isInt()
|
||||
{
|
||||
|
||||
boolean retVal = isInt_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool isReal()
|
||||
//
|
||||
|
||||
//javadoc: DictValue::isReal()
|
||||
public boolean isReal()
|
||||
{
|
||||
|
||||
boolean retVal = isReal_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool isString()
|
||||
//
|
||||
|
||||
//javadoc: DictValue::isString()
|
||||
public boolean isString()
|
||||
{
|
||||
|
||||
boolean retVal = isString_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getRealValue(int idx = -1)
|
||||
//
|
||||
|
||||
//javadoc: DictValue::getRealValue(idx)
|
||||
public double getRealValue(int idx)
|
||||
{
|
||||
|
||||
double retVal = getRealValue_0(nativeObj, idx);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: DictValue::getRealValue()
|
||||
public double getRealValue()
|
||||
{
|
||||
|
||||
double retVal = getRealValue_1(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getIntValue(int idx = -1)
|
||||
//
|
||||
|
||||
//javadoc: DictValue::getIntValue(idx)
|
||||
public int getIntValue(int idx)
|
||||
{
|
||||
|
||||
int retVal = getIntValue_0(nativeObj, idx);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: DictValue::getIntValue()
|
||||
public int getIntValue()
|
||||
{
|
||||
|
||||
int retVal = getIntValue_1(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: DictValue(String s)
|
||||
private static native long DictValue_0(String s);
|
||||
|
||||
// C++: DictValue(double p)
|
||||
private static native long DictValue_1(double p);
|
||||
|
||||
// C++: DictValue(int i)
|
||||
private static native long DictValue_2(int i);
|
||||
|
||||
// C++: String getStringValue(int idx = -1)
|
||||
private static native String getStringValue_0(long nativeObj, int idx);
|
||||
private static native String getStringValue_1(long nativeObj);
|
||||
|
||||
// C++: bool isInt()
|
||||
private static native boolean isInt_0(long nativeObj);
|
||||
|
||||
// C++: bool isReal()
|
||||
private static native boolean isReal_0(long nativeObj);
|
||||
|
||||
// C++: bool isString()
|
||||
private static native boolean isString_0(long nativeObj);
|
||||
|
||||
// C++: double getRealValue(int idx = -1)
|
||||
private static native double getRealValue_0(long nativeObj, int idx);
|
||||
private static native double getRealValue_1(long nativeObj);
|
||||
|
||||
// C++: int getIntValue(int idx = -1)
|
||||
private static native int getIntValue_0(long nativeObj, int idx);
|
||||
private static native int getIntValue_1(long nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.dnn;
|
||||
|
||||
import java.lang.String;
|
||||
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.core.MatOfRect;
|
||||
import org.opencv.core.Scalar;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.dnn.Net;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class Dnn
|
||||
//javadoc: Dnn
|
||||
|
||||
public class Dnn {
|
||||
|
||||
public static final int
|
||||
DNN_BACKEND_DEFAULT = 0,
|
||||
DNN_BACKEND_HALIDE = 1,
|
||||
DNN_BACKEND_INFERENCE_ENGINE = 2,
|
||||
DNN_BACKEND_OPENCV = 3,
|
||||
DNN_TARGET_CPU = 0,
|
||||
DNN_TARGET_OPENCL = 1,
|
||||
DNN_TARGET_OPENCL_FP16 = 2,
|
||||
DNN_TARGET_MYRIAD = 3;
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat blobFromImage(Mat image, double scalefactor = 1.0, Size size = Size(), Scalar mean = Scalar(), bool swapRB = true, bool crop = true)
|
||||
//
|
||||
|
||||
//javadoc: blobFromImage(image, scalefactor, size, mean, swapRB, crop)
|
||||
public static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop)
|
||||
{
|
||||
|
||||
Mat retVal = 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));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: blobFromImage(image)
|
||||
public static Mat blobFromImage(Mat image)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(blobFromImage_1(image.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat blobFromImages(vector_Mat images, double scalefactor = 1.0, Size size = Size(), Scalar mean = Scalar(), bool swapRB = true, bool crop = true)
|
||||
//
|
||||
|
||||
//javadoc: blobFromImages(images, scalefactor, size, mean, swapRB, crop)
|
||||
public static Mat blobFromImages(List<Mat> images, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop)
|
||||
{
|
||||
Mat images_mat = Converters.vector_Mat_to_Mat(images);
|
||||
Mat retVal = 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));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: blobFromImages(images)
|
||||
public static Mat blobFromImages(List<Mat> images)
|
||||
{
|
||||
Mat images_mat = Converters.vector_Mat_to_Mat(images);
|
||||
Mat retVal = new Mat(blobFromImages_1(images_mat.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat readTorchBlob(String filename, bool isBinary = true)
|
||||
//
|
||||
|
||||
//javadoc: readTorchBlob(filename, isBinary)
|
||||
public static Mat readTorchBlob(String filename, boolean isBinary)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(readTorchBlob_0(filename, isBinary));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: readTorchBlob(filename)
|
||||
public static Mat readTorchBlob(String filename)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(readTorchBlob_1(filename));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Net readNet(String model, String config = "", String framework = "")
|
||||
//
|
||||
|
||||
//javadoc: readNet(model, config, framework)
|
||||
public static Net readNet(String model, String config, String framework)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNet_0(model, config, framework));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: readNet(model)
|
||||
public static Net readNet(String model)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNet_1(model));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Net readNetFromCaffe(String prototxt, String caffeModel = String())
|
||||
//
|
||||
|
||||
//javadoc: readNetFromCaffe(prototxt, caffeModel)
|
||||
public static Net readNetFromCaffe(String prototxt, String caffeModel)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromCaffe_0(prototxt, caffeModel));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: readNetFromCaffe(prototxt)
|
||||
public static Net readNetFromCaffe(String prototxt)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromCaffe_1(prototxt));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Net readNetFromDarknet(String cfgFile, String darknetModel = String())
|
||||
//
|
||||
|
||||
//javadoc: readNetFromDarknet(cfgFile, darknetModel)
|
||||
public static Net readNetFromDarknet(String cfgFile, String darknetModel)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromDarknet_0(cfgFile, darknetModel));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: readNetFromDarknet(cfgFile)
|
||||
public static Net readNetFromDarknet(String cfgFile)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromDarknet_1(cfgFile));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Net readNetFromModelOptimizer(String xml, String bin)
|
||||
//
|
||||
|
||||
//javadoc: readNetFromModelOptimizer(xml, bin)
|
||||
public static Net readNetFromModelOptimizer(String xml, String bin)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromModelOptimizer_0(xml, bin));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Net readNetFromTensorflow(String model, String config = String())
|
||||
//
|
||||
|
||||
//javadoc: readNetFromTensorflow(model, config)
|
||||
public static Net readNetFromTensorflow(String model, String config)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromTensorflow_0(model, config));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: readNetFromTensorflow(model)
|
||||
public static Net readNetFromTensorflow(String model)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromTensorflow_1(model));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Net readNetFromTorch(String model, bool isBinary = true)
|
||||
//
|
||||
|
||||
//javadoc: readNetFromTorch(model, isBinary)
|
||||
public static Net readNetFromTorch(String model, boolean isBinary)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromTorch_0(model, isBinary));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: readNetFromTorch(model)
|
||||
public static Net readNetFromTorch(String model)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readNetFromTorch_1(model));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void NMSBoxes(vector_Rect bboxes, vector_float scores, float score_threshold, float nms_threshold, vector_int& indices, float eta = 1.f, int top_k = 0)
|
||||
//
|
||||
|
||||
//javadoc: NMSBoxes(bboxes, scores, score_threshold, nms_threshold, indices, eta, top_k)
|
||||
public static void NMSBoxes(MatOfRect 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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: NMSBoxes(bboxes, scores, score_threshold, nms_threshold, indices)
|
||||
public static void NMSBoxes(MatOfRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices)
|
||||
{
|
||||
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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void imagesFromBlob(Mat blob_, vector_Mat& images_)
|
||||
//
|
||||
|
||||
//javadoc: imagesFromBlob(blob_, images_)
|
||||
public static void imagesFromBlob(Mat blob_, List<Mat> images_)
|
||||
{
|
||||
Mat images__mat = new Mat();
|
||||
imagesFromBlob_0(blob_.nativeObj, images__mat.nativeObj);
|
||||
Converters.Mat_to_vector_Mat(images__mat, images_);
|
||||
images__mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void shrinkCaffeModel(String src, String dst, vector_String layersTypes = std::vector<String>())
|
||||
//
|
||||
|
||||
//javadoc: shrinkCaffeModel(src, dst, layersTypes)
|
||||
public static void shrinkCaffeModel(String src, String dst, List<String> layersTypes)
|
||||
{
|
||||
|
||||
shrinkCaffeModel_0(src, dst, layersTypes);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: shrinkCaffeModel(src, dst)
|
||||
public static void shrinkCaffeModel(String src, String dst)
|
||||
{
|
||||
|
||||
shrinkCaffeModel_1(src, dst);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// C++: Mat blobFromImage(Mat image, double scalefactor = 1.0, Size size = Size(), Scalar mean = Scalar(), bool swapRB = true, bool crop = true)
|
||||
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);
|
||||
private static native long blobFromImage_1(long image_nativeObj);
|
||||
|
||||
// C++: Mat blobFromImages(vector_Mat images, double scalefactor = 1.0, Size size = Size(), Scalar mean = Scalar(), bool swapRB = true, bool crop = true)
|
||||
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);
|
||||
private static native long blobFromImages_1(long images_mat_nativeObj);
|
||||
|
||||
// C++: Mat 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 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);
|
||||
|
||||
// C++: Net 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 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 readNetFromModelOptimizer(String xml, String bin)
|
||||
private static native long readNetFromModelOptimizer_0(String xml, String bin);
|
||||
|
||||
// C++: Net 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 readNetFromTorch(String model, bool isBinary = true)
|
||||
private static native long readNetFromTorch_0(String model, boolean isBinary);
|
||||
private static native long readNetFromTorch_1(String model);
|
||||
|
||||
// C++: void NMSBoxes(vector_Rect 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);
|
||||
|
||||
// C++: void imagesFromBlob(Mat blob_, vector_Mat& images_)
|
||||
private static native void imagesFromBlob_0(long blob__nativeObj, long images__mat_nativeObj);
|
||||
|
||||
// C++: void shrinkCaffeModel(String src, String dst, vector_String layersTypes = std::vector<String>())
|
||||
private static native void shrinkCaffeModel_0(String src, String dst, List<String> layersTypes);
|
||||
private static native void shrinkCaffeModel_1(String src, String dst);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.dnn;
|
||||
|
||||
import java.lang.String;
|
||||
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
|
||||
//javadoc: Layer
|
||||
|
||||
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++: int outputNameToIndex(String outputName)
|
||||
//
|
||||
|
||||
//javadoc: Layer::outputNameToIndex(outputName)
|
||||
public int outputNameToIndex(String outputName)
|
||||
{
|
||||
|
||||
int retVal = outputNameToIndex_0(nativeObj, outputName);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: vector_Mat finalize(vector_Mat inputs)
|
||||
//
|
||||
|
||||
//javadoc: Layer::finalize(inputs)
|
||||
public List<Mat> finalize(List<Mat> inputs)
|
||||
{
|
||||
Mat inputs_mat = Converters.vector_Mat_to_Mat(inputs);
|
||||
List<Mat> retVal = new ArrayList<Mat>();
|
||||
Mat retValMat = new Mat(finalize_0(nativeObj, inputs_mat.nativeObj));
|
||||
Converters.Mat_to_vector_Mat(retValMat, retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void finalize(vector_Mat inputs, vector_Mat& outputs)
|
||||
//
|
||||
|
||||
//javadoc: Layer::finalize(inputs, outputs)
|
||||
public void finalize(List<Mat> inputs, List<Mat> outputs)
|
||||
{
|
||||
Mat inputs_mat = Converters.vector_Mat_to_Mat(inputs);
|
||||
Mat outputs_mat = new Mat();
|
||||
finalize_1(nativeObj, inputs_mat.nativeObj, outputs_mat.nativeObj);
|
||||
Converters.Mat_to_vector_Mat(outputs_mat, outputs);
|
||||
outputs_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void run(vector_Mat inputs, vector_Mat& outputs, vector_Mat& internals)
|
||||
//
|
||||
|
||||
//javadoc: Layer::run(inputs, outputs, internals)
|
||||
public void run(List<Mat> inputs, List<Mat> outputs, List<Mat> 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();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: vector_Mat Layer::blobs
|
||||
//
|
||||
|
||||
//javadoc: Layer::get_blobs()
|
||||
public List<Mat> get_blobs()
|
||||
{
|
||||
List<Mat> retVal = new ArrayList<Mat>();
|
||||
Mat retValMat = new Mat(get_blobs_0(nativeObj));
|
||||
Converters.Mat_to_vector_Mat(retValMat, retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Layer::blobs
|
||||
//
|
||||
|
||||
//javadoc: Layer::set_blobs(blobs)
|
||||
public void set_blobs(List<Mat> blobs)
|
||||
{
|
||||
Mat blobs_mat = Converters.vector_Mat_to_Mat(blobs);
|
||||
set_blobs_0(nativeObj, blobs_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String Layer::name
|
||||
//
|
||||
|
||||
//javadoc: Layer::get_name()
|
||||
public String get_name()
|
||||
{
|
||||
|
||||
String retVal = get_name_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String Layer::type
|
||||
//
|
||||
|
||||
//javadoc: Layer::get_type()
|
||||
public String get_type()
|
||||
{
|
||||
|
||||
String retVal = get_type_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int Layer::preferableTarget
|
||||
//
|
||||
|
||||
//javadoc: Layer::get_preferableTarget()
|
||||
public int get_preferableTarget()
|
||||
{
|
||||
|
||||
int retVal = get_preferableTarget_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: int outputNameToIndex(String outputName)
|
||||
private static native int outputNameToIndex_0(long nativeObj, String outputName);
|
||||
|
||||
// C++: vector_Mat finalize(vector_Mat inputs)
|
||||
private static native long finalize_0(long nativeObj, long inputs_mat_nativeObj);
|
||||
|
||||
// C++: void finalize(vector_Mat inputs, vector_Mat& outputs)
|
||||
private static native void finalize_1(long nativeObj, long inputs_mat_nativeObj, long outputs_mat_nativeObj);
|
||||
|
||||
// C++: void 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++: 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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,622 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.dnn;
|
||||
|
||||
import java.lang.String;
|
||||
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.dnn.DictValue;
|
||||
import org.opencv.dnn.Layer;
|
||||
import org.opencv.dnn.Net;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class Net
|
||||
//javadoc: Net
|
||||
|
||||
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++: Net()
|
||||
//
|
||||
|
||||
//javadoc: Net::Net()
|
||||
public Net()
|
||||
{
|
||||
|
||||
nativeObj = Net_0();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat forward(String outputName = String())
|
||||
//
|
||||
|
||||
//javadoc: Net::forward(outputName)
|
||||
public Mat forward(String outputName)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(forward_0(nativeObj, outputName));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: Net::forward()
|
||||
public Mat forward()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(forward_1(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getParam(LayerId layer, int numParam = 0)
|
||||
//
|
||||
|
||||
//javadoc: Net::getParam(layer, numParam)
|
||||
public Mat getParam(DictValue layer, int numParam)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getParam_0(nativeObj, layer.getNativeObjAddr(), numParam));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: Net::getParam(layer)
|
||||
public Mat getParam(DictValue layer)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getParam_1(nativeObj, layer.getNativeObjAddr()));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Net readFromModelOptimizer(String xml, String bin)
|
||||
//
|
||||
|
||||
//javadoc: Net::readFromModelOptimizer(xml, bin)
|
||||
public static Net readFromModelOptimizer(String xml, String bin)
|
||||
{
|
||||
|
||||
Net retVal = new Net(readFromModelOptimizer_0(xml, bin));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Ptr_Layer getLayer(LayerId layerId)
|
||||
//
|
||||
|
||||
//javadoc: Net::getLayer(layerId)
|
||||
public Layer getLayer(DictValue layerId)
|
||||
{
|
||||
|
||||
Layer retVal = Layer.__fromPtr__(getLayer_0(nativeObj, layerId.getNativeObjAddr()));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool empty()
|
||||
//
|
||||
|
||||
//javadoc: Net::empty()
|
||||
public boolean empty()
|
||||
{
|
||||
|
||||
boolean retVal = empty_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getLayerId(String layer)
|
||||
//
|
||||
|
||||
//javadoc: Net::getLayerId(layer)
|
||||
public int getLayerId(String layer)
|
||||
{
|
||||
|
||||
int retVal = getLayerId_0(nativeObj, layer);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getLayersCount(String layerType)
|
||||
//
|
||||
|
||||
//javadoc: Net::getLayersCount(layerType)
|
||||
public int getLayersCount(String layerType)
|
||||
{
|
||||
|
||||
int retVal = getLayersCount_0(nativeObj, layerType);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int64 getFLOPS(MatShape netInputShape)
|
||||
//
|
||||
|
||||
//javadoc: Net::getFLOPS(netInputShape)
|
||||
public long getFLOPS(MatOfInt netInputShape)
|
||||
{
|
||||
Mat netInputShape_mat = netInputShape;
|
||||
long retVal = getFLOPS_0(nativeObj, netInputShape_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int64 getFLOPS(int layerId, MatShape netInputShape)
|
||||
//
|
||||
|
||||
//javadoc: Net::getFLOPS(layerId, netInputShape)
|
||||
public long getFLOPS(int layerId, MatOfInt netInputShape)
|
||||
{
|
||||
Mat netInputShape_mat = netInputShape;
|
||||
long retVal = getFLOPS_1(nativeObj, layerId, netInputShape_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int64 getFLOPS(int layerId, vector_MatShape netInputShapes)
|
||||
//
|
||||
|
||||
//javadoc: Net::getFLOPS(layerId, netInputShapes)
|
||||
public long getFLOPS(int layerId, List<MatOfInt> netInputShapes)
|
||||
{
|
||||
|
||||
long retVal = getFLOPS_2(nativeObj, layerId, netInputShapes);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int64 getFLOPS(vector_MatShape netInputShapes)
|
||||
//
|
||||
|
||||
//javadoc: Net::getFLOPS(netInputShapes)
|
||||
public long getFLOPS(List<MatOfInt> netInputShapes)
|
||||
{
|
||||
|
||||
long retVal = getFLOPS_3(nativeObj, netInputShapes);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int64 getPerfProfile(vector_double& timings)
|
||||
//
|
||||
|
||||
//javadoc: Net::getPerfProfile(timings)
|
||||
public long getPerfProfile(MatOfDouble timings)
|
||||
{
|
||||
Mat timings_mat = timings;
|
||||
long retVal = getPerfProfile_0(nativeObj, timings_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: vector_String getLayerNames()
|
||||
//
|
||||
|
||||
//javadoc: Net::getLayerNames()
|
||||
public List<String> getLayerNames()
|
||||
{
|
||||
|
||||
List<String> retVal = getLayerNames_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: vector_int getUnconnectedOutLayers()
|
||||
//
|
||||
|
||||
//javadoc: Net::getUnconnectedOutLayers()
|
||||
public MatOfInt getUnconnectedOutLayers()
|
||||
{
|
||||
|
||||
MatOfInt retVal = MatOfInt.fromNativeAddr(getUnconnectedOutLayers_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void connect(String outPin, String inpPin)
|
||||
//
|
||||
|
||||
//javadoc: Net::connect(outPin, inpPin)
|
||||
public void connect(String outPin, String inpPin)
|
||||
{
|
||||
|
||||
connect_0(nativeObj, outPin, inpPin);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void deleteLayer(LayerId layer)
|
||||
//
|
||||
|
||||
//javadoc: Net::deleteLayer(layer)
|
||||
public void deleteLayer(DictValue layer)
|
||||
{
|
||||
|
||||
deleteLayer_0(nativeObj, layer.getNativeObjAddr());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void enableFusion(bool fusion)
|
||||
//
|
||||
|
||||
//javadoc: Net::enableFusion(fusion)
|
||||
public void enableFusion(boolean fusion)
|
||||
{
|
||||
|
||||
enableFusion_0(nativeObj, fusion);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void forward(vector_Mat& outputBlobs, String outputName = String())
|
||||
//
|
||||
|
||||
//javadoc: Net::forward(outputBlobs, outputName)
|
||||
public void forward(List<Mat> 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();
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: Net::forward(outputBlobs)
|
||||
public void forward(List<Mat> outputBlobs)
|
||||
{
|
||||
Mat outputBlobs_mat = new Mat();
|
||||
forward_3(nativeObj, outputBlobs_mat.nativeObj);
|
||||
Converters.Mat_to_vector_Mat(outputBlobs_mat, outputBlobs);
|
||||
outputBlobs_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void forward(vector_Mat& outputBlobs, vector_String outBlobNames)
|
||||
//
|
||||
|
||||
//javadoc: Net::forward(outputBlobs, outBlobNames)
|
||||
public void forward(List<Mat> outputBlobs, List<String> outBlobNames)
|
||||
{
|
||||
Mat outputBlobs_mat = new Mat();
|
||||
forward_4(nativeObj, outputBlobs_mat.nativeObj, outBlobNames);
|
||||
Converters.Mat_to_vector_Mat(outputBlobs_mat, outputBlobs);
|
||||
outputBlobs_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void forward(vector_vector_Mat& outputBlobs, vector_String outBlobNames)
|
||||
//
|
||||
|
||||
// Unknown type 'vector_vector_Mat' (O), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: void getLayerTypes(vector_String& layersTypes)
|
||||
//
|
||||
|
||||
//javadoc: Net::getLayerTypes(layersTypes)
|
||||
public void getLayerTypes(List<String> layersTypes)
|
||||
{
|
||||
|
||||
getLayerTypes_0(nativeObj, layersTypes);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getLayersShapes(MatShape netInputShape, vector_int& layersIds, vector_vector_MatShape& inLayersShapes, vector_vector_MatShape& outLayersShapes)
|
||||
//
|
||||
|
||||
// Unknown type 'vector_vector_MatShape' (O), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: void 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 getMemoryConsumption(MatShape netInputShape, size_t& weights, size_t& blobs)
|
||||
//
|
||||
|
||||
//javadoc: Net::getMemoryConsumption(netInputShape, weights, 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];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getMemoryConsumption(int layerId, MatShape netInputShape, size_t& weights, size_t& blobs)
|
||||
//
|
||||
|
||||
//javadoc: Net::getMemoryConsumption(layerId, netInputShape, weights, 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_1(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];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getMemoryConsumption(int layerId, vector_MatShape netInputShapes, size_t& weights, size_t& blobs)
|
||||
//
|
||||
|
||||
//javadoc: Net::getMemoryConsumption(layerId, netInputShapes, weights, blobs)
|
||||
public void getMemoryConsumption(int layerId, List<MatOfInt> netInputShapes, long[] weights, long[] blobs)
|
||||
{
|
||||
double[] weights_out = new double[1];
|
||||
double[] blobs_out = new double[1];
|
||||
getMemoryConsumption_2(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];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setHalideScheduler(String scheduler)
|
||||
//
|
||||
|
||||
//javadoc: Net::setHalideScheduler(scheduler)
|
||||
public void setHalideScheduler(String scheduler)
|
||||
{
|
||||
|
||||
setHalideScheduler_0(nativeObj, scheduler);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setInput(Mat blob, String name = "")
|
||||
//
|
||||
|
||||
//javadoc: Net::setInput(blob, name)
|
||||
public void setInput(Mat blob, String name)
|
||||
{
|
||||
|
||||
setInput_0(nativeObj, blob.nativeObj, name);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: Net::setInput(blob)
|
||||
public void setInput(Mat blob)
|
||||
{
|
||||
|
||||
setInput_1(nativeObj, blob.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setInputsNames(vector_String inputBlobNames)
|
||||
//
|
||||
|
||||
//javadoc: Net::setInputsNames(inputBlobNames)
|
||||
public void setInputsNames(List<String> inputBlobNames)
|
||||
{
|
||||
|
||||
setInputsNames_0(nativeObj, inputBlobNames);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setParam(LayerId layer, int numParam, Mat blob)
|
||||
//
|
||||
|
||||
//javadoc: Net::setParam(layer, numParam, blob)
|
||||
public void setParam(DictValue layer, int numParam, Mat blob)
|
||||
{
|
||||
|
||||
setParam_0(nativeObj, layer.getNativeObjAddr(), numParam, blob.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPreferableBackend(int backendId)
|
||||
//
|
||||
|
||||
//javadoc: Net::setPreferableBackend(backendId)
|
||||
public void setPreferableBackend(int backendId)
|
||||
{
|
||||
|
||||
setPreferableBackend_0(nativeObj, backendId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPreferableTarget(int targetId)
|
||||
//
|
||||
|
||||
//javadoc: Net::setPreferableTarget(targetId)
|
||||
public void setPreferableTarget(int targetId)
|
||||
{
|
||||
|
||||
setPreferableTarget_0(nativeObj, targetId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Net()
|
||||
private static native long Net_0();
|
||||
|
||||
// C++: Mat forward(String outputName = String())
|
||||
private static native long forward_0(long nativeObj, String outputName);
|
||||
private static native long forward_1(long nativeObj);
|
||||
|
||||
// C++: Mat 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++: static Net readFromModelOptimizer(String xml, String bin)
|
||||
private static native long readFromModelOptimizer_0(String xml, String bin);
|
||||
|
||||
// C++: Ptr_Layer getLayer(LayerId layerId)
|
||||
private static native long getLayer_0(long nativeObj, long layerId_nativeObj);
|
||||
|
||||
// C++: bool empty()
|
||||
private static native boolean empty_0(long nativeObj);
|
||||
|
||||
// C++: int getLayerId(String layer)
|
||||
private static native int getLayerId_0(long nativeObj, String layer);
|
||||
|
||||
// C++: int getLayersCount(String layerType)
|
||||
private static native int getLayersCount_0(long nativeObj, String layerType);
|
||||
|
||||
// C++: int64 getFLOPS(MatShape netInputShape)
|
||||
private static native long getFLOPS_0(long nativeObj, long netInputShape_mat_nativeObj);
|
||||
|
||||
// C++: int64 getFLOPS(int layerId, MatShape netInputShape)
|
||||
private static native long getFLOPS_1(long nativeObj, int layerId, long netInputShape_mat_nativeObj);
|
||||
|
||||
// C++: int64 getFLOPS(int layerId, vector_MatShape netInputShapes)
|
||||
private static native long getFLOPS_2(long nativeObj, int layerId, List<MatOfInt> netInputShapes);
|
||||
|
||||
// C++: int64 getFLOPS(vector_MatShape netInputShapes)
|
||||
private static native long getFLOPS_3(long nativeObj, List<MatOfInt> netInputShapes);
|
||||
|
||||
// C++: int64 getPerfProfile(vector_double& timings)
|
||||
private static native long getPerfProfile_0(long nativeObj, long timings_mat_nativeObj);
|
||||
|
||||
// C++: vector_String getLayerNames()
|
||||
private static native List<String> getLayerNames_0(long nativeObj);
|
||||
|
||||
// C++: vector_int getUnconnectedOutLayers()
|
||||
private static native long getUnconnectedOutLayers_0(long nativeObj);
|
||||
|
||||
// C++: void connect(String outPin, String inpPin)
|
||||
private static native void connect_0(long nativeObj, String outPin, String inpPin);
|
||||
|
||||
// C++: void deleteLayer(LayerId layer)
|
||||
private static native void deleteLayer_0(long nativeObj, long layer_nativeObj);
|
||||
|
||||
// C++: void enableFusion(bool fusion)
|
||||
private static native void enableFusion_0(long nativeObj, boolean fusion);
|
||||
|
||||
// C++: void 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 forward(vector_Mat& outputBlobs, vector_String outBlobNames)
|
||||
private static native void forward_4(long nativeObj, long outputBlobs_mat_nativeObj, List<String> outBlobNames);
|
||||
|
||||
// C++: void getLayerTypes(vector_String& layersTypes)
|
||||
private static native void getLayerTypes_0(long nativeObj, List<String> layersTypes);
|
||||
|
||||
// C++: void 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 getMemoryConsumption(int layerId, MatShape netInputShape, size_t& weights, size_t& blobs)
|
||||
private static native void getMemoryConsumption_1(long nativeObj, int layerId, long netInputShape_mat_nativeObj, double[] weights_out, double[] blobs_out);
|
||||
|
||||
// C++: void getMemoryConsumption(int layerId, vector_MatShape netInputShapes, size_t& weights, size_t& blobs)
|
||||
private static native void getMemoryConsumption_2(long nativeObj, int layerId, List<MatOfInt> netInputShapes, double[] weights_out, double[] blobs_out);
|
||||
|
||||
// C++: void setHalideScheduler(String scheduler)
|
||||
private static native void setHalideScheduler_0(long nativeObj, String scheduler);
|
||||
|
||||
// C++: void setInput(Mat blob, String name = "")
|
||||
private static native void setInput_0(long nativeObj, long blob_nativeObj, String name);
|
||||
private static native void setInput_1(long nativeObj, long blob_nativeObj);
|
||||
|
||||
// C++: void setInputsNames(vector_String inputBlobNames)
|
||||
private static native void setInputsNames_0(long nativeObj, List<String> inputBlobNames);
|
||||
|
||||
// C++: void setParam(LayerId layer, int numParam, Mat blob)
|
||||
private static native void setParam_0(long nativeObj, long layer_nativeObj, int numParam, long blob_nativeObj);
|
||||
|
||||
// C++: void setPreferableBackend(int backendId)
|
||||
private static native void setPreferableBackend_0(long nativeObj, int backendId);
|
||||
|
||||
// C++: void setPreferableTarget(int targetId)
|
||||
private static native void setPreferableTarget_0(long nativeObj, int targetId);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.features2d.AKAZE;
|
||||
import org.opencv.features2d.Feature2D;
|
||||
|
||||
// C++: class AKAZE
|
||||
//javadoc: AKAZE
|
||||
|
||||
public class AKAZE extends Feature2D {
|
||||
|
||||
protected AKAZE(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static AKAZE __fromPtr__(long addr) { return new AKAZE(addr); }
|
||||
|
||||
public static final int
|
||||
DESCRIPTOR_KAZE_UPRIGHT = 2,
|
||||
DESCRIPTOR_KAZE = 3,
|
||||
DESCRIPTOR_MLDB_UPRIGHT = 4,
|
||||
DESCRIPTOR_MLDB = 5;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_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)
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::create(descriptor_type, descriptor_size, descriptor_channels, threshold, nOctaves, nOctaveLayers, diffusivity)
|
||||
public static AKAZE create(int descriptor_type, int descriptor_size, int descriptor_channels, float threshold, int nOctaves, int nOctaveLayers, int diffusivity)
|
||||
{
|
||||
|
||||
AKAZE retVal = AKAZE.__fromPtr__(create_0(descriptor_type, descriptor_size, descriptor_channels, threshold, nOctaves, nOctaveLayers, diffusivity));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: AKAZE::create()
|
||||
public static AKAZE create()
|
||||
{
|
||||
|
||||
AKAZE retVal = AKAZE.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getThreshold()
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::getThreshold()
|
||||
public double getThreshold()
|
||||
{
|
||||
|
||||
double retVal = getThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getDescriptorChannels()
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::getDescriptorChannels()
|
||||
public int getDescriptorChannels()
|
||||
{
|
||||
|
||||
int retVal = getDescriptorChannels_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getDescriptorSize()
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::getDescriptorSize()
|
||||
public int getDescriptorSize()
|
||||
{
|
||||
|
||||
int retVal = getDescriptorSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getDescriptorType()
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::getDescriptorType()
|
||||
public int getDescriptorType()
|
||||
{
|
||||
|
||||
int retVal = getDescriptorType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getDiffusivity()
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::getDiffusivity()
|
||||
public int getDiffusivity()
|
||||
{
|
||||
|
||||
int retVal = getDiffusivity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNOctaveLayers()
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::getNOctaveLayers()
|
||||
public int getNOctaveLayers()
|
||||
{
|
||||
|
||||
int retVal = getNOctaveLayers_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNOctaves()
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::getNOctaves()
|
||||
public int getNOctaves()
|
||||
{
|
||||
|
||||
int retVal = getNOctaves_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDescriptorChannels(int dch)
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::setDescriptorChannels(dch)
|
||||
public void setDescriptorChannels(int dch)
|
||||
{
|
||||
|
||||
setDescriptorChannels_0(nativeObj, dch);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDescriptorSize(int dsize)
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::setDescriptorSize(dsize)
|
||||
public void setDescriptorSize(int dsize)
|
||||
{
|
||||
|
||||
setDescriptorSize_0(nativeObj, dsize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDescriptorType(int dtype)
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::setDescriptorType(dtype)
|
||||
public void setDescriptorType(int dtype)
|
||||
{
|
||||
|
||||
setDescriptorType_0(nativeObj, dtype);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDiffusivity(int diff)
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::setDiffusivity(diff)
|
||||
public void setDiffusivity(int diff)
|
||||
{
|
||||
|
||||
setDiffusivity_0(nativeObj, diff);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNOctaveLayers(int octaveLayers)
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::setNOctaveLayers(octaveLayers)
|
||||
public void setNOctaveLayers(int octaveLayers)
|
||||
{
|
||||
|
||||
setNOctaveLayers_0(nativeObj, octaveLayers);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNOctaves(int octaves)
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::setNOctaves(octaves)
|
||||
public void setNOctaves(int octaves)
|
||||
{
|
||||
|
||||
setNOctaves_0(nativeObj, octaves);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setThreshold(double threshold)
|
||||
//
|
||||
|
||||
//javadoc: AKAZE::setThreshold(threshold)
|
||||
public void setThreshold(double threshold)
|
||||
{
|
||||
|
||||
setThreshold_0(nativeObj, threshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_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();
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: double getThreshold()
|
||||
private static native double getThreshold_0(long nativeObj);
|
||||
|
||||
// C++: int getDescriptorChannels()
|
||||
private static native int getDescriptorChannels_0(long nativeObj);
|
||||
|
||||
// C++: int getDescriptorSize()
|
||||
private static native int getDescriptorSize_0(long nativeObj);
|
||||
|
||||
// C++: int getDescriptorType()
|
||||
private static native int getDescriptorType_0(long nativeObj);
|
||||
|
||||
// C++: int getDiffusivity()
|
||||
private static native int getDiffusivity_0(long nativeObj);
|
||||
|
||||
// C++: int getNOctaveLayers()
|
||||
private static native int getNOctaveLayers_0(long nativeObj);
|
||||
|
||||
// C++: int getNOctaves()
|
||||
private static native int getNOctaves_0(long nativeObj);
|
||||
|
||||
// C++: void setDescriptorChannels(int dch)
|
||||
private static native void setDescriptorChannels_0(long nativeObj, int dch);
|
||||
|
||||
// C++: void setDescriptorSize(int dsize)
|
||||
private static native void setDescriptorSize_0(long nativeObj, int dsize);
|
||||
|
||||
// C++: void setDescriptorType(int dtype)
|
||||
private static native void setDescriptorType_0(long nativeObj, int dtype);
|
||||
|
||||
// C++: void setDiffusivity(int diff)
|
||||
private static native void setDiffusivity_0(long nativeObj, int diff);
|
||||
|
||||
// C++: void setNOctaveLayers(int octaveLayers)
|
||||
private static native void setNOctaveLayers_0(long nativeObj, int octaveLayers);
|
||||
|
||||
// C++: void setNOctaves(int octaves)
|
||||
private static native void setNOctaves_0(long nativeObj, int octaves);
|
||||
|
||||
// C++: void setThreshold(double threshold)
|
||||
private static native void setThreshold_0(long nativeObj, double threshold);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.features2d.AgastFeatureDetector;
|
||||
import org.opencv.features2d.Feature2D;
|
||||
|
||||
// C++: class AgastFeatureDetector
|
||||
//javadoc: AgastFeatureDetector
|
||||
|
||||
public class AgastFeatureDetector extends Feature2D {
|
||||
|
||||
protected AgastFeatureDetector(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static AgastFeatureDetector __fromPtr__(long addr) { return new AgastFeatureDetector(addr); }
|
||||
|
||||
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 create(int threshold = 10, bool nonmaxSuppression = true, int type = AgastFeatureDetector::OAST_9_16)
|
||||
//
|
||||
|
||||
//javadoc: AgastFeatureDetector::create(threshold, nonmaxSuppression, type)
|
||||
public static AgastFeatureDetector create(int threshold, boolean nonmaxSuppression, int type)
|
||||
{
|
||||
|
||||
AgastFeatureDetector retVal = AgastFeatureDetector.__fromPtr__(create_0(threshold, nonmaxSuppression, type));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: AgastFeatureDetector::create()
|
||||
public static AgastFeatureDetector create()
|
||||
{
|
||||
|
||||
AgastFeatureDetector retVal = AgastFeatureDetector.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: AgastFeatureDetector::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getNonmaxSuppression()
|
||||
//
|
||||
|
||||
//javadoc: AgastFeatureDetector::getNonmaxSuppression()
|
||||
public boolean getNonmaxSuppression()
|
||||
{
|
||||
|
||||
boolean retVal = getNonmaxSuppression_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getThreshold()
|
||||
//
|
||||
|
||||
//javadoc: AgastFeatureDetector::getThreshold()
|
||||
public int getThreshold()
|
||||
{
|
||||
|
||||
int retVal = getThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getType()
|
||||
//
|
||||
|
||||
//javadoc: AgastFeatureDetector::getType()
|
||||
public int getType()
|
||||
{
|
||||
|
||||
int retVal = getType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNonmaxSuppression(bool f)
|
||||
//
|
||||
|
||||
//javadoc: AgastFeatureDetector::setNonmaxSuppression(f)
|
||||
public void setNonmaxSuppression(boolean f)
|
||||
{
|
||||
|
||||
setNonmaxSuppression_0(nativeObj, f);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setThreshold(int threshold)
|
||||
//
|
||||
|
||||
//javadoc: AgastFeatureDetector::setThreshold(threshold)
|
||||
public void setThreshold(int threshold)
|
||||
{
|
||||
|
||||
setThreshold_0(nativeObj, threshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setType(int type)
|
||||
//
|
||||
|
||||
//javadoc: AgastFeatureDetector::setType(type)
|
||||
public void setType(int type)
|
||||
{
|
||||
|
||||
setType_0(nativeObj, type);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_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();
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: bool getNonmaxSuppression()
|
||||
private static native boolean getNonmaxSuppression_0(long nativeObj);
|
||||
|
||||
// C++: int getThreshold()
|
||||
private static native int getThreshold_0(long nativeObj);
|
||||
|
||||
// C++: int getType()
|
||||
private static native int getType_0(long nativeObj);
|
||||
|
||||
// C++: void setNonmaxSuppression(bool f)
|
||||
private static native void setNonmaxSuppression_0(long nativeObj, boolean f);
|
||||
|
||||
// C++: void setThreshold(int threshold)
|
||||
private static native void setThreshold_0(long nativeObj, int threshold);
|
||||
|
||||
// C++: void setType(int type)
|
||||
private static native void setType_0(long nativeObj, int type);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// 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
|
||||
//javadoc: BFMatcher
|
||||
|
||||
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++: BFMatcher(int normType = NORM_L2, bool crossCheck = false)
|
||||
//
|
||||
|
||||
//javadoc: BFMatcher::BFMatcher(normType, crossCheck)
|
||||
public BFMatcher(int normType, boolean crossCheck)
|
||||
{
|
||||
|
||||
super( BFMatcher_0(normType, crossCheck) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: BFMatcher::BFMatcher()
|
||||
public BFMatcher()
|
||||
{
|
||||
|
||||
super( BFMatcher_1() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_BFMatcher create(int normType = NORM_L2, bool crossCheck = false)
|
||||
//
|
||||
|
||||
//javadoc: BFMatcher::create(normType, crossCheck)
|
||||
public static BFMatcher create(int normType, boolean crossCheck)
|
||||
{
|
||||
|
||||
BFMatcher retVal = BFMatcher.__fromPtr__(create_0(normType, crossCheck));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: BFMatcher::create()
|
||||
public static BFMatcher create()
|
||||
{
|
||||
|
||||
BFMatcher retVal = BFMatcher.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: BFMatcher(int normType = NORM_L2, bool crossCheck = false)
|
||||
private static native long BFMatcher_0(int normType, boolean crossCheck);
|
||||
private static native long BFMatcher_1();
|
||||
|
||||
// C++: static Ptr_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();
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// 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
|
||||
//javadoc: BOWImgDescriptorExtractor
|
||||
|
||||
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++: BOWImgDescriptorExtractor(Ptr_DescriptorExtractor dextractor, Ptr_DescriptorMatcher dmatcher)
|
||||
//
|
||||
|
||||
// Unknown type 'Ptr_DescriptorExtractor' (I), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getVocabulary()
|
||||
//
|
||||
|
||||
//javadoc: BOWImgDescriptorExtractor::getVocabulary()
|
||||
public Mat getVocabulary()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getVocabulary_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int descriptorSize()
|
||||
//
|
||||
|
||||
//javadoc: BOWImgDescriptorExtractor::descriptorSize()
|
||||
public int descriptorSize()
|
||||
{
|
||||
|
||||
int retVal = descriptorSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int descriptorType()
|
||||
//
|
||||
|
||||
//javadoc: BOWImgDescriptorExtractor::descriptorType()
|
||||
public int descriptorType()
|
||||
{
|
||||
|
||||
int retVal = descriptorType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor)
|
||||
//
|
||||
|
||||
//javadoc: BOWImgDescriptorExtractor::compute2(image, keypoints, imgDescriptor)
|
||||
public void compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, imgDescriptor.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setVocabulary(Mat vocabulary)
|
||||
//
|
||||
|
||||
//javadoc: BOWImgDescriptorExtractor::setVocabulary(vocabulary)
|
||||
public void setVocabulary(Mat vocabulary)
|
||||
{
|
||||
|
||||
setVocabulary_0(nativeObj, vocabulary.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat getVocabulary()
|
||||
private static native long getVocabulary_0(long nativeObj);
|
||||
|
||||
// C++: int descriptorSize()
|
||||
private static native int descriptorSize_0(long nativeObj);
|
||||
|
||||
// C++: int descriptorType()
|
||||
private static native int descriptorType_0(long nativeObj);
|
||||
|
||||
// C++: void 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++: void setVocabulary(Mat vocabulary)
|
||||
private static native void setVocabulary_0(long nativeObj, long vocabulary_nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// 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
|
||||
//javadoc: BOWKMeansTrainer
|
||||
|
||||
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++: BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS)
|
||||
//
|
||||
|
||||
//javadoc: BOWKMeansTrainer::BOWKMeansTrainer(clusterCount, termcrit, attempts, flags)
|
||||
public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts, int flags)
|
||||
{
|
||||
|
||||
super( BOWKMeansTrainer_0(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts, flags) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: BOWKMeansTrainer::BOWKMeansTrainer(clusterCount)
|
||||
public BOWKMeansTrainer(int clusterCount)
|
||||
{
|
||||
|
||||
super( BOWKMeansTrainer_1(clusterCount) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat cluster(Mat descriptors)
|
||||
//
|
||||
|
||||
//javadoc: BOWKMeansTrainer::cluster(descriptors)
|
||||
public Mat cluster(Mat descriptors)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(cluster_0(nativeObj, descriptors.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat cluster()
|
||||
//
|
||||
|
||||
//javadoc: BOWKMeansTrainer::cluster()
|
||||
public Mat cluster()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(cluster_1(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: 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);
|
||||
|
||||
// C++: Mat cluster(Mat descriptors)
|
||||
private static native long cluster_0(long nativeObj, long descriptors_nativeObj);
|
||||
|
||||
// C++: Mat cluster()
|
||||
private static native long cluster_1(long nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// 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
|
||||
//javadoc: BOWTrainer
|
||||
|
||||
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++: Mat cluster(Mat descriptors)
|
||||
//
|
||||
|
||||
//javadoc: BOWTrainer::cluster(descriptors)
|
||||
public Mat cluster(Mat descriptors)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(cluster_0(nativeObj, descriptors.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat cluster()
|
||||
//
|
||||
|
||||
//javadoc: BOWTrainer::cluster()
|
||||
public Mat cluster()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(cluster_1(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int descriptorsCount()
|
||||
//
|
||||
|
||||
//javadoc: BOWTrainer::descriptorsCount()
|
||||
public int descriptorsCount()
|
||||
{
|
||||
|
||||
int retVal = descriptorsCount_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: vector_Mat getDescriptors()
|
||||
//
|
||||
|
||||
//javadoc: BOWTrainer::getDescriptors()
|
||||
public List<Mat> getDescriptors()
|
||||
{
|
||||
List<Mat> retVal = new ArrayList<Mat>();
|
||||
Mat retValMat = new Mat(getDescriptors_0(nativeObj));
|
||||
Converters.Mat_to_vector_Mat(retValMat, retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void add(Mat descriptors)
|
||||
//
|
||||
|
||||
//javadoc: BOWTrainer::add(descriptors)
|
||||
public void add(Mat descriptors)
|
||||
{
|
||||
|
||||
add_0(nativeObj, descriptors.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void clear()
|
||||
//
|
||||
|
||||
//javadoc: BOWTrainer::clear()
|
||||
public void clear()
|
||||
{
|
||||
|
||||
clear_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat cluster(Mat descriptors)
|
||||
private static native long cluster_0(long nativeObj, long descriptors_nativeObj);
|
||||
|
||||
// C++: Mat cluster()
|
||||
private static native long cluster_1(long nativeObj);
|
||||
|
||||
// C++: int descriptorsCount()
|
||||
private static native int descriptorsCount_0(long nativeObj);
|
||||
|
||||
// C++: vector_Mat getDescriptors()
|
||||
private static native long getDescriptors_0(long nativeObj);
|
||||
|
||||
// C++: void add(Mat descriptors)
|
||||
private static native void add_0(long nativeObj, long descriptors_nativeObj);
|
||||
|
||||
// C++: void clear()
|
||||
private static native void clear_0(long nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
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
|
||||
//javadoc: BRISK
|
||||
|
||||
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 create(int thresh, int octaves, vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector<int>())
|
||||
//
|
||||
|
||||
//javadoc: BRISK::create(thresh, octaves, radiusList, numberList, dMax, dMin, indexChange)
|
||||
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;
|
||||
BRISK retVal = BRISK.__fromPtr__(create_0(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin, indexChange_mat.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: BRISK::create(thresh, octaves, radiusList, numberList)
|
||||
public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList)
|
||||
{
|
||||
Mat radiusList_mat = radiusList;
|
||||
Mat numberList_mat = numberList;
|
||||
BRISK retVal = BRISK.__fromPtr__(create_1(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_BRISK create(int thresh = 30, int octaves = 3, float patternScale = 1.0f)
|
||||
//
|
||||
|
||||
//javadoc: BRISK::create(thresh, octaves, patternScale)
|
||||
public static BRISK create(int thresh, int octaves, float patternScale)
|
||||
{
|
||||
|
||||
BRISK retVal = BRISK.__fromPtr__(create_2(thresh, octaves, patternScale));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: BRISK::create()
|
||||
public static BRISK create()
|
||||
{
|
||||
|
||||
BRISK retVal = BRISK.__fromPtr__(create_3());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_BRISK create(vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector<int>())
|
||||
//
|
||||
|
||||
//javadoc: BRISK::create(radiusList, numberList, dMax, dMin, indexChange)
|
||||
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;
|
||||
BRISK retVal = BRISK.__fromPtr__(create_4(radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin, indexChange_mat.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: BRISK::create(radiusList, numberList)
|
||||
public static BRISK create(MatOfFloat radiusList, MatOfInt numberList)
|
||||
{
|
||||
Mat radiusList_mat = radiusList;
|
||||
Mat numberList_mat = numberList;
|
||||
BRISK retVal = BRISK.__fromPtr__(create_5(radiusList_mat.nativeObj, numberList_mat.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: BRISK::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_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<int>())
|
||||
private static native long create_0(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_1(int thresh, int octaves, long radiusList_mat_nativeObj, long numberList_mat_nativeObj);
|
||||
|
||||
// C++: static Ptr_BRISK create(int thresh = 30, int octaves = 3, float patternScale = 1.0f)
|
||||
private static native long create_2(int thresh, int octaves, float patternScale);
|
||||
private static native long create_3();
|
||||
|
||||
// C++: static Ptr_BRISK create(vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector<int>())
|
||||
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);
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
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
|
||||
//javadoc: javaDescriptorExtractor
|
||||
@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;
|
||||
|
||||
|
||||
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++: static Ptr_javaDescriptorExtractor create(int extractorType)
|
||||
//
|
||||
|
||||
//javadoc: javaDescriptorExtractor::create(extractorType)
|
||||
public static DescriptorExtractor create(int extractorType)
|
||||
{
|
||||
|
||||
DescriptorExtractor retVal = DescriptorExtractor.__fromPtr__(create_0(extractorType));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool empty()
|
||||
//
|
||||
|
||||
//javadoc: javaDescriptorExtractor::empty()
|
||||
public boolean empty()
|
||||
{
|
||||
|
||||
boolean retVal = empty_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int descriptorSize()
|
||||
//
|
||||
|
||||
//javadoc: javaDescriptorExtractor::descriptorSize()
|
||||
public int descriptorSize()
|
||||
{
|
||||
|
||||
int retVal = descriptorSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int descriptorType()
|
||||
//
|
||||
|
||||
//javadoc: javaDescriptorExtractor::descriptorType()
|
||||
public int descriptorType()
|
||||
{
|
||||
|
||||
int retVal = descriptorType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void compute(Mat image, vector_KeyPoint& keypoints, Mat descriptors)
|
||||
//
|
||||
|
||||
//javadoc: javaDescriptorExtractor::compute(image, keypoints, descriptors)
|
||||
public void compute(Mat image, MatOfKeyPoint keypoints, Mat descriptors)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, descriptors.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void compute(vector_Mat images, vector_vector_KeyPoint& keypoints, vector_Mat& descriptors)
|
||||
//
|
||||
|
||||
//javadoc: javaDescriptorExtractor::compute(images, keypoints, descriptors)
|
||||
public void compute(List<Mat> images, List<MatOfKeyPoint> keypoints, List<Mat> descriptors)
|
||||
{
|
||||
Mat images_mat = Converters.vector_Mat_to_Mat(images);
|
||||
List<Mat> keypoints_tmplm = new ArrayList<Mat>((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();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void read(String fileName)
|
||||
//
|
||||
|
||||
//javadoc: javaDescriptorExtractor::read(fileName)
|
||||
public void read(String fileName)
|
||||
{
|
||||
|
||||
read_0(nativeObj, fileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void write(String fileName)
|
||||
//
|
||||
|
||||
//javadoc: javaDescriptorExtractor::write(fileName)
|
||||
public void write(String fileName)
|
||||
{
|
||||
|
||||
write_0(nativeObj, fileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_javaDescriptorExtractor create(int extractorType)
|
||||
private static native long create_0(int extractorType);
|
||||
|
||||
// C++: bool empty()
|
||||
private static native boolean empty_0(long nativeObj);
|
||||
|
||||
// C++: int descriptorSize()
|
||||
private static native int descriptorSize_0(long nativeObj);
|
||||
|
||||
// C++: int descriptorType()
|
||||
private static native int descriptorType_0(long nativeObj);
|
||||
|
||||
// C++: void 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 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++: void read(String fileName)
|
||||
private static native void read_0(long nativeObj, String fileName);
|
||||
|
||||
// C++: void write(String fileName)
|
||||
private static native void write_0(long nativeObj, String fileName);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+428
@@ -0,0 +1,428 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
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
|
||||
//javadoc: DescriptorMatcher
|
||||
|
||||
public class DescriptorMatcher extends Algorithm {
|
||||
|
||||
protected DescriptorMatcher(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static DescriptorMatcher __fromPtr__(long addr) { return new DescriptorMatcher(addr); }
|
||||
|
||||
public static final int
|
||||
FLANNBASED = 1,
|
||||
BRUTEFORCE = 2,
|
||||
BRUTEFORCE_L1 = 3,
|
||||
BRUTEFORCE_HAMMING = 4,
|
||||
BRUTEFORCE_HAMMINGLUT = 5,
|
||||
BRUTEFORCE_SL2 = 6;
|
||||
|
||||
|
||||
//
|
||||
// C++: Ptr_DescriptorMatcher clone(bool emptyTrainData = false)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::clone(emptyTrainData)
|
||||
public DescriptorMatcher clone(boolean emptyTrainData)
|
||||
{
|
||||
|
||||
DescriptorMatcher retVal = DescriptorMatcher.__fromPtr__(clone_0(nativeObj, emptyTrainData));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: DescriptorMatcher::clone()
|
||||
public DescriptorMatcher clone()
|
||||
{
|
||||
|
||||
DescriptorMatcher retVal = DescriptorMatcher.__fromPtr__(clone_1(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_DescriptorMatcher create(String descriptorMatcherType)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::create(descriptorMatcherType)
|
||||
public static DescriptorMatcher create(String descriptorMatcherType)
|
||||
{
|
||||
|
||||
DescriptorMatcher retVal = DescriptorMatcher.__fromPtr__(create_0(descriptorMatcherType));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_DescriptorMatcher create(int matcherType)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::create(matcherType)
|
||||
public static DescriptorMatcher create(int matcherType)
|
||||
{
|
||||
|
||||
DescriptorMatcher retVal = DescriptorMatcher.__fromPtr__(create_1(matcherType));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool empty()
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::empty()
|
||||
public boolean empty()
|
||||
{
|
||||
|
||||
boolean retVal = empty_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool isMaskSupported()
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::isMaskSupported()
|
||||
public boolean isMaskSupported()
|
||||
{
|
||||
|
||||
boolean retVal = isMaskSupported_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: vector_Mat getTrainDescriptors()
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::getTrainDescriptors()
|
||||
public List<Mat> getTrainDescriptors()
|
||||
{
|
||||
List<Mat> retVal = new ArrayList<Mat>();
|
||||
Mat retValMat = new Mat(getTrainDescriptors_0(nativeObj));
|
||||
Converters.Mat_to_vector_Mat(retValMat, retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void add(vector_Mat descriptors)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::add(descriptors)
|
||||
public void add(List<Mat> descriptors)
|
||||
{
|
||||
Mat descriptors_mat = Converters.vector_Mat_to_Mat(descriptors);
|
||||
add_0(nativeObj, descriptors_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void clear()
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::clear()
|
||||
public void clear()
|
||||
{
|
||||
|
||||
clear_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void knnMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, int k, Mat mask = Mat(), bool compactResult = false)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::knnMatch(queryDescriptors, trainDescriptors, matches, k, mask, compactResult)
|
||||
public void knnMatch(Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> 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();
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: DescriptorMatcher::knnMatch(queryDescriptors, trainDescriptors, matches, k)
|
||||
public void knnMatch(Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, int k)
|
||||
{
|
||||
Mat matches_mat = new Mat();
|
||||
knnMatch_1(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, k);
|
||||
Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
|
||||
matches_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void knnMatch(Mat queryDescriptors, vector_vector_DMatch& matches, int k, vector_Mat masks = vector_Mat(), bool compactResult = false)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::knnMatch(queryDescriptors, matches, k, masks, compactResult)
|
||||
public void knnMatch(Mat queryDescriptors, List<MatOfDMatch> matches, int k, List<Mat> masks, boolean compactResult)
|
||||
{
|
||||
Mat matches_mat = new Mat();
|
||||
Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
|
||||
knnMatch_2(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, k, masks_mat.nativeObj, compactResult);
|
||||
Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
|
||||
matches_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: DescriptorMatcher::knnMatch(queryDescriptors, matches, k)
|
||||
public void knnMatch(Mat queryDescriptors, List<MatOfDMatch> matches, int k)
|
||||
{
|
||||
Mat matches_mat = new Mat();
|
||||
knnMatch_3(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, k);
|
||||
Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
|
||||
matches_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void match(Mat queryDescriptors, Mat trainDescriptors, vector_DMatch& matches, Mat mask = Mat())
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::match(queryDescriptors, trainDescriptors, matches, mask)
|
||||
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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: DescriptorMatcher::match(queryDescriptors, trainDescriptors, matches)
|
||||
public void match(Mat queryDescriptors, Mat trainDescriptors, MatOfDMatch matches)
|
||||
{
|
||||
Mat matches_mat = matches;
|
||||
match_1(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void match(Mat queryDescriptors, vector_DMatch& matches, vector_Mat masks = vector_Mat())
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::match(queryDescriptors, matches, masks)
|
||||
public void match(Mat queryDescriptors, MatOfDMatch matches, List<Mat> 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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: DescriptorMatcher::match(queryDescriptors, matches)
|
||||
public void match(Mat queryDescriptors, MatOfDMatch matches)
|
||||
{
|
||||
Mat matches_mat = matches;
|
||||
match_3(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void radiusMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, float maxDistance, Mat mask = Mat(), bool compactResult = false)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, trainDescriptors, matches, maxDistance, mask, compactResult)
|
||||
public void radiusMatch(Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> 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();
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, trainDescriptors, matches, maxDistance)
|
||||
public void radiusMatch(Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, float maxDistance)
|
||||
{
|
||||
Mat matches_mat = new Mat();
|
||||
radiusMatch_1(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, maxDistance);
|
||||
Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
|
||||
matches_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void radiusMatch(Mat queryDescriptors, vector_vector_DMatch& matches, float maxDistance, vector_Mat masks = vector_Mat(), bool compactResult = false)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, matches, maxDistance, masks, compactResult)
|
||||
public void radiusMatch(Mat queryDescriptors, List<MatOfDMatch> matches, float maxDistance, List<Mat> masks, boolean compactResult)
|
||||
{
|
||||
Mat matches_mat = new Mat();
|
||||
Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
|
||||
radiusMatch_2(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, maxDistance, masks_mat.nativeObj, compactResult);
|
||||
Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
|
||||
matches_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, matches, maxDistance)
|
||||
public void radiusMatch(Mat queryDescriptors, List<MatOfDMatch> matches, float maxDistance)
|
||||
{
|
||||
Mat matches_mat = new Mat();
|
||||
radiusMatch_3(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, maxDistance);
|
||||
Converters.Mat_to_vector_vector_DMatch(matches_mat, matches);
|
||||
matches_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void read(FileNode arg1)
|
||||
//
|
||||
|
||||
// Unknown type 'FileNode' (I), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: void read(String fileName)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::read(fileName)
|
||||
public void read(String fileName)
|
||||
{
|
||||
|
||||
read_0(nativeObj, fileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void train()
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::train()
|
||||
public void train()
|
||||
{
|
||||
|
||||
train_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void write(Ptr_FileStorage fs, String name = String())
|
||||
//
|
||||
|
||||
// Unknown type 'Ptr_FileStorage' (I), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: void write(String fileName)
|
||||
//
|
||||
|
||||
//javadoc: DescriptorMatcher::write(fileName)
|
||||
public void write(String fileName)
|
||||
{
|
||||
|
||||
write_0(nativeObj, fileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Ptr_DescriptorMatcher clone(bool emptyTrainData = false)
|
||||
private static native long clone_0(long nativeObj, boolean emptyTrainData);
|
||||
private static native long clone_1(long nativeObj);
|
||||
|
||||
// C++: static Ptr_DescriptorMatcher create(String descriptorMatcherType)
|
||||
private static native long create_0(String descriptorMatcherType);
|
||||
|
||||
// C++: static Ptr_DescriptorMatcher create(int matcherType)
|
||||
private static native long create_1(int matcherType);
|
||||
|
||||
// C++: bool empty()
|
||||
private static native boolean empty_0(long nativeObj);
|
||||
|
||||
// C++: bool isMaskSupported()
|
||||
private static native boolean isMaskSupported_0(long nativeObj);
|
||||
|
||||
// C++: vector_Mat getTrainDescriptors()
|
||||
private static native long getTrainDescriptors_0(long nativeObj);
|
||||
|
||||
// C++: void add(vector_Mat descriptors)
|
||||
private static native void add_0(long nativeObj, long descriptors_mat_nativeObj);
|
||||
|
||||
// C++: void clear()
|
||||
private static native void clear_0(long nativeObj);
|
||||
|
||||
// C++: void knnMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, int k, Mat mask = Mat(), bool compactResult = false)
|
||||
private static native void knnMatch_0(long nativeObj, long queryDescriptors_nativeObj, long trainDescriptors_nativeObj, long matches_mat_nativeObj, int k, long mask_nativeObj, boolean compactResult);
|
||||
private static native void knnMatch_1(long nativeObj, long queryDescriptors_nativeObj, long trainDescriptors_nativeObj, long matches_mat_nativeObj, int k);
|
||||
|
||||
// C++: void knnMatch(Mat queryDescriptors, vector_vector_DMatch& matches, int k, vector_Mat masks = vector_Mat(), bool compactResult = false)
|
||||
private static native void knnMatch_2(long nativeObj, long queryDescriptors_nativeObj, long matches_mat_nativeObj, int k, long masks_mat_nativeObj, boolean compactResult);
|
||||
private static native void knnMatch_3(long nativeObj, long queryDescriptors_nativeObj, long matches_mat_nativeObj, int k);
|
||||
|
||||
// C++: void match(Mat queryDescriptors, Mat trainDescriptors, vector_DMatch& matches, Mat mask = Mat())
|
||||
private static native void match_0(long nativeObj, long queryDescriptors_nativeObj, long trainDescriptors_nativeObj, long matches_mat_nativeObj, long mask_nativeObj);
|
||||
private static native void match_1(long nativeObj, long queryDescriptors_nativeObj, long trainDescriptors_nativeObj, long matches_mat_nativeObj);
|
||||
|
||||
// C++: void match(Mat queryDescriptors, vector_DMatch& matches, vector_Mat masks = vector_Mat())
|
||||
private static native void match_2(long nativeObj, long queryDescriptors_nativeObj, long matches_mat_nativeObj, long masks_mat_nativeObj);
|
||||
private static native void match_3(long nativeObj, long queryDescriptors_nativeObj, long matches_mat_nativeObj);
|
||||
|
||||
// C++: void radiusMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, float maxDistance, Mat mask = Mat(), bool compactResult = false)
|
||||
private static native void radiusMatch_0(long nativeObj, long queryDescriptors_nativeObj, long trainDescriptors_nativeObj, long matches_mat_nativeObj, float maxDistance, long mask_nativeObj, boolean compactResult);
|
||||
private static native void radiusMatch_1(long nativeObj, long queryDescriptors_nativeObj, long trainDescriptors_nativeObj, long matches_mat_nativeObj, float maxDistance);
|
||||
|
||||
// C++: void radiusMatch(Mat queryDescriptors, vector_vector_DMatch& matches, float maxDistance, vector_Mat masks = vector_Mat(), bool compactResult = false)
|
||||
private static native void radiusMatch_2(long nativeObj, long queryDescriptors_nativeObj, long matches_mat_nativeObj, float maxDistance, long masks_mat_nativeObj, boolean compactResult);
|
||||
private static native void radiusMatch_3(long nativeObj, long queryDescriptors_nativeObj, long matches_mat_nativeObj, float maxDistance);
|
||||
|
||||
// C++: void read(String fileName)
|
||||
private static native void read_0(long nativeObj, String fileName);
|
||||
|
||||
// C++: void train()
|
||||
private static native void train_0(long nativeObj);
|
||||
|
||||
// C++: void write(String fileName)
|
||||
private static native void write_0(long nativeObj, String fileName);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.features2d.FastFeatureDetector;
|
||||
import org.opencv.features2d.Feature2D;
|
||||
|
||||
// C++: class FastFeatureDetector
|
||||
//javadoc: FastFeatureDetector
|
||||
|
||||
public class FastFeatureDetector extends Feature2D {
|
||||
|
||||
protected FastFeatureDetector(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static FastFeatureDetector __fromPtr__(long addr) { return new FastFeatureDetector(addr); }
|
||||
|
||||
public static final int
|
||||
TYPE_5_8 = 0,
|
||||
TYPE_7_12 = 1,
|
||||
TYPE_9_16 = 2,
|
||||
THRESHOLD = 10000,
|
||||
NONMAX_SUPPRESSION = 10001,
|
||||
FAST_N = 10002;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_FastFeatureDetector create(int threshold = 10, bool nonmaxSuppression = true, int type = FastFeatureDetector::TYPE_9_16)
|
||||
//
|
||||
|
||||
//javadoc: FastFeatureDetector::create(threshold, nonmaxSuppression, type)
|
||||
public static FastFeatureDetector create(int threshold, boolean nonmaxSuppression, int type)
|
||||
{
|
||||
|
||||
FastFeatureDetector retVal = FastFeatureDetector.__fromPtr__(create_0(threshold, nonmaxSuppression, type));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: FastFeatureDetector::create()
|
||||
public static FastFeatureDetector create()
|
||||
{
|
||||
|
||||
FastFeatureDetector retVal = FastFeatureDetector.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: FastFeatureDetector::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getNonmaxSuppression()
|
||||
//
|
||||
|
||||
//javadoc: FastFeatureDetector::getNonmaxSuppression()
|
||||
public boolean getNonmaxSuppression()
|
||||
{
|
||||
|
||||
boolean retVal = getNonmaxSuppression_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getThreshold()
|
||||
//
|
||||
|
||||
//javadoc: FastFeatureDetector::getThreshold()
|
||||
public int getThreshold()
|
||||
{
|
||||
|
||||
int retVal = getThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getType()
|
||||
//
|
||||
|
||||
//javadoc: FastFeatureDetector::getType()
|
||||
public int getType()
|
||||
{
|
||||
|
||||
int retVal = getType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNonmaxSuppression(bool f)
|
||||
//
|
||||
|
||||
//javadoc: FastFeatureDetector::setNonmaxSuppression(f)
|
||||
public void setNonmaxSuppression(boolean f)
|
||||
{
|
||||
|
||||
setNonmaxSuppression_0(nativeObj, f);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setThreshold(int threshold)
|
||||
//
|
||||
|
||||
//javadoc: FastFeatureDetector::setThreshold(threshold)
|
||||
public void setThreshold(int threshold)
|
||||
{
|
||||
|
||||
setThreshold_0(nativeObj, threshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setType(int type)
|
||||
//
|
||||
|
||||
//javadoc: FastFeatureDetector::setType(type)
|
||||
public void setType(int type)
|
||||
{
|
||||
|
||||
setType_0(nativeObj, type);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_FastFeatureDetector create(int threshold = 10, bool nonmaxSuppression = true, int type = FastFeatureDetector::TYPE_9_16)
|
||||
private static native long create_0(int threshold, boolean nonmaxSuppression, int type);
|
||||
private static native long create_1();
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: bool getNonmaxSuppression()
|
||||
private static native boolean getNonmaxSuppression_0(long nativeObj);
|
||||
|
||||
// C++: int getThreshold()
|
||||
private static native int getThreshold_0(long nativeObj);
|
||||
|
||||
// C++: int getType()
|
||||
private static native int getType_0(long nativeObj);
|
||||
|
||||
// C++: void setNonmaxSuppression(bool f)
|
||||
private static native void setNonmaxSuppression_0(long nativeObj, boolean f);
|
||||
|
||||
// C++: void setThreshold(int threshold)
|
||||
private static native void setThreshold_0(long nativeObj, int threshold);
|
||||
|
||||
// C++: void setType(int type)
|
||||
private static native void setType_0(long nativeObj, int type);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Algorithm;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfKeyPoint;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class Feature2D
|
||||
//javadoc: Feature2D
|
||||
|
||||
public class Feature2D extends Algorithm {
|
||||
|
||||
protected Feature2D(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static Feature2D __fromPtr__(long addr) { return new Feature2D(addr); }
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool empty()
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::empty()
|
||||
public boolean empty()
|
||||
{
|
||||
|
||||
boolean retVal = empty_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int defaultNorm()
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::defaultNorm()
|
||||
public int defaultNorm()
|
||||
{
|
||||
|
||||
int retVal = defaultNorm_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int descriptorSize()
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::descriptorSize()
|
||||
public int descriptorSize()
|
||||
{
|
||||
|
||||
int retVal = descriptorSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int descriptorType()
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::descriptorType()
|
||||
public int descriptorType()
|
||||
{
|
||||
|
||||
int retVal = descriptorType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void compute(Mat image, vector_KeyPoint& keypoints, Mat& descriptors)
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::compute(image, keypoints, descriptors)
|
||||
public void compute(Mat image, MatOfKeyPoint keypoints, Mat descriptors)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, descriptors.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void compute(vector_Mat images, vector_vector_KeyPoint& keypoints, vector_Mat& descriptors)
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::compute(images, keypoints, descriptors)
|
||||
public void compute(List<Mat> images, List<MatOfKeyPoint> keypoints, List<Mat> descriptors)
|
||||
{
|
||||
Mat images_mat = Converters.vector_Mat_to_Mat(images);
|
||||
List<Mat> keypoints_tmplm = new ArrayList<Mat>((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();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detect(Mat image, vector_KeyPoint& keypoints, Mat mask = Mat())
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::detect(image, keypoints, mask)
|
||||
public void detect(Mat image, MatOfKeyPoint keypoints, Mat mask)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
detect_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, mask.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: Feature2D::detect(image, keypoints)
|
||||
public void detect(Mat image, MatOfKeyPoint keypoints)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
detect_1(nativeObj, image.nativeObj, keypoints_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detect(vector_Mat images, vector_vector_KeyPoint& keypoints, vector_Mat masks = vector_Mat())
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::detect(images, keypoints, masks)
|
||||
public void detect(List<Mat> images, List<MatOfKeyPoint> keypoints, List<Mat> masks)
|
||||
{
|
||||
Mat images_mat = Converters.vector_Mat_to_Mat(images);
|
||||
Mat keypoints_mat = new Mat();
|
||||
Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
|
||||
detect_2(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj, masks_mat.nativeObj);
|
||||
Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
|
||||
keypoints_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: Feature2D::detect(images, keypoints)
|
||||
public void detect(List<Mat> images, List<MatOfKeyPoint> keypoints)
|
||||
{
|
||||
Mat images_mat = Converters.vector_Mat_to_Mat(images);
|
||||
Mat keypoints_mat = new Mat();
|
||||
detect_3(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj);
|
||||
Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
|
||||
keypoints_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detectAndCompute(Mat image, Mat mask, vector_KeyPoint& keypoints, Mat& descriptors, bool useProvidedKeypoints = false)
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::detectAndCompute(image, mask, keypoints, descriptors, useProvidedKeypoints)
|
||||
public void detectAndCompute(Mat image, Mat mask, MatOfKeyPoint keypoints, Mat descriptors, boolean useProvidedKeypoints)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
detectAndCompute_0(nativeObj, image.nativeObj, mask.nativeObj, keypoints_mat.nativeObj, descriptors.nativeObj, useProvidedKeypoints);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: Feature2D::detectAndCompute(image, mask, keypoints, descriptors)
|
||||
public void detectAndCompute(Mat image, Mat mask, MatOfKeyPoint keypoints, Mat descriptors)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
detectAndCompute_1(nativeObj, image.nativeObj, mask.nativeObj, keypoints_mat.nativeObj, descriptors.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void read(FileNode arg1)
|
||||
//
|
||||
|
||||
// Unknown type 'FileNode' (I), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: void read(String fileName)
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::read(fileName)
|
||||
public void read(String fileName)
|
||||
{
|
||||
|
||||
read_0(nativeObj, fileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void write(Ptr_FileStorage fs, String name = String())
|
||||
//
|
||||
|
||||
// Unknown type 'Ptr_FileStorage' (I), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: void write(String fileName)
|
||||
//
|
||||
|
||||
//javadoc: Feature2D::write(fileName)
|
||||
public void write(String fileName)
|
||||
{
|
||||
|
||||
write_0(nativeObj, fileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: bool empty()
|
||||
private static native boolean empty_0(long nativeObj);
|
||||
|
||||
// C++: int defaultNorm()
|
||||
private static native int defaultNorm_0(long nativeObj);
|
||||
|
||||
// C++: int descriptorSize()
|
||||
private static native int descriptorSize_0(long nativeObj);
|
||||
|
||||
// C++: int descriptorType()
|
||||
private static native int descriptorType_0(long nativeObj);
|
||||
|
||||
// C++: void 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 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++: void detect(Mat image, vector_KeyPoint& keypoints, Mat mask = Mat())
|
||||
private static native void detect_0(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj, long mask_nativeObj);
|
||||
private static native void detect_1(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj);
|
||||
|
||||
// C++: void detect(vector_Mat images, vector_vector_KeyPoint& keypoints, vector_Mat masks = vector_Mat())
|
||||
private static native void detect_2(long nativeObj, long images_mat_nativeObj, long keypoints_mat_nativeObj, long masks_mat_nativeObj);
|
||||
private static native void detect_3(long nativeObj, long images_mat_nativeObj, long keypoints_mat_nativeObj);
|
||||
|
||||
// C++: void detectAndCompute(Mat image, Mat mask, vector_KeyPoint& keypoints, Mat& descriptors, bool useProvidedKeypoints = false)
|
||||
private static native void detectAndCompute_0(long nativeObj, long image_nativeObj, long mask_nativeObj, long keypoints_mat_nativeObj, long descriptors_nativeObj, boolean useProvidedKeypoints);
|
||||
private static native void detectAndCompute_1(long nativeObj, long image_nativeObj, long mask_nativeObj, long keypoints_mat_nativeObj, long descriptors_nativeObj);
|
||||
|
||||
// C++: void read(String fileName)
|
||||
private static native void read_0(long nativeObj, String fileName);
|
||||
|
||||
// C++: void write(String fileName)
|
||||
private static native void write_0(long nativeObj, String fileName);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfKeyPoint;
|
||||
import org.opencv.features2d.FeatureDetector;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class javaFeatureDetector
|
||||
//javadoc: javaFeatureDetector
|
||||
@Deprecated
|
||||
public class FeatureDetector {
|
||||
|
||||
protected final long nativeObj;
|
||||
protected FeatureDetector(long addr) { nativeObj = addr; }
|
||||
|
||||
public long getNativeObjAddr() { return nativeObj; }
|
||||
|
||||
// internal usage only
|
||||
public static FeatureDetector __fromPtr__(long addr) { return new FeatureDetector(addr); }
|
||||
|
||||
private static final int
|
||||
GRIDDETECTOR = 1000,
|
||||
PYRAMIDDETECTOR = 2000,
|
||||
DYNAMICDETECTOR = 3000;
|
||||
|
||||
|
||||
public static final int
|
||||
FAST = 1,
|
||||
STAR = 2,
|
||||
SIFT = 3,
|
||||
SURF = 4,
|
||||
ORB = 5,
|
||||
MSER = 6,
|
||||
GFTT = 7,
|
||||
HARRIS = 8,
|
||||
SIMPLEBLOB = 9,
|
||||
DENSE = 10,
|
||||
BRISK = 11,
|
||||
AKAZE = 12,
|
||||
GRID_FAST = GRIDDETECTOR + FAST,
|
||||
GRID_STAR = GRIDDETECTOR + STAR,
|
||||
GRID_SIFT = GRIDDETECTOR + SIFT,
|
||||
GRID_SURF = GRIDDETECTOR + SURF,
|
||||
GRID_ORB = GRIDDETECTOR + ORB,
|
||||
GRID_MSER = GRIDDETECTOR + MSER,
|
||||
GRID_GFTT = GRIDDETECTOR + GFTT,
|
||||
GRID_HARRIS = GRIDDETECTOR + HARRIS,
|
||||
GRID_SIMPLEBLOB = GRIDDETECTOR + SIMPLEBLOB,
|
||||
GRID_DENSE = GRIDDETECTOR + DENSE,
|
||||
GRID_BRISK = GRIDDETECTOR + BRISK,
|
||||
GRID_AKAZE = GRIDDETECTOR + AKAZE,
|
||||
PYRAMID_FAST = PYRAMIDDETECTOR + FAST,
|
||||
PYRAMID_STAR = PYRAMIDDETECTOR + STAR,
|
||||
PYRAMID_SIFT = PYRAMIDDETECTOR + SIFT,
|
||||
PYRAMID_SURF = PYRAMIDDETECTOR + SURF,
|
||||
PYRAMID_ORB = PYRAMIDDETECTOR + ORB,
|
||||
PYRAMID_MSER = PYRAMIDDETECTOR + MSER,
|
||||
PYRAMID_GFTT = PYRAMIDDETECTOR + GFTT,
|
||||
PYRAMID_HARRIS = PYRAMIDDETECTOR + HARRIS,
|
||||
PYRAMID_SIMPLEBLOB = PYRAMIDDETECTOR + SIMPLEBLOB,
|
||||
PYRAMID_DENSE = PYRAMIDDETECTOR + DENSE,
|
||||
PYRAMID_BRISK = PYRAMIDDETECTOR + BRISK,
|
||||
PYRAMID_AKAZE = PYRAMIDDETECTOR + AKAZE,
|
||||
DYNAMIC_FAST = DYNAMICDETECTOR + FAST,
|
||||
DYNAMIC_STAR = DYNAMICDETECTOR + STAR,
|
||||
DYNAMIC_SIFT = DYNAMICDETECTOR + SIFT,
|
||||
DYNAMIC_SURF = DYNAMICDETECTOR + SURF,
|
||||
DYNAMIC_ORB = DYNAMICDETECTOR + ORB,
|
||||
DYNAMIC_MSER = DYNAMICDETECTOR + MSER,
|
||||
DYNAMIC_GFTT = DYNAMICDETECTOR + GFTT,
|
||||
DYNAMIC_HARRIS = DYNAMICDETECTOR + HARRIS,
|
||||
DYNAMIC_SIMPLEBLOB = DYNAMICDETECTOR + SIMPLEBLOB,
|
||||
DYNAMIC_DENSE = DYNAMICDETECTOR + DENSE,
|
||||
DYNAMIC_BRISK = DYNAMICDETECTOR + BRISK,
|
||||
DYNAMIC_AKAZE = DYNAMICDETECTOR + AKAZE;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_javaFeatureDetector create(int detectorType)
|
||||
//
|
||||
|
||||
//javadoc: javaFeatureDetector::create(detectorType)
|
||||
@Deprecated
|
||||
public static FeatureDetector create(int detectorType)
|
||||
{
|
||||
|
||||
FeatureDetector retVal = FeatureDetector.__fromPtr__(create_0(detectorType));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool empty()
|
||||
//
|
||||
|
||||
//javadoc: javaFeatureDetector::empty()
|
||||
public boolean empty()
|
||||
{
|
||||
|
||||
boolean retVal = empty_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detect(Mat image, vector_KeyPoint& keypoints, Mat mask = Mat())
|
||||
//
|
||||
|
||||
//javadoc: javaFeatureDetector::detect(image, keypoints, mask)
|
||||
public void detect(Mat image, MatOfKeyPoint keypoints, Mat mask)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
detect_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, mask.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: javaFeatureDetector::detect(image, keypoints)
|
||||
public void detect(Mat image, MatOfKeyPoint keypoints)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
detect_1(nativeObj, image.nativeObj, keypoints_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detect(vector_Mat images, vector_vector_KeyPoint& keypoints, vector_Mat masks = std::vector<Mat>())
|
||||
//
|
||||
|
||||
//javadoc: javaFeatureDetector::detect(images, keypoints, masks)
|
||||
public void detect(List<Mat> images, List<MatOfKeyPoint> keypoints, List<Mat> masks)
|
||||
{
|
||||
Mat images_mat = Converters.vector_Mat_to_Mat(images);
|
||||
Mat keypoints_mat = new Mat();
|
||||
Mat masks_mat = Converters.vector_Mat_to_Mat(masks);
|
||||
detect_2(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj, masks_mat.nativeObj);
|
||||
Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
|
||||
keypoints_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: javaFeatureDetector::detect(images, keypoints)
|
||||
public void detect(List<Mat> images, List<MatOfKeyPoint> keypoints)
|
||||
{
|
||||
Mat images_mat = Converters.vector_Mat_to_Mat(images);
|
||||
Mat keypoints_mat = new Mat();
|
||||
detect_3(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj);
|
||||
Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints);
|
||||
keypoints_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void read(String fileName)
|
||||
//
|
||||
|
||||
//javadoc: javaFeatureDetector::read(fileName)
|
||||
public void read(String fileName)
|
||||
{
|
||||
|
||||
read_0(nativeObj, fileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void write(String fileName)
|
||||
//
|
||||
|
||||
//javadoc: javaFeatureDetector::write(fileName)
|
||||
public void write(String fileName)
|
||||
{
|
||||
|
||||
write_0(nativeObj, fileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_javaFeatureDetector create(int detectorType)
|
||||
private static native long create_0(int detectorType);
|
||||
|
||||
// C++: bool empty()
|
||||
private static native boolean empty_0(long nativeObj);
|
||||
|
||||
// C++: void detect(Mat image, vector_KeyPoint& keypoints, Mat mask = Mat())
|
||||
private static native void detect_0(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj, long mask_nativeObj);
|
||||
private static native void detect_1(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj);
|
||||
|
||||
// C++: void detect(vector_Mat images, vector_vector_KeyPoint& keypoints, vector_Mat masks = std::vector<Mat>())
|
||||
private static native void detect_2(long nativeObj, long images_mat_nativeObj, long keypoints_mat_nativeObj, long masks_mat_nativeObj);
|
||||
private static native void detect_3(long nativeObj, long images_mat_nativeObj, long keypoints_mat_nativeObj);
|
||||
|
||||
// C++: void read(String fileName)
|
||||
private static native void read_0(long nativeObj, String fileName);
|
||||
|
||||
// C++: void write(String fileName)
|
||||
private static native void write_0(long nativeObj, String fileName);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
//
|
||||
// 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.MatOfByte;
|
||||
import org.opencv.core.MatOfDMatch;
|
||||
import org.opencv.core.MatOfKeyPoint;
|
||||
import org.opencv.core.Scalar;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class Features2d
|
||||
//javadoc: Features2d
|
||||
|
||||
public class Features2d {
|
||||
|
||||
public static final int
|
||||
DRAW_OVER_OUTIMG = 1,
|
||||
NOT_DRAW_SINGLE_POINTS = 2,
|
||||
DRAW_RICH_KEYPOINTS = 4;
|
||||
|
||||
|
||||
//
|
||||
// C++: void drawKeypoints(Mat image, vector_KeyPoint keypoints, Mat& outImage, Scalar color = Scalar::all(-1), int flags = DrawMatchesFlags::DEFAULT)
|
||||
//
|
||||
|
||||
//javadoc: drawKeypoints(image, keypoints, outImage, color, flags)
|
||||
public static void drawKeypoints(Mat image, MatOfKeyPoint keypoints, Mat outImage, Scalar color, int flags)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
drawKeypoints_0(image.nativeObj, keypoints_mat.nativeObj, outImage.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], flags);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: drawKeypoints(image, keypoints, outImage)
|
||||
public static void drawKeypoints(Mat image, MatOfKeyPoint keypoints, Mat outImage)
|
||||
{
|
||||
Mat keypoints_mat = keypoints;
|
||||
drawKeypoints_1(image.nativeObj, keypoints_mat.nativeObj, outImage.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_char matchesMask = std::vector<char>(), int flags = DrawMatchesFlags::DEFAULT)
|
||||
//
|
||||
|
||||
//javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchColor, singlePointColor, matchesMask, flags)
|
||||
public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask, int flags)
|
||||
{
|
||||
Mat keypoints1_mat = keypoints1;
|
||||
Mat keypoints2_mat = keypoints2;
|
||||
Mat matches1to2_mat = matches1to2;
|
||||
Mat matchesMask_mat = matchesMask;
|
||||
drawMatches_0(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg)
|
||||
public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg)
|
||||
{
|
||||
Mat keypoints1_mat = keypoints1;
|
||||
Mat keypoints2_mat = keypoints2;
|
||||
Mat matches1to2_mat = matches1to2;
|
||||
drawMatches_1(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_vector_DMatch matches1to2, Mat outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_vector_char matchesMask = std::vector<std::vector<char> >(), int flags = 0)
|
||||
//
|
||||
|
||||
//javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchColor, singlePointColor, matchesMask, flags)
|
||||
public static void drawMatches2(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, List<MatOfByte> matchesMask, int flags)
|
||||
{
|
||||
Mat keypoints1_mat = keypoints1;
|
||||
Mat keypoints2_mat = keypoints2;
|
||||
List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
|
||||
Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
|
||||
List<Mat> matchesMask_tmplm = new ArrayList<Mat>((matchesMask != null) ? matchesMask.size() : 0);
|
||||
Mat matchesMask_mat = Converters.vector_vector_char_to_Mat(matchesMask, matchesMask_tmplm);
|
||||
drawMatches2_0(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg)
|
||||
public static void drawMatches2(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg)
|
||||
{
|
||||
Mat keypoints1_mat = keypoints1;
|
||||
Mat keypoints2_mat = keypoints2;
|
||||
List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
|
||||
Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
|
||||
drawMatches2_1(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_vector_char matchesMask = std::vector<std::vector<char> >(), int flags = DrawMatchesFlags::DEFAULT)
|
||||
//
|
||||
|
||||
//javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchColor, singlePointColor, matchesMask, flags)
|
||||
public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, List<MatOfByte> matchesMask, int flags)
|
||||
{
|
||||
Mat keypoints1_mat = keypoints1;
|
||||
Mat keypoints2_mat = keypoints2;
|
||||
List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
|
||||
Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
|
||||
List<Mat> matchesMask_tmplm = new ArrayList<Mat>((matchesMask != null) ? matchesMask.size() : 0);
|
||||
Mat matchesMask_mat = Converters.vector_vector_char_to_Mat(matchesMask, matchesMask_tmplm);
|
||||
drawMatchesKnn_0(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg)
|
||||
public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg)
|
||||
{
|
||||
Mat keypoints1_mat = keypoints1;
|
||||
Mat keypoints2_mat = keypoints2;
|
||||
List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
|
||||
Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
|
||||
drawMatchesKnn_1(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// C++: void drawKeypoints(Mat image, vector_KeyPoint keypoints, Mat& outImage, Scalar color = Scalar::all(-1), int flags = DrawMatchesFlags::DEFAULT)
|
||||
private static native void drawKeypoints_0(long image_nativeObj, long keypoints_mat_nativeObj, long outImage_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3, int flags);
|
||||
private static native void drawKeypoints_1(long image_nativeObj, long keypoints_mat_nativeObj, long outImage_nativeObj);
|
||||
|
||||
// C++: void drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_char matchesMask = std::vector<char>(), int flags = DrawMatchesFlags::DEFAULT)
|
||||
private static native void drawMatches_0(long img1_nativeObj, long keypoints1_mat_nativeObj, long img2_nativeObj, long keypoints2_mat_nativeObj, long matches1to2_mat_nativeObj, long outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, long matchesMask_mat_nativeObj, int flags);
|
||||
private static native void drawMatches_1(long img1_nativeObj, long keypoints1_mat_nativeObj, long img2_nativeObj, long keypoints2_mat_nativeObj, long matches1to2_mat_nativeObj, long outImg_nativeObj);
|
||||
|
||||
// C++: void drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_vector_DMatch matches1to2, Mat outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_vector_char matchesMask = std::vector<std::vector<char> >(), int flags = 0)
|
||||
private static native void drawMatches2_0(long img1_nativeObj, long keypoints1_mat_nativeObj, long img2_nativeObj, long keypoints2_mat_nativeObj, long matches1to2_mat_nativeObj, long outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, long matchesMask_mat_nativeObj, int flags);
|
||||
private static native void drawMatches2_1(long img1_nativeObj, long keypoints1_mat_nativeObj, long img2_nativeObj, long keypoints2_mat_nativeObj, long matches1to2_mat_nativeObj, long outImg_nativeObj);
|
||||
|
||||
// C++: void drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_vector_char matchesMask = std::vector<std::vector<char> >(), int flags = DrawMatchesFlags::DEFAULT)
|
||||
private static native void drawMatchesKnn_0(long img1_nativeObj, long keypoints1_mat_nativeObj, long img2_nativeObj, long keypoints2_mat_nativeObj, long matches1to2_mat_nativeObj, long outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, long matchesMask_mat_nativeObj, int flags);
|
||||
private static native void drawMatchesKnn_1(long img1_nativeObj, long keypoints1_mat_nativeObj, long img2_nativeObj, long keypoints2_mat_nativeObj, long matches1to2_mat_nativeObj, long outImg_nativeObj);
|
||||
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import org.opencv.features2d.DescriptorMatcher;
|
||||
import org.opencv.features2d.FlannBasedMatcher;
|
||||
|
||||
// C++: class FlannBasedMatcher
|
||||
//javadoc: FlannBasedMatcher
|
||||
|
||||
public class FlannBasedMatcher extends DescriptorMatcher {
|
||||
|
||||
protected FlannBasedMatcher(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static FlannBasedMatcher __fromPtr__(long addr) { return new FlannBasedMatcher(addr); }
|
||||
|
||||
//
|
||||
// C++: FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr<flann::KDTreeIndexParams>(), Ptr_flann_SearchParams searchParams = makePtr<flann::SearchParams>())
|
||||
//
|
||||
|
||||
//javadoc: FlannBasedMatcher::FlannBasedMatcher()
|
||||
public FlannBasedMatcher()
|
||||
{
|
||||
|
||||
super( FlannBasedMatcher_0() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_FlannBasedMatcher create()
|
||||
//
|
||||
|
||||
//javadoc: FlannBasedMatcher::create()
|
||||
public static FlannBasedMatcher create()
|
||||
{
|
||||
|
||||
FlannBasedMatcher retVal = FlannBasedMatcher.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr<flann::KDTreeIndexParams>(), Ptr_flann_SearchParams searchParams = makePtr<flann::SearchParams>())
|
||||
private static native long FlannBasedMatcher_0();
|
||||
|
||||
// C++: static Ptr_FlannBasedMatcher create()
|
||||
private static native long create_0();
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.features2d.Feature2D;
|
||||
import org.opencv.features2d.GFTTDetector;
|
||||
|
||||
// C++: class GFTTDetector
|
||||
//javadoc: GFTTDetector
|
||||
|
||||
public class GFTTDetector extends Feature2D {
|
||||
|
||||
protected GFTTDetector(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static GFTTDetector __fromPtr__(long addr) { return new GFTTDetector(addr); }
|
||||
|
||||
//
|
||||
// C++: static Ptr_GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, bool useHarrisDetector = false, double k = 0.04)
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::create(maxCorners, qualityLevel, minDistance, blockSize, gradiantSize, useHarrisDetector, k)
|
||||
public static GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, boolean useHarrisDetector, double k)
|
||||
{
|
||||
|
||||
GFTTDetector retVal = GFTTDetector.__fromPtr__(create_0(maxCorners, qualityLevel, minDistance, blockSize, gradiantSize, useHarrisDetector, k));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: GFTTDetector::create(maxCorners, qualityLevel, minDistance, blockSize, gradiantSize)
|
||||
public static GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize)
|
||||
{
|
||||
|
||||
GFTTDetector retVal = GFTTDetector.__fromPtr__(create_1(maxCorners, qualityLevel, minDistance, blockSize, gradiantSize));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_GFTTDetector create(int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 1, int blockSize = 3, bool useHarrisDetector = false, double k = 0.04)
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::create(maxCorners, qualityLevel, minDistance, blockSize, useHarrisDetector, k)
|
||||
public static GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, boolean useHarrisDetector, double k)
|
||||
{
|
||||
|
||||
GFTTDetector retVal = GFTTDetector.__fromPtr__(create_2(maxCorners, qualityLevel, minDistance, blockSize, useHarrisDetector, k));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: GFTTDetector::create()
|
||||
public static GFTTDetector create()
|
||||
{
|
||||
|
||||
GFTTDetector retVal = GFTTDetector.__fromPtr__(create_3());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getHarrisDetector()
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::getHarrisDetector()
|
||||
public boolean getHarrisDetector()
|
||||
{
|
||||
|
||||
boolean retVal = getHarrisDetector_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getK()
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::getK()
|
||||
public double getK()
|
||||
{
|
||||
|
||||
double retVal = getK_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getMinDistance()
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::getMinDistance()
|
||||
public double getMinDistance()
|
||||
{
|
||||
|
||||
double retVal = getMinDistance_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getQualityLevel()
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::getQualityLevel()
|
||||
public double getQualityLevel()
|
||||
{
|
||||
|
||||
double retVal = getQualityLevel_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getBlockSize()
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::getBlockSize()
|
||||
public int getBlockSize()
|
||||
{
|
||||
|
||||
int retVal = getBlockSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMaxFeatures()
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::getMaxFeatures()
|
||||
public int getMaxFeatures()
|
||||
{
|
||||
|
||||
int retVal = getMaxFeatures_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setBlockSize(int blockSize)
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::setBlockSize(blockSize)
|
||||
public void setBlockSize(int blockSize)
|
||||
{
|
||||
|
||||
setBlockSize_0(nativeObj, blockSize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setHarrisDetector(bool val)
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::setHarrisDetector(val)
|
||||
public void setHarrisDetector(boolean val)
|
||||
{
|
||||
|
||||
setHarrisDetector_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setK(double k)
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::setK(k)
|
||||
public void setK(double k)
|
||||
{
|
||||
|
||||
setK_0(nativeObj, k);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMaxFeatures(int maxFeatures)
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::setMaxFeatures(maxFeatures)
|
||||
public void setMaxFeatures(int maxFeatures)
|
||||
{
|
||||
|
||||
setMaxFeatures_0(nativeObj, maxFeatures);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMinDistance(double minDistance)
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::setMinDistance(minDistance)
|
||||
public void setMinDistance(double minDistance)
|
||||
{
|
||||
|
||||
setMinDistance_0(nativeObj, minDistance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setQualityLevel(double qlevel)
|
||||
//
|
||||
|
||||
//javadoc: GFTTDetector::setQualityLevel(qlevel)
|
||||
public void setQualityLevel(double qlevel)
|
||||
{
|
||||
|
||||
setQualityLevel_0(nativeObj, qlevel);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, bool useHarrisDetector = false, double k = 0.04)
|
||||
private static native long create_0(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, boolean useHarrisDetector, double k);
|
||||
private static native long create_1(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize);
|
||||
|
||||
// C++: static Ptr_GFTTDetector create(int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 1, int blockSize = 3, bool useHarrisDetector = false, double k = 0.04)
|
||||
private static native long create_2(int maxCorners, double qualityLevel, double minDistance, int blockSize, boolean useHarrisDetector, double k);
|
||||
private static native long create_3();
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: bool getHarrisDetector()
|
||||
private static native boolean getHarrisDetector_0(long nativeObj);
|
||||
|
||||
// C++: double getK()
|
||||
private static native double getK_0(long nativeObj);
|
||||
|
||||
// C++: double getMinDistance()
|
||||
private static native double getMinDistance_0(long nativeObj);
|
||||
|
||||
// C++: double getQualityLevel()
|
||||
private static native double getQualityLevel_0(long nativeObj);
|
||||
|
||||
// C++: int getBlockSize()
|
||||
private static native int getBlockSize_0(long nativeObj);
|
||||
|
||||
// C++: int getMaxFeatures()
|
||||
private static native int getMaxFeatures_0(long nativeObj);
|
||||
|
||||
// C++: void setBlockSize(int blockSize)
|
||||
private static native void setBlockSize_0(long nativeObj, int blockSize);
|
||||
|
||||
// C++: void setHarrisDetector(bool val)
|
||||
private static native void setHarrisDetector_0(long nativeObj, boolean val);
|
||||
|
||||
// C++: void setK(double k)
|
||||
private static native void setK_0(long nativeObj, double k);
|
||||
|
||||
// C++: void setMaxFeatures(int maxFeatures)
|
||||
private static native void setMaxFeatures_0(long nativeObj, int maxFeatures);
|
||||
|
||||
// C++: void setMinDistance(double minDistance)
|
||||
private static native void setMinDistance_0(long nativeObj, double minDistance);
|
||||
|
||||
// C++: void setQualityLevel(double qlevel)
|
||||
private static native void setQualityLevel_0(long nativeObj, double qlevel);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.features2d.Feature2D;
|
||||
import org.opencv.features2d.KAZE;
|
||||
|
||||
// C++: class KAZE
|
||||
//javadoc: KAZE
|
||||
|
||||
public class KAZE extends Feature2D {
|
||||
|
||||
protected KAZE(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static KAZE __fromPtr__(long addr) { return new KAZE(addr); }
|
||||
|
||||
public static final int
|
||||
DIFF_PM_G1 = 0,
|
||||
DIFF_PM_G2 = 1,
|
||||
DIFF_WEICKERT = 2,
|
||||
DIFF_CHARBONNIER = 3;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_KAZE create(bool extended = false, bool upright = false, float threshold = 0.001f, int nOctaves = 4, int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2)
|
||||
//
|
||||
|
||||
//javadoc: KAZE::create(extended, upright, threshold, nOctaves, nOctaveLayers, diffusivity)
|
||||
public static KAZE create(boolean extended, boolean upright, float threshold, int nOctaves, int nOctaveLayers, int diffusivity)
|
||||
{
|
||||
|
||||
KAZE retVal = KAZE.__fromPtr__(create_0(extended, upright, threshold, nOctaves, nOctaveLayers, diffusivity));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: KAZE::create()
|
||||
public static KAZE create()
|
||||
{
|
||||
|
||||
KAZE retVal = KAZE.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: KAZE::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getExtended()
|
||||
//
|
||||
|
||||
//javadoc: KAZE::getExtended()
|
||||
public boolean getExtended()
|
||||
{
|
||||
|
||||
boolean retVal = getExtended_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getUpright()
|
||||
//
|
||||
|
||||
//javadoc: KAZE::getUpright()
|
||||
public boolean getUpright()
|
||||
{
|
||||
|
||||
boolean retVal = getUpright_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getThreshold()
|
||||
//
|
||||
|
||||
//javadoc: KAZE::getThreshold()
|
||||
public double getThreshold()
|
||||
{
|
||||
|
||||
double retVal = getThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getDiffusivity()
|
||||
//
|
||||
|
||||
//javadoc: KAZE::getDiffusivity()
|
||||
public int getDiffusivity()
|
||||
{
|
||||
|
||||
int retVal = getDiffusivity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNOctaveLayers()
|
||||
//
|
||||
|
||||
//javadoc: KAZE::getNOctaveLayers()
|
||||
public int getNOctaveLayers()
|
||||
{
|
||||
|
||||
int retVal = getNOctaveLayers_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNOctaves()
|
||||
//
|
||||
|
||||
//javadoc: KAZE::getNOctaves()
|
||||
public int getNOctaves()
|
||||
{
|
||||
|
||||
int retVal = getNOctaves_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDiffusivity(int diff)
|
||||
//
|
||||
|
||||
//javadoc: KAZE::setDiffusivity(diff)
|
||||
public void setDiffusivity(int diff)
|
||||
{
|
||||
|
||||
setDiffusivity_0(nativeObj, diff);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setExtended(bool extended)
|
||||
//
|
||||
|
||||
//javadoc: KAZE::setExtended(extended)
|
||||
public void setExtended(boolean extended)
|
||||
{
|
||||
|
||||
setExtended_0(nativeObj, extended);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNOctaveLayers(int octaveLayers)
|
||||
//
|
||||
|
||||
//javadoc: KAZE::setNOctaveLayers(octaveLayers)
|
||||
public void setNOctaveLayers(int octaveLayers)
|
||||
{
|
||||
|
||||
setNOctaveLayers_0(nativeObj, octaveLayers);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNOctaves(int octaves)
|
||||
//
|
||||
|
||||
//javadoc: KAZE::setNOctaves(octaves)
|
||||
public void setNOctaves(int octaves)
|
||||
{
|
||||
|
||||
setNOctaves_0(nativeObj, octaves);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setThreshold(double threshold)
|
||||
//
|
||||
|
||||
//javadoc: KAZE::setThreshold(threshold)
|
||||
public void setThreshold(double threshold)
|
||||
{
|
||||
|
||||
setThreshold_0(nativeObj, threshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setUpright(bool upright)
|
||||
//
|
||||
|
||||
//javadoc: KAZE::setUpright(upright)
|
||||
public void setUpright(boolean upright)
|
||||
{
|
||||
|
||||
setUpright_0(nativeObj, upright);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_KAZE create(bool extended = false, bool upright = false, float threshold = 0.001f, int nOctaves = 4, int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2)
|
||||
private static native long create_0(boolean extended, boolean upright, float threshold, int nOctaves, int nOctaveLayers, int diffusivity);
|
||||
private static native long create_1();
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: bool getExtended()
|
||||
private static native boolean getExtended_0(long nativeObj);
|
||||
|
||||
// C++: bool getUpright()
|
||||
private static native boolean getUpright_0(long nativeObj);
|
||||
|
||||
// C++: double getThreshold()
|
||||
private static native double getThreshold_0(long nativeObj);
|
||||
|
||||
// C++: int getDiffusivity()
|
||||
private static native int getDiffusivity_0(long nativeObj);
|
||||
|
||||
// C++: int getNOctaveLayers()
|
||||
private static native int getNOctaveLayers_0(long nativeObj);
|
||||
|
||||
// C++: int getNOctaves()
|
||||
private static native int getNOctaves_0(long nativeObj);
|
||||
|
||||
// C++: void setDiffusivity(int diff)
|
||||
private static native void setDiffusivity_0(long nativeObj, int diff);
|
||||
|
||||
// C++: void setExtended(bool extended)
|
||||
private static native void setExtended_0(long nativeObj, boolean extended);
|
||||
|
||||
// C++: void setNOctaveLayers(int octaveLayers)
|
||||
private static native void setNOctaveLayers_0(long nativeObj, int octaveLayers);
|
||||
|
||||
// C++: void setNOctaves(int octaves)
|
||||
private static native void setNOctaves_0(long nativeObj, int octaves);
|
||||
|
||||
// C++: void setThreshold(double threshold)
|
||||
private static native void setThreshold_0(long nativeObj, double threshold);
|
||||
|
||||
// C++: void setUpright(bool upright)
|
||||
private static native void setUpright_0(long nativeObj, boolean upright);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfPoint;
|
||||
import org.opencv.core.MatOfRect;
|
||||
import org.opencv.features2d.Feature2D;
|
||||
import org.opencv.features2d.MSER;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class MSER
|
||||
//javadoc: MSER
|
||||
|
||||
public class MSER extends Feature2D {
|
||||
|
||||
protected MSER(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static MSER __fromPtr__(long addr) { return new MSER(addr); }
|
||||
|
||||
//
|
||||
// C++: static Ptr_MSER create(int _delta = 5, int _min_area = 60, int _max_area = 14400, double _max_variation = 0.25, double _min_diversity = .2, int _max_evolution = 200, double _area_threshold = 1.01, double _min_margin = 0.003, int _edge_blur_size = 5)
|
||||
//
|
||||
|
||||
//javadoc: MSER::create(_delta, _min_area, _max_area, _max_variation, _min_diversity, _max_evolution, _area_threshold, _min_margin, _edge_blur_size)
|
||||
public static MSER create(int _delta, int _min_area, int _max_area, double _max_variation, double _min_diversity, int _max_evolution, double _area_threshold, double _min_margin, int _edge_blur_size)
|
||||
{
|
||||
|
||||
MSER retVal = MSER.__fromPtr__(create_0(_delta, _min_area, _max_area, _max_variation, _min_diversity, _max_evolution, _area_threshold, _min_margin, _edge_blur_size));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: MSER::create()
|
||||
public static MSER create()
|
||||
{
|
||||
|
||||
MSER retVal = MSER.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: MSER::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getPass2Only()
|
||||
//
|
||||
|
||||
//javadoc: MSER::getPass2Only()
|
||||
public boolean getPass2Only()
|
||||
{
|
||||
|
||||
boolean retVal = getPass2Only_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getDelta()
|
||||
//
|
||||
|
||||
//javadoc: MSER::getDelta()
|
||||
public int getDelta()
|
||||
{
|
||||
|
||||
int retVal = getDelta_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMaxArea()
|
||||
//
|
||||
|
||||
//javadoc: MSER::getMaxArea()
|
||||
public int getMaxArea()
|
||||
{
|
||||
|
||||
int retVal = getMaxArea_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMinArea()
|
||||
//
|
||||
|
||||
//javadoc: MSER::getMinArea()
|
||||
public int getMinArea()
|
||||
{
|
||||
|
||||
int retVal = getMinArea_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detectRegions(Mat image, vector_vector_Point& msers, vector_Rect& bboxes)
|
||||
//
|
||||
|
||||
//javadoc: MSER::detectRegions(image, msers, bboxes)
|
||||
public void detectRegions(Mat image, List<MatOfPoint> msers, MatOfRect bboxes)
|
||||
{
|
||||
Mat msers_mat = new Mat();
|
||||
Mat bboxes_mat = bboxes;
|
||||
detectRegions_0(nativeObj, image.nativeObj, msers_mat.nativeObj, bboxes_mat.nativeObj);
|
||||
Converters.Mat_to_vector_vector_Point(msers_mat, msers);
|
||||
msers_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDelta(int delta)
|
||||
//
|
||||
|
||||
//javadoc: MSER::setDelta(delta)
|
||||
public void setDelta(int delta)
|
||||
{
|
||||
|
||||
setDelta_0(nativeObj, delta);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMaxArea(int maxArea)
|
||||
//
|
||||
|
||||
//javadoc: MSER::setMaxArea(maxArea)
|
||||
public void setMaxArea(int maxArea)
|
||||
{
|
||||
|
||||
setMaxArea_0(nativeObj, maxArea);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMinArea(int minArea)
|
||||
//
|
||||
|
||||
//javadoc: MSER::setMinArea(minArea)
|
||||
public void setMinArea(int minArea)
|
||||
{
|
||||
|
||||
setMinArea_0(nativeObj, minArea);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPass2Only(bool f)
|
||||
//
|
||||
|
||||
//javadoc: MSER::setPass2Only(f)
|
||||
public void setPass2Only(boolean f)
|
||||
{
|
||||
|
||||
setPass2Only_0(nativeObj, f);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_MSER create(int _delta = 5, int _min_area = 60, int _max_area = 14400, double _max_variation = 0.25, double _min_diversity = .2, int _max_evolution = 200, double _area_threshold = 1.01, double _min_margin = 0.003, int _edge_blur_size = 5)
|
||||
private static native long create_0(int _delta, int _min_area, int _max_area, double _max_variation, double _min_diversity, int _max_evolution, double _area_threshold, double _min_margin, int _edge_blur_size);
|
||||
private static native long create_1();
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: bool getPass2Only()
|
||||
private static native boolean getPass2Only_0(long nativeObj);
|
||||
|
||||
// C++: int getDelta()
|
||||
private static native int getDelta_0(long nativeObj);
|
||||
|
||||
// C++: int getMaxArea()
|
||||
private static native int getMaxArea_0(long nativeObj);
|
||||
|
||||
// C++: int getMinArea()
|
||||
private static native int getMinArea_0(long nativeObj);
|
||||
|
||||
// C++: void detectRegions(Mat image, vector_vector_Point& msers, vector_Rect& bboxes)
|
||||
private static native void detectRegions_0(long nativeObj, long image_nativeObj, long msers_mat_nativeObj, long bboxes_mat_nativeObj);
|
||||
|
||||
// C++: void setDelta(int delta)
|
||||
private static native void setDelta_0(long nativeObj, int delta);
|
||||
|
||||
// C++: void setMaxArea(int maxArea)
|
||||
private static native void setMaxArea_0(long nativeObj, int maxArea);
|
||||
|
||||
// C++: void setMinArea(int minArea)
|
||||
private static native void setMinArea_0(long nativeObj, int minArea);
|
||||
|
||||
// C++: void setPass2Only(bool f)
|
||||
private static native void setPass2Only_0(long nativeObj, boolean f);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,386 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.features2d.Feature2D;
|
||||
import org.opencv.features2d.ORB;
|
||||
|
||||
// C++: class ORB
|
||||
//javadoc: ORB
|
||||
|
||||
public class ORB extends Feature2D {
|
||||
|
||||
protected ORB(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static ORB __fromPtr__(long addr) { return new ORB(addr); }
|
||||
|
||||
public static final int
|
||||
kBytes = 32,
|
||||
HARRIS_SCORE = 0,
|
||||
FAST_SCORE = 1;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_ORB create(int nfeatures = 500, float scaleFactor = 1.2f, int nlevels = 8, int edgeThreshold = 31, int firstLevel = 0, int WTA_K = 2, int scoreType = ORB::HARRIS_SCORE, int patchSize = 31, int fastThreshold = 20)
|
||||
//
|
||||
|
||||
//javadoc: ORB::create(nfeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, WTA_K, scoreType, patchSize, fastThreshold)
|
||||
public static ORB create(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int WTA_K, int scoreType, int patchSize, int fastThreshold)
|
||||
{
|
||||
|
||||
ORB retVal = ORB.__fromPtr__(create_0(nfeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, WTA_K, scoreType, patchSize, fastThreshold));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: ORB::create()
|
||||
public static ORB create()
|
||||
{
|
||||
|
||||
ORB retVal = ORB.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: String getDefaultName()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getDefaultName()
|
||||
public String getDefaultName()
|
||||
{
|
||||
|
||||
String retVal = getDefaultName_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getScaleFactor()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getScaleFactor()
|
||||
public double getScaleFactor()
|
||||
{
|
||||
|
||||
double retVal = getScaleFactor_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getEdgeThreshold()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getEdgeThreshold()
|
||||
public int getEdgeThreshold()
|
||||
{
|
||||
|
||||
int retVal = getEdgeThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getFastThreshold()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getFastThreshold()
|
||||
public int getFastThreshold()
|
||||
{
|
||||
|
||||
int retVal = getFastThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getFirstLevel()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getFirstLevel()
|
||||
public int getFirstLevel()
|
||||
{
|
||||
|
||||
int retVal = getFirstLevel_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMaxFeatures()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getMaxFeatures()
|
||||
public int getMaxFeatures()
|
||||
{
|
||||
|
||||
int retVal = getMaxFeatures_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNLevels()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getNLevels()
|
||||
public int getNLevels()
|
||||
{
|
||||
|
||||
int retVal = getNLevels_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getPatchSize()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getPatchSize()
|
||||
public int getPatchSize()
|
||||
{
|
||||
|
||||
int retVal = getPatchSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getScoreType()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getScoreType()
|
||||
public int getScoreType()
|
||||
{
|
||||
|
||||
int retVal = getScoreType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getWTA_K()
|
||||
//
|
||||
|
||||
//javadoc: ORB::getWTA_K()
|
||||
public int getWTA_K()
|
||||
{
|
||||
|
||||
int retVal = getWTA_K_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setEdgeThreshold(int edgeThreshold)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setEdgeThreshold(edgeThreshold)
|
||||
public void setEdgeThreshold(int edgeThreshold)
|
||||
{
|
||||
|
||||
setEdgeThreshold_0(nativeObj, edgeThreshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setFastThreshold(int fastThreshold)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setFastThreshold(fastThreshold)
|
||||
public void setFastThreshold(int fastThreshold)
|
||||
{
|
||||
|
||||
setFastThreshold_0(nativeObj, fastThreshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setFirstLevel(int firstLevel)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setFirstLevel(firstLevel)
|
||||
public void setFirstLevel(int firstLevel)
|
||||
{
|
||||
|
||||
setFirstLevel_0(nativeObj, firstLevel);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMaxFeatures(int maxFeatures)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setMaxFeatures(maxFeatures)
|
||||
public void setMaxFeatures(int maxFeatures)
|
||||
{
|
||||
|
||||
setMaxFeatures_0(nativeObj, maxFeatures);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNLevels(int nlevels)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setNLevels(nlevels)
|
||||
public void setNLevels(int nlevels)
|
||||
{
|
||||
|
||||
setNLevels_0(nativeObj, nlevels);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPatchSize(int patchSize)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setPatchSize(patchSize)
|
||||
public void setPatchSize(int patchSize)
|
||||
{
|
||||
|
||||
setPatchSize_0(nativeObj, patchSize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setScaleFactor(double scaleFactor)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setScaleFactor(scaleFactor)
|
||||
public void setScaleFactor(double scaleFactor)
|
||||
{
|
||||
|
||||
setScaleFactor_0(nativeObj, scaleFactor);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setScoreType(int scoreType)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setScoreType(scoreType)
|
||||
public void setScoreType(int scoreType)
|
||||
{
|
||||
|
||||
setScoreType_0(nativeObj, scoreType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setWTA_K(int wta_k)
|
||||
//
|
||||
|
||||
//javadoc: ORB::setWTA_K(wta_k)
|
||||
public void setWTA_K(int wta_k)
|
||||
{
|
||||
|
||||
setWTA_K_0(nativeObj, wta_k);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_ORB create(int nfeatures = 500, float scaleFactor = 1.2f, int nlevels = 8, int edgeThreshold = 31, int firstLevel = 0, int WTA_K = 2, int scoreType = ORB::HARRIS_SCORE, int patchSize = 31, int fastThreshold = 20)
|
||||
private static native long create_0(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int WTA_K, int scoreType, int patchSize, int fastThreshold);
|
||||
private static native long create_1();
|
||||
|
||||
// C++: String getDefaultName()
|
||||
private static native String getDefaultName_0(long nativeObj);
|
||||
|
||||
// C++: double getScaleFactor()
|
||||
private static native double getScaleFactor_0(long nativeObj);
|
||||
|
||||
// C++: int getEdgeThreshold()
|
||||
private static native int getEdgeThreshold_0(long nativeObj);
|
||||
|
||||
// C++: int getFastThreshold()
|
||||
private static native int getFastThreshold_0(long nativeObj);
|
||||
|
||||
// C++: int getFirstLevel()
|
||||
private static native int getFirstLevel_0(long nativeObj);
|
||||
|
||||
// C++: int getMaxFeatures()
|
||||
private static native int getMaxFeatures_0(long nativeObj);
|
||||
|
||||
// C++: int getNLevels()
|
||||
private static native int getNLevels_0(long nativeObj);
|
||||
|
||||
// C++: int getPatchSize()
|
||||
private static native int getPatchSize_0(long nativeObj);
|
||||
|
||||
// C++: int getScoreType()
|
||||
private static native int getScoreType_0(long nativeObj);
|
||||
|
||||
// C++: int getWTA_K()
|
||||
private static native int getWTA_K_0(long nativeObj);
|
||||
|
||||
// C++: void setEdgeThreshold(int edgeThreshold)
|
||||
private static native void setEdgeThreshold_0(long nativeObj, int edgeThreshold);
|
||||
|
||||
// C++: void setFastThreshold(int fastThreshold)
|
||||
private static native void setFastThreshold_0(long nativeObj, int fastThreshold);
|
||||
|
||||
// C++: void setFirstLevel(int firstLevel)
|
||||
private static native void setFirstLevel_0(long nativeObj, int firstLevel);
|
||||
|
||||
// C++: void setMaxFeatures(int maxFeatures)
|
||||
private static native void setMaxFeatures_0(long nativeObj, int maxFeatures);
|
||||
|
||||
// C++: void setNLevels(int nlevels)
|
||||
private static native void setNLevels_0(long nativeObj, int nlevels);
|
||||
|
||||
// C++: void setPatchSize(int patchSize)
|
||||
private static native void setPatchSize_0(long nativeObj, int patchSize);
|
||||
|
||||
// C++: void setScaleFactor(double scaleFactor)
|
||||
private static native void setScaleFactor_0(long nativeObj, double scaleFactor);
|
||||
|
||||
// C++: void setScoreType(int scoreType)
|
||||
private static native void setScoreType_0(long nativeObj, int scoreType);
|
||||
|
||||
// C++: void setWTA_K(int wta_k)
|
||||
private static native void setWTA_K_0(long nativeObj, int wta_k);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,674 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.features2d;
|
||||
|
||||
|
||||
|
||||
// C++: class Params
|
||||
//javadoc: Params
|
||||
|
||||
public class Params {
|
||||
|
||||
protected final long nativeObj;
|
||||
protected Params(long addr) { nativeObj = addr; }
|
||||
|
||||
public long getNativeObjAddr() { return nativeObj; }
|
||||
|
||||
// internal usage only
|
||||
public static Params __fromPtr__(long addr) { return new Params(addr); }
|
||||
|
||||
//
|
||||
// C++: Params()
|
||||
//
|
||||
|
||||
//javadoc: Params::Params()
|
||||
public Params()
|
||||
{
|
||||
|
||||
nativeObj = Params_0();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::thresholdStep
|
||||
//
|
||||
|
||||
//javadoc: Params::get_thresholdStep()
|
||||
public float get_thresholdStep()
|
||||
{
|
||||
|
||||
float retVal = get_thresholdStep_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::thresholdStep
|
||||
//
|
||||
|
||||
//javadoc: Params::set_thresholdStep(thresholdStep)
|
||||
public void set_thresholdStep(float thresholdStep)
|
||||
{
|
||||
|
||||
set_thresholdStep_0(nativeObj, thresholdStep);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::minThreshold
|
||||
//
|
||||
|
||||
//javadoc: Params::get_minThreshold()
|
||||
public float get_minThreshold()
|
||||
{
|
||||
|
||||
float retVal = get_minThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::minThreshold
|
||||
//
|
||||
|
||||
//javadoc: Params::set_minThreshold(minThreshold)
|
||||
public void set_minThreshold(float minThreshold)
|
||||
{
|
||||
|
||||
set_minThreshold_0(nativeObj, minThreshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::maxThreshold
|
||||
//
|
||||
|
||||
//javadoc: Params::get_maxThreshold()
|
||||
public float get_maxThreshold()
|
||||
{
|
||||
|
||||
float retVal = get_maxThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::maxThreshold
|
||||
//
|
||||
|
||||
//javadoc: Params::set_maxThreshold(maxThreshold)
|
||||
public void set_maxThreshold(float maxThreshold)
|
||||
{
|
||||
|
||||
set_maxThreshold_0(nativeObj, maxThreshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: size_t Params::minRepeatability
|
||||
//
|
||||
|
||||
//javadoc: Params::get_minRepeatability()
|
||||
public long get_minRepeatability()
|
||||
{
|
||||
|
||||
long retVal = get_minRepeatability_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::minRepeatability
|
||||
//
|
||||
|
||||
//javadoc: Params::set_minRepeatability(minRepeatability)
|
||||
public void set_minRepeatability(long minRepeatability)
|
||||
{
|
||||
|
||||
set_minRepeatability_0(nativeObj, minRepeatability);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::minDistBetweenBlobs
|
||||
//
|
||||
|
||||
//javadoc: Params::get_minDistBetweenBlobs()
|
||||
public float get_minDistBetweenBlobs()
|
||||
{
|
||||
|
||||
float retVal = get_minDistBetweenBlobs_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::minDistBetweenBlobs
|
||||
//
|
||||
|
||||
//javadoc: Params::set_minDistBetweenBlobs(minDistBetweenBlobs)
|
||||
public void set_minDistBetweenBlobs(float minDistBetweenBlobs)
|
||||
{
|
||||
|
||||
set_minDistBetweenBlobs_0(nativeObj, minDistBetweenBlobs);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool Params::filterByColor
|
||||
//
|
||||
|
||||
//javadoc: Params::get_filterByColor()
|
||||
public boolean get_filterByColor()
|
||||
{
|
||||
|
||||
boolean retVal = get_filterByColor_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::filterByColor
|
||||
//
|
||||
|
||||
//javadoc: Params::set_filterByColor(filterByColor)
|
||||
public void set_filterByColor(boolean filterByColor)
|
||||
{
|
||||
|
||||
set_filterByColor_0(nativeObj, filterByColor);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: uchar Params::blobColor
|
||||
//
|
||||
|
||||
// Return type 'uchar' is not supported, skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::blobColor
|
||||
//
|
||||
|
||||
// Unknown type 'uchar' (I), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: bool Params::filterByArea
|
||||
//
|
||||
|
||||
//javadoc: Params::get_filterByArea()
|
||||
public boolean get_filterByArea()
|
||||
{
|
||||
|
||||
boolean retVal = get_filterByArea_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::filterByArea
|
||||
//
|
||||
|
||||
//javadoc: Params::set_filterByArea(filterByArea)
|
||||
public void set_filterByArea(boolean filterByArea)
|
||||
{
|
||||
|
||||
set_filterByArea_0(nativeObj, filterByArea);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::minArea
|
||||
//
|
||||
|
||||
//javadoc: Params::get_minArea()
|
||||
public float get_minArea()
|
||||
{
|
||||
|
||||
float retVal = get_minArea_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::minArea
|
||||
//
|
||||
|
||||
//javadoc: Params::set_minArea(minArea)
|
||||
public void set_minArea(float minArea)
|
||||
{
|
||||
|
||||
set_minArea_0(nativeObj, minArea);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::maxArea
|
||||
//
|
||||
|
||||
//javadoc: Params::get_maxArea()
|
||||
public float get_maxArea()
|
||||
{
|
||||
|
||||
float retVal = get_maxArea_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::maxArea
|
||||
//
|
||||
|
||||
//javadoc: Params::set_maxArea(maxArea)
|
||||
public void set_maxArea(float maxArea)
|
||||
{
|
||||
|
||||
set_maxArea_0(nativeObj, maxArea);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool Params::filterByCircularity
|
||||
//
|
||||
|
||||
//javadoc: Params::get_filterByCircularity()
|
||||
public boolean get_filterByCircularity()
|
||||
{
|
||||
|
||||
boolean retVal = get_filterByCircularity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::filterByCircularity
|
||||
//
|
||||
|
||||
//javadoc: Params::set_filterByCircularity(filterByCircularity)
|
||||
public void set_filterByCircularity(boolean filterByCircularity)
|
||||
{
|
||||
|
||||
set_filterByCircularity_0(nativeObj, filterByCircularity);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::minCircularity
|
||||
//
|
||||
|
||||
//javadoc: Params::get_minCircularity()
|
||||
public float get_minCircularity()
|
||||
{
|
||||
|
||||
float retVal = get_minCircularity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::minCircularity
|
||||
//
|
||||
|
||||
//javadoc: Params::set_minCircularity(minCircularity)
|
||||
public void set_minCircularity(float minCircularity)
|
||||
{
|
||||
|
||||
set_minCircularity_0(nativeObj, minCircularity);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::maxCircularity
|
||||
//
|
||||
|
||||
//javadoc: Params::get_maxCircularity()
|
||||
public float get_maxCircularity()
|
||||
{
|
||||
|
||||
float retVal = get_maxCircularity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::maxCircularity
|
||||
//
|
||||
|
||||
//javadoc: Params::set_maxCircularity(maxCircularity)
|
||||
public void set_maxCircularity(float maxCircularity)
|
||||
{
|
||||
|
||||
set_maxCircularity_0(nativeObj, maxCircularity);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool Params::filterByInertia
|
||||
//
|
||||
|
||||
//javadoc: Params::get_filterByInertia()
|
||||
public boolean get_filterByInertia()
|
||||
{
|
||||
|
||||
boolean retVal = get_filterByInertia_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::filterByInertia
|
||||
//
|
||||
|
||||
//javadoc: Params::set_filterByInertia(filterByInertia)
|
||||
public void set_filterByInertia(boolean filterByInertia)
|
||||
{
|
||||
|
||||
set_filterByInertia_0(nativeObj, filterByInertia);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::minInertiaRatio
|
||||
//
|
||||
|
||||
//javadoc: Params::get_minInertiaRatio()
|
||||
public float get_minInertiaRatio()
|
||||
{
|
||||
|
||||
float retVal = get_minInertiaRatio_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::minInertiaRatio
|
||||
//
|
||||
|
||||
//javadoc: Params::set_minInertiaRatio(minInertiaRatio)
|
||||
public void set_minInertiaRatio(float minInertiaRatio)
|
||||
{
|
||||
|
||||
set_minInertiaRatio_0(nativeObj, minInertiaRatio);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::maxInertiaRatio
|
||||
//
|
||||
|
||||
//javadoc: Params::get_maxInertiaRatio()
|
||||
public float get_maxInertiaRatio()
|
||||
{
|
||||
|
||||
float retVal = get_maxInertiaRatio_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::maxInertiaRatio
|
||||
//
|
||||
|
||||
//javadoc: Params::set_maxInertiaRatio(maxInertiaRatio)
|
||||
public void set_maxInertiaRatio(float maxInertiaRatio)
|
||||
{
|
||||
|
||||
set_maxInertiaRatio_0(nativeObj, maxInertiaRatio);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool Params::filterByConvexity
|
||||
//
|
||||
|
||||
//javadoc: Params::get_filterByConvexity()
|
||||
public boolean get_filterByConvexity()
|
||||
{
|
||||
|
||||
boolean retVal = get_filterByConvexity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::filterByConvexity
|
||||
//
|
||||
|
||||
//javadoc: Params::set_filterByConvexity(filterByConvexity)
|
||||
public void set_filterByConvexity(boolean filterByConvexity)
|
||||
{
|
||||
|
||||
set_filterByConvexity_0(nativeObj, filterByConvexity);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::minConvexity
|
||||
//
|
||||
|
||||
//javadoc: Params::get_minConvexity()
|
||||
public float get_minConvexity()
|
||||
{
|
||||
|
||||
float retVal = get_minConvexity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::minConvexity
|
||||
//
|
||||
|
||||
//javadoc: Params::set_minConvexity(minConvexity)
|
||||
public void set_minConvexity(float minConvexity)
|
||||
{
|
||||
|
||||
set_minConvexity_0(nativeObj, minConvexity);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float Params::maxConvexity
|
||||
//
|
||||
|
||||
//javadoc: Params::get_maxConvexity()
|
||||
public float get_maxConvexity()
|
||||
{
|
||||
|
||||
float retVal = get_maxConvexity_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void Params::maxConvexity
|
||||
//
|
||||
|
||||
//javadoc: Params::set_maxConvexity(maxConvexity)
|
||||
public void set_maxConvexity(float maxConvexity)
|
||||
{
|
||||
|
||||
set_maxConvexity_0(nativeObj, maxConvexity);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Params()
|
||||
private static native long Params_0();
|
||||
|
||||
// C++: float Params::thresholdStep
|
||||
private static native float get_thresholdStep_0(long nativeObj);
|
||||
|
||||
// C++: void Params::thresholdStep
|
||||
private static native void set_thresholdStep_0(long nativeObj, float thresholdStep);
|
||||
|
||||
// C++: float Params::minThreshold
|
||||
private static native float get_minThreshold_0(long nativeObj);
|
||||
|
||||
// C++: void Params::minThreshold
|
||||
private static native void set_minThreshold_0(long nativeObj, float minThreshold);
|
||||
|
||||
// C++: float Params::maxThreshold
|
||||
private static native float get_maxThreshold_0(long nativeObj);
|
||||
|
||||
// C++: void Params::maxThreshold
|
||||
private static native void set_maxThreshold_0(long nativeObj, float maxThreshold);
|
||||
|
||||
// C++: size_t Params::minRepeatability
|
||||
private static native long get_minRepeatability_0(long nativeObj);
|
||||
|
||||
// C++: void Params::minRepeatability
|
||||
private static native void set_minRepeatability_0(long nativeObj, long minRepeatability);
|
||||
|
||||
// C++: float Params::minDistBetweenBlobs
|
||||
private static native float get_minDistBetweenBlobs_0(long nativeObj);
|
||||
|
||||
// C++: void Params::minDistBetweenBlobs
|
||||
private static native void set_minDistBetweenBlobs_0(long nativeObj, float minDistBetweenBlobs);
|
||||
|
||||
// C++: bool Params::filterByColor
|
||||
private static native boolean get_filterByColor_0(long nativeObj);
|
||||
|
||||
// C++: void Params::filterByColor
|
||||
private static native void set_filterByColor_0(long nativeObj, boolean filterByColor);
|
||||
|
||||
// C++: bool Params::filterByArea
|
||||
private static native boolean get_filterByArea_0(long nativeObj);
|
||||
|
||||
// C++: void Params::filterByArea
|
||||
private static native void set_filterByArea_0(long nativeObj, boolean filterByArea);
|
||||
|
||||
// C++: float Params::minArea
|
||||
private static native float get_minArea_0(long nativeObj);
|
||||
|
||||
// C++: void Params::minArea
|
||||
private static native void set_minArea_0(long nativeObj, float minArea);
|
||||
|
||||
// C++: float Params::maxArea
|
||||
private static native float get_maxArea_0(long nativeObj);
|
||||
|
||||
// C++: void Params::maxArea
|
||||
private static native void set_maxArea_0(long nativeObj, float maxArea);
|
||||
|
||||
// C++: bool Params::filterByCircularity
|
||||
private static native boolean get_filterByCircularity_0(long nativeObj);
|
||||
|
||||
// C++: void Params::filterByCircularity
|
||||
private static native void set_filterByCircularity_0(long nativeObj, boolean filterByCircularity);
|
||||
|
||||
// C++: float Params::minCircularity
|
||||
private static native float get_minCircularity_0(long nativeObj);
|
||||
|
||||
// C++: void Params::minCircularity
|
||||
private static native void set_minCircularity_0(long nativeObj, float minCircularity);
|
||||
|
||||
// C++: float Params::maxCircularity
|
||||
private static native float get_maxCircularity_0(long nativeObj);
|
||||
|
||||
// C++: void Params::maxCircularity
|
||||
private static native void set_maxCircularity_0(long nativeObj, float maxCircularity);
|
||||
|
||||
// C++: bool Params::filterByInertia
|
||||
private static native boolean get_filterByInertia_0(long nativeObj);
|
||||
|
||||
// C++: void Params::filterByInertia
|
||||
private static native void set_filterByInertia_0(long nativeObj, boolean filterByInertia);
|
||||
|
||||
// C++: float Params::minInertiaRatio
|
||||
private static native float get_minInertiaRatio_0(long nativeObj);
|
||||
|
||||
// C++: void Params::minInertiaRatio
|
||||
private static native void set_minInertiaRatio_0(long nativeObj, float minInertiaRatio);
|
||||
|
||||
// C++: float Params::maxInertiaRatio
|
||||
private static native float get_maxInertiaRatio_0(long nativeObj);
|
||||
|
||||
// C++: void Params::maxInertiaRatio
|
||||
private static native void set_maxInertiaRatio_0(long nativeObj, float maxInertiaRatio);
|
||||
|
||||
// C++: bool Params::filterByConvexity
|
||||
private static native boolean get_filterByConvexity_0(long nativeObj);
|
||||
|
||||
// C++: void Params::filterByConvexity
|
||||
private static native void set_filterByConvexity_0(long nativeObj, boolean filterByConvexity);
|
||||
|
||||
// C++: float Params::minConvexity
|
||||
private static native float get_minConvexity_0(long nativeObj);
|
||||
|
||||
// C++: void Params::minConvexity
|
||||
private static native void set_minConvexity_0(long nativeObj, float minConvexity);
|
||||
|
||||
// C++: float Params::maxConvexity
|
||||
private static native float get_maxConvexity_0(long nativeObj);
|
||||
|
||||
// C++: void Params::maxConvexity
|
||||
private static native void set_maxConvexity_0(long nativeObj, float maxConvexity);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.imgcodecs;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfByte;
|
||||
import org.opencv.core.MatOfInt;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class Imgcodecs
|
||||
//javadoc: Imgcodecs
|
||||
|
||||
public class Imgcodecs {
|
||||
|
||||
public static final int
|
||||
CV_LOAD_IMAGE_UNCHANGED = -1,
|
||||
CV_LOAD_IMAGE_GRAYSCALE = 0,
|
||||
CV_LOAD_IMAGE_COLOR = 1,
|
||||
CV_LOAD_IMAGE_ANYDEPTH = 2,
|
||||
CV_LOAD_IMAGE_ANYCOLOR = 4,
|
||||
CV_LOAD_IMAGE_IGNORE_ORIENTATION = 128,
|
||||
CV_IMWRITE_JPEG_QUALITY = 1,
|
||||
CV_IMWRITE_JPEG_PROGRESSIVE = 2,
|
||||
CV_IMWRITE_JPEG_OPTIMIZE = 3,
|
||||
CV_IMWRITE_JPEG_RST_INTERVAL = 4,
|
||||
CV_IMWRITE_JPEG_LUMA_QUALITY = 5,
|
||||
CV_IMWRITE_JPEG_CHROMA_QUALITY = 6,
|
||||
CV_IMWRITE_PNG_COMPRESSION = 16,
|
||||
CV_IMWRITE_PNG_STRATEGY = 17,
|
||||
CV_IMWRITE_PNG_BILEVEL = 18,
|
||||
CV_IMWRITE_PNG_STRATEGY_DEFAULT = 0,
|
||||
CV_IMWRITE_PNG_STRATEGY_FILTERED = 1,
|
||||
CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
|
||||
CV_IMWRITE_PNG_STRATEGY_RLE = 3,
|
||||
CV_IMWRITE_PNG_STRATEGY_FIXED = 4,
|
||||
CV_IMWRITE_PXM_BINARY = 32,
|
||||
CV_IMWRITE_EXR_TYPE = 48,
|
||||
CV_IMWRITE_WEBP_QUALITY = 64,
|
||||
CV_IMWRITE_PAM_TUPLETYPE = 128,
|
||||
CV_IMWRITE_PAM_FORMAT_NULL = 0,
|
||||
CV_IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1,
|
||||
CV_IMWRITE_PAM_FORMAT_GRAYSCALE = 2,
|
||||
CV_IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3,
|
||||
CV_IMWRITE_PAM_FORMAT_RGB = 4,
|
||||
CV_IMWRITE_PAM_FORMAT_RGB_ALPHA = 5,
|
||||
CV_CVTIMG_FLIP = 1,
|
||||
CV_CVTIMG_SWAP_RB = 2,
|
||||
IMREAD_UNCHANGED = -1,
|
||||
IMREAD_GRAYSCALE = 0,
|
||||
IMREAD_COLOR = 1,
|
||||
IMREAD_ANYDEPTH = 2,
|
||||
IMREAD_ANYCOLOR = 4,
|
||||
IMREAD_LOAD_GDAL = 8,
|
||||
IMREAD_REDUCED_GRAYSCALE_2 = 16,
|
||||
IMREAD_REDUCED_COLOR_2 = 17,
|
||||
IMREAD_REDUCED_GRAYSCALE_4 = 32,
|
||||
IMREAD_REDUCED_COLOR_4 = 33,
|
||||
IMREAD_REDUCED_GRAYSCALE_8 = 64,
|
||||
IMREAD_REDUCED_COLOR_8 = 65,
|
||||
IMREAD_IGNORE_ORIENTATION = 128,
|
||||
IMWRITE_JPEG_QUALITY = 1,
|
||||
IMWRITE_JPEG_PROGRESSIVE = 2,
|
||||
IMWRITE_JPEG_OPTIMIZE = 3,
|
||||
IMWRITE_JPEG_RST_INTERVAL = 4,
|
||||
IMWRITE_JPEG_LUMA_QUALITY = 5,
|
||||
IMWRITE_JPEG_CHROMA_QUALITY = 6,
|
||||
IMWRITE_PNG_COMPRESSION = 16,
|
||||
IMWRITE_PNG_STRATEGY = 17,
|
||||
IMWRITE_PNG_BILEVEL = 18,
|
||||
IMWRITE_PXM_BINARY = 32,
|
||||
IMWRITE_EXR_TYPE = (3 << 4) + 0,
|
||||
IMWRITE_WEBP_QUALITY = 64,
|
||||
IMWRITE_PAM_TUPLETYPE = 128,
|
||||
IMWRITE_TIFF_RESUNIT = 256,
|
||||
IMWRITE_TIFF_XDPI = 257,
|
||||
IMWRITE_TIFF_YDPI = 258,
|
||||
IMWRITE_EXR_TYPE_HALF = 1,
|
||||
IMWRITE_EXR_TYPE_FLOAT = 2,
|
||||
IMWRITE_PNG_STRATEGY_DEFAULT = 0,
|
||||
IMWRITE_PNG_STRATEGY_FILTERED = 1,
|
||||
IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
|
||||
IMWRITE_PNG_STRATEGY_RLE = 3,
|
||||
IMWRITE_PNG_STRATEGY_FIXED = 4,
|
||||
IMWRITE_PAM_FORMAT_NULL = 0,
|
||||
IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1,
|
||||
IMWRITE_PAM_FORMAT_GRAYSCALE = 2,
|
||||
IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3,
|
||||
IMWRITE_PAM_FORMAT_RGB = 4,
|
||||
IMWRITE_PAM_FORMAT_RGB_ALPHA = 5;
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat imdecode(Mat buf, int flags)
|
||||
//
|
||||
|
||||
//javadoc: imdecode(buf, flags)
|
||||
public static Mat imdecode(Mat buf, int flags)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(imdecode_0(buf.nativeObj, flags));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat imread(String filename, int flags = IMREAD_COLOR)
|
||||
//
|
||||
|
||||
//javadoc: imread(filename, flags)
|
||||
public static Mat imread(String filename, int flags)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(imread_0(filename, flags));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: imread(filename)
|
||||
public static Mat imread(String filename)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(imread_1(filename));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool imencode(String ext, Mat img, vector_uchar& buf, vector_int params = std::vector<int>())
|
||||
//
|
||||
|
||||
//javadoc: imencode(ext, img, buf, params)
|
||||
public static boolean imencode(String ext, Mat img, MatOfByte buf, MatOfInt params)
|
||||
{
|
||||
Mat buf_mat = buf;
|
||||
Mat params_mat = params;
|
||||
boolean retVal = imencode_0(ext, img.nativeObj, buf_mat.nativeObj, params_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: imencode(ext, img, buf)
|
||||
public static boolean imencode(String ext, Mat img, MatOfByte buf)
|
||||
{
|
||||
Mat buf_mat = buf;
|
||||
boolean retVal = imencode_1(ext, img.nativeObj, buf_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool imreadmulti(String filename, vector_Mat& mats, int flags = IMREAD_ANYCOLOR)
|
||||
//
|
||||
|
||||
//javadoc: imreadmulti(filename, mats, flags)
|
||||
public static boolean imreadmulti(String filename, List<Mat> mats, int flags)
|
||||
{
|
||||
Mat mats_mat = new Mat();
|
||||
boolean retVal = imreadmulti_0(filename, mats_mat.nativeObj, flags);
|
||||
Converters.Mat_to_vector_Mat(mats_mat, mats);
|
||||
mats_mat.release();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: imreadmulti(filename, mats)
|
||||
public static boolean imreadmulti(String filename, List<Mat> mats)
|
||||
{
|
||||
Mat mats_mat = new Mat();
|
||||
boolean retVal = imreadmulti_1(filename, mats_mat.nativeObj);
|
||||
Converters.Mat_to_vector_Mat(mats_mat, mats);
|
||||
mats_mat.release();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool imwrite(String filename, Mat img, vector_int params = std::vector<int>())
|
||||
//
|
||||
|
||||
//javadoc: imwrite(filename, img, params)
|
||||
public static boolean imwrite(String filename, Mat img, MatOfInt params)
|
||||
{
|
||||
Mat params_mat = params;
|
||||
boolean retVal = imwrite_0(filename, img.nativeObj, params_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: imwrite(filename, img)
|
||||
public static boolean imwrite(String filename, Mat img)
|
||||
{
|
||||
|
||||
boolean retVal = imwrite_1(filename, img.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// C++: Mat imdecode(Mat buf, int flags)
|
||||
private static native long imdecode_0(long buf_nativeObj, int flags);
|
||||
|
||||
// C++: Mat imread(String filename, int flags = IMREAD_COLOR)
|
||||
private static native long imread_0(String filename, int flags);
|
||||
private static native long imread_1(String filename);
|
||||
|
||||
// C++: bool imencode(String ext, Mat img, vector_uchar& buf, vector_int params = std::vector<int>())
|
||||
private static native boolean imencode_0(String ext, long img_nativeObj, long buf_mat_nativeObj, long params_mat_nativeObj);
|
||||
private static native boolean imencode_1(String ext, long img_nativeObj, long buf_mat_nativeObj);
|
||||
|
||||
// C++: bool imreadmulti(String filename, vector_Mat& mats, int flags = IMREAD_ANYCOLOR)
|
||||
private static native boolean imreadmulti_0(String filename, long mats_mat_nativeObj, int flags);
|
||||
private static native boolean imreadmulti_1(String filename, long mats_mat_nativeObj);
|
||||
|
||||
// C++: bool imwrite(String filename, Mat img, vector_int params = std::vector<int>())
|
||||
private static native boolean imwrite_0(String filename, long img_nativeObj, long params_mat_nativeObj);
|
||||
private static native boolean imwrite_1(String filename, long img_nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.imgproc;
|
||||
|
||||
import org.opencv.core.Algorithm;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
|
||||
// C++: class CLAHE
|
||||
//javadoc: CLAHE
|
||||
|
||||
public class CLAHE extends Algorithm {
|
||||
|
||||
protected CLAHE(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static CLAHE __fromPtr__(long addr) { return new CLAHE(addr); }
|
||||
|
||||
//
|
||||
// C++: Size getTilesGridSize()
|
||||
//
|
||||
|
||||
//javadoc: CLAHE::getTilesGridSize()
|
||||
public Size getTilesGridSize()
|
||||
{
|
||||
|
||||
Size retVal = new Size(getTilesGridSize_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getClipLimit()
|
||||
//
|
||||
|
||||
//javadoc: CLAHE::getClipLimit()
|
||||
public double getClipLimit()
|
||||
{
|
||||
|
||||
double retVal = getClipLimit_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void apply(Mat src, Mat& dst)
|
||||
//
|
||||
|
||||
//javadoc: CLAHE::apply(src, dst)
|
||||
public void apply(Mat src, Mat dst)
|
||||
{
|
||||
|
||||
apply_0(nativeObj, src.nativeObj, dst.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void collectGarbage()
|
||||
//
|
||||
|
||||
//javadoc: CLAHE::collectGarbage()
|
||||
public void collectGarbage()
|
||||
{
|
||||
|
||||
collectGarbage_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setClipLimit(double clipLimit)
|
||||
//
|
||||
|
||||
//javadoc: CLAHE::setClipLimit(clipLimit)
|
||||
public void setClipLimit(double clipLimit)
|
||||
{
|
||||
|
||||
setClipLimit_0(nativeObj, clipLimit);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTilesGridSize(Size tileGridSize)
|
||||
//
|
||||
|
||||
//javadoc: CLAHE::setTilesGridSize(tileGridSize)
|
||||
public void setTilesGridSize(Size tileGridSize)
|
||||
{
|
||||
|
||||
setTilesGridSize_0(nativeObj, tileGridSize.width, tileGridSize.height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Size getTilesGridSize()
|
||||
private static native double[] getTilesGridSize_0(long nativeObj);
|
||||
|
||||
// C++: double getClipLimit()
|
||||
private static native double getClipLimit_0(long nativeObj);
|
||||
|
||||
// C++: void apply(Mat src, Mat& dst)
|
||||
private static native void apply_0(long nativeObj, long src_nativeObj, long dst_nativeObj);
|
||||
|
||||
// C++: void collectGarbage()
|
||||
private static native void collectGarbage_0(long nativeObj);
|
||||
|
||||
// C++: void setClipLimit(double clipLimit)
|
||||
private static native void setClipLimit_0(long nativeObj, double clipLimit);
|
||||
|
||||
// C++: void setTilesGridSize(Size tileGridSize)
|
||||
private static native void setTilesGridSize_0(long nativeObj, double tileGridSize_width, double tileGridSize_height);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+101
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.imgproc;
|
||||
|
||||
import org.opencv.core.Algorithm;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
|
||||
// C++: class LineSegmentDetector
|
||||
//javadoc: LineSegmentDetector
|
||||
|
||||
public class LineSegmentDetector extends Algorithm {
|
||||
|
||||
protected LineSegmentDetector(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static LineSegmentDetector __fromPtr__(long addr) { return new LineSegmentDetector(addr); }
|
||||
|
||||
//
|
||||
// C++: int compareSegments(Size size, Mat lines1, Mat lines2, Mat& _image = Mat())
|
||||
//
|
||||
|
||||
//javadoc: LineSegmentDetector::compareSegments(size, lines1, lines2, _image)
|
||||
public int compareSegments(Size size, Mat lines1, Mat lines2, Mat _image)
|
||||
{
|
||||
|
||||
int retVal = compareSegments_0(nativeObj, size.width, size.height, lines1.nativeObj, lines2.nativeObj, _image.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: LineSegmentDetector::compareSegments(size, lines1, lines2)
|
||||
public int compareSegments(Size size, Mat lines1, Mat lines2)
|
||||
{
|
||||
|
||||
int retVal = compareSegments_1(nativeObj, size.width, size.height, lines1.nativeObj, lines2.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detect(Mat _image, Mat& _lines, Mat& width = Mat(), Mat& prec = Mat(), Mat& nfa = Mat())
|
||||
//
|
||||
|
||||
//javadoc: LineSegmentDetector::detect(_image, _lines, width, prec, nfa)
|
||||
public void detect(Mat _image, Mat _lines, Mat width, Mat prec, Mat nfa)
|
||||
{
|
||||
|
||||
detect_0(nativeObj, _image.nativeObj, _lines.nativeObj, width.nativeObj, prec.nativeObj, nfa.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: LineSegmentDetector::detect(_image, _lines)
|
||||
public void detect(Mat _image, Mat _lines)
|
||||
{
|
||||
|
||||
detect_1(nativeObj, _image.nativeObj, _lines.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void drawSegments(Mat& _image, Mat lines)
|
||||
//
|
||||
|
||||
//javadoc: LineSegmentDetector::drawSegments(_image, lines)
|
||||
public void drawSegments(Mat _image, Mat lines)
|
||||
{
|
||||
|
||||
drawSegments_0(nativeObj, _image.nativeObj, lines.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: int compareSegments(Size size, Mat lines1, Mat lines2, Mat& _image = Mat())
|
||||
private static native int compareSegments_0(long nativeObj, double size_width, double size_height, long lines1_nativeObj, long lines2_nativeObj, long _image_nativeObj);
|
||||
private static native int compareSegments_1(long nativeObj, double size_width, double size_height, long lines1_nativeObj, long lines2_nativeObj);
|
||||
|
||||
// C++: void detect(Mat _image, Mat& _lines, Mat& width = Mat(), Mat& prec = Mat(), Mat& nfa = Mat())
|
||||
private static native void detect_0(long nativeObj, long _image_nativeObj, long _lines_nativeObj, long width_nativeObj, long prec_nativeObj, long nfa_nativeObj);
|
||||
private static native void detect_1(long nativeObj, long _image_nativeObj, long _lines_nativeObj);
|
||||
|
||||
// C++: void drawSegments(Mat& _image, Mat lines)
|
||||
private static native void drawSegments_0(long nativeObj, long _image_nativeObj, long lines_nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package org.opencv.imgproc;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
//javadoc:Moments
|
||||
public class Moments {
|
||||
|
||||
public double m00;
|
||||
public double m10;
|
||||
public double m01;
|
||||
public double m20;
|
||||
public double m11;
|
||||
public double m02;
|
||||
public double m30;
|
||||
public double m21;
|
||||
public double m12;
|
||||
public double m03;
|
||||
|
||||
public double mu20;
|
||||
public double mu11;
|
||||
public double mu02;
|
||||
public double mu30;
|
||||
public double mu21;
|
||||
public double mu12;
|
||||
public double mu03;
|
||||
|
||||
public double nu20;
|
||||
public double nu11;
|
||||
public double nu02;
|
||||
public double nu30;
|
||||
public double nu21;
|
||||
public double nu12;
|
||||
public double nu03;
|
||||
|
||||
public Moments(
|
||||
double m00,
|
||||
double m10,
|
||||
double m01,
|
||||
double m20,
|
||||
double m11,
|
||||
double m02,
|
||||
double m30,
|
||||
double m21,
|
||||
double m12,
|
||||
double m03)
|
||||
{
|
||||
this.m00 = m00;
|
||||
this.m10 = m10;
|
||||
this.m01 = m01;
|
||||
this.m20 = m20;
|
||||
this.m11 = m11;
|
||||
this.m02 = m02;
|
||||
this.m30 = m30;
|
||||
this.m21 = m21;
|
||||
this.m12 = m12;
|
||||
this.m03 = m03;
|
||||
this.completeState();
|
||||
}
|
||||
|
||||
public Moments() {
|
||||
this(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Moments(double[] vals) {
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
m00 = vals.length > 0 ? vals[0] : 0;
|
||||
m10 = vals.length > 1 ? vals[1] : 0;
|
||||
m01 = vals.length > 2 ? vals[2] : 0;
|
||||
m20 = vals.length > 3 ? vals[3] : 0;
|
||||
m11 = vals.length > 4 ? vals[4] : 0;
|
||||
m02 = vals.length > 5 ? vals[5] : 0;
|
||||
m30 = vals.length > 6 ? vals[6] : 0;
|
||||
m21 = vals.length > 7 ? vals[7] : 0;
|
||||
m12 = vals.length > 8 ? vals[8] : 0;
|
||||
m03 = vals.length > 9 ? vals[9] : 0;
|
||||
this.completeState();
|
||||
} else {
|
||||
m00 = 0;
|
||||
m10 = 0;
|
||||
m01 = 0;
|
||||
m20 = 0;
|
||||
m11 = 0;
|
||||
m02 = 0;
|
||||
m30 = 0;
|
||||
m21 = 0;
|
||||
m12 = 0;
|
||||
m03 = 0;
|
||||
mu20 = 0;
|
||||
mu11 = 0;
|
||||
mu02 = 0;
|
||||
mu30 = 0;
|
||||
mu21 = 0;
|
||||
mu12 = 0;
|
||||
mu03 = 0;
|
||||
nu20 = 0;
|
||||
nu11 = 0;
|
||||
nu02 = 0;
|
||||
nu30 = 0;
|
||||
nu21 = 0;
|
||||
nu12 = 0;
|
||||
nu03 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Moments [ " +
|
||||
"\n" +
|
||||
"m00=" + m00 + ", " +
|
||||
"\n" +
|
||||
"m10=" + m10 + ", " +
|
||||
"m01=" + m01 + ", " +
|
||||
"\n" +
|
||||
"m20=" + m20 + ", " +
|
||||
"m11=" + m11 + ", " +
|
||||
"m02=" + m02 + ", " +
|
||||
"\n" +
|
||||
"m30=" + m30 + ", " +
|
||||
"m21=" + m21 + ", " +
|
||||
"m12=" + m12 + ", " +
|
||||
"m03=" + m03 + ", " +
|
||||
"\n" +
|
||||
"mu20=" + mu20 + ", " +
|
||||
"mu11=" + mu11 + ", " +
|
||||
"mu02=" + mu02 + ", " +
|
||||
"\n" +
|
||||
"mu30=" + mu30 + ", " +
|
||||
"mu21=" + mu21 + ", " +
|
||||
"mu12=" + mu12 + ", " +
|
||||
"mu03=" + mu03 + ", " +
|
||||
"\n" +
|
||||
"nu20=" + nu20 + ", " +
|
||||
"nu11=" + nu11 + ", " +
|
||||
"nu02=" + nu02 + ", " +
|
||||
"\n" +
|
||||
"nu30=" + nu30 + ", " +
|
||||
"nu21=" + nu21 + ", " +
|
||||
"nu12=" + nu12 + ", " +
|
||||
"nu03=" + nu03 + ", " +
|
||||
"\n]";
|
||||
}
|
||||
|
||||
protected void completeState()
|
||||
{
|
||||
double cx = 0, cy = 0;
|
||||
double mu20, mu11, mu02;
|
||||
double inv_m00 = 0.0;
|
||||
|
||||
if( Math.abs(this.m00) > 0.00000001 )
|
||||
{
|
||||
inv_m00 = 1. / this.m00;
|
||||
cx = this.m10 * inv_m00;
|
||||
cy = this.m01 * inv_m00;
|
||||
}
|
||||
|
||||
// mu20 = m20 - m10*cx
|
||||
mu20 = this.m20 - this.m10 * cx;
|
||||
// mu11 = m11 - m10*cy
|
||||
mu11 = this.m11 - this.m10 * cy;
|
||||
// mu02 = m02 - m01*cy
|
||||
mu02 = this.m02 - this.m01 * cy;
|
||||
|
||||
this.mu20 = mu20;
|
||||
this.mu11 = mu11;
|
||||
this.mu02 = mu02;
|
||||
|
||||
// mu30 = m30 - cx*(3*mu20 + cx*m10)
|
||||
this.mu30 = this.m30 - cx * (3 * mu20 + cx * this.m10);
|
||||
mu11 += mu11;
|
||||
// mu21 = m21 - cx*(2*mu11 + cx*m01) - cy*mu20
|
||||
this.mu21 = this.m21 - cx * (mu11 + cx * this.m01) - cy * mu20;
|
||||
// mu12 = m12 - cy*(2*mu11 + cy*m10) - cx*mu02
|
||||
this.mu12 = this.m12 - cy * (mu11 + cy * this.m10) - cx * mu02;
|
||||
// mu03 = m03 - cy*(3*mu02 + cy*m01)
|
||||
this.mu03 = this.m03 - cy * (3 * mu02 + cy * this.m01);
|
||||
|
||||
|
||||
double inv_sqrt_m00 = Math.sqrt(Math.abs(inv_m00));
|
||||
double s2 = inv_m00*inv_m00, s3 = s2*inv_sqrt_m00;
|
||||
|
||||
this.nu20 = this.mu20*s2;
|
||||
this.nu11 = this.mu11*s2;
|
||||
this.nu02 = this.mu02*s2;
|
||||
this.nu30 = this.mu30*s3;
|
||||
this.nu21 = this.mu21*s3;
|
||||
this.nu12 = this.mu12*s3;
|
||||
this.nu03 = this.mu03*s3;
|
||||
|
||||
}
|
||||
|
||||
public double get_m00() { return this.m00; }
|
||||
public double get_m10() { return this.m10; }
|
||||
public double get_m01() { return this.m01; }
|
||||
public double get_m20() { return this.m20; }
|
||||
public double get_m11() { return this.m11; }
|
||||
public double get_m02() { return this.m02; }
|
||||
public double get_m30() { return this.m30; }
|
||||
public double get_m21() { return this.m21; }
|
||||
public double get_m12() { return this.m12; }
|
||||
public double get_m03() { return this.m03; }
|
||||
public double get_mu20() { return this.mu20; }
|
||||
public double get_mu11() { return this.mu11; }
|
||||
public double get_mu02() { return this.mu02; }
|
||||
public double get_mu30() { return this.mu30; }
|
||||
public double get_mu21() { return this.mu21; }
|
||||
public double get_mu12() { return this.mu12; }
|
||||
public double get_mu03() { return this.mu03; }
|
||||
public double get_nu20() { return this.nu20; }
|
||||
public double get_nu11() { return this.nu11; }
|
||||
public double get_nu02() { return this.nu02; }
|
||||
public double get_nu30() { return this.nu30; }
|
||||
public double get_nu21() { return this.nu21; }
|
||||
public double get_nu12() { return this.nu12; }
|
||||
public double get_nu03() { return this.nu03; }
|
||||
|
||||
public void set_m00(double m00) { this.m00 = m00; }
|
||||
public void set_m10(double m10) { this.m10 = m10; }
|
||||
public void set_m01(double m01) { this.m01 = m01; }
|
||||
public void set_m20(double m20) { this.m20 = m20; }
|
||||
public void set_m11(double m11) { this.m11 = m11; }
|
||||
public void set_m02(double m02) { this.m02 = m02; }
|
||||
public void set_m30(double m30) { this.m30 = m30; }
|
||||
public void set_m21(double m21) { this.m21 = m21; }
|
||||
public void set_m12(double m12) { this.m12 = m12; }
|
||||
public void set_m03(double m03) { this.m03 = m03; }
|
||||
public void set_mu20(double mu20) { this.mu20 = mu20; }
|
||||
public void set_mu11(double mu11) { this.mu11 = mu11; }
|
||||
public void set_mu02(double mu02) { this.mu02 = mu02; }
|
||||
public void set_mu30(double mu30) { this.mu30 = mu30; }
|
||||
public void set_mu21(double mu21) { this.mu21 = mu21; }
|
||||
public void set_mu12(double mu12) { this.mu12 = mu12; }
|
||||
public void set_mu03(double mu03) { this.mu03 = mu03; }
|
||||
public void set_nu20(double nu20) { this.nu20 = nu20; }
|
||||
public void set_nu11(double nu11) { this.nu11 = nu11; }
|
||||
public void set_nu02(double nu02) { this.nu02 = nu02; }
|
||||
public void set_nu30(double nu30) { this.nu30 = nu30; }
|
||||
public void set_nu21(double nu21) { this.nu21 = nu21; }
|
||||
public void set_nu12(double nu12) { this.nu12 = nu12; }
|
||||
public void set_nu03(double nu03) { this.nu03 = nu03; }
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.imgproc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfFloat4;
|
||||
import org.opencv.core.MatOfFloat6;
|
||||
import org.opencv.core.MatOfInt;
|
||||
import org.opencv.core.MatOfPoint2f;
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Rect;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class Subdiv2D
|
||||
//javadoc: Subdiv2D
|
||||
|
||||
public class Subdiv2D {
|
||||
|
||||
protected final long nativeObj;
|
||||
protected Subdiv2D(long addr) { nativeObj = addr; }
|
||||
|
||||
public long getNativeObjAddr() { return nativeObj; }
|
||||
|
||||
// internal usage only
|
||||
public static Subdiv2D __fromPtr__(long addr) { return new Subdiv2D(addr); }
|
||||
|
||||
public static final int
|
||||
PTLOC_ERROR = -2,
|
||||
PTLOC_OUTSIDE_RECT = -1,
|
||||
PTLOC_INSIDE = 0,
|
||||
PTLOC_VERTEX = 1,
|
||||
PTLOC_ON_EDGE = 2,
|
||||
NEXT_AROUND_ORG = 0x00,
|
||||
NEXT_AROUND_DST = 0x22,
|
||||
PREV_AROUND_ORG = 0x11,
|
||||
PREV_AROUND_DST = 0x33,
|
||||
NEXT_AROUND_LEFT = 0x13,
|
||||
NEXT_AROUND_RIGHT = 0x31,
|
||||
PREV_AROUND_LEFT = 0x20,
|
||||
PREV_AROUND_RIGHT = 0x02;
|
||||
|
||||
|
||||
//
|
||||
// C++: Subdiv2D(Rect rect)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::Subdiv2D(rect)
|
||||
public Subdiv2D(Rect rect)
|
||||
{
|
||||
|
||||
nativeObj = Subdiv2D_0(rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Subdiv2D()
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::Subdiv2D()
|
||||
public Subdiv2D()
|
||||
{
|
||||
|
||||
nativeObj = Subdiv2D_1();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Point2f getVertex(int vertex, int* firstEdge = 0)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::getVertex(vertex, firstEdge)
|
||||
public Point getVertex(int vertex, int[] firstEdge)
|
||||
{
|
||||
double[] firstEdge_out = new double[1];
|
||||
Point retVal = new Point(getVertex_0(nativeObj, vertex, firstEdge_out));
|
||||
if(firstEdge!=null) firstEdge[0] = (int)firstEdge_out[0];
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: Subdiv2D::getVertex(vertex)
|
||||
public Point getVertex(int vertex)
|
||||
{
|
||||
|
||||
Point retVal = new Point(getVertex_1(nativeObj, vertex));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int edgeDst(int edge, Point2f* dstpt = 0)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::edgeDst(edge, dstpt)
|
||||
public int edgeDst(int edge, Point dstpt)
|
||||
{
|
||||
double[] dstpt_out = new double[2];
|
||||
int retVal = edgeDst_0(nativeObj, edge, dstpt_out);
|
||||
if(dstpt!=null){ dstpt.x = dstpt_out[0]; dstpt.y = dstpt_out[1]; }
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: Subdiv2D::edgeDst(edge)
|
||||
public int edgeDst(int edge)
|
||||
{
|
||||
|
||||
int retVal = edgeDst_1(nativeObj, edge);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int edgeOrg(int edge, Point2f* orgpt = 0)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::edgeOrg(edge, orgpt)
|
||||
public int edgeOrg(int edge, Point orgpt)
|
||||
{
|
||||
double[] orgpt_out = new double[2];
|
||||
int retVal = edgeOrg_0(nativeObj, edge, orgpt_out);
|
||||
if(orgpt!=null){ orgpt.x = orgpt_out[0]; orgpt.y = orgpt_out[1]; }
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: Subdiv2D::edgeOrg(edge)
|
||||
public int edgeOrg(int edge)
|
||||
{
|
||||
|
||||
int retVal = edgeOrg_1(nativeObj, edge);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int findNearest(Point2f pt, Point2f* nearestPt = 0)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::findNearest(pt, nearestPt)
|
||||
public int findNearest(Point pt, Point nearestPt)
|
||||
{
|
||||
double[] nearestPt_out = new double[2];
|
||||
int retVal = findNearest_0(nativeObj, pt.x, pt.y, nearestPt_out);
|
||||
if(nearestPt!=null){ nearestPt.x = nearestPt_out[0]; nearestPt.y = nearestPt_out[1]; }
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: Subdiv2D::findNearest(pt)
|
||||
public int findNearest(Point pt)
|
||||
{
|
||||
|
||||
int retVal = findNearest_1(nativeObj, pt.x, pt.y);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getEdge(int edge, int nextEdgeType)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::getEdge(edge, nextEdgeType)
|
||||
public int getEdge(int edge, int nextEdgeType)
|
||||
{
|
||||
|
||||
int retVal = getEdge_0(nativeObj, edge, nextEdgeType);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int insert(Point2f pt)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::insert(pt)
|
||||
public int insert(Point pt)
|
||||
{
|
||||
|
||||
int retVal = insert_0(nativeObj, pt.x, pt.y);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int locate(Point2f pt, int& edge, int& vertex)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::locate(pt, edge, vertex)
|
||||
public int locate(Point pt, int[] edge, int[] vertex)
|
||||
{
|
||||
double[] edge_out = new double[1];
|
||||
double[] vertex_out = new double[1];
|
||||
int retVal = locate_0(nativeObj, pt.x, pt.y, edge_out, vertex_out);
|
||||
if(edge!=null) edge[0] = (int)edge_out[0];
|
||||
if(vertex!=null) vertex[0] = (int)vertex_out[0];
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int nextEdge(int edge)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::nextEdge(edge)
|
||||
public int nextEdge(int edge)
|
||||
{
|
||||
|
||||
int retVal = nextEdge_0(nativeObj, edge);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int rotateEdge(int edge, int rotate)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::rotateEdge(edge, rotate)
|
||||
public int rotateEdge(int edge, int rotate)
|
||||
{
|
||||
|
||||
int retVal = rotateEdge_0(nativeObj, edge, rotate);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int symEdge(int edge)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::symEdge(edge)
|
||||
public int symEdge(int edge)
|
||||
{
|
||||
|
||||
int retVal = symEdge_0(nativeObj, edge);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getEdgeList(vector_Vec4f& edgeList)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::getEdgeList(edgeList)
|
||||
public void getEdgeList(MatOfFloat4 edgeList)
|
||||
{
|
||||
Mat edgeList_mat = edgeList;
|
||||
getEdgeList_0(nativeObj, edgeList_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getLeadingEdgeList(vector_int& leadingEdgeList)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::getLeadingEdgeList(leadingEdgeList)
|
||||
public void getLeadingEdgeList(MatOfInt leadingEdgeList)
|
||||
{
|
||||
Mat leadingEdgeList_mat = leadingEdgeList;
|
||||
getLeadingEdgeList_0(nativeObj, leadingEdgeList_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getTriangleList(vector_Vec6f& triangleList)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::getTriangleList(triangleList)
|
||||
public void getTriangleList(MatOfFloat6 triangleList)
|
||||
{
|
||||
Mat triangleList_mat = triangleList;
|
||||
getTriangleList_0(nativeObj, triangleList_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::getVoronoiFacetList(idx, facetList, facetCenters)
|
||||
public void getVoronoiFacetList(MatOfInt idx, List<MatOfPoint2f> facetList, MatOfPoint2f facetCenters)
|
||||
{
|
||||
Mat idx_mat = idx;
|
||||
Mat facetList_mat = new Mat();
|
||||
Mat facetCenters_mat = facetCenters;
|
||||
getVoronoiFacetList_0(nativeObj, idx_mat.nativeObj, facetList_mat.nativeObj, facetCenters_mat.nativeObj);
|
||||
Converters.Mat_to_vector_vector_Point2f(facetList_mat, facetList);
|
||||
facetList_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void initDelaunay(Rect rect)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::initDelaunay(rect)
|
||||
public void initDelaunay(Rect rect)
|
||||
{
|
||||
|
||||
initDelaunay_0(nativeObj, rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void insert(vector_Point2f ptvec)
|
||||
//
|
||||
|
||||
//javadoc: Subdiv2D::insert(ptvec)
|
||||
public void insert(MatOfPoint2f ptvec)
|
||||
{
|
||||
Mat ptvec_mat = ptvec;
|
||||
insert_1(nativeObj, ptvec_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Subdiv2D(Rect rect)
|
||||
private static native long Subdiv2D_0(int rect_x, int rect_y, int rect_width, int rect_height);
|
||||
|
||||
// C++: Subdiv2D()
|
||||
private static native long Subdiv2D_1();
|
||||
|
||||
// C++: Point2f getVertex(int vertex, int* firstEdge = 0)
|
||||
private static native double[] getVertex_0(long nativeObj, int vertex, double[] firstEdge_out);
|
||||
private static native double[] getVertex_1(long nativeObj, int vertex);
|
||||
|
||||
// C++: int edgeDst(int edge, Point2f* dstpt = 0)
|
||||
private static native int edgeDst_0(long nativeObj, int edge, double[] dstpt_out);
|
||||
private static native int edgeDst_1(long nativeObj, int edge);
|
||||
|
||||
// C++: int edgeOrg(int edge, Point2f* orgpt = 0)
|
||||
private static native int edgeOrg_0(long nativeObj, int edge, double[] orgpt_out);
|
||||
private static native int edgeOrg_1(long nativeObj, int edge);
|
||||
|
||||
// C++: int findNearest(Point2f pt, Point2f* nearestPt = 0)
|
||||
private static native int findNearest_0(long nativeObj, double pt_x, double pt_y, double[] nearestPt_out);
|
||||
private static native int findNearest_1(long nativeObj, double pt_x, double pt_y);
|
||||
|
||||
// C++: int getEdge(int edge, int nextEdgeType)
|
||||
private static native int getEdge_0(long nativeObj, int edge, int nextEdgeType);
|
||||
|
||||
// C++: int insert(Point2f pt)
|
||||
private static native int insert_0(long nativeObj, double pt_x, double pt_y);
|
||||
|
||||
// C++: int locate(Point2f pt, int& edge, int& vertex)
|
||||
private static native int locate_0(long nativeObj, double pt_x, double pt_y, double[] edge_out, double[] vertex_out);
|
||||
|
||||
// C++: int nextEdge(int edge)
|
||||
private static native int nextEdge_0(long nativeObj, int edge);
|
||||
|
||||
// C++: int rotateEdge(int edge, int rotate)
|
||||
private static native int rotateEdge_0(long nativeObj, int edge, int rotate);
|
||||
|
||||
// C++: int symEdge(int edge)
|
||||
private static native int symEdge_0(long nativeObj, int edge);
|
||||
|
||||
// C++: void getEdgeList(vector_Vec4f& edgeList)
|
||||
private static native void getEdgeList_0(long nativeObj, long edgeList_mat_nativeObj);
|
||||
|
||||
// C++: void getLeadingEdgeList(vector_int& leadingEdgeList)
|
||||
private static native void getLeadingEdgeList_0(long nativeObj, long leadingEdgeList_mat_nativeObj);
|
||||
|
||||
// C++: void getTriangleList(vector_Vec6f& triangleList)
|
||||
private static native void getTriangleList_0(long nativeObj, long triangleList_mat_nativeObj);
|
||||
|
||||
// C++: void getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters)
|
||||
private static native void getVoronoiFacetList_0(long nativeObj, long idx_mat_nativeObj, long facetList_mat_nativeObj, long facetCenters_mat_nativeObj);
|
||||
|
||||
// C++: void initDelaunay(Rect rect)
|
||||
private static native void initDelaunay_0(long nativeObj, int rect_x, int rect_y, int rect_width, int rect_height);
|
||||
|
||||
// C++: void insert(vector_Point2f ptvec)
|
||||
private static native void insert_1(long nativeObj, long ptvec_mat_nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,610 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.TermCriteria;
|
||||
import org.opencv.ml.ANN_MLP;
|
||||
import org.opencv.ml.StatModel;
|
||||
|
||||
// C++: class ANN_MLP
|
||||
//javadoc: ANN_MLP
|
||||
|
||||
public class ANN_MLP extends StatModel {
|
||||
|
||||
protected ANN_MLP(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static ANN_MLP __fromPtr__(long addr) { return new ANN_MLP(addr); }
|
||||
|
||||
public static final int
|
||||
BACKPROP = 0,
|
||||
RPROP = 1,
|
||||
ANNEAL = 2,
|
||||
IDENTITY = 0,
|
||||
SIGMOID_SYM = 1,
|
||||
GAUSSIAN = 2,
|
||||
RELU = 3,
|
||||
LEAKYRELU = 4,
|
||||
UPDATE_WEIGHTS = 1,
|
||||
NO_INPUT_SCALE = 2,
|
||||
NO_OUTPUT_SCALE = 4;
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getLayerSizes()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getLayerSizes()
|
||||
public Mat getLayerSizes()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getLayerSizes_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getWeights(int layerIdx)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getWeights(layerIdx)
|
||||
public Mat getWeights(int layerIdx)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getWeights_0(nativeObj, layerIdx));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_ANN_MLP create()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::create()
|
||||
public static ANN_MLP create()
|
||||
{
|
||||
|
||||
ANN_MLP retVal = ANN_MLP.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_ANN_MLP load(String filepath)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::load(filepath)
|
||||
public static ANN_MLP load(String filepath)
|
||||
{
|
||||
|
||||
ANN_MLP retVal = ANN_MLP.__fromPtr__(load_0(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getTermCriteria()
|
||||
public TermCriteria getTermCriteria()
|
||||
{
|
||||
|
||||
TermCriteria retVal = new TermCriteria(getTermCriteria_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getAnnealCoolingRatio()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getAnnealCoolingRatio()
|
||||
public double getAnnealCoolingRatio()
|
||||
{
|
||||
|
||||
double retVal = getAnnealCoolingRatio_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getAnnealFinalT()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getAnnealFinalT()
|
||||
public double getAnnealFinalT()
|
||||
{
|
||||
|
||||
double retVal = getAnnealFinalT_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getAnnealInitialT()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getAnnealInitialT()
|
||||
public double getAnnealInitialT()
|
||||
{
|
||||
|
||||
double retVal = getAnnealInitialT_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getBackpropMomentumScale()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getBackpropMomentumScale()
|
||||
public double getBackpropMomentumScale()
|
||||
{
|
||||
|
||||
double retVal = getBackpropMomentumScale_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getBackpropWeightScale()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getBackpropWeightScale()
|
||||
public double getBackpropWeightScale()
|
||||
{
|
||||
|
||||
double retVal = getBackpropWeightScale_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getRpropDW0()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getRpropDW0()
|
||||
public double getRpropDW0()
|
||||
{
|
||||
|
||||
double retVal = getRpropDW0_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getRpropDWMax()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getRpropDWMax()
|
||||
public double getRpropDWMax()
|
||||
{
|
||||
|
||||
double retVal = getRpropDWMax_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getRpropDWMin()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getRpropDWMin()
|
||||
public double getRpropDWMin()
|
||||
{
|
||||
|
||||
double retVal = getRpropDWMin_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getRpropDWMinus()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getRpropDWMinus()
|
||||
public double getRpropDWMinus()
|
||||
{
|
||||
|
||||
double retVal = getRpropDWMinus_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getRpropDWPlus()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getRpropDWPlus()
|
||||
public double getRpropDWPlus()
|
||||
{
|
||||
|
||||
double retVal = getRpropDWPlus_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getAnnealItePerStep()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getAnnealItePerStep()
|
||||
public int getAnnealItePerStep()
|
||||
{
|
||||
|
||||
int retVal = getAnnealItePerStep_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getTrainMethod()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::getTrainMethod()
|
||||
public int getTrainMethod()
|
||||
{
|
||||
|
||||
int retVal = getTrainMethod_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setActivationFunction(int type, double param1 = 0, double param2 = 0)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setActivationFunction(type, param1, param2)
|
||||
public void setActivationFunction(int type, double param1, double param2)
|
||||
{
|
||||
|
||||
setActivationFunction_0(nativeObj, type, param1, param2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: ANN_MLP::setActivationFunction(type)
|
||||
public void setActivationFunction(int type)
|
||||
{
|
||||
|
||||
setActivationFunction_1(nativeObj, type);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAnnealCoolingRatio(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setAnnealCoolingRatio(val)
|
||||
public void setAnnealCoolingRatio(double val)
|
||||
{
|
||||
|
||||
setAnnealCoolingRatio_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAnnealFinalT(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setAnnealFinalT(val)
|
||||
public void setAnnealFinalT(double val)
|
||||
{
|
||||
|
||||
setAnnealFinalT_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAnnealInitialT(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setAnnealInitialT(val)
|
||||
public void setAnnealInitialT(double val)
|
||||
{
|
||||
|
||||
setAnnealInitialT_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAnnealItePerStep(int val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setAnnealItePerStep(val)
|
||||
public void setAnnealItePerStep(int val)
|
||||
{
|
||||
|
||||
setAnnealItePerStep_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setBackpropMomentumScale(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setBackpropMomentumScale(val)
|
||||
public void setBackpropMomentumScale(double val)
|
||||
{
|
||||
|
||||
setBackpropMomentumScale_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setBackpropWeightScale(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setBackpropWeightScale(val)
|
||||
public void setBackpropWeightScale(double val)
|
||||
{
|
||||
|
||||
setBackpropWeightScale_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setLayerSizes(Mat _layer_sizes)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setLayerSizes(_layer_sizes)
|
||||
public void setLayerSizes(Mat _layer_sizes)
|
||||
{
|
||||
|
||||
setLayerSizes_0(nativeObj, _layer_sizes.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setRpropDW0(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setRpropDW0(val)
|
||||
public void setRpropDW0(double val)
|
||||
{
|
||||
|
||||
setRpropDW0_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setRpropDWMax(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setRpropDWMax(val)
|
||||
public void setRpropDWMax(double val)
|
||||
{
|
||||
|
||||
setRpropDWMax_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setRpropDWMin(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setRpropDWMin(val)
|
||||
public void setRpropDWMin(double val)
|
||||
{
|
||||
|
||||
setRpropDWMin_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setRpropDWMinus(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setRpropDWMinus(val)
|
||||
public void setRpropDWMinus(double val)
|
||||
{
|
||||
|
||||
setRpropDWMinus_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setRpropDWPlus(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setRpropDWPlus(val)
|
||||
public void setRpropDWPlus(double val)
|
||||
{
|
||||
|
||||
setRpropDWPlus_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setTermCriteria(val)
|
||||
public void setTermCriteria(TermCriteria val)
|
||||
{
|
||||
|
||||
setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTrainMethod(int method, double param1 = 0, double param2 = 0)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP::setTrainMethod(method, param1, param2)
|
||||
public void setTrainMethod(int method, double param1, double param2)
|
||||
{
|
||||
|
||||
setTrainMethod_0(nativeObj, method, param1, param2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: ANN_MLP::setTrainMethod(method)
|
||||
public void setTrainMethod(int method)
|
||||
{
|
||||
|
||||
setTrainMethod_1(nativeObj, method);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat getLayerSizes()
|
||||
private static native long getLayerSizes_0(long nativeObj);
|
||||
|
||||
// C++: Mat getWeights(int layerIdx)
|
||||
private static native long getWeights_0(long nativeObj, int layerIdx);
|
||||
|
||||
// C++: static Ptr_ANN_MLP create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_ANN_MLP load(String filepath)
|
||||
private static native long load_0(String filepath);
|
||||
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
private static native double[] getTermCriteria_0(long nativeObj);
|
||||
|
||||
// C++: double getAnnealCoolingRatio()
|
||||
private static native double getAnnealCoolingRatio_0(long nativeObj);
|
||||
|
||||
// C++: double getAnnealFinalT()
|
||||
private static native double getAnnealFinalT_0(long nativeObj);
|
||||
|
||||
// C++: double getAnnealInitialT()
|
||||
private static native double getAnnealInitialT_0(long nativeObj);
|
||||
|
||||
// C++: double getBackpropMomentumScale()
|
||||
private static native double getBackpropMomentumScale_0(long nativeObj);
|
||||
|
||||
// C++: double getBackpropWeightScale()
|
||||
private static native double getBackpropWeightScale_0(long nativeObj);
|
||||
|
||||
// C++: double getRpropDW0()
|
||||
private static native double getRpropDW0_0(long nativeObj);
|
||||
|
||||
// C++: double getRpropDWMax()
|
||||
private static native double getRpropDWMax_0(long nativeObj);
|
||||
|
||||
// C++: double getRpropDWMin()
|
||||
private static native double getRpropDWMin_0(long nativeObj);
|
||||
|
||||
// C++: double getRpropDWMinus()
|
||||
private static native double getRpropDWMinus_0(long nativeObj);
|
||||
|
||||
// C++: double getRpropDWPlus()
|
||||
private static native double getRpropDWPlus_0(long nativeObj);
|
||||
|
||||
// C++: int getAnnealItePerStep()
|
||||
private static native int getAnnealItePerStep_0(long nativeObj);
|
||||
|
||||
// C++: int getTrainMethod()
|
||||
private static native int getTrainMethod_0(long nativeObj);
|
||||
|
||||
// C++: void setActivationFunction(int type, double param1 = 0, double param2 = 0)
|
||||
private static native void setActivationFunction_0(long nativeObj, int type, double param1, double param2);
|
||||
private static native void setActivationFunction_1(long nativeObj, int type);
|
||||
|
||||
// C++: void setAnnealCoolingRatio(double val)
|
||||
private static native void setAnnealCoolingRatio_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setAnnealFinalT(double val)
|
||||
private static native void setAnnealFinalT_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setAnnealInitialT(double val)
|
||||
private static native void setAnnealInitialT_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setAnnealItePerStep(int val)
|
||||
private static native void setAnnealItePerStep_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setBackpropMomentumScale(double val)
|
||||
private static native void setBackpropMomentumScale_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setBackpropWeightScale(double val)
|
||||
private static native void setBackpropWeightScale_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setLayerSizes(Mat _layer_sizes)
|
||||
private static native void setLayerSizes_0(long nativeObj, long _layer_sizes_nativeObj);
|
||||
|
||||
// C++: void setRpropDW0(double val)
|
||||
private static native void setRpropDW0_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setRpropDWMax(double val)
|
||||
private static native void setRpropDWMax_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setRpropDWMin(double val)
|
||||
private static native void setRpropDWMin_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setRpropDWMinus(double val)
|
||||
private static native void setRpropDWMinus_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setRpropDWPlus(double val)
|
||||
private static native void setRpropDWPlus_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);
|
||||
|
||||
// C++: void setTrainMethod(int method, double param1 = 0, double param2 = 0)
|
||||
private static native void setTrainMethod_0(long nativeObj, int method, double param1, double param2);
|
||||
private static native void setTrainMethod_1(long nativeObj, int method);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import org.opencv.ml.ANN_MLP;
|
||||
|
||||
// C++: class ANN_MLP_ANNEAL
|
||||
//javadoc: ANN_MLP_ANNEAL
|
||||
|
||||
public class ANN_MLP_ANNEAL extends ANN_MLP {
|
||||
|
||||
protected ANN_MLP_ANNEAL(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static ANN_MLP_ANNEAL __fromPtr__(long addr) { return new ANN_MLP_ANNEAL(addr); }
|
||||
|
||||
//
|
||||
// C++: double getAnnealCoolingRatio()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP_ANNEAL::getAnnealCoolingRatio()
|
||||
public double getAnnealCoolingRatio()
|
||||
{
|
||||
|
||||
double retVal = getAnnealCoolingRatio_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getAnnealFinalT()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP_ANNEAL::getAnnealFinalT()
|
||||
public double getAnnealFinalT()
|
||||
{
|
||||
|
||||
double retVal = getAnnealFinalT_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getAnnealInitialT()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP_ANNEAL::getAnnealInitialT()
|
||||
public double getAnnealInitialT()
|
||||
{
|
||||
|
||||
double retVal = getAnnealInitialT_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getAnnealItePerStep()
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP_ANNEAL::getAnnealItePerStep()
|
||||
public int getAnnealItePerStep()
|
||||
{
|
||||
|
||||
int retVal = getAnnealItePerStep_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAnnealCoolingRatio(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP_ANNEAL::setAnnealCoolingRatio(val)
|
||||
public void setAnnealCoolingRatio(double val)
|
||||
{
|
||||
|
||||
setAnnealCoolingRatio_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAnnealFinalT(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP_ANNEAL::setAnnealFinalT(val)
|
||||
public void setAnnealFinalT(double val)
|
||||
{
|
||||
|
||||
setAnnealFinalT_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAnnealInitialT(double val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP_ANNEAL::setAnnealInitialT(val)
|
||||
public void setAnnealInitialT(double val)
|
||||
{
|
||||
|
||||
setAnnealInitialT_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAnnealItePerStep(int val)
|
||||
//
|
||||
|
||||
//javadoc: ANN_MLP_ANNEAL::setAnnealItePerStep(val)
|
||||
public void setAnnealItePerStep(int val)
|
||||
{
|
||||
|
||||
setAnnealItePerStep_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: double getAnnealCoolingRatio()
|
||||
private static native double getAnnealCoolingRatio_0(long nativeObj);
|
||||
|
||||
// C++: double getAnnealFinalT()
|
||||
private static native double getAnnealFinalT_0(long nativeObj);
|
||||
|
||||
// C++: double getAnnealInitialT()
|
||||
private static native double getAnnealInitialT_0(long nativeObj);
|
||||
|
||||
// C++: int getAnnealItePerStep()
|
||||
private static native int getAnnealItePerStep_0(long nativeObj);
|
||||
|
||||
// C++: void setAnnealCoolingRatio(double val)
|
||||
private static native void setAnnealCoolingRatio_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setAnnealFinalT(double val)
|
||||
private static native void setAnnealFinalT_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setAnnealInitialT(double val)
|
||||
private static native void setAnnealInitialT_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setAnnealItePerStep(int val)
|
||||
private static native void setAnnealItePerStep_0(long nativeObj, int val);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.ml.Boost;
|
||||
import org.opencv.ml.DTrees;
|
||||
|
||||
// C++: class Boost
|
||||
//javadoc: Boost
|
||||
|
||||
public class Boost extends DTrees {
|
||||
|
||||
protected Boost(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static Boost __fromPtr__(long addr) { return new Boost(addr); }
|
||||
|
||||
public static final int
|
||||
DISCRETE = 0,
|
||||
REAL = 1,
|
||||
LOGIT = 2,
|
||||
GENTLE = 3;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_Boost create()
|
||||
//
|
||||
|
||||
//javadoc: Boost::create()
|
||||
public static Boost create()
|
||||
{
|
||||
|
||||
Boost retVal = Boost.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_Boost load(String filepath, String nodeName = String())
|
||||
//
|
||||
|
||||
//javadoc: Boost::load(filepath, nodeName)
|
||||
public static Boost load(String filepath, String nodeName)
|
||||
{
|
||||
|
||||
Boost retVal = Boost.__fromPtr__(load_0(filepath, nodeName));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: Boost::load(filepath)
|
||||
public static Boost load(String filepath)
|
||||
{
|
||||
|
||||
Boost retVal = Boost.__fromPtr__(load_1(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getWeightTrimRate()
|
||||
//
|
||||
|
||||
//javadoc: Boost::getWeightTrimRate()
|
||||
public double getWeightTrimRate()
|
||||
{
|
||||
|
||||
double retVal = getWeightTrimRate_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getBoostType()
|
||||
//
|
||||
|
||||
//javadoc: Boost::getBoostType()
|
||||
public int getBoostType()
|
||||
{
|
||||
|
||||
int retVal = getBoostType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getWeakCount()
|
||||
//
|
||||
|
||||
//javadoc: Boost::getWeakCount()
|
||||
public int getWeakCount()
|
||||
{
|
||||
|
||||
int retVal = getWeakCount_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setBoostType(int val)
|
||||
//
|
||||
|
||||
//javadoc: Boost::setBoostType(val)
|
||||
public void setBoostType(int val)
|
||||
{
|
||||
|
||||
setBoostType_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setWeakCount(int val)
|
||||
//
|
||||
|
||||
//javadoc: Boost::setWeakCount(val)
|
||||
public void setWeakCount(int val)
|
||||
{
|
||||
|
||||
setWeakCount_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setWeightTrimRate(double val)
|
||||
//
|
||||
|
||||
//javadoc: Boost::setWeightTrimRate(val)
|
||||
public void setWeightTrimRate(double val)
|
||||
{
|
||||
|
||||
setWeightTrimRate_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_Boost create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_Boost load(String filepath, String nodeName = String())
|
||||
private static native long load_0(String filepath, String nodeName);
|
||||
private static native long load_1(String filepath);
|
||||
|
||||
// C++: double getWeightTrimRate()
|
||||
private static native double getWeightTrimRate_0(long nativeObj);
|
||||
|
||||
// C++: int getBoostType()
|
||||
private static native int getBoostType_0(long nativeObj);
|
||||
|
||||
// C++: int getWeakCount()
|
||||
private static native int getWeakCount_0(long nativeObj);
|
||||
|
||||
// C++: void setBoostType(int val)
|
||||
private static native void setBoostType_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setWeakCount(int val)
|
||||
private static native void setWeakCount_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setWeightTrimRate(double val)
|
||||
private static native void setWeightTrimRate_0(long nativeObj, double val);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,388 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.ml.DTrees;
|
||||
import org.opencv.ml.StatModel;
|
||||
|
||||
// C++: class DTrees
|
||||
//javadoc: DTrees
|
||||
|
||||
public class DTrees extends StatModel {
|
||||
|
||||
protected DTrees(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static DTrees __fromPtr__(long addr) { return new DTrees(addr); }
|
||||
|
||||
public static final int
|
||||
PREDICT_AUTO = 0,
|
||||
PREDICT_SUM = (1<<8),
|
||||
PREDICT_MAX_VOTE = (2<<8),
|
||||
PREDICT_MASK = (3<<8);
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getPriors()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getPriors()
|
||||
public Mat getPriors()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getPriors_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_DTrees create()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::create()
|
||||
public static DTrees create()
|
||||
{
|
||||
|
||||
DTrees retVal = DTrees.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_DTrees load(String filepath, String nodeName = String())
|
||||
//
|
||||
|
||||
//javadoc: DTrees::load(filepath, nodeName)
|
||||
public static DTrees load(String filepath, String nodeName)
|
||||
{
|
||||
|
||||
DTrees retVal = DTrees.__fromPtr__(load_0(filepath, nodeName));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: DTrees::load(filepath)
|
||||
public static DTrees load(String filepath)
|
||||
{
|
||||
|
||||
DTrees retVal = DTrees.__fromPtr__(load_1(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getTruncatePrunedTree()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getTruncatePrunedTree()
|
||||
public boolean getTruncatePrunedTree()
|
||||
{
|
||||
|
||||
boolean retVal = getTruncatePrunedTree_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getUse1SERule()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getUse1SERule()
|
||||
public boolean getUse1SERule()
|
||||
{
|
||||
|
||||
boolean retVal = getUse1SERule_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getUseSurrogates()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getUseSurrogates()
|
||||
public boolean getUseSurrogates()
|
||||
{
|
||||
|
||||
boolean retVal = getUseSurrogates_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float getRegressionAccuracy()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getRegressionAccuracy()
|
||||
public float getRegressionAccuracy()
|
||||
{
|
||||
|
||||
float retVal = getRegressionAccuracy_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getCVFolds()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getCVFolds()
|
||||
public int getCVFolds()
|
||||
{
|
||||
|
||||
int retVal = getCVFolds_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMaxCategories()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getMaxCategories()
|
||||
public int getMaxCategories()
|
||||
{
|
||||
|
||||
int retVal = getMaxCategories_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMaxDepth()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getMaxDepth()
|
||||
public int getMaxDepth()
|
||||
{
|
||||
|
||||
int retVal = getMaxDepth_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMinSampleCount()
|
||||
//
|
||||
|
||||
//javadoc: DTrees::getMinSampleCount()
|
||||
public int getMinSampleCount()
|
||||
{
|
||||
|
||||
int retVal = getMinSampleCount_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setCVFolds(int val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setCVFolds(val)
|
||||
public void setCVFolds(int val)
|
||||
{
|
||||
|
||||
setCVFolds_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMaxCategories(int val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setMaxCategories(val)
|
||||
public void setMaxCategories(int val)
|
||||
{
|
||||
|
||||
setMaxCategories_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMaxDepth(int val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setMaxDepth(val)
|
||||
public void setMaxDepth(int val)
|
||||
{
|
||||
|
||||
setMaxDepth_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMinSampleCount(int val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setMinSampleCount(val)
|
||||
public void setMinSampleCount(int val)
|
||||
{
|
||||
|
||||
setMinSampleCount_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setPriors(Mat val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setPriors(val)
|
||||
public void setPriors(Mat val)
|
||||
{
|
||||
|
||||
setPriors_0(nativeObj, val.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setRegressionAccuracy(float val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setRegressionAccuracy(val)
|
||||
public void setRegressionAccuracy(float val)
|
||||
{
|
||||
|
||||
setRegressionAccuracy_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTruncatePrunedTree(bool val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setTruncatePrunedTree(val)
|
||||
public void setTruncatePrunedTree(boolean val)
|
||||
{
|
||||
|
||||
setTruncatePrunedTree_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setUse1SERule(bool val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setUse1SERule(val)
|
||||
public void setUse1SERule(boolean val)
|
||||
{
|
||||
|
||||
setUse1SERule_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setUseSurrogates(bool val)
|
||||
//
|
||||
|
||||
//javadoc: DTrees::setUseSurrogates(val)
|
||||
public void setUseSurrogates(boolean val)
|
||||
{
|
||||
|
||||
setUseSurrogates_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat getPriors()
|
||||
private static native long getPriors_0(long nativeObj);
|
||||
|
||||
// C++: static Ptr_DTrees create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_DTrees load(String filepath, String nodeName = String())
|
||||
private static native long load_0(String filepath, String nodeName);
|
||||
private static native long load_1(String filepath);
|
||||
|
||||
// C++: bool getTruncatePrunedTree()
|
||||
private static native boolean getTruncatePrunedTree_0(long nativeObj);
|
||||
|
||||
// C++: bool getUse1SERule()
|
||||
private static native boolean getUse1SERule_0(long nativeObj);
|
||||
|
||||
// C++: bool getUseSurrogates()
|
||||
private static native boolean getUseSurrogates_0(long nativeObj);
|
||||
|
||||
// C++: float getRegressionAccuracy()
|
||||
private static native float getRegressionAccuracy_0(long nativeObj);
|
||||
|
||||
// C++: int getCVFolds()
|
||||
private static native int getCVFolds_0(long nativeObj);
|
||||
|
||||
// C++: int getMaxCategories()
|
||||
private static native int getMaxCategories_0(long nativeObj);
|
||||
|
||||
// C++: int getMaxDepth()
|
||||
private static native int getMaxDepth_0(long nativeObj);
|
||||
|
||||
// C++: int getMinSampleCount()
|
||||
private static native int getMinSampleCount_0(long nativeObj);
|
||||
|
||||
// C++: void setCVFolds(int val)
|
||||
private static native void setCVFolds_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setMaxCategories(int val)
|
||||
private static native void setMaxCategories_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setMaxDepth(int val)
|
||||
private static native void setMaxDepth_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setMinSampleCount(int val)
|
||||
private static native void setMinSampleCount_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setPriors(Mat val)
|
||||
private static native void setPriors_0(long nativeObj, long val_nativeObj);
|
||||
|
||||
// C++: void setRegressionAccuracy(float val)
|
||||
private static native void setRegressionAccuracy_0(long nativeObj, float val);
|
||||
|
||||
// C++: void setTruncatePrunedTree(bool val)
|
||||
private static native void setTruncatePrunedTree_0(long nativeObj, boolean val);
|
||||
|
||||
// C++: void setUse1SERule(bool val)
|
||||
private static native void setUse1SERule_0(long nativeObj, boolean val);
|
||||
|
||||
// C++: void setUseSurrogates(bool val)
|
||||
private static native void setUseSurrogates_0(long nativeObj, boolean val);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.TermCriteria;
|
||||
import org.opencv.ml.EM;
|
||||
import org.opencv.ml.StatModel;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class EM
|
||||
//javadoc: EM
|
||||
|
||||
public class EM extends StatModel {
|
||||
|
||||
protected EM(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static EM __fromPtr__(long addr) { return new EM(addr); }
|
||||
|
||||
public static final int
|
||||
COV_MAT_SPHERICAL = 0,
|
||||
COV_MAT_DIAGONAL = 1,
|
||||
COV_MAT_GENERIC = 2,
|
||||
COV_MAT_DEFAULT = COV_MAT_DIAGONAL,
|
||||
DEFAULT_NCLUSTERS = 5,
|
||||
DEFAULT_MAX_ITERS = 100,
|
||||
START_E_STEP = 1,
|
||||
START_M_STEP = 2,
|
||||
START_AUTO_STEP = 0;
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getMeans()
|
||||
//
|
||||
|
||||
//javadoc: EM::getMeans()
|
||||
public Mat getMeans()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getMeans_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getWeights()
|
||||
//
|
||||
|
||||
//javadoc: EM::getWeights()
|
||||
public Mat getWeights()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getWeights_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_EM create()
|
||||
//
|
||||
|
||||
//javadoc: EM::create()
|
||||
public static EM create()
|
||||
{
|
||||
|
||||
EM retVal = EM.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_EM load(String filepath, String nodeName = String())
|
||||
//
|
||||
|
||||
//javadoc: EM::load(filepath, nodeName)
|
||||
public static EM load(String filepath, String nodeName)
|
||||
{
|
||||
|
||||
EM retVal = EM.__fromPtr__(load_0(filepath, nodeName));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: EM::load(filepath)
|
||||
public static EM load(String filepath)
|
||||
{
|
||||
|
||||
EM retVal = EM.__fromPtr__(load_1(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
//
|
||||
|
||||
//javadoc: EM::getTermCriteria()
|
||||
public TermCriteria getTermCriteria()
|
||||
{
|
||||
|
||||
TermCriteria retVal = new TermCriteria(getTermCriteria_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Vec2d predict2(Mat sample, Mat& probs)
|
||||
//
|
||||
|
||||
//javadoc: EM::predict2(sample, probs)
|
||||
public double[] predict2(Mat sample, Mat probs)
|
||||
{
|
||||
|
||||
double[] retVal = predict2_0(nativeObj, sample.nativeObj, probs.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool trainE(Mat samples, Mat means0, Mat covs0 = Mat(), Mat weights0 = Mat(), Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
|
||||
//
|
||||
|
||||
//javadoc: EM::trainE(samples, means0, covs0, weights0, logLikelihoods, labels, probs)
|
||||
public boolean trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels, Mat probs)
|
||||
{
|
||||
|
||||
boolean retVal = trainE_0(nativeObj, samples.nativeObj, means0.nativeObj, covs0.nativeObj, weights0.nativeObj, logLikelihoods.nativeObj, labels.nativeObj, probs.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: EM::trainE(samples, means0)
|
||||
public boolean trainE(Mat samples, Mat means0)
|
||||
{
|
||||
|
||||
boolean retVal = trainE_1(nativeObj, samples.nativeObj, means0.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool trainEM(Mat samples, Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
|
||||
//
|
||||
|
||||
//javadoc: EM::trainEM(samples, logLikelihoods, labels, probs)
|
||||
public boolean trainEM(Mat samples, Mat logLikelihoods, Mat labels, Mat probs)
|
||||
{
|
||||
|
||||
boolean retVal = trainEM_0(nativeObj, samples.nativeObj, logLikelihoods.nativeObj, labels.nativeObj, probs.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: EM::trainEM(samples)
|
||||
public boolean trainEM(Mat samples)
|
||||
{
|
||||
|
||||
boolean retVal = trainEM_1(nativeObj, samples.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool trainM(Mat samples, Mat probs0, Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
|
||||
//
|
||||
|
||||
//javadoc: EM::trainM(samples, probs0, logLikelihoods, labels, probs)
|
||||
public boolean trainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels, Mat probs)
|
||||
{
|
||||
|
||||
boolean retVal = trainM_0(nativeObj, samples.nativeObj, probs0.nativeObj, logLikelihoods.nativeObj, labels.nativeObj, probs.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: EM::trainM(samples, probs0)
|
||||
public boolean trainM(Mat samples, Mat probs0)
|
||||
{
|
||||
|
||||
boolean retVal = trainM_1(nativeObj, samples.nativeObj, probs0.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float predict(Mat samples, Mat& results = Mat(), int flags = 0)
|
||||
//
|
||||
|
||||
//javadoc: EM::predict(samples, results, flags)
|
||||
public float predict(Mat samples, Mat results, int flags)
|
||||
{
|
||||
|
||||
float retVal = predict_0(nativeObj, samples.nativeObj, results.nativeObj, flags);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: EM::predict(samples)
|
||||
public float predict(Mat samples)
|
||||
{
|
||||
|
||||
float retVal = predict_1(nativeObj, samples.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getClustersNumber()
|
||||
//
|
||||
|
||||
//javadoc: EM::getClustersNumber()
|
||||
public int getClustersNumber()
|
||||
{
|
||||
|
||||
int retVal = getClustersNumber_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getCovarianceMatrixType()
|
||||
//
|
||||
|
||||
//javadoc: EM::getCovarianceMatrixType()
|
||||
public int getCovarianceMatrixType()
|
||||
{
|
||||
|
||||
int retVal = getCovarianceMatrixType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getCovs(vector_Mat& covs)
|
||||
//
|
||||
|
||||
//javadoc: EM::getCovs(covs)
|
||||
public void getCovs(List<Mat> covs)
|
||||
{
|
||||
Mat covs_mat = new Mat();
|
||||
getCovs_0(nativeObj, covs_mat.nativeObj);
|
||||
Converters.Mat_to_vector_Mat(covs_mat, covs);
|
||||
covs_mat.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setClustersNumber(int val)
|
||||
//
|
||||
|
||||
//javadoc: EM::setClustersNumber(val)
|
||||
public void setClustersNumber(int val)
|
||||
{
|
||||
|
||||
setClustersNumber_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setCovarianceMatrixType(int val)
|
||||
//
|
||||
|
||||
//javadoc: EM::setCovarianceMatrixType(val)
|
||||
public void setCovarianceMatrixType(int val)
|
||||
{
|
||||
|
||||
setCovarianceMatrixType_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
//
|
||||
|
||||
//javadoc: EM::setTermCriteria(val)
|
||||
public void setTermCriteria(TermCriteria val)
|
||||
{
|
||||
|
||||
setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat getMeans()
|
||||
private static native long getMeans_0(long nativeObj);
|
||||
|
||||
// C++: Mat getWeights()
|
||||
private static native long getWeights_0(long nativeObj);
|
||||
|
||||
// C++: static Ptr_EM create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_EM load(String filepath, String nodeName = String())
|
||||
private static native long load_0(String filepath, String nodeName);
|
||||
private static native long load_1(String filepath);
|
||||
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
private static native double[] getTermCriteria_0(long nativeObj);
|
||||
|
||||
// C++: Vec2d predict2(Mat sample, Mat& probs)
|
||||
private static native double[] predict2_0(long nativeObj, long sample_nativeObj, long probs_nativeObj);
|
||||
|
||||
// C++: bool trainE(Mat samples, Mat means0, Mat covs0 = Mat(), Mat weights0 = Mat(), Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
|
||||
private static native boolean trainE_0(long nativeObj, long samples_nativeObj, long means0_nativeObj, long covs0_nativeObj, long weights0_nativeObj, long logLikelihoods_nativeObj, long labels_nativeObj, long probs_nativeObj);
|
||||
private static native boolean trainE_1(long nativeObj, long samples_nativeObj, long means0_nativeObj);
|
||||
|
||||
// C++: bool trainEM(Mat samples, Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
|
||||
private static native boolean trainEM_0(long nativeObj, long samples_nativeObj, long logLikelihoods_nativeObj, long labels_nativeObj, long probs_nativeObj);
|
||||
private static native boolean trainEM_1(long nativeObj, long samples_nativeObj);
|
||||
|
||||
// C++: bool trainM(Mat samples, Mat probs0, Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
|
||||
private static native boolean trainM_0(long nativeObj, long samples_nativeObj, long probs0_nativeObj, long logLikelihoods_nativeObj, long labels_nativeObj, long probs_nativeObj);
|
||||
private static native boolean trainM_1(long nativeObj, long samples_nativeObj, long probs0_nativeObj);
|
||||
|
||||
// C++: float predict(Mat samples, Mat& results = Mat(), int flags = 0)
|
||||
private static native float predict_0(long nativeObj, long samples_nativeObj, long results_nativeObj, int flags);
|
||||
private static native float predict_1(long nativeObj, long samples_nativeObj);
|
||||
|
||||
// C++: int getClustersNumber()
|
||||
private static native int getClustersNumber_0(long nativeObj);
|
||||
|
||||
// C++: int getCovarianceMatrixType()
|
||||
private static native int getCovarianceMatrixType_0(long nativeObj);
|
||||
|
||||
// C++: void getCovs(vector_Mat& covs)
|
||||
private static native void getCovs_0(long nativeObj, long covs_mat_nativeObj);
|
||||
|
||||
// C++: void setClustersNumber(int val)
|
||||
private static native void setClustersNumber_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setCovarianceMatrixType(int val)
|
||||
private static native void setCovarianceMatrixType_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.ml.KNearest;
|
||||
import org.opencv.ml.StatModel;
|
||||
|
||||
// C++: class KNearest
|
||||
//javadoc: KNearest
|
||||
|
||||
public class KNearest extends StatModel {
|
||||
|
||||
protected KNearest(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static KNearest __fromPtr__(long addr) { return new KNearest(addr); }
|
||||
|
||||
public static final int
|
||||
BRUTE_FORCE = 1,
|
||||
KDTREE = 2;
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_KNearest create()
|
||||
//
|
||||
|
||||
//javadoc: KNearest::create()
|
||||
public static KNearest create()
|
||||
{
|
||||
|
||||
KNearest retVal = KNearest.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getIsClassifier()
|
||||
//
|
||||
|
||||
//javadoc: KNearest::getIsClassifier()
|
||||
public boolean getIsClassifier()
|
||||
{
|
||||
|
||||
boolean retVal = getIsClassifier_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float findNearest(Mat samples, int k, Mat& results, Mat& neighborResponses = Mat(), Mat& dist = Mat())
|
||||
//
|
||||
|
||||
//javadoc: KNearest::findNearest(samples, k, results, neighborResponses, dist)
|
||||
public float findNearest(Mat samples, int k, Mat results, Mat neighborResponses, Mat dist)
|
||||
{
|
||||
|
||||
float retVal = findNearest_0(nativeObj, samples.nativeObj, k, results.nativeObj, neighborResponses.nativeObj, dist.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: KNearest::findNearest(samples, k, results)
|
||||
public float findNearest(Mat samples, int k, Mat results)
|
||||
{
|
||||
|
||||
float retVal = findNearest_1(nativeObj, samples.nativeObj, k, results.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getAlgorithmType()
|
||||
//
|
||||
|
||||
//javadoc: KNearest::getAlgorithmType()
|
||||
public int getAlgorithmType()
|
||||
{
|
||||
|
||||
int retVal = getAlgorithmType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getDefaultK()
|
||||
//
|
||||
|
||||
//javadoc: KNearest::getDefaultK()
|
||||
public int getDefaultK()
|
||||
{
|
||||
|
||||
int retVal = getDefaultK_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getEmax()
|
||||
//
|
||||
|
||||
//javadoc: KNearest::getEmax()
|
||||
public int getEmax()
|
||||
{
|
||||
|
||||
int retVal = getEmax_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setAlgorithmType(int val)
|
||||
//
|
||||
|
||||
//javadoc: KNearest::setAlgorithmType(val)
|
||||
public void setAlgorithmType(int val)
|
||||
{
|
||||
|
||||
setAlgorithmType_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDefaultK(int val)
|
||||
//
|
||||
|
||||
//javadoc: KNearest::setDefaultK(val)
|
||||
public void setDefaultK(int val)
|
||||
{
|
||||
|
||||
setDefaultK_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setEmax(int val)
|
||||
//
|
||||
|
||||
//javadoc: KNearest::setEmax(val)
|
||||
public void setEmax(int val)
|
||||
{
|
||||
|
||||
setEmax_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setIsClassifier(bool val)
|
||||
//
|
||||
|
||||
//javadoc: KNearest::setIsClassifier(val)
|
||||
public void setIsClassifier(boolean val)
|
||||
{
|
||||
|
||||
setIsClassifier_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_KNearest create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: bool getIsClassifier()
|
||||
private static native boolean getIsClassifier_0(long nativeObj);
|
||||
|
||||
// C++: float findNearest(Mat samples, int k, Mat& results, Mat& neighborResponses = Mat(), Mat& dist = Mat())
|
||||
private static native float findNearest_0(long nativeObj, long samples_nativeObj, int k, long results_nativeObj, long neighborResponses_nativeObj, long dist_nativeObj);
|
||||
private static native float findNearest_1(long nativeObj, long samples_nativeObj, int k, long results_nativeObj);
|
||||
|
||||
// C++: int getAlgorithmType()
|
||||
private static native int getAlgorithmType_0(long nativeObj);
|
||||
|
||||
// C++: int getDefaultK()
|
||||
private static native int getDefaultK_0(long nativeObj);
|
||||
|
||||
// C++: int getEmax()
|
||||
private static native int getEmax_0(long nativeObj);
|
||||
|
||||
// C++: void setAlgorithmType(int val)
|
||||
private static native void setAlgorithmType_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setDefaultK(int val)
|
||||
private static native void setDefaultK_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setEmax(int val)
|
||||
private static native void setEmax_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setIsClassifier(bool val)
|
||||
private static native void setIsClassifier_0(long nativeObj, boolean val);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.TermCriteria;
|
||||
import org.opencv.ml.LogisticRegression;
|
||||
import org.opencv.ml.StatModel;
|
||||
|
||||
// C++: class LogisticRegression
|
||||
//javadoc: LogisticRegression
|
||||
|
||||
public class LogisticRegression extends StatModel {
|
||||
|
||||
protected LogisticRegression(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static LogisticRegression __fromPtr__(long addr) { return new LogisticRegression(addr); }
|
||||
|
||||
public static final int
|
||||
REG_DISABLE = -1,
|
||||
REG_L1 = 0,
|
||||
REG_L2 = 1,
|
||||
BATCH = 0,
|
||||
MINI_BATCH = 1;
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat get_learnt_thetas()
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::get_learnt_thetas()
|
||||
public Mat get_learnt_thetas()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(get_learnt_thetas_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_LogisticRegression create()
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::create()
|
||||
public static LogisticRegression create()
|
||||
{
|
||||
|
||||
LogisticRegression retVal = LogisticRegression.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_LogisticRegression load(String filepath, String nodeName = String())
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::load(filepath, nodeName)
|
||||
public static LogisticRegression load(String filepath, String nodeName)
|
||||
{
|
||||
|
||||
LogisticRegression retVal = LogisticRegression.__fromPtr__(load_0(filepath, nodeName));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: LogisticRegression::load(filepath)
|
||||
public static LogisticRegression load(String filepath)
|
||||
{
|
||||
|
||||
LogisticRegression retVal = LogisticRegression.__fromPtr__(load_1(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::getTermCriteria()
|
||||
public TermCriteria getTermCriteria()
|
||||
{
|
||||
|
||||
TermCriteria retVal = new TermCriteria(getTermCriteria_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getLearningRate()
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::getLearningRate()
|
||||
public double getLearningRate()
|
||||
{
|
||||
|
||||
double retVal = getLearningRate_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float predict(Mat samples, Mat& results = Mat(), int flags = 0)
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::predict(samples, results, flags)
|
||||
public float predict(Mat samples, Mat results, int flags)
|
||||
{
|
||||
|
||||
float retVal = predict_0(nativeObj, samples.nativeObj, results.nativeObj, flags);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: LogisticRegression::predict(samples)
|
||||
public float predict(Mat samples)
|
||||
{
|
||||
|
||||
float retVal = predict_1(nativeObj, samples.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getIterations()
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::getIterations()
|
||||
public int getIterations()
|
||||
{
|
||||
|
||||
int retVal = getIterations_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMiniBatchSize()
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::getMiniBatchSize()
|
||||
public int getMiniBatchSize()
|
||||
{
|
||||
|
||||
int retVal = getMiniBatchSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getRegularization()
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::getRegularization()
|
||||
public int getRegularization()
|
||||
{
|
||||
|
||||
int retVal = getRegularization_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getTrainMethod()
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::getTrainMethod()
|
||||
public int getTrainMethod()
|
||||
{
|
||||
|
||||
int retVal = getTrainMethod_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setIterations(int val)
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::setIterations(val)
|
||||
public void setIterations(int val)
|
||||
{
|
||||
|
||||
setIterations_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setLearningRate(double val)
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::setLearningRate(val)
|
||||
public void setLearningRate(double val)
|
||||
{
|
||||
|
||||
setLearningRate_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMiniBatchSize(int val)
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::setMiniBatchSize(val)
|
||||
public void setMiniBatchSize(int val)
|
||||
{
|
||||
|
||||
setMiniBatchSize_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setRegularization(int val)
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::setRegularization(val)
|
||||
public void setRegularization(int val)
|
||||
{
|
||||
|
||||
setRegularization_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::setTermCriteria(val)
|
||||
public void setTermCriteria(TermCriteria val)
|
||||
{
|
||||
|
||||
setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTrainMethod(int val)
|
||||
//
|
||||
|
||||
//javadoc: LogisticRegression::setTrainMethod(val)
|
||||
public void setTrainMethod(int val)
|
||||
{
|
||||
|
||||
setTrainMethod_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat get_learnt_thetas()
|
||||
private static native long get_learnt_thetas_0(long nativeObj);
|
||||
|
||||
// C++: static Ptr_LogisticRegression create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_LogisticRegression load(String filepath, String nodeName = String())
|
||||
private static native long load_0(String filepath, String nodeName);
|
||||
private static native long load_1(String filepath);
|
||||
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
private static native double[] getTermCriteria_0(long nativeObj);
|
||||
|
||||
// C++: double getLearningRate()
|
||||
private static native double getLearningRate_0(long nativeObj);
|
||||
|
||||
// C++: float predict(Mat samples, Mat& results = Mat(), int flags = 0)
|
||||
private static native float predict_0(long nativeObj, long samples_nativeObj, long results_nativeObj, int flags);
|
||||
private static native float predict_1(long nativeObj, long samples_nativeObj);
|
||||
|
||||
// C++: int getIterations()
|
||||
private static native int getIterations_0(long nativeObj);
|
||||
|
||||
// C++: int getMiniBatchSize()
|
||||
private static native int getMiniBatchSize_0(long nativeObj);
|
||||
|
||||
// C++: int getRegularization()
|
||||
private static native int getRegularization_0(long nativeObj);
|
||||
|
||||
// C++: int getTrainMethod()
|
||||
private static native int getTrainMethod_0(long nativeObj);
|
||||
|
||||
// C++: void setIterations(int val)
|
||||
private static native void setIterations_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setLearningRate(double val)
|
||||
private static native void setLearningRate_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setMiniBatchSize(int val)
|
||||
private static native void setMiniBatchSize_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setRegularization(int val)
|
||||
private static native void setRegularization_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);
|
||||
|
||||
// C++: void setTrainMethod(int val)
|
||||
private static native void setTrainMethod_0(long nativeObj, int val);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
|
||||
|
||||
// C++: class Ml
|
||||
//javadoc: Ml
|
||||
|
||||
public class Ml {
|
||||
|
||||
public static final int
|
||||
VAR_NUMERICAL = 0,
|
||||
VAR_ORDERED = 0,
|
||||
VAR_CATEGORICAL = 1,
|
||||
TEST_ERROR = 0,
|
||||
TRAIN_ERROR = 1,
|
||||
ROW_SAMPLE = 0,
|
||||
COL_SAMPLE = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.ml.NormalBayesClassifier;
|
||||
import org.opencv.ml.StatModel;
|
||||
|
||||
// C++: class NormalBayesClassifier
|
||||
//javadoc: NormalBayesClassifier
|
||||
|
||||
public class NormalBayesClassifier extends StatModel {
|
||||
|
||||
protected NormalBayesClassifier(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static NormalBayesClassifier __fromPtr__(long addr) { return new NormalBayesClassifier(addr); }
|
||||
|
||||
//
|
||||
// C++: static Ptr_NormalBayesClassifier create()
|
||||
//
|
||||
|
||||
//javadoc: NormalBayesClassifier::create()
|
||||
public static NormalBayesClassifier create()
|
||||
{
|
||||
|
||||
NormalBayesClassifier retVal = NormalBayesClassifier.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_NormalBayesClassifier load(String filepath, String nodeName = String())
|
||||
//
|
||||
|
||||
//javadoc: NormalBayesClassifier::load(filepath, nodeName)
|
||||
public static NormalBayesClassifier load(String filepath, String nodeName)
|
||||
{
|
||||
|
||||
NormalBayesClassifier retVal = NormalBayesClassifier.__fromPtr__(load_0(filepath, nodeName));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: NormalBayesClassifier::load(filepath)
|
||||
public static NormalBayesClassifier load(String filepath)
|
||||
{
|
||||
|
||||
NormalBayesClassifier retVal = NormalBayesClassifier.__fromPtr__(load_1(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float predictProb(Mat inputs, Mat& outputs, Mat& outputProbs, int flags = 0)
|
||||
//
|
||||
|
||||
//javadoc: NormalBayesClassifier::predictProb(inputs, outputs, outputProbs, flags)
|
||||
public float predictProb(Mat inputs, Mat outputs, Mat outputProbs, int flags)
|
||||
{
|
||||
|
||||
float retVal = predictProb_0(nativeObj, inputs.nativeObj, outputs.nativeObj, outputProbs.nativeObj, flags);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: NormalBayesClassifier::predictProb(inputs, outputs, outputProbs)
|
||||
public float predictProb(Mat inputs, Mat outputs, Mat outputProbs)
|
||||
{
|
||||
|
||||
float retVal = predictProb_1(nativeObj, inputs.nativeObj, outputs.nativeObj, outputProbs.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_NormalBayesClassifier create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_NormalBayesClassifier load(String filepath, String nodeName = String())
|
||||
private static native long load_0(String filepath, String nodeName);
|
||||
private static native long load_1(String filepath);
|
||||
|
||||
// C++: float predictProb(Mat inputs, Mat& outputs, Mat& outputProbs, int flags = 0)
|
||||
private static native float predictProb_0(long nativeObj, long inputs_nativeObj, long outputs_nativeObj, long outputProbs_nativeObj, int flags);
|
||||
private static native float predictProb_1(long nativeObj, long inputs_nativeObj, long outputs_nativeObj, long outputProbs_nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import org.opencv.ml.ParamGrid;
|
||||
|
||||
// C++: class ParamGrid
|
||||
//javadoc: ParamGrid
|
||||
|
||||
public class ParamGrid {
|
||||
|
||||
protected final long nativeObj;
|
||||
protected ParamGrid(long addr) { nativeObj = addr; }
|
||||
|
||||
public long getNativeObjAddr() { return nativeObj; }
|
||||
|
||||
// internal usage only
|
||||
public static ParamGrid __fromPtr__(long addr) { return new ParamGrid(addr); }
|
||||
|
||||
//
|
||||
// C++: static Ptr_ParamGrid create(double minVal = 0., double maxVal = 0., double logstep = 1.)
|
||||
//
|
||||
|
||||
//javadoc: ParamGrid::create(minVal, maxVal, logstep)
|
||||
public static ParamGrid create(double minVal, double maxVal, double logstep)
|
||||
{
|
||||
|
||||
ParamGrid retVal = ParamGrid.__fromPtr__(create_0(minVal, maxVal, logstep));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: ParamGrid::create()
|
||||
public static ParamGrid create()
|
||||
{
|
||||
|
||||
ParamGrid retVal = ParamGrid.__fromPtr__(create_1());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double ParamGrid::minVal
|
||||
//
|
||||
|
||||
//javadoc: ParamGrid::get_minVal()
|
||||
public double get_minVal()
|
||||
{
|
||||
|
||||
double retVal = get_minVal_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void ParamGrid::minVal
|
||||
//
|
||||
|
||||
//javadoc: ParamGrid::set_minVal(minVal)
|
||||
public void set_minVal(double minVal)
|
||||
{
|
||||
|
||||
set_minVal_0(nativeObj, minVal);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double ParamGrid::maxVal
|
||||
//
|
||||
|
||||
//javadoc: ParamGrid::get_maxVal()
|
||||
public double get_maxVal()
|
||||
{
|
||||
|
||||
double retVal = get_maxVal_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void ParamGrid::maxVal
|
||||
//
|
||||
|
||||
//javadoc: ParamGrid::set_maxVal(maxVal)
|
||||
public void set_maxVal(double maxVal)
|
||||
{
|
||||
|
||||
set_maxVal_0(nativeObj, maxVal);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double ParamGrid::logStep
|
||||
//
|
||||
|
||||
//javadoc: ParamGrid::get_logStep()
|
||||
public double get_logStep()
|
||||
{
|
||||
|
||||
double retVal = get_logStep_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void ParamGrid::logStep
|
||||
//
|
||||
|
||||
//javadoc: ParamGrid::set_logStep(logStep)
|
||||
public void set_logStep(double logStep)
|
||||
{
|
||||
|
||||
set_logStep_0(nativeObj, logStep);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: static Ptr_ParamGrid create(double minVal = 0., double maxVal = 0., double logstep = 1.)
|
||||
private static native long create_0(double minVal, double maxVal, double logstep);
|
||||
private static native long create_1();
|
||||
|
||||
// C++: double ParamGrid::minVal
|
||||
private static native double get_minVal_0(long nativeObj);
|
||||
|
||||
// C++: void ParamGrid::minVal
|
||||
private static native void set_minVal_0(long nativeObj, double minVal);
|
||||
|
||||
// C++: double ParamGrid::maxVal
|
||||
private static native double get_maxVal_0(long nativeObj);
|
||||
|
||||
// C++: void ParamGrid::maxVal
|
||||
private static native void set_maxVal_0(long nativeObj, double maxVal);
|
||||
|
||||
// C++: double ParamGrid::logStep
|
||||
private static native double get_logStep_0(long nativeObj);
|
||||
|
||||
// C++: void ParamGrid::logStep
|
||||
private static native void set_logStep_0(long nativeObj, double logStep);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.TermCriteria;
|
||||
import org.opencv.ml.DTrees;
|
||||
import org.opencv.ml.RTrees;
|
||||
|
||||
// C++: class RTrees
|
||||
//javadoc: RTrees
|
||||
|
||||
public class RTrees extends DTrees {
|
||||
|
||||
protected RTrees(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static RTrees __fromPtr__(long addr) { return new RTrees(addr); }
|
||||
|
||||
//
|
||||
// C++: Mat getVarImportance()
|
||||
//
|
||||
|
||||
//javadoc: RTrees::getVarImportance()
|
||||
public Mat getVarImportance()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getVarImportance_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_RTrees create()
|
||||
//
|
||||
|
||||
//javadoc: RTrees::create()
|
||||
public static RTrees create()
|
||||
{
|
||||
|
||||
RTrees retVal = RTrees.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_RTrees load(String filepath, String nodeName = String())
|
||||
//
|
||||
|
||||
//javadoc: RTrees::load(filepath, nodeName)
|
||||
public static RTrees load(String filepath, String nodeName)
|
||||
{
|
||||
|
||||
RTrees retVal = RTrees.__fromPtr__(load_0(filepath, nodeName));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: RTrees::load(filepath)
|
||||
public static RTrees load(String filepath)
|
||||
{
|
||||
|
||||
RTrees retVal = RTrees.__fromPtr__(load_1(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
//
|
||||
|
||||
//javadoc: RTrees::getTermCriteria()
|
||||
public TermCriteria getTermCriteria()
|
||||
{
|
||||
|
||||
TermCriteria retVal = new TermCriteria(getTermCriteria_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool getCalculateVarImportance()
|
||||
//
|
||||
|
||||
//javadoc: RTrees::getCalculateVarImportance()
|
||||
public boolean getCalculateVarImportance()
|
||||
{
|
||||
|
||||
boolean retVal = getCalculateVarImportance_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getActiveVarCount()
|
||||
//
|
||||
|
||||
//javadoc: RTrees::getActiveVarCount()
|
||||
public int getActiveVarCount()
|
||||
{
|
||||
|
||||
int retVal = getActiveVarCount_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getVotes(Mat samples, Mat& results, int flags)
|
||||
//
|
||||
|
||||
//javadoc: RTrees::getVotes(samples, results, flags)
|
||||
public void getVotes(Mat samples, Mat results, int flags)
|
||||
{
|
||||
|
||||
getVotes_0(nativeObj, samples.nativeObj, results.nativeObj, flags);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setActiveVarCount(int val)
|
||||
//
|
||||
|
||||
//javadoc: RTrees::setActiveVarCount(val)
|
||||
public void setActiveVarCount(int val)
|
||||
{
|
||||
|
||||
setActiveVarCount_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setCalculateVarImportance(bool val)
|
||||
//
|
||||
|
||||
//javadoc: RTrees::setCalculateVarImportance(val)
|
||||
public void setCalculateVarImportance(boolean val)
|
||||
{
|
||||
|
||||
setCalculateVarImportance_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
//
|
||||
|
||||
//javadoc: RTrees::setTermCriteria(val)
|
||||
public void setTermCriteria(TermCriteria val)
|
||||
{
|
||||
|
||||
setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat getVarImportance()
|
||||
private static native long getVarImportance_0(long nativeObj);
|
||||
|
||||
// C++: static Ptr_RTrees create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_RTrees load(String filepath, String nodeName = String())
|
||||
private static native long load_0(String filepath, String nodeName);
|
||||
private static native long load_1(String filepath);
|
||||
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
private static native double[] getTermCriteria_0(long nativeObj);
|
||||
|
||||
// C++: bool getCalculateVarImportance()
|
||||
private static native boolean getCalculateVarImportance_0(long nativeObj);
|
||||
|
||||
// C++: int getActiveVarCount()
|
||||
private static native int getActiveVarCount_0(long nativeObj);
|
||||
|
||||
// C++: void getVotes(Mat samples, Mat& results, int flags)
|
||||
private static native void getVotes_0(long nativeObj, long samples_nativeObj, long results_nativeObj, int flags);
|
||||
|
||||
// C++: void setActiveVarCount(int val)
|
||||
private static native void setActiveVarCount_0(long nativeObj, int val);
|
||||
|
||||
// C++: void setCalculateVarImportance(bool val)
|
||||
private static native void setCalculateVarImportance_0(long nativeObj, boolean val);
|
||||
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,523 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.TermCriteria;
|
||||
import org.opencv.ml.ParamGrid;
|
||||
import org.opencv.ml.SVM;
|
||||
import org.opencv.ml.StatModel;
|
||||
|
||||
// C++: class SVM
|
||||
//javadoc: SVM
|
||||
|
||||
public class SVM extends StatModel {
|
||||
|
||||
protected SVM(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static SVM __fromPtr__(long addr) { return new SVM(addr); }
|
||||
|
||||
public static final int
|
||||
C_SVC = 100,
|
||||
NU_SVC = 101,
|
||||
ONE_CLASS = 102,
|
||||
EPS_SVR = 103,
|
||||
NU_SVR = 104,
|
||||
CUSTOM = -1,
|
||||
LINEAR = 0,
|
||||
POLY = 1,
|
||||
RBF = 2,
|
||||
SIGMOID = 3,
|
||||
CHI2 = 4,
|
||||
INTER = 5,
|
||||
C = 0,
|
||||
GAMMA = 1,
|
||||
P = 2,
|
||||
NU = 3,
|
||||
COEF = 4,
|
||||
DEGREE = 5;
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getClassWeights()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getClassWeights()
|
||||
public Mat getClassWeights()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getClassWeights_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getSupportVectors()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getSupportVectors()
|
||||
public Mat getSupportVectors()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getSupportVectors_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getUncompressedSupportVectors()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getUncompressedSupportVectors()
|
||||
public Mat getUncompressedSupportVectors()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getUncompressedSupportVectors_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_ParamGrid getDefaultGridPtr(int param_id)
|
||||
//
|
||||
|
||||
//javadoc: SVM::getDefaultGridPtr(param_id)
|
||||
public static ParamGrid getDefaultGridPtr(int param_id)
|
||||
{
|
||||
|
||||
ParamGrid retVal = ParamGrid.__fromPtr__(getDefaultGridPtr_0(param_id));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_SVM create()
|
||||
//
|
||||
|
||||
//javadoc: SVM::create()
|
||||
public static SVM create()
|
||||
{
|
||||
|
||||
SVM retVal = SVM.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_SVM load(String filepath)
|
||||
//
|
||||
|
||||
//javadoc: SVM::load(filepath)
|
||||
public static SVM load(String filepath)
|
||||
{
|
||||
|
||||
SVM retVal = SVM.__fromPtr__(load_0(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getTermCriteria()
|
||||
public TermCriteria getTermCriteria()
|
||||
{
|
||||
|
||||
TermCriteria retVal = new TermCriteria(getTermCriteria_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool trainAuto(Mat samples, int layout, Mat responses, int kFold = 10, Ptr_ParamGrid Cgrid = SVM::getDefaultGridPtr(SVM::C), Ptr_ParamGrid gammaGrid = SVM::getDefaultGridPtr(SVM::GAMMA), Ptr_ParamGrid pGrid = SVM::getDefaultGridPtr(SVM::P), Ptr_ParamGrid nuGrid = SVM::getDefaultGridPtr(SVM::NU), Ptr_ParamGrid coeffGrid = SVM::getDefaultGridPtr(SVM::COEF), Ptr_ParamGrid degreeGrid = SVM::getDefaultGridPtr(SVM::DEGREE), bool balanced = false)
|
||||
//
|
||||
|
||||
//javadoc: SVM::trainAuto(samples, layout, responses, kFold, Cgrid, gammaGrid, pGrid, nuGrid, coeffGrid, degreeGrid, balanced)
|
||||
public boolean trainAuto(Mat samples, int layout, Mat responses, int kFold, ParamGrid Cgrid, ParamGrid gammaGrid, ParamGrid pGrid, ParamGrid nuGrid, ParamGrid coeffGrid, ParamGrid degreeGrid, boolean balanced)
|
||||
{
|
||||
|
||||
boolean retVal = trainAuto_0(nativeObj, samples.nativeObj, layout, responses.nativeObj, kFold, Cgrid.getNativeObjAddr(), gammaGrid.getNativeObjAddr(), pGrid.getNativeObjAddr(), nuGrid.getNativeObjAddr(), coeffGrid.getNativeObjAddr(), degreeGrid.getNativeObjAddr(), balanced);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: SVM::trainAuto(samples, layout, responses)
|
||||
public boolean trainAuto(Mat samples, int layout, Mat responses)
|
||||
{
|
||||
|
||||
boolean retVal = trainAuto_1(nativeObj, samples.nativeObj, layout, responses.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getC()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getC()
|
||||
public double getC()
|
||||
{
|
||||
|
||||
double retVal = getC_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getCoef0()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getCoef0()
|
||||
public double getCoef0()
|
||||
{
|
||||
|
||||
double retVal = getCoef0_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getDecisionFunction(int i, Mat& alpha, Mat& svidx)
|
||||
//
|
||||
|
||||
//javadoc: SVM::getDecisionFunction(i, alpha, svidx)
|
||||
public double getDecisionFunction(int i, Mat alpha, Mat svidx)
|
||||
{
|
||||
|
||||
double retVal = getDecisionFunction_0(nativeObj, i, alpha.nativeObj, svidx.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getDegree()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getDegree()
|
||||
public double getDegree()
|
||||
{
|
||||
|
||||
double retVal = getDegree_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getGamma()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getGamma()
|
||||
public double getGamma()
|
||||
{
|
||||
|
||||
double retVal = getGamma_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getNu()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getNu()
|
||||
public double getNu()
|
||||
{
|
||||
|
||||
double retVal = getNu_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getP()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getP()
|
||||
public double getP()
|
||||
{
|
||||
|
||||
double retVal = getP_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getKernelType()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getKernelType()
|
||||
public int getKernelType()
|
||||
{
|
||||
|
||||
int retVal = getKernelType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getType()
|
||||
//
|
||||
|
||||
//javadoc: SVM::getType()
|
||||
public int getType()
|
||||
{
|
||||
|
||||
int retVal = getType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setC(double val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setC(val)
|
||||
public void setC(double val)
|
||||
{
|
||||
|
||||
setC_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setClassWeights(Mat val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setClassWeights(val)
|
||||
public void setClassWeights(Mat val)
|
||||
{
|
||||
|
||||
setClassWeights_0(nativeObj, val.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setCoef0(double val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setCoef0(val)
|
||||
public void setCoef0(double val)
|
||||
{
|
||||
|
||||
setCoef0_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setDegree(double val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setDegree(val)
|
||||
public void setDegree(double val)
|
||||
{
|
||||
|
||||
setDegree_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setGamma(double val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setGamma(val)
|
||||
public void setGamma(double val)
|
||||
{
|
||||
|
||||
setGamma_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setKernel(int kernelType)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setKernel(kernelType)
|
||||
public void setKernel(int kernelType)
|
||||
{
|
||||
|
||||
setKernel_0(nativeObj, kernelType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setNu(double val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setNu(val)
|
||||
public void setNu(double val)
|
||||
{
|
||||
|
||||
setNu_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setP(double val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setP(val)
|
||||
public void setP(double val)
|
||||
{
|
||||
|
||||
setP_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setTermCriteria(val)
|
||||
public void setTermCriteria(TermCriteria val)
|
||||
{
|
||||
|
||||
setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setType(int val)
|
||||
//
|
||||
|
||||
//javadoc: SVM::setType(val)
|
||||
public void setType(int val)
|
||||
{
|
||||
|
||||
setType_0(nativeObj, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat getClassWeights()
|
||||
private static native long getClassWeights_0(long nativeObj);
|
||||
|
||||
// C++: Mat getSupportVectors()
|
||||
private static native long getSupportVectors_0(long nativeObj);
|
||||
|
||||
// C++: Mat getUncompressedSupportVectors()
|
||||
private static native long getUncompressedSupportVectors_0(long nativeObj);
|
||||
|
||||
// C++: static Ptr_ParamGrid getDefaultGridPtr(int param_id)
|
||||
private static native long getDefaultGridPtr_0(int param_id);
|
||||
|
||||
// C++: static Ptr_SVM create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_SVM load(String filepath)
|
||||
private static native long load_0(String filepath);
|
||||
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
private static native double[] getTermCriteria_0(long nativeObj);
|
||||
|
||||
// C++: bool trainAuto(Mat samples, int layout, Mat responses, int kFold = 10, Ptr_ParamGrid Cgrid = SVM::getDefaultGridPtr(SVM::C), Ptr_ParamGrid gammaGrid = SVM::getDefaultGridPtr(SVM::GAMMA), Ptr_ParamGrid pGrid = SVM::getDefaultGridPtr(SVM::P), Ptr_ParamGrid nuGrid = SVM::getDefaultGridPtr(SVM::NU), Ptr_ParamGrid coeffGrid = SVM::getDefaultGridPtr(SVM::COEF), Ptr_ParamGrid degreeGrid = SVM::getDefaultGridPtr(SVM::DEGREE), bool balanced = false)
|
||||
private static native boolean trainAuto_0(long nativeObj, long samples_nativeObj, int layout, long responses_nativeObj, int kFold, long Cgrid_nativeObj, long gammaGrid_nativeObj, long pGrid_nativeObj, long nuGrid_nativeObj, long coeffGrid_nativeObj, long degreeGrid_nativeObj, boolean balanced);
|
||||
private static native boolean trainAuto_1(long nativeObj, long samples_nativeObj, int layout, long responses_nativeObj);
|
||||
|
||||
// C++: double getC()
|
||||
private static native double getC_0(long nativeObj);
|
||||
|
||||
// C++: double getCoef0()
|
||||
private static native double getCoef0_0(long nativeObj);
|
||||
|
||||
// C++: double getDecisionFunction(int i, Mat& alpha, Mat& svidx)
|
||||
private static native double getDecisionFunction_0(long nativeObj, int i, long alpha_nativeObj, long svidx_nativeObj);
|
||||
|
||||
// C++: double getDegree()
|
||||
private static native double getDegree_0(long nativeObj);
|
||||
|
||||
// C++: double getGamma()
|
||||
private static native double getGamma_0(long nativeObj);
|
||||
|
||||
// C++: double getNu()
|
||||
private static native double getNu_0(long nativeObj);
|
||||
|
||||
// C++: double getP()
|
||||
private static native double getP_0(long nativeObj);
|
||||
|
||||
// C++: int getKernelType()
|
||||
private static native int getKernelType_0(long nativeObj);
|
||||
|
||||
// C++: int getType()
|
||||
private static native int getType_0(long nativeObj);
|
||||
|
||||
// C++: void setC(double val)
|
||||
private static native void setC_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setClassWeights(Mat val)
|
||||
private static native void setClassWeights_0(long nativeObj, long val_nativeObj);
|
||||
|
||||
// C++: void setCoef0(double val)
|
||||
private static native void setCoef0_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setDegree(double val)
|
||||
private static native void setDegree_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setGamma(double val)
|
||||
private static native void setGamma_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setKernel(int kernelType)
|
||||
private static native void setKernel_0(long nativeObj, int kernelType);
|
||||
|
||||
// C++: void setNu(double val)
|
||||
private static native void setNu_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setP(double val)
|
||||
private static native void setP_0(long nativeObj, double val);
|
||||
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);
|
||||
|
||||
// C++: void setType(int val)
|
||||
private static native void setType_0(long nativeObj, int val);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.TermCriteria;
|
||||
import org.opencv.ml.SVMSGD;
|
||||
import org.opencv.ml.StatModel;
|
||||
|
||||
// C++: class SVMSGD
|
||||
//javadoc: SVMSGD
|
||||
|
||||
public class SVMSGD extends StatModel {
|
||||
|
||||
protected SVMSGD(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static SVMSGD __fromPtr__(long addr) { return new SVMSGD(addr); }
|
||||
|
||||
public static final int
|
||||
SGD = 0,
|
||||
ASGD = 1,
|
||||
SOFT_MARGIN = 0,
|
||||
HARD_MARGIN = 1;
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getWeights()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::getWeights()
|
||||
public Mat getWeights()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getWeights_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_SVMSGD create()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::create()
|
||||
public static SVMSGD create()
|
||||
{
|
||||
|
||||
SVMSGD retVal = SVMSGD.__fromPtr__(create_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_SVMSGD load(String filepath, String nodeName = String())
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::load(filepath, nodeName)
|
||||
public static SVMSGD load(String filepath, String nodeName)
|
||||
{
|
||||
|
||||
SVMSGD retVal = SVMSGD.__fromPtr__(load_0(filepath, nodeName));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: SVMSGD::load(filepath)
|
||||
public static SVMSGD load(String filepath)
|
||||
{
|
||||
|
||||
SVMSGD retVal = SVMSGD.__fromPtr__(load_1(filepath));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::getTermCriteria()
|
||||
public TermCriteria getTermCriteria()
|
||||
{
|
||||
|
||||
TermCriteria retVal = new TermCriteria(getTermCriteria_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float getInitialStepSize()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::getInitialStepSize()
|
||||
public float getInitialStepSize()
|
||||
{
|
||||
|
||||
float retVal = getInitialStepSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float getMarginRegularization()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::getMarginRegularization()
|
||||
public float getMarginRegularization()
|
||||
{
|
||||
|
||||
float retVal = getMarginRegularization_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float getShift()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::getShift()
|
||||
public float getShift()
|
||||
{
|
||||
|
||||
float retVal = getShift_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float getStepDecreasingPower()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::getStepDecreasingPower()
|
||||
public float getStepDecreasingPower()
|
||||
{
|
||||
|
||||
float retVal = getStepDecreasingPower_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getMarginType()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::getMarginType()
|
||||
public int getMarginType()
|
||||
{
|
||||
|
||||
int retVal = getMarginType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getSvmsgdType()
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::getSvmsgdType()
|
||||
public int getSvmsgdType()
|
||||
{
|
||||
|
||||
int retVal = getSvmsgdType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setInitialStepSize(float InitialStepSize)
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::setInitialStepSize(InitialStepSize)
|
||||
public void setInitialStepSize(float InitialStepSize)
|
||||
{
|
||||
|
||||
setInitialStepSize_0(nativeObj, InitialStepSize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMarginRegularization(float marginRegularization)
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::setMarginRegularization(marginRegularization)
|
||||
public void setMarginRegularization(float marginRegularization)
|
||||
{
|
||||
|
||||
setMarginRegularization_0(nativeObj, marginRegularization);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setMarginType(int marginType)
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::setMarginType(marginType)
|
||||
public void setMarginType(int marginType)
|
||||
{
|
||||
|
||||
setMarginType_0(nativeObj, marginType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setOptimalParameters(int svmsgdType = SVMSGD::ASGD, int marginType = SVMSGD::SOFT_MARGIN)
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::setOptimalParameters(svmsgdType, marginType)
|
||||
public void setOptimalParameters(int svmsgdType, int marginType)
|
||||
{
|
||||
|
||||
setOptimalParameters_0(nativeObj, svmsgdType, marginType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: SVMSGD::setOptimalParameters()
|
||||
public void setOptimalParameters()
|
||||
{
|
||||
|
||||
setOptimalParameters_1(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setStepDecreasingPower(float stepDecreasingPower)
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::setStepDecreasingPower(stepDecreasingPower)
|
||||
public void setStepDecreasingPower(float stepDecreasingPower)
|
||||
{
|
||||
|
||||
setStepDecreasingPower_0(nativeObj, stepDecreasingPower);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setSvmsgdType(int svmsgdType)
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::setSvmsgdType(svmsgdType)
|
||||
public void setSvmsgdType(int svmsgdType)
|
||||
{
|
||||
|
||||
setSvmsgdType_0(nativeObj, svmsgdType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
//
|
||||
|
||||
//javadoc: SVMSGD::setTermCriteria(val)
|
||||
public void setTermCriteria(TermCriteria val)
|
||||
{
|
||||
|
||||
setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat getWeights()
|
||||
private static native long getWeights_0(long nativeObj);
|
||||
|
||||
// C++: static Ptr_SVMSGD create()
|
||||
private static native long create_0();
|
||||
|
||||
// C++: static Ptr_SVMSGD load(String filepath, String nodeName = String())
|
||||
private static native long load_0(String filepath, String nodeName);
|
||||
private static native long load_1(String filepath);
|
||||
|
||||
// C++: TermCriteria getTermCriteria()
|
||||
private static native double[] getTermCriteria_0(long nativeObj);
|
||||
|
||||
// C++: float getInitialStepSize()
|
||||
private static native float getInitialStepSize_0(long nativeObj);
|
||||
|
||||
// C++: float getMarginRegularization()
|
||||
private static native float getMarginRegularization_0(long nativeObj);
|
||||
|
||||
// C++: float getShift()
|
||||
private static native float getShift_0(long nativeObj);
|
||||
|
||||
// C++: float getStepDecreasingPower()
|
||||
private static native float getStepDecreasingPower_0(long nativeObj);
|
||||
|
||||
// C++: int getMarginType()
|
||||
private static native int getMarginType_0(long nativeObj);
|
||||
|
||||
// C++: int getSvmsgdType()
|
||||
private static native int getSvmsgdType_0(long nativeObj);
|
||||
|
||||
// C++: void setInitialStepSize(float InitialStepSize)
|
||||
private static native void setInitialStepSize_0(long nativeObj, float InitialStepSize);
|
||||
|
||||
// C++: void setMarginRegularization(float marginRegularization)
|
||||
private static native void setMarginRegularization_0(long nativeObj, float marginRegularization);
|
||||
|
||||
// C++: void setMarginType(int marginType)
|
||||
private static native void setMarginType_0(long nativeObj, int marginType);
|
||||
|
||||
// C++: void setOptimalParameters(int svmsgdType = SVMSGD::ASGD, int marginType = SVMSGD::SOFT_MARGIN)
|
||||
private static native void setOptimalParameters_0(long nativeObj, int svmsgdType, int marginType);
|
||||
private static native void setOptimalParameters_1(long nativeObj);
|
||||
|
||||
// C++: void setStepDecreasingPower(float stepDecreasingPower)
|
||||
private static native void setStepDecreasingPower_0(long nativeObj, float stepDecreasingPower);
|
||||
|
||||
// C++: void setSvmsgdType(int svmsgdType)
|
||||
private static native void setSvmsgdType_0(long nativeObj, int svmsgdType);
|
||||
|
||||
// C++: void setTermCriteria(TermCriteria val)
|
||||
private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import org.opencv.core.Algorithm;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.ml.TrainData;
|
||||
|
||||
// C++: class StatModel
|
||||
//javadoc: StatModel
|
||||
|
||||
public class StatModel extends Algorithm {
|
||||
|
||||
protected StatModel(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static StatModel __fromPtr__(long addr) { return new StatModel(addr); }
|
||||
|
||||
public static final int
|
||||
UPDATE_MODEL = 1,
|
||||
RAW_OUTPUT = 1,
|
||||
COMPRESSED_INPUT = 2,
|
||||
PREPROCESSED_INPUT = 4;
|
||||
|
||||
|
||||
//
|
||||
// C++: bool empty()
|
||||
//
|
||||
|
||||
//javadoc: StatModel::empty()
|
||||
public boolean empty()
|
||||
{
|
||||
|
||||
boolean retVal = empty_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool isClassifier()
|
||||
//
|
||||
|
||||
//javadoc: StatModel::isClassifier()
|
||||
public boolean isClassifier()
|
||||
{
|
||||
|
||||
boolean retVal = isClassifier_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool isTrained()
|
||||
//
|
||||
|
||||
//javadoc: StatModel::isTrained()
|
||||
public boolean isTrained()
|
||||
{
|
||||
|
||||
boolean retVal = isTrained_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool train(Mat samples, int layout, Mat responses)
|
||||
//
|
||||
|
||||
//javadoc: StatModel::train(samples, layout, responses)
|
||||
public boolean train(Mat samples, int layout, Mat responses)
|
||||
{
|
||||
|
||||
boolean retVal = train_0(nativeObj, samples.nativeObj, layout, responses.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool train(Ptr_TrainData trainData, int flags = 0)
|
||||
//
|
||||
|
||||
//javadoc: StatModel::train(trainData, flags)
|
||||
public boolean train(TrainData trainData, int flags)
|
||||
{
|
||||
|
||||
boolean retVal = train_1(nativeObj, trainData.getNativeObjAddr(), flags);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: StatModel::train(trainData)
|
||||
public boolean train(TrainData trainData)
|
||||
{
|
||||
|
||||
boolean retVal = train_2(nativeObj, trainData.getNativeObjAddr());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float calcError(Ptr_TrainData data, bool test, Mat& resp)
|
||||
//
|
||||
|
||||
//javadoc: StatModel::calcError(data, test, resp)
|
||||
public float calcError(TrainData data, boolean test, Mat resp)
|
||||
{
|
||||
|
||||
float retVal = calcError_0(nativeObj, data.getNativeObjAddr(), test, resp.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: float predict(Mat samples, Mat& results = Mat(), int flags = 0)
|
||||
//
|
||||
|
||||
//javadoc: StatModel::predict(samples, results, flags)
|
||||
public float predict(Mat samples, Mat results, int flags)
|
||||
{
|
||||
|
||||
float retVal = predict_0(nativeObj, samples.nativeObj, results.nativeObj, flags);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: StatModel::predict(samples)
|
||||
public float predict(Mat samples)
|
||||
{
|
||||
|
||||
float retVal = predict_1(nativeObj, samples.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getVarCount()
|
||||
//
|
||||
|
||||
//javadoc: StatModel::getVarCount()
|
||||
public int getVarCount()
|
||||
{
|
||||
|
||||
int retVal = getVarCount_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: bool empty()
|
||||
private static native boolean empty_0(long nativeObj);
|
||||
|
||||
// C++: bool isClassifier()
|
||||
private static native boolean isClassifier_0(long nativeObj);
|
||||
|
||||
// C++: bool isTrained()
|
||||
private static native boolean isTrained_0(long nativeObj);
|
||||
|
||||
// C++: bool train(Mat samples, int layout, Mat responses)
|
||||
private static native boolean train_0(long nativeObj, long samples_nativeObj, int layout, long responses_nativeObj);
|
||||
|
||||
// C++: bool train(Ptr_TrainData trainData, int flags = 0)
|
||||
private static native boolean train_1(long nativeObj, long trainData_nativeObj, int flags);
|
||||
private static native boolean train_2(long nativeObj, long trainData_nativeObj);
|
||||
|
||||
// C++: float calcError(Ptr_TrainData data, bool test, Mat& resp)
|
||||
private static native float calcError_0(long nativeObj, long data_nativeObj, boolean test, long resp_nativeObj);
|
||||
|
||||
// C++: float predict(Mat samples, Mat& results = Mat(), int flags = 0)
|
||||
private static native float predict_0(long nativeObj, long samples_nativeObj, long results_nativeObj, int flags);
|
||||
private static native float predict_1(long nativeObj, long samples_nativeObj);
|
||||
|
||||
// C++: int getVarCount()
|
||||
private static native int getVarCount_0(long nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,722 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.ml;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.ml.TrainData;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class TrainData
|
||||
//javadoc: TrainData
|
||||
|
||||
public class TrainData {
|
||||
|
||||
protected final long nativeObj;
|
||||
protected TrainData(long addr) { nativeObj = addr; }
|
||||
|
||||
public long getNativeObjAddr() { return nativeObj; }
|
||||
|
||||
// internal usage only
|
||||
public static TrainData __fromPtr__(long addr) { return new TrainData(addr); }
|
||||
|
||||
//
|
||||
// C++: Mat getCatMap()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getCatMap()
|
||||
public Mat getCatMap()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getCatMap_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getCatOfs()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getCatOfs()
|
||||
public Mat getCatOfs()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getCatOfs_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getClassLabels()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getClassLabels()
|
||||
public Mat getClassLabels()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getClassLabels_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getDefaultSubstValues()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getDefaultSubstValues()
|
||||
public Mat getDefaultSubstValues()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getDefaultSubstValues_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getMissing()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getMissing()
|
||||
public Mat getMissing()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getMissing_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getNormCatResponses()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getNormCatResponses()
|
||||
public Mat getNormCatResponses()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getNormCatResponses_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getResponses()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getResponses()
|
||||
public Mat getResponses()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getResponses_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getSampleWeights()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getSampleWeights()
|
||||
public Mat getSampleWeights()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getSampleWeights_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getSamples()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getSamples()
|
||||
public Mat getSamples()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getSamples_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Mat getSubVector(Mat vec, Mat idx)
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getSubVector(vec, idx)
|
||||
public static Mat getSubVector(Mat vec, Mat idx)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getSubVector_0(vec.nativeObj, idx.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTestNormCatResponses()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTestNormCatResponses()
|
||||
public Mat getTestNormCatResponses()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTestNormCatResponses_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTestResponses()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTestResponses()
|
||||
public Mat getTestResponses()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTestResponses_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTestSampleIdx()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTestSampleIdx()
|
||||
public Mat getTestSampleIdx()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTestSampleIdx_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTestSampleWeights()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTestSampleWeights()
|
||||
public Mat getTestSampleWeights()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTestSampleWeights_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTestSamples()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTestSamples()
|
||||
public Mat getTestSamples()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTestSamples_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTrainNormCatResponses()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTrainNormCatResponses()
|
||||
public Mat getTrainNormCatResponses()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTrainNormCatResponses_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTrainResponses()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTrainResponses()
|
||||
public Mat getTrainResponses()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTrainResponses_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTrainSampleIdx()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTrainSampleIdx()
|
||||
public Mat getTrainSampleIdx()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTrainSampleIdx_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTrainSampleWeights()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTrainSampleWeights()
|
||||
public Mat getTrainSampleWeights()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTrainSampleWeights_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getTrainSamples(int layout = ROW_SAMPLE, bool compressSamples = true, bool compressVars = true)
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getTrainSamples(layout, compressSamples, compressVars)
|
||||
public Mat getTrainSamples(int layout, boolean compressSamples, boolean compressVars)
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTrainSamples_0(nativeObj, layout, compressSamples, compressVars));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: TrainData::getTrainSamples()
|
||||
public Mat getTrainSamples()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getTrainSamples_1(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getVarIdx()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getVarIdx()
|
||||
public Mat getVarIdx()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getVarIdx_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getVarSymbolFlags()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getVarSymbolFlags()
|
||||
public Mat getVarSymbolFlags()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getVarSymbolFlags_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat getVarType()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getVarType()
|
||||
public Mat getVarType()
|
||||
{
|
||||
|
||||
Mat retVal = new Mat(getVarType_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static Ptr_TrainData create(Mat samples, int layout, Mat responses, Mat varIdx = Mat(), Mat sampleIdx = Mat(), Mat sampleWeights = Mat(), Mat varType = Mat())
|
||||
//
|
||||
|
||||
//javadoc: TrainData::create(samples, layout, responses, varIdx, sampleIdx, sampleWeights, varType)
|
||||
public static TrainData create(Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx, Mat sampleWeights, Mat varType)
|
||||
{
|
||||
|
||||
TrainData retVal = TrainData.__fromPtr__(create_0(samples.nativeObj, layout, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, sampleWeights.nativeObj, varType.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: TrainData::create(samples, layout, responses)
|
||||
public static TrainData create(Mat samples, int layout, Mat responses)
|
||||
{
|
||||
|
||||
TrainData retVal = TrainData.__fromPtr__(create_1(samples.nativeObj, layout, responses.nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getCatCount(int vi)
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getCatCount(vi)
|
||||
public int getCatCount(int vi)
|
||||
{
|
||||
|
||||
int retVal = getCatCount_0(nativeObj, vi);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getLayout()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getLayout()
|
||||
public int getLayout()
|
||||
{
|
||||
|
||||
int retVal = getLayout_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNAllVars()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getNAllVars()
|
||||
public int getNAllVars()
|
||||
{
|
||||
|
||||
int retVal = getNAllVars_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNSamples()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getNSamples()
|
||||
public int getNSamples()
|
||||
{
|
||||
|
||||
int retVal = getNSamples_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNTestSamples()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getNTestSamples()
|
||||
public int getNTestSamples()
|
||||
{
|
||||
|
||||
int retVal = getNTestSamples_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNTrainSamples()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getNTrainSamples()
|
||||
public int getNTrainSamples()
|
||||
{
|
||||
|
||||
int retVal = getNTrainSamples_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getNVars()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getNVars()
|
||||
public int getNVars()
|
||||
{
|
||||
|
||||
int retVal = getNVars_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int getResponseType()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getResponseType()
|
||||
public int getResponseType()
|
||||
{
|
||||
|
||||
int retVal = getResponseType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getNames(vector_String names)
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getNames(names)
|
||||
public void getNames(List<String> names)
|
||||
{
|
||||
|
||||
getNames_0(nativeObj, names);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getSample(Mat varIdx, int sidx, float* buf)
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getSample(varIdx, sidx, buf)
|
||||
public void getSample(Mat varIdx, int sidx, float buf)
|
||||
{
|
||||
|
||||
getSample_0(nativeObj, varIdx.nativeObj, sidx, buf);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void getValues(int vi, Mat sidx, float* values)
|
||||
//
|
||||
|
||||
//javadoc: TrainData::getValues(vi, sidx, values)
|
||||
public void getValues(int vi, Mat sidx, float values)
|
||||
{
|
||||
|
||||
getValues_0(nativeObj, vi, sidx.nativeObj, values);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTrainTestSplit(int count, bool shuffle = true)
|
||||
//
|
||||
|
||||
//javadoc: TrainData::setTrainTestSplit(count, shuffle)
|
||||
public void setTrainTestSplit(int count, boolean shuffle)
|
||||
{
|
||||
|
||||
setTrainTestSplit_0(nativeObj, count, shuffle);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: TrainData::setTrainTestSplit(count)
|
||||
public void setTrainTestSplit(int count)
|
||||
{
|
||||
|
||||
setTrainTestSplit_1(nativeObj, count);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setTrainTestSplitRatio(double ratio, bool shuffle = true)
|
||||
//
|
||||
|
||||
//javadoc: TrainData::setTrainTestSplitRatio(ratio, shuffle)
|
||||
public void setTrainTestSplitRatio(double ratio, boolean shuffle)
|
||||
{
|
||||
|
||||
setTrainTestSplitRatio_0(nativeObj, ratio, shuffle);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: TrainData::setTrainTestSplitRatio(ratio)
|
||||
public void setTrainTestSplitRatio(double ratio)
|
||||
{
|
||||
|
||||
setTrainTestSplitRatio_1(nativeObj, ratio);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void shuffleTrainTest()
|
||||
//
|
||||
|
||||
//javadoc: TrainData::shuffleTrainTest()
|
||||
public void shuffleTrainTest()
|
||||
{
|
||||
|
||||
shuffleTrainTest_0(nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: Mat getCatMap()
|
||||
private static native long getCatMap_0(long nativeObj);
|
||||
|
||||
// C++: Mat getCatOfs()
|
||||
private static native long getCatOfs_0(long nativeObj);
|
||||
|
||||
// C++: Mat getClassLabels()
|
||||
private static native long getClassLabels_0(long nativeObj);
|
||||
|
||||
// C++: Mat getDefaultSubstValues()
|
||||
private static native long getDefaultSubstValues_0(long nativeObj);
|
||||
|
||||
// C++: Mat getMissing()
|
||||
private static native long getMissing_0(long nativeObj);
|
||||
|
||||
// C++: Mat getNormCatResponses()
|
||||
private static native long getNormCatResponses_0(long nativeObj);
|
||||
|
||||
// C++: Mat getResponses()
|
||||
private static native long getResponses_0(long nativeObj);
|
||||
|
||||
// C++: Mat getSampleWeights()
|
||||
private static native long getSampleWeights_0(long nativeObj);
|
||||
|
||||
// C++: Mat getSamples()
|
||||
private static native long getSamples_0(long nativeObj);
|
||||
|
||||
// C++: static Mat getSubVector(Mat vec, Mat idx)
|
||||
private static native long getSubVector_0(long vec_nativeObj, long idx_nativeObj);
|
||||
|
||||
// C++: Mat getTestNormCatResponses()
|
||||
private static native long getTestNormCatResponses_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTestResponses()
|
||||
private static native long getTestResponses_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTestSampleIdx()
|
||||
private static native long getTestSampleIdx_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTestSampleWeights()
|
||||
private static native long getTestSampleWeights_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTestSamples()
|
||||
private static native long getTestSamples_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTrainNormCatResponses()
|
||||
private static native long getTrainNormCatResponses_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTrainResponses()
|
||||
private static native long getTrainResponses_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTrainSampleIdx()
|
||||
private static native long getTrainSampleIdx_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTrainSampleWeights()
|
||||
private static native long getTrainSampleWeights_0(long nativeObj);
|
||||
|
||||
// C++: Mat getTrainSamples(int layout = ROW_SAMPLE, bool compressSamples = true, bool compressVars = true)
|
||||
private static native long getTrainSamples_0(long nativeObj, int layout, boolean compressSamples, boolean compressVars);
|
||||
private static native long getTrainSamples_1(long nativeObj);
|
||||
|
||||
// C++: Mat getVarIdx()
|
||||
private static native long getVarIdx_0(long nativeObj);
|
||||
|
||||
// C++: Mat getVarSymbolFlags()
|
||||
private static native long getVarSymbolFlags_0(long nativeObj);
|
||||
|
||||
// C++: Mat getVarType()
|
||||
private static native long getVarType_0(long nativeObj);
|
||||
|
||||
// C++: static Ptr_TrainData create(Mat samples, int layout, Mat responses, Mat varIdx = Mat(), Mat sampleIdx = Mat(), Mat sampleWeights = Mat(), Mat varType = Mat())
|
||||
private static native long create_0(long samples_nativeObj, int layout, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long sampleWeights_nativeObj, long varType_nativeObj);
|
||||
private static native long create_1(long samples_nativeObj, int layout, long responses_nativeObj);
|
||||
|
||||
// C++: int getCatCount(int vi)
|
||||
private static native int getCatCount_0(long nativeObj, int vi);
|
||||
|
||||
// C++: int getLayout()
|
||||
private static native int getLayout_0(long nativeObj);
|
||||
|
||||
// C++: int getNAllVars()
|
||||
private static native int getNAllVars_0(long nativeObj);
|
||||
|
||||
// C++: int getNSamples()
|
||||
private static native int getNSamples_0(long nativeObj);
|
||||
|
||||
// C++: int getNTestSamples()
|
||||
private static native int getNTestSamples_0(long nativeObj);
|
||||
|
||||
// C++: int getNTrainSamples()
|
||||
private static native int getNTrainSamples_0(long nativeObj);
|
||||
|
||||
// C++: int getNVars()
|
||||
private static native int getNVars_0(long nativeObj);
|
||||
|
||||
// C++: int getResponseType()
|
||||
private static native int getResponseType_0(long nativeObj);
|
||||
|
||||
// C++: void getNames(vector_String names)
|
||||
private static native void getNames_0(long nativeObj, List<String> names);
|
||||
|
||||
// C++: void getSample(Mat varIdx, int sidx, float* buf)
|
||||
private static native void getSample_0(long nativeObj, long varIdx_nativeObj, int sidx, float buf);
|
||||
|
||||
// C++: void getValues(int vi, Mat sidx, float* values)
|
||||
private static native void getValues_0(long nativeObj, int vi, long sidx_nativeObj, float values);
|
||||
|
||||
// C++: void setTrainTestSplit(int count, bool shuffle = true)
|
||||
private static native void setTrainTestSplit_0(long nativeObj, int count, boolean shuffle);
|
||||
private static native void setTrainTestSplit_1(long nativeObj, int count);
|
||||
|
||||
// C++: void setTrainTestSplitRatio(double ratio, bool shuffle = true)
|
||||
private static native void setTrainTestSplitRatio_0(long nativeObj, double ratio, boolean shuffle);
|
||||
private static native void setTrainTestSplitRatio_1(long nativeObj, double ratio);
|
||||
|
||||
// C++: void shuffleTrainTest()
|
||||
private static native void shuffleTrainTest_0(long nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.objdetect;
|
||||
|
||||
import org.opencv.core.Algorithm;
|
||||
|
||||
// C++: class BaseCascadeClassifier
|
||||
//javadoc: BaseCascadeClassifier
|
||||
|
||||
public class BaseCascadeClassifier extends Algorithm {
|
||||
|
||||
protected BaseCascadeClassifier(long addr) { super(addr); }
|
||||
|
||||
// internal usage only
|
||||
public static BaseCascadeClassifier __fromPtr__(long addr) { return new BaseCascadeClassifier(addr); }
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
+269
@@ -0,0 +1,269 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.objdetect;
|
||||
|
||||
import java.lang.String;
|
||||
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.MatOfRect;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class CascadeClassifier
|
||||
//javadoc: CascadeClassifier
|
||||
|
||||
public class CascadeClassifier {
|
||||
|
||||
protected final long nativeObj;
|
||||
protected CascadeClassifier(long addr) { nativeObj = addr; }
|
||||
|
||||
public long getNativeObjAddr() { return nativeObj; }
|
||||
|
||||
// internal usage only
|
||||
public static CascadeClassifier __fromPtr__(long addr) { return new CascadeClassifier(addr); }
|
||||
|
||||
//
|
||||
// C++: CascadeClassifier(String filename)
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::CascadeClassifier(filename)
|
||||
public CascadeClassifier(String filename)
|
||||
{
|
||||
|
||||
nativeObj = CascadeClassifier_0(filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: CascadeClassifier()
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::CascadeClassifier()
|
||||
public CascadeClassifier()
|
||||
{
|
||||
|
||||
nativeObj = CascadeClassifier_1();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Size getOriginalWindowSize()
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::getOriginalWindowSize()
|
||||
public Size getOriginalWindowSize()
|
||||
{
|
||||
|
||||
Size retVal = new Size(getOriginalWindowSize_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static bool convert(String oldcascade, String newcascade)
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::convert(oldcascade, newcascade)
|
||||
public static boolean convert(String oldcascade, String newcascade)
|
||||
{
|
||||
|
||||
boolean retVal = convert_0(oldcascade, newcascade);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool empty()
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::empty()
|
||||
public boolean empty()
|
||||
{
|
||||
|
||||
boolean retVal = empty_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool isOldFormatCascade()
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::isOldFormatCascade()
|
||||
public boolean isOldFormatCascade()
|
||||
{
|
||||
|
||||
boolean retVal = isOldFormatCascade_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool load(String filename)
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::load(filename)
|
||||
public boolean load(String filename)
|
||||
{
|
||||
|
||||
boolean retVal = load_0(nativeObj, filename);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool read(FileNode node)
|
||||
//
|
||||
|
||||
// Unknown type 'FileNode' (I), skipping the function
|
||||
|
||||
|
||||
//
|
||||
// C++: int getFeatureType()
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::getFeatureType()
|
||||
public int getFeatureType()
|
||||
{
|
||||
|
||||
int retVal = getFeatureType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detectMultiScale(Mat image, vector_Rect& objects, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size())
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::detectMultiScale(image, objects, scaleFactor, minNeighbors, flags, minSize, maxSize)
|
||||
public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
|
||||
{
|
||||
Mat objects_mat = objects;
|
||||
detectMultiScale_0(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: CascadeClassifier::detectMultiScale(image, objects)
|
||||
public void detectMultiScale(Mat image, MatOfRect objects)
|
||||
{
|
||||
Mat objects_mat = objects;
|
||||
detectMultiScale_1(nativeObj, image.nativeObj, objects_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detectMultiScale(Mat image, vector_Rect& objects, vector_int& numDetections, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size())
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::detectMultiScale(image, objects, numDetections, scaleFactor, minNeighbors, flags, minSize, maxSize)
|
||||
public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
|
||||
{
|
||||
Mat objects_mat = objects;
|
||||
Mat numDetections_mat = numDetections;
|
||||
detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: CascadeClassifier::detectMultiScale(image, objects, numDetections)
|
||||
public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections)
|
||||
{
|
||||
Mat objects_mat = objects;
|
||||
Mat numDetections_mat = numDetections;
|
||||
detectMultiScale2_1(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detectMultiScale(Mat image, vector_Rect& objects, vector_int& rejectLevels, vector_double& levelWeights, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size(), bool outputRejectLevels = false)
|
||||
//
|
||||
|
||||
//javadoc: CascadeClassifier::detectMultiScale(image, objects, rejectLevels, levelWeights, scaleFactor, minNeighbors, flags, minSize, maxSize, outputRejectLevels)
|
||||
public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, boolean outputRejectLevels)
|
||||
{
|
||||
Mat objects_mat = objects;
|
||||
Mat rejectLevels_mat = rejectLevels;
|
||||
Mat levelWeights_mat = levelWeights;
|
||||
detectMultiScale3_0(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height, outputRejectLevels);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: CascadeClassifier::detectMultiScale(image, objects, rejectLevels, levelWeights)
|
||||
public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
|
||||
{
|
||||
Mat objects_mat = objects;
|
||||
Mat rejectLevels_mat = rejectLevels;
|
||||
Mat levelWeights_mat = levelWeights;
|
||||
detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: CascadeClassifier(String filename)
|
||||
private static native long CascadeClassifier_0(String filename);
|
||||
|
||||
// C++: CascadeClassifier()
|
||||
private static native long CascadeClassifier_1();
|
||||
|
||||
// C++: Size getOriginalWindowSize()
|
||||
private static native double[] getOriginalWindowSize_0(long nativeObj);
|
||||
|
||||
// C++: static bool convert(String oldcascade, String newcascade)
|
||||
private static native boolean convert_0(String oldcascade, String newcascade);
|
||||
|
||||
// C++: bool empty()
|
||||
private static native boolean empty_0(long nativeObj);
|
||||
|
||||
// C++: bool isOldFormatCascade()
|
||||
private static native boolean isOldFormatCascade_0(long nativeObj);
|
||||
|
||||
// C++: bool load(String filename)
|
||||
private static native boolean load_0(long nativeObj, String filename);
|
||||
|
||||
// C++: int getFeatureType()
|
||||
private static native int getFeatureType_0(long nativeObj);
|
||||
|
||||
// C++: void detectMultiScale(Mat image, vector_Rect& objects, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size())
|
||||
private static native void detectMultiScale_0(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height);
|
||||
private static native void detectMultiScale_1(long nativeObj, long image_nativeObj, long objects_mat_nativeObj);
|
||||
|
||||
// C++: void detectMultiScale(Mat image, vector_Rect& objects, vector_int& numDetections, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size())
|
||||
private static native void detectMultiScale2_0(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height);
|
||||
private static native void detectMultiScale2_1(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj);
|
||||
|
||||
// C++: void detectMultiScale(Mat image, vector_Rect& objects, vector_int& rejectLevels, vector_double& levelWeights, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size(), bool outputRejectLevels = false)
|
||||
private static native void detectMultiScale3_0(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height, boolean outputRejectLevels);
|
||||
private static native void detectMultiScale3_1(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,597 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.objdetect;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfDouble;
|
||||
import org.opencv.core.MatOfFloat;
|
||||
import org.opencv.core.MatOfPoint;
|
||||
import org.opencv.core.MatOfRect;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class HOGDescriptor
|
||||
//javadoc: HOGDescriptor
|
||||
|
||||
public class HOGDescriptor {
|
||||
|
||||
protected final long nativeObj;
|
||||
protected HOGDescriptor(long addr) { nativeObj = addr; }
|
||||
|
||||
public long getNativeObjAddr() { return nativeObj; }
|
||||
|
||||
// internal usage only
|
||||
public static HOGDescriptor __fromPtr__(long addr) { return new HOGDescriptor(addr); }
|
||||
|
||||
public static final int
|
||||
L2Hys = 0,
|
||||
DEFAULT_NLEVELS = 64;
|
||||
|
||||
|
||||
//
|
||||
// C++: HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture = 1, double _winSigma = -1, int _histogramNormType = HOGDescriptor::L2Hys, double _L2HysThreshold = 0.2, bool _gammaCorrection = false, int _nlevels = HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient = false)
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::HOGDescriptor(_winSize, _blockSize, _blockStride, _cellSize, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold, _gammaCorrection, _nlevels, _signedGradient)
|
||||
public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, boolean _gammaCorrection, int _nlevels, boolean _signedGradient)
|
||||
{
|
||||
|
||||
nativeObj = HOGDescriptor_0(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold, _gammaCorrection, _nlevels, _signedGradient);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: HOGDescriptor::HOGDescriptor(_winSize, _blockSize, _blockStride, _cellSize, _nbins)
|
||||
public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins)
|
||||
{
|
||||
|
||||
nativeObj = HOGDescriptor_1(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: HOGDescriptor(String filename)
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::HOGDescriptor(filename)
|
||||
public HOGDescriptor(String filename)
|
||||
{
|
||||
|
||||
nativeObj = HOGDescriptor_2(filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: HOGDescriptor()
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::HOGDescriptor()
|
||||
public HOGDescriptor()
|
||||
{
|
||||
|
||||
nativeObj = HOGDescriptor_3();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool checkDetectorSize()
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::checkDetectorSize()
|
||||
public boolean checkDetectorSize()
|
||||
{
|
||||
|
||||
boolean retVal = checkDetectorSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool load(String filename, String objname = String())
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::load(filename, objname)
|
||||
public boolean load(String filename, String objname)
|
||||
{
|
||||
|
||||
boolean retVal = load_0(nativeObj, filename, objname);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//javadoc: HOGDescriptor::load(filename)
|
||||
public boolean load(String filename)
|
||||
{
|
||||
|
||||
boolean retVal = load_1(nativeObj, filename);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double getWinSigma()
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::getWinSigma()
|
||||
public double getWinSigma()
|
||||
{
|
||||
|
||||
double retVal = getWinSigma_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: size_t getDescriptorSize()
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::getDescriptorSize()
|
||||
public long getDescriptorSize()
|
||||
{
|
||||
|
||||
long retVal = getDescriptorSize_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static vector_float getDaimlerPeopleDetector()
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::getDaimlerPeopleDetector()
|
||||
public static MatOfFloat getDaimlerPeopleDetector()
|
||||
{
|
||||
|
||||
MatOfFloat retVal = MatOfFloat.fromNativeAddr(getDaimlerPeopleDetector_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: static vector_float getDefaultPeopleDetector()
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::getDefaultPeopleDetector()
|
||||
public static MatOfFloat getDefaultPeopleDetector()
|
||||
{
|
||||
|
||||
MatOfFloat retVal = MatOfFloat.fromNativeAddr(getDefaultPeopleDetector_0());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void compute(Mat img, vector_float& descriptors, Size winStride = Size(), Size padding = Size(), vector_Point locations = std::vector<Point>())
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::compute(img, descriptors, winStride, padding, locations)
|
||||
public void compute(Mat img, MatOfFloat descriptors, Size winStride, Size padding, MatOfPoint locations)
|
||||
{
|
||||
Mat descriptors_mat = descriptors;
|
||||
Mat locations_mat = locations;
|
||||
compute_0(nativeObj, img.nativeObj, descriptors_mat.nativeObj, winStride.width, winStride.height, padding.width, padding.height, locations_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: HOGDescriptor::compute(img, descriptors)
|
||||
public void compute(Mat img, MatOfFloat descriptors)
|
||||
{
|
||||
Mat descriptors_mat = descriptors;
|
||||
compute_1(nativeObj, img.nativeObj, descriptors_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void computeGradient(Mat img, Mat& grad, Mat& angleOfs, Size paddingTL = Size(), Size paddingBR = Size())
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::computeGradient(img, grad, angleOfs, paddingTL, paddingBR)
|
||||
public void computeGradient(Mat img, Mat grad, Mat angleOfs, Size paddingTL, Size paddingBR)
|
||||
{
|
||||
|
||||
computeGradient_0(nativeObj, img.nativeObj, grad.nativeObj, angleOfs.nativeObj, paddingTL.width, paddingTL.height, paddingBR.width, paddingBR.height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: HOGDescriptor::computeGradient(img, grad, angleOfs)
|
||||
public void computeGradient(Mat img, Mat grad, Mat angleOfs)
|
||||
{
|
||||
|
||||
computeGradient_1(nativeObj, img.nativeObj, grad.nativeObj, angleOfs.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detect(Mat img, vector_Point& foundLocations, vector_double& weights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), vector_Point searchLocations = std::vector<Point>())
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::detect(img, foundLocations, weights, hitThreshold, winStride, padding, searchLocations)
|
||||
public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold, Size winStride, Size padding, MatOfPoint searchLocations)
|
||||
{
|
||||
Mat foundLocations_mat = foundLocations;
|
||||
Mat weights_mat = weights;
|
||||
Mat searchLocations_mat = searchLocations;
|
||||
detect_0(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, searchLocations_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: HOGDescriptor::detect(img, foundLocations, weights)
|
||||
public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights)
|
||||
{
|
||||
Mat foundLocations_mat = foundLocations;
|
||||
Mat weights_mat = weights;
|
||||
detect_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void detectMultiScale(Mat img, vector_Rect& foundLocations, vector_double& foundWeights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), double scale = 1.05, double finalThreshold = 2.0, bool useMeanshiftGrouping = false)
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::detectMultiScale(img, foundLocations, foundWeights, hitThreshold, winStride, padding, scale, finalThreshold, useMeanshiftGrouping)
|
||||
public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double finalThreshold, boolean useMeanshiftGrouping)
|
||||
{
|
||||
Mat foundLocations_mat = foundLocations;
|
||||
Mat foundWeights_mat = foundWeights;
|
||||
detectMultiScale_0(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, finalThreshold, useMeanshiftGrouping);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: HOGDescriptor::detectMultiScale(img, foundLocations, foundWeights)
|
||||
public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights)
|
||||
{
|
||||
Mat foundLocations_mat = foundLocations;
|
||||
Mat foundWeights_mat = foundWeights;
|
||||
detectMultiScale_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void save(String filename, String objname = String())
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::save(filename, objname)
|
||||
public void save(String filename, String objname)
|
||||
{
|
||||
|
||||
save_0(nativeObj, filename, objname);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: HOGDescriptor::save(filename)
|
||||
public void save(String filename)
|
||||
{
|
||||
|
||||
save_1(nativeObj, filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: void setSVMDetector(Mat _svmdetector)
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::setSVMDetector(_svmdetector)
|
||||
public void setSVMDetector(Mat _svmdetector)
|
||||
{
|
||||
|
||||
setSVMDetector_0(nativeObj, _svmdetector.nativeObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Size HOGDescriptor::winSize
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_winSize()
|
||||
public Size get_winSize()
|
||||
{
|
||||
|
||||
Size retVal = new Size(get_winSize_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Size HOGDescriptor::blockSize
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_blockSize()
|
||||
public Size get_blockSize()
|
||||
{
|
||||
|
||||
Size retVal = new Size(get_blockSize_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Size HOGDescriptor::blockStride
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_blockStride()
|
||||
public Size get_blockStride()
|
||||
{
|
||||
|
||||
Size retVal = new Size(get_blockStride_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Size HOGDescriptor::cellSize
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_cellSize()
|
||||
public Size get_cellSize()
|
||||
{
|
||||
|
||||
Size retVal = new Size(get_cellSize_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int HOGDescriptor::nbins
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_nbins()
|
||||
public int get_nbins()
|
||||
{
|
||||
|
||||
int retVal = get_nbins_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int HOGDescriptor::derivAperture
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_derivAperture()
|
||||
public int get_derivAperture()
|
||||
{
|
||||
|
||||
int retVal = get_derivAperture_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double HOGDescriptor::winSigma
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_winSigma()
|
||||
public double get_winSigma()
|
||||
{
|
||||
|
||||
double retVal = get_winSigma_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int HOGDescriptor::histogramNormType
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_histogramNormType()
|
||||
public int get_histogramNormType()
|
||||
{
|
||||
|
||||
int retVal = get_histogramNormType_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: double HOGDescriptor::L2HysThreshold
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_L2HysThreshold()
|
||||
public double get_L2HysThreshold()
|
||||
{
|
||||
|
||||
double retVal = get_L2HysThreshold_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool HOGDescriptor::gammaCorrection
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_gammaCorrection()
|
||||
public boolean get_gammaCorrection()
|
||||
{
|
||||
|
||||
boolean retVal = get_gammaCorrection_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: vector_float HOGDescriptor::svmDetector
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_svmDetector()
|
||||
public MatOfFloat get_svmDetector()
|
||||
{
|
||||
|
||||
MatOfFloat retVal = MatOfFloat.fromNativeAddr(get_svmDetector_0(nativeObj));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: int HOGDescriptor::nlevels
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_nlevels()
|
||||
public int get_nlevels()
|
||||
{
|
||||
|
||||
int retVal = get_nlevels_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool HOGDescriptor::signedGradient
|
||||
//
|
||||
|
||||
//javadoc: HOGDescriptor::get_signedGradient()
|
||||
public boolean get_signedGradient()
|
||||
{
|
||||
|
||||
boolean retVal = get_signedGradient_0(nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativeObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C++: HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture = 1, double _winSigma = -1, int _histogramNormType = HOGDescriptor::L2Hys, double _L2HysThreshold = 0.2, bool _gammaCorrection = false, int _nlevels = HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient = false)
|
||||
private static native long HOGDescriptor_0(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, boolean _gammaCorrection, int _nlevels, boolean _signedGradient);
|
||||
private static native long HOGDescriptor_1(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins);
|
||||
|
||||
// C++: HOGDescriptor(String filename)
|
||||
private static native long HOGDescriptor_2(String filename);
|
||||
|
||||
// C++: HOGDescriptor()
|
||||
private static native long HOGDescriptor_3();
|
||||
|
||||
// C++: bool checkDetectorSize()
|
||||
private static native boolean checkDetectorSize_0(long nativeObj);
|
||||
|
||||
// C++: bool load(String filename, String objname = String())
|
||||
private static native boolean load_0(long nativeObj, String filename, String objname);
|
||||
private static native boolean load_1(long nativeObj, String filename);
|
||||
|
||||
// C++: double getWinSigma()
|
||||
private static native double getWinSigma_0(long nativeObj);
|
||||
|
||||
// C++: size_t getDescriptorSize()
|
||||
private static native long getDescriptorSize_0(long nativeObj);
|
||||
|
||||
// C++: static vector_float getDaimlerPeopleDetector()
|
||||
private static native long getDaimlerPeopleDetector_0();
|
||||
|
||||
// C++: static vector_float getDefaultPeopleDetector()
|
||||
private static native long getDefaultPeopleDetector_0();
|
||||
|
||||
// C++: void compute(Mat img, vector_float& descriptors, Size winStride = Size(), Size padding = Size(), vector_Point locations = std::vector<Point>())
|
||||
private static native void compute_0(long nativeObj, long img_nativeObj, long descriptors_mat_nativeObj, double winStride_width, double winStride_height, double padding_width, double padding_height, long locations_mat_nativeObj);
|
||||
private static native void compute_1(long nativeObj, long img_nativeObj, long descriptors_mat_nativeObj);
|
||||
|
||||
// C++: void computeGradient(Mat img, Mat& grad, Mat& angleOfs, Size paddingTL = Size(), Size paddingBR = Size())
|
||||
private static native void computeGradient_0(long nativeObj, long img_nativeObj, long grad_nativeObj, long angleOfs_nativeObj, double paddingTL_width, double paddingTL_height, double paddingBR_width, double paddingBR_height);
|
||||
private static native void computeGradient_1(long nativeObj, long img_nativeObj, long grad_nativeObj, long angleOfs_nativeObj);
|
||||
|
||||
// C++: void detect(Mat img, vector_Point& foundLocations, vector_double& weights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), vector_Point searchLocations = std::vector<Point>())
|
||||
private static native void detect_0(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long weights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, long searchLocations_mat_nativeObj);
|
||||
private static native void detect_1(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long weights_mat_nativeObj);
|
||||
|
||||
// C++: void detectMultiScale(Mat img, vector_Rect& foundLocations, vector_double& foundWeights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), double scale = 1.05, double finalThreshold = 2.0, bool useMeanshiftGrouping = false)
|
||||
private static native void detectMultiScale_0(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, double scale, double finalThreshold, boolean useMeanshiftGrouping);
|
||||
private static native void detectMultiScale_1(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj);
|
||||
|
||||
// C++: void save(String filename, String objname = String())
|
||||
private static native void save_0(long nativeObj, String filename, String objname);
|
||||
private static native void save_1(long nativeObj, String filename);
|
||||
|
||||
// C++: void setSVMDetector(Mat _svmdetector)
|
||||
private static native void setSVMDetector_0(long nativeObj, long _svmdetector_nativeObj);
|
||||
|
||||
// C++: Size HOGDescriptor::winSize
|
||||
private static native double[] get_winSize_0(long nativeObj);
|
||||
|
||||
// C++: Size HOGDescriptor::blockSize
|
||||
private static native double[] get_blockSize_0(long nativeObj);
|
||||
|
||||
// C++: Size HOGDescriptor::blockStride
|
||||
private static native double[] get_blockStride_0(long nativeObj);
|
||||
|
||||
// C++: Size HOGDescriptor::cellSize
|
||||
private static native double[] get_cellSize_0(long nativeObj);
|
||||
|
||||
// C++: int HOGDescriptor::nbins
|
||||
private static native int get_nbins_0(long nativeObj);
|
||||
|
||||
// C++: int HOGDescriptor::derivAperture
|
||||
private static native int get_derivAperture_0(long nativeObj);
|
||||
|
||||
// C++: double HOGDescriptor::winSigma
|
||||
private static native double get_winSigma_0(long nativeObj);
|
||||
|
||||
// C++: int HOGDescriptor::histogramNormType
|
||||
private static native int get_histogramNormType_0(long nativeObj);
|
||||
|
||||
// C++: double HOGDescriptor::L2HysThreshold
|
||||
private static native double get_L2HysThreshold_0(long nativeObj);
|
||||
|
||||
// C++: bool HOGDescriptor::gammaCorrection
|
||||
private static native boolean get_gammaCorrection_0(long nativeObj);
|
||||
|
||||
// C++: vector_float HOGDescriptor::svmDetector
|
||||
private static native long get_svmDetector_0(long nativeObj);
|
||||
|
||||
// C++: int HOGDescriptor::nlevels
|
||||
private static native int get_nlevels_0(long nativeObj);
|
||||
|
||||
// C++: bool HOGDescriptor::signedGradient
|
||||
private static native boolean get_signedGradient_0(long nativeObj);
|
||||
|
||||
// native support for java finalize()
|
||||
private static native void delete(long nativeObj);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// This file is auto-generated. Please don't modify it!
|
||||
//
|
||||
package org.opencv.objdetect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfInt;
|
||||
import org.opencv.core.MatOfRect;
|
||||
import org.opencv.utils.Converters;
|
||||
|
||||
// C++: class Objdetect
|
||||
//javadoc: Objdetect
|
||||
|
||||
public class Objdetect {
|
||||
|
||||
public static final int
|
||||
CASCADE_DO_CANNY_PRUNING = 1,
|
||||
CASCADE_SCALE_IMAGE = 2,
|
||||
CASCADE_FIND_BIGGEST_OBJECT = 4,
|
||||
CASCADE_DO_ROUGH_SEARCH = 8;
|
||||
|
||||
|
||||
//
|
||||
// C++: void groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2)
|
||||
//
|
||||
|
||||
//javadoc: groupRectangles(rectList, weights, groupThreshold, eps)
|
||||
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps)
|
||||
{
|
||||
Mat rectList_mat = rectList;
|
||||
Mat weights_mat = weights;
|
||||
groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//javadoc: groupRectangles(rectList, weights, groupThreshold)
|
||||
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
|
||||
{
|
||||
Mat rectList_mat = rectList;
|
||||
Mat weights_mat = weights;
|
||||
groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// C++: void groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2)
|
||||
private static native void groupRectangles_0(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold, double eps);
|
||||
private static native void groupRectangles_1(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.opencv.osgi;
|
||||
|
||||
/**
|
||||
* Dummy interface to allow some integration testing within OSGi implementation.
|
||||
*/
|
||||
public interface OpenCVInterface
|
||||
{
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user