123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
-
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UtilsModule;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace OpenCVForUnity.MlModule
- {
- // C++: class LogisticRegression
- //javadoc: LogisticRegression
- public class LogisticRegression : StatModel
- {
- protected override void Dispose (bool disposing)
- {
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
- try {
- if (disposing) {
- }
- if (IsEnabledDispose) {
- if (nativeObj != IntPtr.Zero)
- ml_LogisticRegression_delete (nativeObj);
- nativeObj = IntPtr.Zero;
- }
- } finally {
- base.Dispose (disposing);
- }
- #else
- return;
- #endif
- }
- protected internal LogisticRegression (IntPtr addr)
- : base (addr)
- {
- }
- // internal usage only
- public static new LogisticRegression __fromPtr__ (IntPtr addr)
- {
- return new LogisticRegression (addr);
- }
- // C++: enum RegKinds
- public const int REG_DISABLE = -1;
- public const int REG_L1 = 0;
- public const int REG_L2 = 1;
- // C++: enum Methods
- public const int BATCH = 0;
- public const int MINI_BATCH = 1;
- //
- // C++: Mat cv::ml::LogisticRegression::get_learnt_thetas()
- //
- //javadoc: LogisticRegression::get_learnt_thetas()
- public Mat get_learnt_thetas ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- Mat retVal = new Mat (ml_LogisticRegression_get_1learnt_1thetas_10 (nativeObj));
-
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: static Ptr_LogisticRegression cv::ml::LogisticRegression::create()
- //
- //javadoc: LogisticRegression::create()
- public static LogisticRegression create ()
- {
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- LogisticRegression retVal = LogisticRegression.__fromPtr__ (ml_LogisticRegression_create_10 ());
-
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: static Ptr_LogisticRegression cv::ml::LogisticRegression::load(String filepath, String nodeName = String())
- //
- //javadoc: LogisticRegression::load(filepath, nodeName)
- public static LogisticRegression load (string filepath, string nodeName)
- {
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- LogisticRegression retVal = LogisticRegression.__fromPtr__ (ml_LogisticRegression_load_10 (filepath, nodeName));
-
- return retVal;
- #else
- return null;
- #endif
- }
- //javadoc: LogisticRegression::load(filepath)
- public static LogisticRegression load (string filepath)
- {
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- LogisticRegression retVal = LogisticRegression.__fromPtr__ (ml_LogisticRegression_load_11 (filepath));
-
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: TermCriteria cv::ml::LogisticRegression::getTermCriteria()
- //
- //javadoc: LogisticRegression::getTermCriteria()
- public TermCriteria getTermCriteria ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- double[] tmpArray = new double[3];
- ml_LogisticRegression_getTermCriteria_10 (nativeObj, tmpArray);
- TermCriteria retVal = new TermCriteria (tmpArray);
-
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: double cv::ml::LogisticRegression::getLearningRate()
- //
- //javadoc: LogisticRegression::getLearningRate()
- public double getLearningRate ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- double retVal = ml_LogisticRegression_getLearningRate_10 (nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: float cv::ml::LogisticRegression::predict(Mat samples, Mat& results = Mat(), int flags = 0)
- //
- //javadoc: LogisticRegression::predict(samples, results, flags)
- public override float predict (Mat samples, Mat results, int flags)
- {
- ThrowIfDisposed ();
- if (samples != null)
- samples.ThrowIfDisposed ();
- if (results != null)
- results.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- float retVal = ml_LogisticRegression_predict_10 (nativeObj, samples.nativeObj, results.nativeObj, flags);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //javadoc: LogisticRegression::predict(samples, results)
- public override float predict (Mat samples, Mat results)
- {
- ThrowIfDisposed ();
- if (samples != null)
- samples.ThrowIfDisposed ();
- if (results != null)
- results.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- float retVal = ml_LogisticRegression_predict_11 (nativeObj, samples.nativeObj, results.nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //javadoc: LogisticRegression::predict(samples)
- public override float predict (Mat samples)
- {
- ThrowIfDisposed ();
- if (samples != null)
- samples.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- float retVal = ml_LogisticRegression_predict_12 (nativeObj, samples.nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: int cv::ml::LogisticRegression::getIterations()
- //
- //javadoc: LogisticRegression::getIterations()
- public int getIterations ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- int retVal = ml_LogisticRegression_getIterations_10 (nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: int cv::ml::LogisticRegression::getMiniBatchSize()
- //
- //javadoc: LogisticRegression::getMiniBatchSize()
- public int getMiniBatchSize ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- int retVal = ml_LogisticRegression_getMiniBatchSize_10 (nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: int cv::ml::LogisticRegression::getRegularization()
- //
- //javadoc: LogisticRegression::getRegularization()
- public int getRegularization ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- int retVal = ml_LogisticRegression_getRegularization_10 (nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: int cv::ml::LogisticRegression::getTrainMethod()
- //
- //javadoc: LogisticRegression::getTrainMethod()
- public int getTrainMethod ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- int retVal = ml_LogisticRegression_getTrainMethod_10 (nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: void cv::ml::LogisticRegression::setIterations(int val)
- //
- //javadoc: LogisticRegression::setIterations(val)
- public void setIterations (int val)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_LogisticRegression_setIterations_10 (nativeObj, val);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::LogisticRegression::setLearningRate(double val)
- //
- //javadoc: LogisticRegression::setLearningRate(val)
- public void setLearningRate (double val)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_LogisticRegression_setLearningRate_10 (nativeObj, val);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::LogisticRegression::setMiniBatchSize(int val)
- //
- //javadoc: LogisticRegression::setMiniBatchSize(val)
- public void setMiniBatchSize (int val)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_LogisticRegression_setMiniBatchSize_10 (nativeObj, val);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::LogisticRegression::setRegularization(int val)
- //
- //javadoc: LogisticRegression::setRegularization(val)
- public void setRegularization (int val)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_LogisticRegression_setRegularization_10 (nativeObj, val);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::LogisticRegression::setTermCriteria(TermCriteria val)
- //
- //javadoc: LogisticRegression::setTermCriteria(val)
- public void setTermCriteria (TermCriteria val)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_LogisticRegression_setTermCriteria_10 (nativeObj, val.type, val.maxCount, val.epsilon);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::LogisticRegression::setTrainMethod(int val)
- //
- //javadoc: LogisticRegression::setTrainMethod(val)
- public void setTrainMethod (int val)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_LogisticRegression_setTrainMethod_10 (nativeObj, val);
-
- return;
- #else
- return;
- #endif
- }
- #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
- const string LIBNAME = "__Internal";
-
- #else
- const string LIBNAME = "opencvforunity";
- #endif
- // C++: Mat cv::ml::LogisticRegression::get_learnt_thetas()
- [DllImport (LIBNAME)]
- private static extern IntPtr ml_LogisticRegression_get_1learnt_1thetas_10 (IntPtr nativeObj);
- // C++: static Ptr_LogisticRegression cv::ml::LogisticRegression::create()
- [DllImport (LIBNAME)]
- private static extern IntPtr ml_LogisticRegression_create_10 ();
- // C++: static Ptr_LogisticRegression cv::ml::LogisticRegression::load(String filepath, String nodeName = String())
- [DllImport (LIBNAME)]
- private static extern IntPtr ml_LogisticRegression_load_10 (string filepath, string nodeName);
- [DllImport (LIBNAME)]
- private static extern IntPtr ml_LogisticRegression_load_11 (string filepath);
- // C++: TermCriteria cv::ml::LogisticRegression::getTermCriteria()
- [DllImport (LIBNAME)]
- private static extern void ml_LogisticRegression_getTermCriteria_10 (IntPtr nativeObj, double[] retVal);
- // C++: double cv::ml::LogisticRegression::getLearningRate()
- [DllImport (LIBNAME)]
- private static extern double ml_LogisticRegression_getLearningRate_10 (IntPtr nativeObj);
- // C++: float cv::ml::LogisticRegression::predict(Mat samples, Mat& results = Mat(), int flags = 0)
- [DllImport (LIBNAME)]
- private static extern float ml_LogisticRegression_predict_10 (IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr results_nativeObj, int flags);
- [DllImport (LIBNAME)]
- private static extern float ml_LogisticRegression_predict_11 (IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr results_nativeObj);
- [DllImport (LIBNAME)]
- private static extern float ml_LogisticRegression_predict_12 (IntPtr nativeObj, IntPtr samples_nativeObj);
- // C++: int cv::ml::LogisticRegression::getIterations()
- [DllImport (LIBNAME)]
- private static extern int ml_LogisticRegression_getIterations_10 (IntPtr nativeObj);
- // C++: int cv::ml::LogisticRegression::getMiniBatchSize()
- [DllImport (LIBNAME)]
- private static extern int ml_LogisticRegression_getMiniBatchSize_10 (IntPtr nativeObj);
- // C++: int cv::ml::LogisticRegression::getRegularization()
- [DllImport (LIBNAME)]
- private static extern int ml_LogisticRegression_getRegularization_10 (IntPtr nativeObj);
- // C++: int cv::ml::LogisticRegression::getTrainMethod()
- [DllImport (LIBNAME)]
- private static extern int ml_LogisticRegression_getTrainMethod_10 (IntPtr nativeObj);
- // C++: void cv::ml::LogisticRegression::setIterations(int val)
- [DllImport (LIBNAME)]
- private static extern void ml_LogisticRegression_setIterations_10 (IntPtr nativeObj, int val);
- // C++: void cv::ml::LogisticRegression::setLearningRate(double val)
- [DllImport (LIBNAME)]
- private static extern void ml_LogisticRegression_setLearningRate_10 (IntPtr nativeObj, double val);
- // C++: void cv::ml::LogisticRegression::setMiniBatchSize(int val)
- [DllImport (LIBNAME)]
- private static extern void ml_LogisticRegression_setMiniBatchSize_10 (IntPtr nativeObj, int val);
- // C++: void cv::ml::LogisticRegression::setRegularization(int val)
- [DllImport (LIBNAME)]
- private static extern void ml_LogisticRegression_setRegularization_10 (IntPtr nativeObj, int val);
- // C++: void cv::ml::LogisticRegression::setTermCriteria(TermCriteria val)
- [DllImport (LIBNAME)]
- private static extern void ml_LogisticRegression_setTermCriteria_10 (IntPtr nativeObj, int val_type, int val_maxCount, double val_epsilon);
- // C++: void cv::ml::LogisticRegression::setTrainMethod(int val)
- [DllImport (LIBNAME)]
- private static extern void ml_LogisticRegression_setTrainMethod_10 (IntPtr nativeObj, int val);
- // native support for java finalize()
- [DllImport (LIBNAME)]
- private static extern void ml_LogisticRegression_delete (IntPtr nativeObj);
- }
- }
|