TrainData.cs 31 KB

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