123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
-
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UtilsModule;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace OpenCVForUnity.MlModule {
- // C++: class RTrees
- //javadoc: RTrees
- public class RTrees : DTrees {
- protected override void Dispose(bool disposing) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- try {
- if (disposing) {
- }
- if (IsEnabledDispose) {
- if (nativeObj != IntPtr.Zero)
- ml_RTrees_delete(nativeObj);
- nativeObj = IntPtr.Zero;
- }
- } finally {
- base.Dispose(disposing);
- }
- #else
- return;
- #endif
- }
- protected internal RTrees(IntPtr addr)
- : base(addr) {
- }
- // internal usage only
- public static new RTrees __fromPtr__(IntPtr addr) {
- return new RTrees(addr);
- }
- //
- // C++: Mat cv::ml::RTrees::getVarImportance()
- //
- //javadoc: RTrees::getVarImportance()
- public Mat getVarImportance() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- Mat retVal = new Mat(ml_RTrees_getVarImportance_10(nativeObj));
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: static Ptr_RTrees cv::ml::RTrees::create()
- //
- //javadoc: RTrees::create()
- public static new RTrees create() {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- RTrees retVal = RTrees.__fromPtr__(ml_RTrees_create_10());
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: static Ptr_RTrees cv::ml::RTrees::load(String filepath, String nodeName = String())
- //
- //javadoc: RTrees::load(filepath, nodeName)
- public static new RTrees load(string filepath, string nodeName) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- RTrees retVal = RTrees.__fromPtr__(ml_RTrees_load_10(filepath, nodeName));
- return retVal;
- #else
- return null;
- #endif
- }
- //javadoc: RTrees::load(filepath)
- public static new RTrees load(string filepath) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- RTrees retVal = RTrees.__fromPtr__(ml_RTrees_load_11(filepath));
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: TermCriteria cv::ml::RTrees::getTermCriteria()
- //
- //javadoc: RTrees::getTermCriteria()
- public TermCriteria getTermCriteria() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- double[] tmpArray = new double[3];
- ml_RTrees_getTermCriteria_10(nativeObj, tmpArray);
- TermCriteria retVal = new TermCriteria(tmpArray);
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: bool cv::ml::RTrees::getCalculateVarImportance()
- //
- //javadoc: RTrees::getCalculateVarImportance()
- public bool getCalculateVarImportance() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = ml_RTrees_getCalculateVarImportance_10(nativeObj);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: int cv::ml::RTrees::getActiveVarCount()
- //
- //javadoc: RTrees::getActiveVarCount()
- public int getActiveVarCount() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- int retVal = ml_RTrees_getActiveVarCount_10(nativeObj);
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: void cv::ml::RTrees::getVotes(Mat samples, Mat& results, int flags)
- //
- //javadoc: RTrees::getVotes(samples, results, flags)
- public void getVotes(Mat samples, Mat results, int flags) {
- ThrowIfDisposed();
- if (samples != null)
- samples.ThrowIfDisposed();
- if (results != null)
- results.ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- ml_RTrees_getVotes_10(nativeObj, samples.nativeObj, results.nativeObj, flags);
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::RTrees::setActiveVarCount(int val)
- //
- //javadoc: RTrees::setActiveVarCount(val)
- public void setActiveVarCount(int val) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- ml_RTrees_setActiveVarCount_10(nativeObj, val);
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::RTrees::setCalculateVarImportance(bool val)
- //
- //javadoc: RTrees::setCalculateVarImportance(val)
- public void setCalculateVarImportance(bool val) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- ml_RTrees_setCalculateVarImportance_10(nativeObj, val);
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::RTrees::setTermCriteria(TermCriteria val)
- //
- //javadoc: RTrees::setTermCriteria(val)
- public void setTermCriteria(TermCriteria val) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- ml_RTrees_setTermCriteria_10(nativeObj, val.type, val.maxCount, val.epsilon);
- return;
- #else
- return;
- #endif
- }
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- const string LIBNAME = "opencvforunity";
- // C++: Mat cv::ml::RTrees::getVarImportance()
- [DllImport(LIBNAME)]
- private static extern IntPtr ml_RTrees_getVarImportance_10(IntPtr nativeObj);
- // C++: static Ptr_RTrees cv::ml::RTrees::create()
- [DllImport(LIBNAME)]
- private static extern IntPtr ml_RTrees_create_10();
- // C++: static Ptr_RTrees cv::ml::RTrees::load(String filepath, String nodeName = String())
- [DllImport(LIBNAME)]
- private static extern IntPtr ml_RTrees_load_10(string filepath, string nodeName);
- [DllImport(LIBNAME)]
- private static extern IntPtr ml_RTrees_load_11(string filepath);
- // C++: TermCriteria cv::ml::RTrees::getTermCriteria()
- [DllImport(LIBNAME)]
- private static extern void ml_RTrees_getTermCriteria_10(IntPtr nativeObj, double[] retVal);
- // C++: bool cv::ml::RTrees::getCalculateVarImportance()
- [DllImport(LIBNAME)]
- private static extern bool ml_RTrees_getCalculateVarImportance_10(IntPtr nativeObj);
- // C++: int cv::ml::RTrees::getActiveVarCount()
- [DllImport(LIBNAME)]
- private static extern int ml_RTrees_getActiveVarCount_10(IntPtr nativeObj);
- // C++: void cv::ml::RTrees::getVotes(Mat samples, Mat& results, int flags)
- [DllImport(LIBNAME)]
- private static extern void ml_RTrees_getVotes_10(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr results_nativeObj, int flags);
- // C++: void cv::ml::RTrees::setActiveVarCount(int val)
- [DllImport(LIBNAME)]
- private static extern void ml_RTrees_setActiveVarCount_10(IntPtr nativeObj, int val);
- // C++: void cv::ml::RTrees::setCalculateVarImportance(bool val)
- [DllImport(LIBNAME)]
- private static extern void ml_RTrees_setCalculateVarImportance_10(IntPtr nativeObj, bool val);
- // C++: void cv::ml::RTrees::setTermCriteria(TermCriteria val)
- [DllImport(LIBNAME)]
- private static extern void ml_RTrees_setTermCriteria_10(IntPtr nativeObj, int val_type, int val_maxCount, double val_epsilon);
- // native support for java finalize()
- [DllImport(LIBNAME)]
- private static extern void ml_RTrees_delete(IntPtr nativeObj);
- #endif
- }
- }
|