TrainData.cs 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  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. {
  9. // C++: class TrainData
  10. //javadoc: TrainData
  11. public class TrainData : DisposableOpenCVObject
  12. {
  13. protected override void Dispose (bool disposing)
  14. {
  15. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  16. try {
  17. if (disposing) {
  18. }
  19. if (IsEnabledDispose) {
  20. if (nativeObj != IntPtr.Zero)
  21. ml_TrainData_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal TrainData (IntPtr addr) : base (addr) { }
  32. public IntPtr getNativeObjAddr () { return nativeObj; }
  33. // internal usage only
  34. public static TrainData __fromPtr__ (IntPtr addr) { return new TrainData (addr); }
  35. //
  36. // C++: Mat cv::ml::TrainData::getCatMap()
  37. //
  38. //javadoc: TrainData::getCatMap()
  39. public Mat getCatMap ()
  40. {
  41. ThrowIfDisposed ();
  42. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  43. Mat retVal = new Mat(ml_TrainData_getCatMap_10(nativeObj));
  44. return retVal;
  45. #else
  46. return null;
  47. #endif
  48. }
  49. //
  50. // C++: Mat cv::ml::TrainData::getCatOfs()
  51. //
  52. //javadoc: TrainData::getCatOfs()
  53. public Mat getCatOfs ()
  54. {
  55. ThrowIfDisposed ();
  56. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  57. Mat retVal = new Mat(ml_TrainData_getCatOfs_10(nativeObj));
  58. return retVal;
  59. #else
  60. return null;
  61. #endif
  62. }
  63. //
  64. // C++: Mat cv::ml::TrainData::getClassLabels()
  65. //
  66. //javadoc: TrainData::getClassLabels()
  67. public Mat getClassLabels ()
  68. {
  69. ThrowIfDisposed ();
  70. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  71. Mat retVal = new Mat(ml_TrainData_getClassLabels_10(nativeObj));
  72. return retVal;
  73. #else
  74. return null;
  75. #endif
  76. }
  77. //
  78. // C++: Mat cv::ml::TrainData::getDefaultSubstValues()
  79. //
  80. //javadoc: TrainData::getDefaultSubstValues()
  81. public Mat getDefaultSubstValues ()
  82. {
  83. ThrowIfDisposed ();
  84. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  85. Mat retVal = new Mat(ml_TrainData_getDefaultSubstValues_10(nativeObj));
  86. return retVal;
  87. #else
  88. return null;
  89. #endif
  90. }
  91. //
  92. // C++: Mat cv::ml::TrainData::getMissing()
  93. //
  94. //javadoc: TrainData::getMissing()
  95. public Mat getMissing ()
  96. {
  97. ThrowIfDisposed ();
  98. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  99. Mat retVal = new Mat(ml_TrainData_getMissing_10(nativeObj));
  100. return retVal;
  101. #else
  102. return null;
  103. #endif
  104. }
  105. //
  106. // C++: Mat cv::ml::TrainData::getNormCatResponses()
  107. //
  108. //javadoc: TrainData::getNormCatResponses()
  109. public Mat getNormCatResponses ()
  110. {
  111. ThrowIfDisposed ();
  112. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  113. Mat retVal = new Mat(ml_TrainData_getNormCatResponses_10(nativeObj));
  114. return retVal;
  115. #else
  116. return null;
  117. #endif
  118. }
  119. //
  120. // C++: Mat cv::ml::TrainData::getResponses()
  121. //
  122. //javadoc: TrainData::getResponses()
  123. public Mat getResponses ()
  124. {
  125. ThrowIfDisposed ();
  126. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  127. Mat retVal = new Mat(ml_TrainData_getResponses_10(nativeObj));
  128. return retVal;
  129. #else
  130. return null;
  131. #endif
  132. }
  133. //
  134. // C++: Mat cv::ml::TrainData::getSampleWeights()
  135. //
  136. //javadoc: TrainData::getSampleWeights()
  137. public Mat getSampleWeights ()
  138. {
  139. ThrowIfDisposed ();
  140. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  141. Mat retVal = new Mat(ml_TrainData_getSampleWeights_10(nativeObj));
  142. return retVal;
  143. #else
  144. return null;
  145. #endif
  146. }
  147. //
  148. // C++: Mat cv::ml::TrainData::getSamples()
  149. //
  150. //javadoc: TrainData::getSamples()
  151. public Mat getSamples ()
  152. {
  153. ThrowIfDisposed ();
  154. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  155. Mat retVal = new Mat(ml_TrainData_getSamples_10(nativeObj));
  156. return retVal;
  157. #else
  158. return null;
  159. #endif
  160. }
  161. //
  162. // C++: static Mat cv::ml::TrainData::getSubMatrix(Mat matrix, Mat idx, int layout)
  163. //
  164. //javadoc: TrainData::getSubMatrix(matrix, idx, layout)
  165. public static Mat getSubMatrix (Mat matrix, Mat idx, int layout)
  166. {
  167. if (matrix != null) matrix.ThrowIfDisposed ();
  168. if (idx != null) idx.ThrowIfDisposed ();
  169. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  170. Mat retVal = new Mat(ml_TrainData_getSubMatrix_10(matrix.nativeObj, idx.nativeObj, layout));
  171. return retVal;
  172. #else
  173. return null;
  174. #endif
  175. }
  176. //
  177. // C++: static Mat cv::ml::TrainData::getSubVector(Mat vec, Mat idx)
  178. //
  179. //javadoc: TrainData::getSubVector(vec, idx)
  180. public static Mat getSubVector (Mat vec, Mat idx)
  181. {
  182. if (vec != null) vec.ThrowIfDisposed ();
  183. if (idx != null) idx.ThrowIfDisposed ();
  184. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  185. Mat retVal = new Mat(ml_TrainData_getSubVector_10(vec.nativeObj, idx.nativeObj));
  186. return retVal;
  187. #else
  188. return null;
  189. #endif
  190. }
  191. //
  192. // C++: Mat cv::ml::TrainData::getTestNormCatResponses()
  193. //
  194. //javadoc: TrainData::getTestNormCatResponses()
  195. public Mat getTestNormCatResponses ()
  196. {
  197. ThrowIfDisposed ();
  198. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  199. Mat retVal = new Mat(ml_TrainData_getTestNormCatResponses_10(nativeObj));
  200. return retVal;
  201. #else
  202. return null;
  203. #endif
  204. }
  205. //
  206. // C++: Mat cv::ml::TrainData::getTestResponses()
  207. //
  208. //javadoc: TrainData::getTestResponses()
  209. public Mat getTestResponses ()
  210. {
  211. ThrowIfDisposed ();
  212. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  213. Mat retVal = new Mat(ml_TrainData_getTestResponses_10(nativeObj));
  214. return retVal;
  215. #else
  216. return null;
  217. #endif
  218. }
  219. //
  220. // C++: Mat cv::ml::TrainData::getTestSampleIdx()
  221. //
  222. //javadoc: TrainData::getTestSampleIdx()
  223. public Mat getTestSampleIdx ()
  224. {
  225. ThrowIfDisposed ();
  226. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  227. Mat retVal = new Mat(ml_TrainData_getTestSampleIdx_10(nativeObj));
  228. return retVal;
  229. #else
  230. return null;
  231. #endif
  232. }
  233. //
  234. // C++: Mat cv::ml::TrainData::getTestSampleWeights()
  235. //
  236. //javadoc: TrainData::getTestSampleWeights()
  237. public Mat getTestSampleWeights ()
  238. {
  239. ThrowIfDisposed ();
  240. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  241. Mat retVal = new Mat(ml_TrainData_getTestSampleWeights_10(nativeObj));
  242. return retVal;
  243. #else
  244. return null;
  245. #endif
  246. }
  247. //
  248. // C++: Mat cv::ml::TrainData::getTestSamples()
  249. //
  250. //javadoc: TrainData::getTestSamples()
  251. public Mat getTestSamples ()
  252. {
  253. ThrowIfDisposed ();
  254. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  255. Mat retVal = new Mat(ml_TrainData_getTestSamples_10(nativeObj));
  256. return retVal;
  257. #else
  258. return null;
  259. #endif
  260. }
  261. //
  262. // C++: Mat cv::ml::TrainData::getTrainNormCatResponses()
  263. //
  264. //javadoc: TrainData::getTrainNormCatResponses()
  265. public Mat getTrainNormCatResponses ()
  266. {
  267. ThrowIfDisposed ();
  268. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  269. Mat retVal = new Mat(ml_TrainData_getTrainNormCatResponses_10(nativeObj));
  270. return retVal;
  271. #else
  272. return null;
  273. #endif
  274. }
  275. //
  276. // C++: Mat cv::ml::TrainData::getTrainResponses()
  277. //
  278. //javadoc: TrainData::getTrainResponses()
  279. public Mat getTrainResponses ()
  280. {
  281. ThrowIfDisposed ();
  282. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  283. Mat retVal = new Mat(ml_TrainData_getTrainResponses_10(nativeObj));
  284. return retVal;
  285. #else
  286. return null;
  287. #endif
  288. }
  289. //
  290. // C++: Mat cv::ml::TrainData::getTrainSampleIdx()
  291. //
  292. //javadoc: TrainData::getTrainSampleIdx()
  293. public Mat getTrainSampleIdx ()
  294. {
  295. ThrowIfDisposed ();
  296. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  297. Mat retVal = new Mat(ml_TrainData_getTrainSampleIdx_10(nativeObj));
  298. return retVal;
  299. #else
  300. return null;
  301. #endif
  302. }
  303. //
  304. // C++: Mat cv::ml::TrainData::getTrainSampleWeights()
  305. //
  306. //javadoc: TrainData::getTrainSampleWeights()
  307. public Mat getTrainSampleWeights ()
  308. {
  309. ThrowIfDisposed ();
  310. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  311. Mat retVal = new Mat(ml_TrainData_getTrainSampleWeights_10(nativeObj));
  312. return retVal;
  313. #else
  314. return null;
  315. #endif
  316. }
  317. //
  318. // C++: Mat cv::ml::TrainData::getTrainSamples(int layout = ROW_SAMPLE, bool compressSamples = true, bool compressVars = true)
  319. //
  320. //javadoc: TrainData::getTrainSamples(layout, compressSamples, compressVars)
  321. public Mat getTrainSamples (int layout, bool compressSamples, bool compressVars)
  322. {
  323. ThrowIfDisposed ();
  324. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  325. Mat retVal = new Mat(ml_TrainData_getTrainSamples_10(nativeObj, layout, compressSamples, compressVars));
  326. return retVal;
  327. #else
  328. return null;
  329. #endif
  330. }
  331. //javadoc: TrainData::getTrainSamples(layout, compressSamples)
  332. public Mat getTrainSamples (int layout, bool compressSamples)
  333. {
  334. ThrowIfDisposed ();
  335. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  336. Mat retVal = new Mat(ml_TrainData_getTrainSamples_11(nativeObj, layout, compressSamples));
  337. return retVal;
  338. #else
  339. return null;
  340. #endif
  341. }
  342. //javadoc: TrainData::getTrainSamples(layout)
  343. public Mat getTrainSamples (int layout)
  344. {
  345. ThrowIfDisposed ();
  346. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  347. Mat retVal = new Mat(ml_TrainData_getTrainSamples_12(nativeObj, layout));
  348. return retVal;
  349. #else
  350. return null;
  351. #endif
  352. }
  353. //javadoc: TrainData::getTrainSamples()
  354. public Mat getTrainSamples ()
  355. {
  356. ThrowIfDisposed ();
  357. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  358. Mat retVal = new Mat(ml_TrainData_getTrainSamples_13(nativeObj));
  359. return retVal;
  360. #else
  361. return null;
  362. #endif
  363. }
  364. //
  365. // C++: Mat cv::ml::TrainData::getVarIdx()
  366. //
  367. //javadoc: TrainData::getVarIdx()
  368. public Mat getVarIdx ()
  369. {
  370. ThrowIfDisposed ();
  371. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  372. Mat retVal = new Mat(ml_TrainData_getVarIdx_10(nativeObj));
  373. return retVal;
  374. #else
  375. return null;
  376. #endif
  377. }
  378. //
  379. // C++: Mat cv::ml::TrainData::getVarSymbolFlags()
  380. //
  381. //javadoc: TrainData::getVarSymbolFlags()
  382. public Mat getVarSymbolFlags ()
  383. {
  384. ThrowIfDisposed ();
  385. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  386. Mat retVal = new Mat(ml_TrainData_getVarSymbolFlags_10(nativeObj));
  387. return retVal;
  388. #else
  389. return null;
  390. #endif
  391. }
  392. //
  393. // C++: Mat cv::ml::TrainData::getVarType()
  394. //
  395. //javadoc: TrainData::getVarType()
  396. public Mat getVarType ()
  397. {
  398. ThrowIfDisposed ();
  399. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  400. Mat retVal = new Mat(ml_TrainData_getVarType_10(nativeObj));
  401. return retVal;
  402. #else
  403. return null;
  404. #endif
  405. }
  406. //
  407. // C++: static Ptr_TrainData cv::ml::TrainData::create(Mat samples, int layout, Mat responses, Mat varIdx = Mat(), Mat sampleIdx = Mat(), Mat sampleWeights = Mat(), Mat varType = Mat())
  408. //
  409. //javadoc: TrainData::create(samples, layout, responses, varIdx, sampleIdx, sampleWeights, varType)
  410. public static TrainData create (Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx, Mat sampleWeights, Mat varType)
  411. {
  412. if (samples != null) samples.ThrowIfDisposed ();
  413. if (responses != null) responses.ThrowIfDisposed ();
  414. if (varIdx != null) varIdx.ThrowIfDisposed ();
  415. if (sampleIdx != null) sampleIdx.ThrowIfDisposed ();
  416. if (sampleWeights != null) sampleWeights.ThrowIfDisposed ();
  417. if (varType != null) varType.ThrowIfDisposed ();
  418. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  419. TrainData retVal = TrainData.__fromPtr__(ml_TrainData_create_10(samples.nativeObj, layout, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, sampleWeights.nativeObj, varType.nativeObj));
  420. return retVal;
  421. #else
  422. return null;
  423. #endif
  424. }
  425. //javadoc: TrainData::create(samples, layout, responses, varIdx, sampleIdx, sampleWeights)
  426. public static TrainData create (Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx, Mat sampleWeights)
  427. {
  428. if (samples != null) samples.ThrowIfDisposed ();
  429. if (responses != null) responses.ThrowIfDisposed ();
  430. if (varIdx != null) varIdx.ThrowIfDisposed ();
  431. if (sampleIdx != null) sampleIdx.ThrowIfDisposed ();
  432. if (sampleWeights != null) sampleWeights.ThrowIfDisposed ();
  433. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  434. TrainData retVal = TrainData.__fromPtr__(ml_TrainData_create_11(samples.nativeObj, layout, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, sampleWeights.nativeObj));
  435. return retVal;
  436. #else
  437. return null;
  438. #endif
  439. }
  440. //javadoc: TrainData::create(samples, layout, responses, varIdx, sampleIdx)
  441. public static TrainData create (Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx)
  442. {
  443. if (samples != null) samples.ThrowIfDisposed ();
  444. if (responses != null) responses.ThrowIfDisposed ();
  445. if (varIdx != null) varIdx.ThrowIfDisposed ();
  446. if (sampleIdx != null) sampleIdx.ThrowIfDisposed ();
  447. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  448. TrainData retVal = TrainData.__fromPtr__(ml_TrainData_create_12(samples.nativeObj, layout, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj));
  449. return retVal;
  450. #else
  451. return null;
  452. #endif
  453. }
  454. //javadoc: TrainData::create(samples, layout, responses, varIdx)
  455. public static TrainData create (Mat samples, int layout, Mat responses, Mat varIdx)
  456. {
  457. if (samples != null) samples.ThrowIfDisposed ();
  458. if (responses != null) responses.ThrowIfDisposed ();
  459. if (varIdx != null) varIdx.ThrowIfDisposed ();
  460. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  461. TrainData retVal = TrainData.__fromPtr__(ml_TrainData_create_13(samples.nativeObj, layout, responses.nativeObj, varIdx.nativeObj));
  462. return retVal;
  463. #else
  464. return null;
  465. #endif
  466. }
  467. //javadoc: TrainData::create(samples, layout, responses)
  468. public static TrainData create (Mat samples, int layout, Mat responses)
  469. {
  470. if (samples != null) samples.ThrowIfDisposed ();
  471. if (responses != null) responses.ThrowIfDisposed ();
  472. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  473. TrainData retVal = TrainData.__fromPtr__(ml_TrainData_create_14(samples.nativeObj, layout, responses.nativeObj));
  474. return retVal;
  475. #else
  476. return null;
  477. #endif
  478. }
  479. //
  480. // C++: int cv::ml::TrainData::getCatCount(int vi)
  481. //
  482. //javadoc: TrainData::getCatCount(vi)
  483. public int getCatCount (int vi)
  484. {
  485. ThrowIfDisposed ();
  486. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  487. int retVal = ml_TrainData_getCatCount_10(nativeObj, vi);
  488. return retVal;
  489. #else
  490. return -1;
  491. #endif
  492. }
  493. //
  494. // C++: int cv::ml::TrainData::getLayout()
  495. //
  496. //javadoc: TrainData::getLayout()
  497. public int getLayout ()
  498. {
  499. ThrowIfDisposed ();
  500. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  501. int retVal = ml_TrainData_getLayout_10(nativeObj);
  502. return retVal;
  503. #else
  504. return -1;
  505. #endif
  506. }
  507. //
  508. // C++: int cv::ml::TrainData::getNAllVars()
  509. //
  510. //javadoc: TrainData::getNAllVars()
  511. public int getNAllVars ()
  512. {
  513. ThrowIfDisposed ();
  514. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  515. int retVal = ml_TrainData_getNAllVars_10(nativeObj);
  516. return retVal;
  517. #else
  518. return -1;
  519. #endif
  520. }
  521. //
  522. // C++: int cv::ml::TrainData::getNSamples()
  523. //
  524. //javadoc: TrainData::getNSamples()
  525. public int getNSamples ()
  526. {
  527. ThrowIfDisposed ();
  528. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  529. int retVal = ml_TrainData_getNSamples_10(nativeObj);
  530. return retVal;
  531. #else
  532. return -1;
  533. #endif
  534. }
  535. //
  536. // C++: int cv::ml::TrainData::getNTestSamples()
  537. //
  538. //javadoc: TrainData::getNTestSamples()
  539. public int getNTestSamples ()
  540. {
  541. ThrowIfDisposed ();
  542. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  543. int retVal = ml_TrainData_getNTestSamples_10(nativeObj);
  544. return retVal;
  545. #else
  546. return -1;
  547. #endif
  548. }
  549. //
  550. // C++: int cv::ml::TrainData::getNTrainSamples()
  551. //
  552. //javadoc: TrainData::getNTrainSamples()
  553. public int getNTrainSamples ()
  554. {
  555. ThrowIfDisposed ();
  556. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  557. int retVal = ml_TrainData_getNTrainSamples_10(nativeObj);
  558. return retVal;
  559. #else
  560. return -1;
  561. #endif
  562. }
  563. //
  564. // C++: int cv::ml::TrainData::getNVars()
  565. //
  566. //javadoc: TrainData::getNVars()
  567. public int getNVars ()
  568. {
  569. ThrowIfDisposed ();
  570. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  571. int retVal = ml_TrainData_getNVars_10(nativeObj);
  572. return retVal;
  573. #else
  574. return -1;
  575. #endif
  576. }
  577. //
  578. // C++: int cv::ml::TrainData::getResponseType()
  579. //
  580. //javadoc: TrainData::getResponseType()
  581. public int getResponseType ()
  582. {
  583. ThrowIfDisposed ();
  584. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  585. int retVal = ml_TrainData_getResponseType_10(nativeObj);
  586. return retVal;
  587. #else
  588. return -1;
  589. #endif
  590. }
  591. //
  592. // C++: void cv::ml::TrainData::getNames(vector_String names)
  593. //
  594. //javadoc: TrainData::getNames(names)
  595. public void getNames (List<string> names)
  596. {
  597. ThrowIfDisposed ();
  598. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  599. Mat names_mat = Converters.vector_String_to_Mat(names);
  600. ml_TrainData_getNames_10(nativeObj, names_mat.nativeObj);
  601. return;
  602. #else
  603. return;
  604. #endif
  605. }
  606. //
  607. // C++: void cv::ml::TrainData::getSample(Mat varIdx, int sidx, float* buf)
  608. //
  609. //javadoc: TrainData::getSample(varIdx, sidx, buf)
  610. public void getSample (Mat varIdx, int sidx, float buf)
  611. {
  612. ThrowIfDisposed ();
  613. if (varIdx != null) varIdx.ThrowIfDisposed ();
  614. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  615. ml_TrainData_getSample_10(nativeObj, varIdx.nativeObj, sidx, buf);
  616. return;
  617. #else
  618. return;
  619. #endif
  620. }
  621. //
  622. // C++: void cv::ml::TrainData::getValues(int vi, Mat sidx, float* values)
  623. //
  624. //javadoc: TrainData::getValues(vi, sidx, values)
  625. public void getValues (int vi, Mat sidx, float values)
  626. {
  627. ThrowIfDisposed ();
  628. if (sidx != null) sidx.ThrowIfDisposed ();
  629. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  630. ml_TrainData_getValues_10(nativeObj, vi, sidx.nativeObj, values);
  631. return;
  632. #else
  633. return;
  634. #endif
  635. }
  636. //
  637. // C++: void cv::ml::TrainData::setTrainTestSplit(int count, bool shuffle = true)
  638. //
  639. //javadoc: TrainData::setTrainTestSplit(count, shuffle)
  640. public void setTrainTestSplit (int count, bool shuffle)
  641. {
  642. ThrowIfDisposed ();
  643. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  644. ml_TrainData_setTrainTestSplit_10(nativeObj, count, shuffle);
  645. return;
  646. #else
  647. return;
  648. #endif
  649. }
  650. //javadoc: TrainData::setTrainTestSplit(count)
  651. public void setTrainTestSplit (int count)
  652. {
  653. ThrowIfDisposed ();
  654. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  655. ml_TrainData_setTrainTestSplit_11(nativeObj, count);
  656. return;
  657. #else
  658. return;
  659. #endif
  660. }
  661. //
  662. // C++: void cv::ml::TrainData::setTrainTestSplitRatio(double ratio, bool shuffle = true)
  663. //
  664. //javadoc: TrainData::setTrainTestSplitRatio(ratio, shuffle)
  665. public void setTrainTestSplitRatio (double ratio, bool shuffle)
  666. {
  667. ThrowIfDisposed ();
  668. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  669. ml_TrainData_setTrainTestSplitRatio_10(nativeObj, ratio, shuffle);
  670. return;
  671. #else
  672. return;
  673. #endif
  674. }
  675. //javadoc: TrainData::setTrainTestSplitRatio(ratio)
  676. public void setTrainTestSplitRatio (double ratio)
  677. {
  678. ThrowIfDisposed ();
  679. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  680. ml_TrainData_setTrainTestSplitRatio_11(nativeObj, ratio);
  681. return;
  682. #else
  683. return;
  684. #endif
  685. }
  686. //
  687. // C++: void cv::ml::TrainData::shuffleTrainTest()
  688. //
  689. //javadoc: TrainData::shuffleTrainTest()
  690. public void shuffleTrainTest ()
  691. {
  692. ThrowIfDisposed ();
  693. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  694. ml_TrainData_shuffleTrainTest_10(nativeObj);
  695. return;
  696. #else
  697. return;
  698. #endif
  699. }
  700. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  701. const string LIBNAME = "__Internal";
  702. #else
  703. const string LIBNAME = "opencvforunity";
  704. #endif
  705. // C++: Mat cv::ml::TrainData::getCatMap()
  706. [DllImport (LIBNAME)]
  707. private static extern IntPtr ml_TrainData_getCatMap_10 (IntPtr nativeObj);
  708. // C++: Mat cv::ml::TrainData::getCatOfs()
  709. [DllImport (LIBNAME)]
  710. private static extern IntPtr ml_TrainData_getCatOfs_10 (IntPtr nativeObj);
  711. // C++: Mat cv::ml::TrainData::getClassLabels()
  712. [DllImport (LIBNAME)]
  713. private static extern IntPtr ml_TrainData_getClassLabels_10 (IntPtr nativeObj);
  714. // C++: Mat cv::ml::TrainData::getDefaultSubstValues()
  715. [DllImport (LIBNAME)]
  716. private static extern IntPtr ml_TrainData_getDefaultSubstValues_10 (IntPtr nativeObj);
  717. // C++: Mat cv::ml::TrainData::getMissing()
  718. [DllImport (LIBNAME)]
  719. private static extern IntPtr ml_TrainData_getMissing_10 (IntPtr nativeObj);
  720. // C++: Mat cv::ml::TrainData::getNormCatResponses()
  721. [DllImport (LIBNAME)]
  722. private static extern IntPtr ml_TrainData_getNormCatResponses_10 (IntPtr nativeObj);
  723. // C++: Mat cv::ml::TrainData::getResponses()
  724. [DllImport (LIBNAME)]
  725. private static extern IntPtr ml_TrainData_getResponses_10 (IntPtr nativeObj);
  726. // C++: Mat cv::ml::TrainData::getSampleWeights()
  727. [DllImport (LIBNAME)]
  728. private static extern IntPtr ml_TrainData_getSampleWeights_10 (IntPtr nativeObj);
  729. // C++: Mat cv::ml::TrainData::getSamples()
  730. [DllImport (LIBNAME)]
  731. private static extern IntPtr ml_TrainData_getSamples_10 (IntPtr nativeObj);
  732. // C++: static Mat cv::ml::TrainData::getSubMatrix(Mat matrix, Mat idx, int layout)
  733. [DllImport (LIBNAME)]
  734. private static extern IntPtr ml_TrainData_getSubMatrix_10 (IntPtr matrix_nativeObj, IntPtr idx_nativeObj, int layout);
  735. // C++: static Mat cv::ml::TrainData::getSubVector(Mat vec, Mat idx)
  736. [DllImport (LIBNAME)]
  737. private static extern IntPtr ml_TrainData_getSubVector_10 (IntPtr vec_nativeObj, IntPtr idx_nativeObj);
  738. // C++: Mat cv::ml::TrainData::getTestNormCatResponses()
  739. [DllImport (LIBNAME)]
  740. private static extern IntPtr ml_TrainData_getTestNormCatResponses_10 (IntPtr nativeObj);
  741. // C++: Mat cv::ml::TrainData::getTestResponses()
  742. [DllImport (LIBNAME)]
  743. private static extern IntPtr ml_TrainData_getTestResponses_10 (IntPtr nativeObj);
  744. // C++: Mat cv::ml::TrainData::getTestSampleIdx()
  745. [DllImport (LIBNAME)]
  746. private static extern IntPtr ml_TrainData_getTestSampleIdx_10 (IntPtr nativeObj);
  747. // C++: Mat cv::ml::TrainData::getTestSampleWeights()
  748. [DllImport (LIBNAME)]
  749. private static extern IntPtr ml_TrainData_getTestSampleWeights_10 (IntPtr nativeObj);
  750. // C++: Mat cv::ml::TrainData::getTestSamples()
  751. [DllImport (LIBNAME)]
  752. private static extern IntPtr ml_TrainData_getTestSamples_10 (IntPtr nativeObj);
  753. // C++: Mat cv::ml::TrainData::getTrainNormCatResponses()
  754. [DllImport (LIBNAME)]
  755. private static extern IntPtr ml_TrainData_getTrainNormCatResponses_10 (IntPtr nativeObj);
  756. // C++: Mat cv::ml::TrainData::getTrainResponses()
  757. [DllImport (LIBNAME)]
  758. private static extern IntPtr ml_TrainData_getTrainResponses_10 (IntPtr nativeObj);
  759. // C++: Mat cv::ml::TrainData::getTrainSampleIdx()
  760. [DllImport (LIBNAME)]
  761. private static extern IntPtr ml_TrainData_getTrainSampleIdx_10 (IntPtr nativeObj);
  762. // C++: Mat cv::ml::TrainData::getTrainSampleWeights()
  763. [DllImport (LIBNAME)]
  764. private static extern IntPtr ml_TrainData_getTrainSampleWeights_10 (IntPtr nativeObj);
  765. // C++: Mat cv::ml::TrainData::getTrainSamples(int layout = ROW_SAMPLE, bool compressSamples = true, bool compressVars = true)
  766. [DllImport (LIBNAME)]
  767. private static extern IntPtr ml_TrainData_getTrainSamples_10 (IntPtr nativeObj, int layout, bool compressSamples, bool compressVars);
  768. [DllImport (LIBNAME)]
  769. private static extern IntPtr ml_TrainData_getTrainSamples_11 (IntPtr nativeObj, int layout, bool compressSamples);
  770. [DllImport (LIBNAME)]
  771. private static extern IntPtr ml_TrainData_getTrainSamples_12 (IntPtr nativeObj, int layout);
  772. [DllImport (LIBNAME)]
  773. private static extern IntPtr ml_TrainData_getTrainSamples_13 (IntPtr nativeObj);
  774. // C++: Mat cv::ml::TrainData::getVarIdx()
  775. [DllImport (LIBNAME)]
  776. private static extern IntPtr ml_TrainData_getVarIdx_10 (IntPtr nativeObj);
  777. // C++: Mat cv::ml::TrainData::getVarSymbolFlags()
  778. [DllImport (LIBNAME)]
  779. private static extern IntPtr ml_TrainData_getVarSymbolFlags_10 (IntPtr nativeObj);
  780. // C++: Mat cv::ml::TrainData::getVarType()
  781. [DllImport (LIBNAME)]
  782. private static extern IntPtr ml_TrainData_getVarType_10 (IntPtr nativeObj);
  783. // C++: static Ptr_TrainData cv::ml::TrainData::create(Mat samples, int layout, Mat responses, Mat varIdx = Mat(), Mat sampleIdx = Mat(), Mat sampleWeights = Mat(), Mat varType = Mat())
  784. [DllImport (LIBNAME)]
  785. private static extern IntPtr ml_TrainData_create_10 (IntPtr samples_nativeObj, int layout, IntPtr responses_nativeObj, IntPtr varIdx_nativeObj, IntPtr sampleIdx_nativeObj, IntPtr sampleWeights_nativeObj, IntPtr varType_nativeObj);
  786. [DllImport (LIBNAME)]
  787. private static extern IntPtr ml_TrainData_create_11 (IntPtr samples_nativeObj, int layout, IntPtr responses_nativeObj, IntPtr varIdx_nativeObj, IntPtr sampleIdx_nativeObj, IntPtr sampleWeights_nativeObj);
  788. [DllImport (LIBNAME)]
  789. private static extern IntPtr ml_TrainData_create_12 (IntPtr samples_nativeObj, int layout, IntPtr responses_nativeObj, IntPtr varIdx_nativeObj, IntPtr sampleIdx_nativeObj);
  790. [DllImport (LIBNAME)]
  791. private static extern IntPtr ml_TrainData_create_13 (IntPtr samples_nativeObj, int layout, IntPtr responses_nativeObj, IntPtr varIdx_nativeObj);
  792. [DllImport (LIBNAME)]
  793. private static extern IntPtr ml_TrainData_create_14 (IntPtr samples_nativeObj, int layout, IntPtr responses_nativeObj);
  794. // C++: int cv::ml::TrainData::getCatCount(int vi)
  795. [DllImport (LIBNAME)]
  796. private static extern int ml_TrainData_getCatCount_10 (IntPtr nativeObj, int vi);
  797. // C++: int cv::ml::TrainData::getLayout()
  798. [DllImport (LIBNAME)]
  799. private static extern int ml_TrainData_getLayout_10 (IntPtr nativeObj);
  800. // C++: int cv::ml::TrainData::getNAllVars()
  801. [DllImport (LIBNAME)]
  802. private static extern int ml_TrainData_getNAllVars_10 (IntPtr nativeObj);
  803. // C++: int cv::ml::TrainData::getNSamples()
  804. [DllImport (LIBNAME)]
  805. private static extern int ml_TrainData_getNSamples_10 (IntPtr nativeObj);
  806. // C++: int cv::ml::TrainData::getNTestSamples()
  807. [DllImport (LIBNAME)]
  808. private static extern int ml_TrainData_getNTestSamples_10 (IntPtr nativeObj);
  809. // C++: int cv::ml::TrainData::getNTrainSamples()
  810. [DllImport (LIBNAME)]
  811. private static extern int ml_TrainData_getNTrainSamples_10 (IntPtr nativeObj);
  812. // C++: int cv::ml::TrainData::getNVars()
  813. [DllImport (LIBNAME)]
  814. private static extern int ml_TrainData_getNVars_10 (IntPtr nativeObj);
  815. // C++: int cv::ml::TrainData::getResponseType()
  816. [DllImport (LIBNAME)]
  817. private static extern int ml_TrainData_getResponseType_10 (IntPtr nativeObj);
  818. // C++: void cv::ml::TrainData::getNames(vector_String names)
  819. [DllImport (LIBNAME)]
  820. private static extern void ml_TrainData_getNames_10 (IntPtr nativeObj, IntPtr names_mat_nativeObj);
  821. // C++: void cv::ml::TrainData::getSample(Mat varIdx, int sidx, float* buf)
  822. [DllImport (LIBNAME)]
  823. private static extern void ml_TrainData_getSample_10 (IntPtr nativeObj, IntPtr varIdx_nativeObj, int sidx, float buf);
  824. // C++: void cv::ml::TrainData::getValues(int vi, Mat sidx, float* values)
  825. [DllImport (LIBNAME)]
  826. private static extern void ml_TrainData_getValues_10 (IntPtr nativeObj, int vi, IntPtr sidx_nativeObj, float values);
  827. // C++: void cv::ml::TrainData::setTrainTestSplit(int count, bool shuffle = true)
  828. [DllImport (LIBNAME)]
  829. private static extern void ml_TrainData_setTrainTestSplit_10 (IntPtr nativeObj, int count, bool shuffle);
  830. [DllImport (LIBNAME)]
  831. private static extern void ml_TrainData_setTrainTestSplit_11 (IntPtr nativeObj, int count);
  832. // C++: void cv::ml::TrainData::setTrainTestSplitRatio(double ratio, bool shuffle = true)
  833. [DllImport (LIBNAME)]
  834. private static extern void ml_TrainData_setTrainTestSplitRatio_10 (IntPtr nativeObj, double ratio, bool shuffle);
  835. [DllImport (LIBNAME)]
  836. private static extern void ml_TrainData_setTrainTestSplitRatio_11 (IntPtr nativeObj, double ratio);
  837. // C++: void cv::ml::TrainData::shuffleTrainTest()
  838. [DllImport (LIBNAME)]
  839. private static extern void ml_TrainData_shuffleTrainTest_10 (IntPtr nativeObj);
  840. // native support for java finalize()
  841. [DllImport (LIBNAME)]
  842. private static extern void ml_TrainData_delete (IntPtr nativeObj);
  843. }
  844. }