EM.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. 
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.MlModule {
  8. // C++: class EM
  9. //javadoc: EM
  10. public class EM : StatModel {
  11. protected override void Dispose(bool disposing) {
  12. #if (UNITY_ANDROID && !UNITY_EDITOR)
  13. try {
  14. if (disposing) {
  15. }
  16. if (IsEnabledDispose) {
  17. if (nativeObj != IntPtr.Zero)
  18. ml_EM_delete(nativeObj);
  19. nativeObj = IntPtr.Zero;
  20. }
  21. } finally {
  22. base.Dispose(disposing);
  23. }
  24. #else
  25. return;
  26. #endif
  27. }
  28. protected internal EM(IntPtr addr)
  29. : base(addr) {
  30. }
  31. // internal usage only
  32. public static new EM __fromPtr__(IntPtr addr) {
  33. return new EM(addr);
  34. }
  35. // C++: enum Types
  36. public const int COV_MAT_SPHERICAL = 0;
  37. public const int COV_MAT_DIAGONAL = 1;
  38. public const int COV_MAT_GENERIC = 2;
  39. public const int COV_MAT_DEFAULT = COV_MAT_DIAGONAL;
  40. // C++: enum <unnamed>
  41. public const int DEFAULT_NCLUSTERS = 5;
  42. public const int DEFAULT_MAX_ITERS = 100;
  43. public const int START_E_STEP = 1;
  44. public const int START_M_STEP = 2;
  45. public const int START_AUTO_STEP = 0;
  46. //
  47. // C++: Mat cv::ml::EM::getMeans()
  48. //
  49. //javadoc: EM::getMeans()
  50. public Mat getMeans() {
  51. ThrowIfDisposed();
  52. #if (UNITY_ANDROID && !UNITY_EDITOR)
  53. Mat retVal = new Mat(ml_EM_getMeans_10(nativeObj));
  54. return retVal;
  55. #else
  56. return null;
  57. #endif
  58. }
  59. //
  60. // C++: Mat cv::ml::EM::getWeights()
  61. //
  62. //javadoc: EM::getWeights()
  63. public Mat getWeights() {
  64. ThrowIfDisposed();
  65. #if (UNITY_ANDROID && !UNITY_EDITOR)
  66. Mat retVal = new Mat(ml_EM_getWeights_10(nativeObj));
  67. return retVal;
  68. #else
  69. return null;
  70. #endif
  71. }
  72. //
  73. // C++: static Ptr_EM cv::ml::EM::create()
  74. //
  75. //javadoc: EM::create()
  76. public static EM create() {
  77. #if (UNITY_ANDROID && !UNITY_EDITOR)
  78. EM retVal = EM.__fromPtr__(ml_EM_create_10());
  79. return retVal;
  80. #else
  81. return null;
  82. #endif
  83. }
  84. //
  85. // C++: static Ptr_EM cv::ml::EM::load(String filepath, String nodeName = String())
  86. //
  87. //javadoc: EM::load(filepath, nodeName)
  88. public static EM load(string filepath, string nodeName) {
  89. #if (UNITY_ANDROID && !UNITY_EDITOR)
  90. EM retVal = EM.__fromPtr__(ml_EM_load_10(filepath, nodeName));
  91. return retVal;
  92. #else
  93. return null;
  94. #endif
  95. }
  96. //javadoc: EM::load(filepath)
  97. public static EM load(string filepath) {
  98. #if (UNITY_ANDROID && !UNITY_EDITOR)
  99. EM retVal = EM.__fromPtr__(ml_EM_load_11(filepath));
  100. return retVal;
  101. #else
  102. return null;
  103. #endif
  104. }
  105. //
  106. // C++: TermCriteria cv::ml::EM::getTermCriteria()
  107. //
  108. //javadoc: EM::getTermCriteria()
  109. public TermCriteria getTermCriteria() {
  110. ThrowIfDisposed();
  111. #if (UNITY_ANDROID && !UNITY_EDITOR)
  112. double[] tmpArray = new double[3];
  113. ml_EM_getTermCriteria_10(nativeObj, tmpArray);
  114. TermCriteria retVal = new TermCriteria(tmpArray);
  115. return retVal;
  116. #else
  117. return null;
  118. #endif
  119. }
  120. //
  121. // C++: Vec2d cv::ml::EM::predict2(Mat sample, Mat& probs)
  122. //
  123. //javadoc: EM::predict2(sample, probs)
  124. public double[] predict2(Mat sample, Mat probs) {
  125. ThrowIfDisposed();
  126. if (sample != null)
  127. sample.ThrowIfDisposed();
  128. if (probs != null)
  129. probs.ThrowIfDisposed();
  130. #if (UNITY_ANDROID && !UNITY_EDITOR)
  131. double[] retVal = new double[2];
  132. ml_EM_predict2_10(nativeObj, sample.nativeObj, probs.nativeObj, retVal);
  133. return retVal;
  134. #else
  135. return null;
  136. #endif
  137. }
  138. //
  139. // C++: bool cv::ml::EM::trainE(Mat samples, Mat means0, Mat covs0 = Mat(), Mat weights0 = Mat(), Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
  140. //
  141. //javadoc: EM::trainE(samples, means0, covs0, weights0, logLikelihoods, labels, probs)
  142. public bool trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels, Mat probs) {
  143. ThrowIfDisposed();
  144. if (samples != null)
  145. samples.ThrowIfDisposed();
  146. if (means0 != null)
  147. means0.ThrowIfDisposed();
  148. if (covs0 != null)
  149. covs0.ThrowIfDisposed();
  150. if (weights0 != null)
  151. weights0.ThrowIfDisposed();
  152. if (logLikelihoods != null)
  153. logLikelihoods.ThrowIfDisposed();
  154. if (labels != null)
  155. labels.ThrowIfDisposed();
  156. if (probs != null)
  157. probs.ThrowIfDisposed();
  158. #if (UNITY_ANDROID && !UNITY_EDITOR)
  159. bool retVal = ml_EM_trainE_10(nativeObj, samples.nativeObj, means0.nativeObj, covs0.nativeObj, weights0.nativeObj, logLikelihoods.nativeObj, labels.nativeObj, probs.nativeObj);
  160. return retVal;
  161. #else
  162. return false;
  163. #endif
  164. }
  165. //javadoc: EM::trainE(samples, means0, covs0, weights0, logLikelihoods, labels)
  166. public bool trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels) {
  167. ThrowIfDisposed();
  168. if (samples != null)
  169. samples.ThrowIfDisposed();
  170. if (means0 != null)
  171. means0.ThrowIfDisposed();
  172. if (covs0 != null)
  173. covs0.ThrowIfDisposed();
  174. if (weights0 != null)
  175. weights0.ThrowIfDisposed();
  176. if (logLikelihoods != null)
  177. logLikelihoods.ThrowIfDisposed();
  178. if (labels != null)
  179. labels.ThrowIfDisposed();
  180. #if (UNITY_ANDROID && !UNITY_EDITOR)
  181. bool retVal = ml_EM_trainE_11(nativeObj, samples.nativeObj, means0.nativeObj, covs0.nativeObj, weights0.nativeObj, logLikelihoods.nativeObj, labels.nativeObj);
  182. return retVal;
  183. #else
  184. return false;
  185. #endif
  186. }
  187. //javadoc: EM::trainE(samples, means0, covs0, weights0, logLikelihoods)
  188. public bool trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods) {
  189. ThrowIfDisposed();
  190. if (samples != null)
  191. samples.ThrowIfDisposed();
  192. if (means0 != null)
  193. means0.ThrowIfDisposed();
  194. if (covs0 != null)
  195. covs0.ThrowIfDisposed();
  196. if (weights0 != null)
  197. weights0.ThrowIfDisposed();
  198. if (logLikelihoods != null)
  199. logLikelihoods.ThrowIfDisposed();
  200. #if (UNITY_ANDROID && !UNITY_EDITOR)
  201. bool retVal = ml_EM_trainE_12(nativeObj, samples.nativeObj, means0.nativeObj, covs0.nativeObj, weights0.nativeObj, logLikelihoods.nativeObj);
  202. return retVal;
  203. #else
  204. return false;
  205. #endif
  206. }
  207. //javadoc: EM::trainE(samples, means0, covs0, weights0)
  208. public bool trainE(Mat samples, Mat means0, Mat covs0, Mat weights0) {
  209. ThrowIfDisposed();
  210. if (samples != null)
  211. samples.ThrowIfDisposed();
  212. if (means0 != null)
  213. means0.ThrowIfDisposed();
  214. if (covs0 != null)
  215. covs0.ThrowIfDisposed();
  216. if (weights0 != null)
  217. weights0.ThrowIfDisposed();
  218. #if (UNITY_ANDROID && !UNITY_EDITOR)
  219. bool retVal = ml_EM_trainE_13(nativeObj, samples.nativeObj, means0.nativeObj, covs0.nativeObj, weights0.nativeObj);
  220. return retVal;
  221. #else
  222. return false;
  223. #endif
  224. }
  225. //javadoc: EM::trainE(samples, means0, covs0)
  226. public bool trainE(Mat samples, Mat means0, Mat covs0) {
  227. ThrowIfDisposed();
  228. if (samples != null)
  229. samples.ThrowIfDisposed();
  230. if (means0 != null)
  231. means0.ThrowIfDisposed();
  232. if (covs0 != null)
  233. covs0.ThrowIfDisposed();
  234. #if (UNITY_ANDROID && !UNITY_EDITOR)
  235. bool retVal = ml_EM_trainE_14(nativeObj, samples.nativeObj, means0.nativeObj, covs0.nativeObj);
  236. return retVal;
  237. #else
  238. return false;
  239. #endif
  240. }
  241. //javadoc: EM::trainE(samples, means0)
  242. public bool trainE(Mat samples, Mat means0) {
  243. ThrowIfDisposed();
  244. if (samples != null)
  245. samples.ThrowIfDisposed();
  246. if (means0 != null)
  247. means0.ThrowIfDisposed();
  248. #if (UNITY_ANDROID && !UNITY_EDITOR)
  249. bool retVal = ml_EM_trainE_15(nativeObj, samples.nativeObj, means0.nativeObj);
  250. return retVal;
  251. #else
  252. return false;
  253. #endif
  254. }
  255. //
  256. // C++: bool cv::ml::EM::trainEM(Mat samples, Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
  257. //
  258. //javadoc: EM::trainEM(samples, logLikelihoods, labels, probs)
  259. public bool trainEM(Mat samples, Mat logLikelihoods, Mat labels, Mat probs) {
  260. ThrowIfDisposed();
  261. if (samples != null)
  262. samples.ThrowIfDisposed();
  263. if (logLikelihoods != null)
  264. logLikelihoods.ThrowIfDisposed();
  265. if (labels != null)
  266. labels.ThrowIfDisposed();
  267. if (probs != null)
  268. probs.ThrowIfDisposed();
  269. #if (UNITY_ANDROID && !UNITY_EDITOR)
  270. bool retVal = ml_EM_trainEM_10(nativeObj, samples.nativeObj, logLikelihoods.nativeObj, labels.nativeObj, probs.nativeObj);
  271. return retVal;
  272. #else
  273. return false;
  274. #endif
  275. }
  276. //javadoc: EM::trainEM(samples, logLikelihoods, labels)
  277. public bool trainEM(Mat samples, Mat logLikelihoods, Mat labels) {
  278. ThrowIfDisposed();
  279. if (samples != null)
  280. samples.ThrowIfDisposed();
  281. if (logLikelihoods != null)
  282. logLikelihoods.ThrowIfDisposed();
  283. if (labels != null)
  284. labels.ThrowIfDisposed();
  285. #if (UNITY_ANDROID && !UNITY_EDITOR)
  286. bool retVal = ml_EM_trainEM_11(nativeObj, samples.nativeObj, logLikelihoods.nativeObj, labels.nativeObj);
  287. return retVal;
  288. #else
  289. return false;
  290. #endif
  291. }
  292. //javadoc: EM::trainEM(samples, logLikelihoods)
  293. public bool trainEM(Mat samples, Mat logLikelihoods) {
  294. ThrowIfDisposed();
  295. if (samples != null)
  296. samples.ThrowIfDisposed();
  297. if (logLikelihoods != null)
  298. logLikelihoods.ThrowIfDisposed();
  299. #if (UNITY_ANDROID && !UNITY_EDITOR)
  300. bool retVal = ml_EM_trainEM_12(nativeObj, samples.nativeObj, logLikelihoods.nativeObj);
  301. return retVal;
  302. #else
  303. return false;
  304. #endif
  305. }
  306. //javadoc: EM::trainEM(samples)
  307. public bool trainEM(Mat samples) {
  308. ThrowIfDisposed();
  309. if (samples != null)
  310. samples.ThrowIfDisposed();
  311. #if (UNITY_ANDROID && !UNITY_EDITOR)
  312. bool retVal = ml_EM_trainEM_13(nativeObj, samples.nativeObj);
  313. return retVal;
  314. #else
  315. return false;
  316. #endif
  317. }
  318. //
  319. // C++: bool cv::ml::EM::trainM(Mat samples, Mat probs0, Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
  320. //
  321. //javadoc: EM::trainM(samples, probs0, logLikelihoods, labels, probs)
  322. public bool trainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels, Mat probs) {
  323. ThrowIfDisposed();
  324. if (samples != null)
  325. samples.ThrowIfDisposed();
  326. if (probs0 != null)
  327. probs0.ThrowIfDisposed();
  328. if (logLikelihoods != null)
  329. logLikelihoods.ThrowIfDisposed();
  330. if (labels != null)
  331. labels.ThrowIfDisposed();
  332. if (probs != null)
  333. probs.ThrowIfDisposed();
  334. #if (UNITY_ANDROID && !UNITY_EDITOR)
  335. bool retVal = ml_EM_trainM_10(nativeObj, samples.nativeObj, probs0.nativeObj, logLikelihoods.nativeObj, labels.nativeObj, probs.nativeObj);
  336. return retVal;
  337. #else
  338. return false;
  339. #endif
  340. }
  341. //javadoc: EM::trainM(samples, probs0, logLikelihoods, labels)
  342. public bool trainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels) {
  343. ThrowIfDisposed();
  344. if (samples != null)
  345. samples.ThrowIfDisposed();
  346. if (probs0 != null)
  347. probs0.ThrowIfDisposed();
  348. if (logLikelihoods != null)
  349. logLikelihoods.ThrowIfDisposed();
  350. if (labels != null)
  351. labels.ThrowIfDisposed();
  352. #if (UNITY_ANDROID && !UNITY_EDITOR)
  353. bool retVal = ml_EM_trainM_11(nativeObj, samples.nativeObj, probs0.nativeObj, logLikelihoods.nativeObj, labels.nativeObj);
  354. return retVal;
  355. #else
  356. return false;
  357. #endif
  358. }
  359. //javadoc: EM::trainM(samples, probs0, logLikelihoods)
  360. public bool trainM(Mat samples, Mat probs0, Mat logLikelihoods) {
  361. ThrowIfDisposed();
  362. if (samples != null)
  363. samples.ThrowIfDisposed();
  364. if (probs0 != null)
  365. probs0.ThrowIfDisposed();
  366. if (logLikelihoods != null)
  367. logLikelihoods.ThrowIfDisposed();
  368. #if (UNITY_ANDROID && !UNITY_EDITOR)
  369. bool retVal = ml_EM_trainM_12(nativeObj, samples.nativeObj, probs0.nativeObj, logLikelihoods.nativeObj);
  370. return retVal;
  371. #else
  372. return false;
  373. #endif
  374. }
  375. //javadoc: EM::trainM(samples, probs0)
  376. public bool trainM(Mat samples, Mat probs0) {
  377. ThrowIfDisposed();
  378. if (samples != null)
  379. samples.ThrowIfDisposed();
  380. if (probs0 != null)
  381. probs0.ThrowIfDisposed();
  382. #if (UNITY_ANDROID && !UNITY_EDITOR)
  383. bool retVal = ml_EM_trainM_13(nativeObj, samples.nativeObj, probs0.nativeObj);
  384. return retVal;
  385. #else
  386. return false;
  387. #endif
  388. }
  389. //
  390. // C++: float cv::ml::EM::predict(Mat samples, Mat& results = Mat(), int flags = 0)
  391. //
  392. //javadoc: EM::predict(samples, results, flags)
  393. public override float predict(Mat samples, Mat results, int flags) {
  394. ThrowIfDisposed();
  395. if (samples != null)
  396. samples.ThrowIfDisposed();
  397. if (results != null)
  398. results.ThrowIfDisposed();
  399. #if (UNITY_ANDROID && !UNITY_EDITOR)
  400. float retVal = ml_EM_predict_10(nativeObj, samples.nativeObj, results.nativeObj, flags);
  401. return retVal;
  402. #else
  403. return -1;
  404. #endif
  405. }
  406. //javadoc: EM::predict(samples, results)
  407. public override float predict(Mat samples, Mat results) {
  408. ThrowIfDisposed();
  409. if (samples != null)
  410. samples.ThrowIfDisposed();
  411. if (results != null)
  412. results.ThrowIfDisposed();
  413. #if (UNITY_ANDROID && !UNITY_EDITOR)
  414. float retVal = ml_EM_predict_11(nativeObj, samples.nativeObj, results.nativeObj);
  415. return retVal;
  416. #else
  417. return -1;
  418. #endif
  419. }
  420. //javadoc: EM::predict(samples)
  421. public override float predict(Mat samples) {
  422. ThrowIfDisposed();
  423. if (samples != null)
  424. samples.ThrowIfDisposed();
  425. #if (UNITY_ANDROID && !UNITY_EDITOR)
  426. float retVal = ml_EM_predict_12(nativeObj, samples.nativeObj);
  427. return retVal;
  428. #else
  429. return -1;
  430. #endif
  431. }
  432. //
  433. // C++: int cv::ml::EM::getClustersNumber()
  434. //
  435. //javadoc: EM::getClustersNumber()
  436. public int getClustersNumber() {
  437. ThrowIfDisposed();
  438. #if (UNITY_ANDROID && !UNITY_EDITOR)
  439. int retVal = ml_EM_getClustersNumber_10(nativeObj);
  440. return retVal;
  441. #else
  442. return -1;
  443. #endif
  444. }
  445. //
  446. // C++: int cv::ml::EM::getCovarianceMatrixType()
  447. //
  448. //javadoc: EM::getCovarianceMatrixType()
  449. public int getCovarianceMatrixType() {
  450. ThrowIfDisposed();
  451. #if (UNITY_ANDROID && !UNITY_EDITOR)
  452. int retVal = ml_EM_getCovarianceMatrixType_10(nativeObj);
  453. return retVal;
  454. #else
  455. return -1;
  456. #endif
  457. }
  458. //
  459. // C++: void cv::ml::EM::getCovs(vector_Mat& covs)
  460. //
  461. //javadoc: EM::getCovs(covs)
  462. public void getCovs(List<Mat> covs) {
  463. ThrowIfDisposed();
  464. #if (UNITY_ANDROID && !UNITY_EDITOR)
  465. Mat covs_mat = new Mat();
  466. ml_EM_getCovs_10(nativeObj, covs_mat.nativeObj);
  467. Converters.Mat_to_vector_Mat(covs_mat, covs);
  468. covs_mat.release();
  469. return;
  470. #else
  471. return;
  472. #endif
  473. }
  474. //
  475. // C++: void cv::ml::EM::setClustersNumber(int val)
  476. //
  477. //javadoc: EM::setClustersNumber(val)
  478. public void setClustersNumber(int val) {
  479. ThrowIfDisposed();
  480. #if (UNITY_ANDROID && !UNITY_EDITOR)
  481. ml_EM_setClustersNumber_10(nativeObj, val);
  482. return;
  483. #else
  484. return;
  485. #endif
  486. }
  487. //
  488. // C++: void cv::ml::EM::setCovarianceMatrixType(int val)
  489. //
  490. //javadoc: EM::setCovarianceMatrixType(val)
  491. public void setCovarianceMatrixType(int val) {
  492. ThrowIfDisposed();
  493. #if (UNITY_ANDROID && !UNITY_EDITOR)
  494. ml_EM_setCovarianceMatrixType_10(nativeObj, val);
  495. return;
  496. #else
  497. return;
  498. #endif
  499. }
  500. //
  501. // C++: void cv::ml::EM::setTermCriteria(TermCriteria val)
  502. //
  503. //javadoc: EM::setTermCriteria(val)
  504. public void setTermCriteria(TermCriteria val) {
  505. ThrowIfDisposed();
  506. #if (UNITY_ANDROID && !UNITY_EDITOR)
  507. ml_EM_setTermCriteria_10(nativeObj, val.type, val.maxCount, val.epsilon);
  508. return;
  509. #else
  510. return;
  511. #endif
  512. }
  513. #if (UNITY_ANDROID && !UNITY_EDITOR)
  514. const string LIBNAME = "opencvforunity";
  515. // C++: Mat cv::ml::EM::getMeans()
  516. [DllImport(LIBNAME)]
  517. private static extern IntPtr ml_EM_getMeans_10(IntPtr nativeObj);
  518. // C++: Mat cv::ml::EM::getWeights()
  519. [DllImport(LIBNAME)]
  520. private static extern IntPtr ml_EM_getWeights_10(IntPtr nativeObj);
  521. // C++: static Ptr_EM cv::ml::EM::create()
  522. [DllImport(LIBNAME)]
  523. private static extern IntPtr ml_EM_create_10();
  524. // C++: static Ptr_EM cv::ml::EM::load(String filepath, String nodeName = String())
  525. [DllImport(LIBNAME)]
  526. private static extern IntPtr ml_EM_load_10(string filepath, string nodeName);
  527. [DllImport(LIBNAME)]
  528. private static extern IntPtr ml_EM_load_11(string filepath);
  529. // C++: TermCriteria cv::ml::EM::getTermCriteria()
  530. [DllImport(LIBNAME)]
  531. private static extern void ml_EM_getTermCriteria_10(IntPtr nativeObj, double[] retVal);
  532. // C++: Vec2d cv::ml::EM::predict2(Mat sample, Mat& probs)
  533. [DllImport(LIBNAME)]
  534. private static extern void ml_EM_predict2_10(IntPtr nativeObj, IntPtr sample_nativeObj, IntPtr probs_nativeObj, double[] retVal);
  535. // C++: bool cv::ml::EM::trainE(Mat samples, Mat means0, Mat covs0 = Mat(), Mat weights0 = Mat(), Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
  536. [DllImport(LIBNAME)]
  537. private static extern bool ml_EM_trainE_10(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr means0_nativeObj, IntPtr covs0_nativeObj, IntPtr weights0_nativeObj, IntPtr logLikelihoods_nativeObj, IntPtr labels_nativeObj, IntPtr probs_nativeObj);
  538. [DllImport(LIBNAME)]
  539. private static extern bool ml_EM_trainE_11(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr means0_nativeObj, IntPtr covs0_nativeObj, IntPtr weights0_nativeObj, IntPtr logLikelihoods_nativeObj, IntPtr labels_nativeObj);
  540. [DllImport(LIBNAME)]
  541. private static extern bool ml_EM_trainE_12(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr means0_nativeObj, IntPtr covs0_nativeObj, IntPtr weights0_nativeObj, IntPtr logLikelihoods_nativeObj);
  542. [DllImport(LIBNAME)]
  543. private static extern bool ml_EM_trainE_13(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr means0_nativeObj, IntPtr covs0_nativeObj, IntPtr weights0_nativeObj);
  544. [DllImport(LIBNAME)]
  545. private static extern bool ml_EM_trainE_14(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr means0_nativeObj, IntPtr covs0_nativeObj);
  546. [DllImport(LIBNAME)]
  547. private static extern bool ml_EM_trainE_15(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr means0_nativeObj);
  548. // C++: bool cv::ml::EM::trainEM(Mat samples, Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
  549. [DllImport(LIBNAME)]
  550. private static extern bool ml_EM_trainEM_10(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr logLikelihoods_nativeObj, IntPtr labels_nativeObj, IntPtr probs_nativeObj);
  551. [DllImport(LIBNAME)]
  552. private static extern bool ml_EM_trainEM_11(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr logLikelihoods_nativeObj, IntPtr labels_nativeObj);
  553. [DllImport(LIBNAME)]
  554. private static extern bool ml_EM_trainEM_12(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr logLikelihoods_nativeObj);
  555. [DllImport(LIBNAME)]
  556. private static extern bool ml_EM_trainEM_13(IntPtr nativeObj, IntPtr samples_nativeObj);
  557. // C++: bool cv::ml::EM::trainM(Mat samples, Mat probs0, Mat& logLikelihoods = Mat(), Mat& labels = Mat(), Mat& probs = Mat())
  558. [DllImport(LIBNAME)]
  559. private static extern bool ml_EM_trainM_10(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr probs0_nativeObj, IntPtr logLikelihoods_nativeObj, IntPtr labels_nativeObj, IntPtr probs_nativeObj);
  560. [DllImport(LIBNAME)]
  561. private static extern bool ml_EM_trainM_11(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr probs0_nativeObj, IntPtr logLikelihoods_nativeObj, IntPtr labels_nativeObj);
  562. [DllImport(LIBNAME)]
  563. private static extern bool ml_EM_trainM_12(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr probs0_nativeObj, IntPtr logLikelihoods_nativeObj);
  564. [DllImport(LIBNAME)]
  565. private static extern bool ml_EM_trainM_13(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr probs0_nativeObj);
  566. // C++: float cv::ml::EM::predict(Mat samples, Mat& results = Mat(), int flags = 0)
  567. [DllImport(LIBNAME)]
  568. private static extern float ml_EM_predict_10(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr results_nativeObj, int flags);
  569. [DllImport(LIBNAME)]
  570. private static extern float ml_EM_predict_11(IntPtr nativeObj, IntPtr samples_nativeObj, IntPtr results_nativeObj);
  571. [DllImport(LIBNAME)]
  572. private static extern float ml_EM_predict_12(IntPtr nativeObj, IntPtr samples_nativeObj);
  573. // C++: int cv::ml::EM::getClustersNumber()
  574. [DllImport(LIBNAME)]
  575. private static extern int ml_EM_getClustersNumber_10(IntPtr nativeObj);
  576. // C++: int cv::ml::EM::getCovarianceMatrixType()
  577. [DllImport(LIBNAME)]
  578. private static extern int ml_EM_getCovarianceMatrixType_10(IntPtr nativeObj);
  579. // C++: void cv::ml::EM::getCovs(vector_Mat& covs)
  580. [DllImport(LIBNAME)]
  581. private static extern void ml_EM_getCovs_10(IntPtr nativeObj, IntPtr covs_mat_nativeObj);
  582. // C++: void cv::ml::EM::setClustersNumber(int val)
  583. [DllImport(LIBNAME)]
  584. private static extern void ml_EM_setClustersNumber_10(IntPtr nativeObj, int val);
  585. // C++: void cv::ml::EM::setCovarianceMatrixType(int val)
  586. [DllImport(LIBNAME)]
  587. private static extern void ml_EM_setCovarianceMatrixType_10(IntPtr nativeObj, int val);
  588. // C++: void cv::ml::EM::setTermCriteria(TermCriteria val)
  589. [DllImport(LIBNAME)]
  590. private static extern void ml_EM_setTermCriteria_10(IntPtr nativeObj, int val_type, int val_maxCount, double val_epsilon);
  591. // native support for java finalize()
  592. [DllImport(LIBNAME)]
  593. private static extern void ml_EM_delete(IntPtr nativeObj);
  594. #endif
  595. }
  596. }