123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
-
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UtilsModule;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace OpenCVForUnity.MlModule
- {
- // C++: class SVMSGD
- //javadoc: SVMSGD
- public class SVMSGD : 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_SVMSGD_delete(nativeObj);
- nativeObj = IntPtr.Zero;
- }
- } finally {
- base.Dispose (disposing);
- }
- #else
- return;
- #endif
- }
- protected internal SVMSGD (IntPtr addr) : base (addr) { }
- // internal usage only
- public static new SVMSGD __fromPtr__ (IntPtr addr) { return new SVMSGD (addr); }
- // C++: enum SvmsgdType
- public const int SGD = 0;
- public const int ASGD = 1;
- // C++: enum MarginType
- public const int SOFT_MARGIN = 0;
- public const int HARD_MARGIN = 1;
- //
- // C++: Mat cv::ml::SVMSGD::getWeights()
- //
- //javadoc: SVMSGD::getWeights()
- public Mat getWeights ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- Mat retVal = new Mat(ml_SVMSGD_getWeights_10(nativeObj));
-
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: static Ptr_SVMSGD cv::ml::SVMSGD::create()
- //
- //javadoc: SVMSGD::create()
- public static SVMSGD create ()
- {
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- SVMSGD retVal = SVMSGD.__fromPtr__(ml_SVMSGD_create_10());
-
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: static Ptr_SVMSGD cv::ml::SVMSGD::load(String filepath, String nodeName = String())
- //
- //javadoc: SVMSGD::load(filepath, nodeName)
- public static SVMSGD load (string filepath, string nodeName)
- {
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- SVMSGD retVal = SVMSGD.__fromPtr__(ml_SVMSGD_load_10(filepath, nodeName));
-
- return retVal;
- #else
- return null;
- #endif
- }
- //javadoc: SVMSGD::load(filepath)
- public static SVMSGD load (string filepath)
- {
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- SVMSGD retVal = SVMSGD.__fromPtr__(ml_SVMSGD_load_11(filepath));
-
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: TermCriteria cv::ml::SVMSGD::getTermCriteria()
- //
- //javadoc: SVMSGD::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_SVMSGD_getTermCriteria_10(nativeObj, tmpArray);
- TermCriteria retVal = new TermCriteria (tmpArray);
-
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: float cv::ml::SVMSGD::getInitialStepSize()
- //
- //javadoc: SVMSGD::getInitialStepSize()
- public float getInitialStepSize ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- float retVal = ml_SVMSGD_getInitialStepSize_10(nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: float cv::ml::SVMSGD::getMarginRegularization()
- //
- //javadoc: SVMSGD::getMarginRegularization()
- public float getMarginRegularization ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- float retVal = ml_SVMSGD_getMarginRegularization_10(nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: float cv::ml::SVMSGD::getShift()
- //
- //javadoc: SVMSGD::getShift()
- public float getShift ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- float retVal = ml_SVMSGD_getShift_10(nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: float cv::ml::SVMSGD::getStepDecreasingPower()
- //
- //javadoc: SVMSGD::getStepDecreasingPower()
- public float getStepDecreasingPower ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- float retVal = ml_SVMSGD_getStepDecreasingPower_10(nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: int cv::ml::SVMSGD::getMarginType()
- //
- //javadoc: SVMSGD::getMarginType()
- public int getMarginType ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- int retVal = ml_SVMSGD_getMarginType_10(nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: int cv::ml::SVMSGD::getSvmsgdType()
- //
- //javadoc: SVMSGD::getSvmsgdType()
- public int getSvmsgdType ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- int retVal = ml_SVMSGD_getSvmsgdType_10(nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: void cv::ml::SVMSGD::setInitialStepSize(float InitialStepSize)
- //
- //javadoc: SVMSGD::setInitialStepSize(InitialStepSize)
- public void setInitialStepSize (float InitialStepSize)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_SVMSGD_setInitialStepSize_10(nativeObj, InitialStepSize);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::SVMSGD::setMarginRegularization(float marginRegularization)
- //
- //javadoc: SVMSGD::setMarginRegularization(marginRegularization)
- public void setMarginRegularization (float marginRegularization)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_SVMSGD_setMarginRegularization_10(nativeObj, marginRegularization);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::SVMSGD::setMarginType(int marginType)
- //
- //javadoc: SVMSGD::setMarginType(marginType)
- public void setMarginType (int marginType)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_SVMSGD_setMarginType_10(nativeObj, marginType);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::SVMSGD::setOptimalParameters(int svmsgdType = SVMSGD::ASGD, int marginType = SVMSGD::SOFT_MARGIN)
- //
- //javadoc: SVMSGD::setOptimalParameters(svmsgdType, marginType)
- public void setOptimalParameters (int svmsgdType, int marginType)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_SVMSGD_setOptimalParameters_10(nativeObj, svmsgdType, marginType);
-
- return;
- #else
- return;
- #endif
- }
- //javadoc: SVMSGD::setOptimalParameters(svmsgdType)
- public void setOptimalParameters (int svmsgdType)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_SVMSGD_setOptimalParameters_11(nativeObj, svmsgdType);
-
- return;
- #else
- return;
- #endif
- }
- //javadoc: SVMSGD::setOptimalParameters()
- public void setOptimalParameters ()
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_SVMSGD_setOptimalParameters_12(nativeObj);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::SVMSGD::setStepDecreasingPower(float stepDecreasingPower)
- //
- //javadoc: SVMSGD::setStepDecreasingPower(stepDecreasingPower)
- public void setStepDecreasingPower (float stepDecreasingPower)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_SVMSGD_setStepDecreasingPower_10(nativeObj, stepDecreasingPower);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::SVMSGD::setSvmsgdType(int svmsgdType)
- //
- //javadoc: SVMSGD::setSvmsgdType(svmsgdType)
- public void setSvmsgdType (int svmsgdType)
- {
- ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- ml_SVMSGD_setSvmsgdType_10(nativeObj, svmsgdType);
-
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::ml::SVMSGD::setTermCriteria(TermCriteria val)
- //
- //javadoc: SVMSGD::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_SVMSGD_setTermCriteria_10(nativeObj, val.type, val.maxCount, val.epsilon);
-
- 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::SVMSGD::getWeights()
- [DllImport (LIBNAME)]
- private static extern IntPtr ml_SVMSGD_getWeights_10 (IntPtr nativeObj);
- // C++: static Ptr_SVMSGD cv::ml::SVMSGD::create()
- [DllImport (LIBNAME)]
- private static extern IntPtr ml_SVMSGD_create_10 ();
- // C++: static Ptr_SVMSGD cv::ml::SVMSGD::load(String filepath, String nodeName = String())
- [DllImport (LIBNAME)]
- private static extern IntPtr ml_SVMSGD_load_10 (string filepath, string nodeName);
- [DllImport (LIBNAME)]
- private static extern IntPtr ml_SVMSGD_load_11 (string filepath);
- // C++: TermCriteria cv::ml::SVMSGD::getTermCriteria()
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_getTermCriteria_10 (IntPtr nativeObj, double[] retVal);
- // C++: float cv::ml::SVMSGD::getInitialStepSize()
- [DllImport (LIBNAME)]
- private static extern float ml_SVMSGD_getInitialStepSize_10 (IntPtr nativeObj);
- // C++: float cv::ml::SVMSGD::getMarginRegularization()
- [DllImport (LIBNAME)]
- private static extern float ml_SVMSGD_getMarginRegularization_10 (IntPtr nativeObj);
- // C++: float cv::ml::SVMSGD::getShift()
- [DllImport (LIBNAME)]
- private static extern float ml_SVMSGD_getShift_10 (IntPtr nativeObj);
- // C++: float cv::ml::SVMSGD::getStepDecreasingPower()
- [DllImport (LIBNAME)]
- private static extern float ml_SVMSGD_getStepDecreasingPower_10 (IntPtr nativeObj);
- // C++: int cv::ml::SVMSGD::getMarginType()
- [DllImport (LIBNAME)]
- private static extern int ml_SVMSGD_getMarginType_10 (IntPtr nativeObj);
- // C++: int cv::ml::SVMSGD::getSvmsgdType()
- [DllImport (LIBNAME)]
- private static extern int ml_SVMSGD_getSvmsgdType_10 (IntPtr nativeObj);
- // C++: void cv::ml::SVMSGD::setInitialStepSize(float InitialStepSize)
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_setInitialStepSize_10 (IntPtr nativeObj, float InitialStepSize);
- // C++: void cv::ml::SVMSGD::setMarginRegularization(float marginRegularization)
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_setMarginRegularization_10 (IntPtr nativeObj, float marginRegularization);
- // C++: void cv::ml::SVMSGD::setMarginType(int marginType)
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_setMarginType_10 (IntPtr nativeObj, int marginType);
- // C++: void cv::ml::SVMSGD::setOptimalParameters(int svmsgdType = SVMSGD::ASGD, int marginType = SVMSGD::SOFT_MARGIN)
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_setOptimalParameters_10 (IntPtr nativeObj, int svmsgdType, int marginType);
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_setOptimalParameters_11 (IntPtr nativeObj, int svmsgdType);
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_setOptimalParameters_12 (IntPtr nativeObj);
- // C++: void cv::ml::SVMSGD::setStepDecreasingPower(float stepDecreasingPower)
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_setStepDecreasingPower_10 (IntPtr nativeObj, float stepDecreasingPower);
- // C++: void cv::ml::SVMSGD::setSvmsgdType(int svmsgdType)
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_setSvmsgdType_10 (IntPtr nativeObj, int svmsgdType);
- // C++: void cv::ml::SVMSGD::setTermCriteria(TermCriteria val)
- [DllImport (LIBNAME)]
- private static extern void ml_SVMSGD_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_SVMSGD_delete (IntPtr nativeObj);
- }
- }
|