CascadeClassifier.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  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.ObjdetectModule
  8. {
  9. // C++: class CascadeClassifier
  10. //javadoc: CascadeClassifier
  11. public class CascadeClassifier : 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. objdetect_CascadeClassifier_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal CascadeClassifier (IntPtr addr) : base (addr) { }
  32. public IntPtr getNativeObjAddr () { return nativeObj; }
  33. // internal usage only
  34. public static CascadeClassifier __fromPtr__ (IntPtr addr) { return new CascadeClassifier (addr); }
  35. //
  36. // C++: cv::CascadeClassifier::CascadeClassifier(String filename)
  37. //
  38. //javadoc: CascadeClassifier::CascadeClassifier(filename)
  39. public CascadeClassifier (string filename)
  40. {
  41. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  42. nativeObj = objdetect_CascadeClassifier_CascadeClassifier_10(filename);
  43. return;
  44. #else
  45. return null;
  46. #endif
  47. }
  48. //
  49. // C++: cv::CascadeClassifier::CascadeClassifier()
  50. //
  51. //javadoc: CascadeClassifier::CascadeClassifier()
  52. public CascadeClassifier ()
  53. {
  54. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  55. nativeObj = objdetect_CascadeClassifier_CascadeClassifier_11();
  56. return;
  57. #else
  58. return null;
  59. #endif
  60. }
  61. //
  62. // C++: Size cv::CascadeClassifier::getOriginalWindowSize()
  63. //
  64. //javadoc: CascadeClassifier::getOriginalWindowSize()
  65. public Size getOriginalWindowSize ()
  66. {
  67. ThrowIfDisposed ();
  68. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  69. double[] tmpArray = new double[2];
  70. objdetect_CascadeClassifier_getOriginalWindowSize_10(nativeObj, tmpArray);
  71. Size retVal = new Size (tmpArray);
  72. return retVal;
  73. #else
  74. return null;
  75. #endif
  76. }
  77. //
  78. // C++: static bool cv::CascadeClassifier::convert(String oldcascade, String newcascade)
  79. //
  80. //javadoc: CascadeClassifier::convert(oldcascade, newcascade)
  81. public static bool convert (string oldcascade, string newcascade)
  82. {
  83. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  84. bool retVal = objdetect_CascadeClassifier_convert_10(oldcascade, newcascade);
  85. return retVal;
  86. #else
  87. return false;
  88. #endif
  89. }
  90. //
  91. // C++: bool cv::CascadeClassifier::empty()
  92. //
  93. //javadoc: CascadeClassifier::empty()
  94. public bool empty ()
  95. {
  96. ThrowIfDisposed ();
  97. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  98. bool retVal = objdetect_CascadeClassifier_empty_10(nativeObj);
  99. return retVal;
  100. #else
  101. return false;
  102. #endif
  103. }
  104. //
  105. // C++: bool cv::CascadeClassifier::isOldFormatCascade()
  106. //
  107. //javadoc: CascadeClassifier::isOldFormatCascade()
  108. public bool isOldFormatCascade ()
  109. {
  110. ThrowIfDisposed ();
  111. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  112. bool retVal = objdetect_CascadeClassifier_isOldFormatCascade_10(nativeObj);
  113. return retVal;
  114. #else
  115. return false;
  116. #endif
  117. }
  118. //
  119. // C++: bool cv::CascadeClassifier::load(String filename)
  120. //
  121. //javadoc: CascadeClassifier::load(filename)
  122. public bool load (string filename)
  123. {
  124. ThrowIfDisposed ();
  125. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  126. bool retVal = objdetect_CascadeClassifier_load_10(nativeObj, filename);
  127. return retVal;
  128. #else
  129. return false;
  130. #endif
  131. }
  132. //
  133. // C++: bool cv::CascadeClassifier::read(FileNode node)
  134. //
  135. // Unknown type 'FileNode' (I), skipping the function
  136. //
  137. // C++: int cv::CascadeClassifier::getFeatureType()
  138. //
  139. //javadoc: CascadeClassifier::getFeatureType()
  140. public int getFeatureType ()
  141. {
  142. ThrowIfDisposed ();
  143. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  144. int retVal = objdetect_CascadeClassifier_getFeatureType_10(nativeObj);
  145. return retVal;
  146. #else
  147. return -1;
  148. #endif
  149. }
  150. //
  151. // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size())
  152. //
  153. //javadoc: CascadeClassifier::detectMultiScale(image, objects, scaleFactor, minNeighbors, flags, minSize, maxSize)
  154. public void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
  155. {
  156. ThrowIfDisposed ();
  157. if (image != null) image.ThrowIfDisposed ();
  158. if (objects != null) objects.ThrowIfDisposed ();
  159. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  160. Mat objects_mat = objects;
  161. objdetect_CascadeClassifier_detectMultiScale_10(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
  162. return;
  163. #else
  164. return;
  165. #endif
  166. }
  167. //javadoc: CascadeClassifier::detectMultiScale(image, objects, scaleFactor, minNeighbors, flags, minSize)
  168. public void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize)
  169. {
  170. ThrowIfDisposed ();
  171. if (image != null) image.ThrowIfDisposed ();
  172. if (objects != null) objects.ThrowIfDisposed ();
  173. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  174. Mat objects_mat = objects;
  175. objdetect_CascadeClassifier_detectMultiScale_11(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height);
  176. return;
  177. #else
  178. return;
  179. #endif
  180. }
  181. //javadoc: CascadeClassifier::detectMultiScale(image, objects, scaleFactor, minNeighbors, flags)
  182. public void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags)
  183. {
  184. ThrowIfDisposed ();
  185. if (image != null) image.ThrowIfDisposed ();
  186. if (objects != null) objects.ThrowIfDisposed ();
  187. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  188. Mat objects_mat = objects;
  189. objdetect_CascadeClassifier_detectMultiScale_12(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags);
  190. return;
  191. #else
  192. return;
  193. #endif
  194. }
  195. //javadoc: CascadeClassifier::detectMultiScale(image, objects, scaleFactor, minNeighbors)
  196. public void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor, int minNeighbors)
  197. {
  198. ThrowIfDisposed ();
  199. if (image != null) image.ThrowIfDisposed ();
  200. if (objects != null) objects.ThrowIfDisposed ();
  201. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  202. Mat objects_mat = objects;
  203. objdetect_CascadeClassifier_detectMultiScale_13(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors);
  204. return;
  205. #else
  206. return;
  207. #endif
  208. }
  209. //javadoc: CascadeClassifier::detectMultiScale(image, objects, scaleFactor)
  210. public void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor)
  211. {
  212. ThrowIfDisposed ();
  213. if (image != null) image.ThrowIfDisposed ();
  214. if (objects != null) objects.ThrowIfDisposed ();
  215. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  216. Mat objects_mat = objects;
  217. objdetect_CascadeClassifier_detectMultiScale_14(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor);
  218. return;
  219. #else
  220. return;
  221. #endif
  222. }
  223. //javadoc: CascadeClassifier::detectMultiScale(image, objects)
  224. public void detectMultiScale (Mat image, MatOfRect objects)
  225. {
  226. ThrowIfDisposed ();
  227. if (image != null) image.ThrowIfDisposed ();
  228. if (objects != null) objects.ThrowIfDisposed ();
  229. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  230. Mat objects_mat = objects;
  231. objdetect_CascadeClassifier_detectMultiScale_15(nativeObj, image.nativeObj, objects_mat.nativeObj);
  232. return;
  233. #else
  234. return;
  235. #endif
  236. }
  237. //
  238. // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, vector_int& numDetections, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size())
  239. //
  240. //javadoc: CascadeClassifier::detectMultiScale2(image, objects, numDetections, scaleFactor, minNeighbors, flags, minSize, maxSize)
  241. public void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
  242. {
  243. ThrowIfDisposed ();
  244. if (image != null) image.ThrowIfDisposed ();
  245. if (objects != null) objects.ThrowIfDisposed ();
  246. if (numDetections != null) numDetections.ThrowIfDisposed ();
  247. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  248. Mat objects_mat = objects;
  249. Mat numDetections_mat = numDetections;
  250. objdetect_CascadeClassifier_detectMultiScale2_10(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
  251. return;
  252. #else
  253. return;
  254. #endif
  255. }
  256. //javadoc: CascadeClassifier::detectMultiScale2(image, objects, numDetections, scaleFactor, minNeighbors, flags, minSize)
  257. public void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize)
  258. {
  259. ThrowIfDisposed ();
  260. if (image != null) image.ThrowIfDisposed ();
  261. if (objects != null) objects.ThrowIfDisposed ();
  262. if (numDetections != null) numDetections.ThrowIfDisposed ();
  263. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  264. Mat objects_mat = objects;
  265. Mat numDetections_mat = numDetections;
  266. objdetect_CascadeClassifier_detectMultiScale2_11(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height);
  267. return;
  268. #else
  269. return;
  270. #endif
  271. }
  272. //javadoc: CascadeClassifier::detectMultiScale2(image, objects, numDetections, scaleFactor, minNeighbors, flags)
  273. public void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags)
  274. {
  275. ThrowIfDisposed ();
  276. if (image != null) image.ThrowIfDisposed ();
  277. if (objects != null) objects.ThrowIfDisposed ();
  278. if (numDetections != null) numDetections.ThrowIfDisposed ();
  279. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  280. Mat objects_mat = objects;
  281. Mat numDetections_mat = numDetections;
  282. objdetect_CascadeClassifier_detectMultiScale2_12(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags);
  283. return;
  284. #else
  285. return;
  286. #endif
  287. }
  288. //javadoc: CascadeClassifier::detectMultiScale2(image, objects, numDetections, scaleFactor, minNeighbors)
  289. public void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors)
  290. {
  291. ThrowIfDisposed ();
  292. if (image != null) image.ThrowIfDisposed ();
  293. if (objects != null) objects.ThrowIfDisposed ();
  294. if (numDetections != null) numDetections.ThrowIfDisposed ();
  295. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  296. Mat objects_mat = objects;
  297. Mat numDetections_mat = numDetections;
  298. objdetect_CascadeClassifier_detectMultiScale2_13(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors);
  299. return;
  300. #else
  301. return;
  302. #endif
  303. }
  304. //javadoc: CascadeClassifier::detectMultiScale2(image, objects, numDetections, scaleFactor)
  305. public void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor)
  306. {
  307. ThrowIfDisposed ();
  308. if (image != null) image.ThrowIfDisposed ();
  309. if (objects != null) objects.ThrowIfDisposed ();
  310. if (numDetections != null) numDetections.ThrowIfDisposed ();
  311. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  312. Mat objects_mat = objects;
  313. Mat numDetections_mat = numDetections;
  314. objdetect_CascadeClassifier_detectMultiScale2_14(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor);
  315. return;
  316. #else
  317. return;
  318. #endif
  319. }
  320. //javadoc: CascadeClassifier::detectMultiScale2(image, objects, numDetections)
  321. public void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections)
  322. {
  323. ThrowIfDisposed ();
  324. if (image != null) image.ThrowIfDisposed ();
  325. if (objects != null) objects.ThrowIfDisposed ();
  326. if (numDetections != null) numDetections.ThrowIfDisposed ();
  327. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  328. Mat objects_mat = objects;
  329. Mat numDetections_mat = numDetections;
  330. objdetect_CascadeClassifier_detectMultiScale2_15(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj);
  331. return;
  332. #else
  333. return;
  334. #endif
  335. }
  336. //
  337. // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, vector_int& rejectLevels, vector_double& levelWeights, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size(), bool outputRejectLevels = false)
  338. //
  339. //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights, scaleFactor, minNeighbors, flags, minSize, maxSize, outputRejectLevels)
  340. public void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, bool outputRejectLevels)
  341. {
  342. ThrowIfDisposed ();
  343. if (image != null) image.ThrowIfDisposed ();
  344. if (objects != null) objects.ThrowIfDisposed ();
  345. if (rejectLevels != null) rejectLevels.ThrowIfDisposed ();
  346. if (levelWeights != null) levelWeights.ThrowIfDisposed ();
  347. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  348. Mat objects_mat = objects;
  349. Mat rejectLevels_mat = rejectLevels;
  350. Mat levelWeights_mat = levelWeights;
  351. objdetect_CascadeClassifier_detectMultiScale3_10(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height, outputRejectLevels);
  352. return;
  353. #else
  354. return;
  355. #endif
  356. }
  357. //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights, scaleFactor, minNeighbors, flags, minSize, maxSize)
  358. public void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
  359. {
  360. ThrowIfDisposed ();
  361. if (image != null) image.ThrowIfDisposed ();
  362. if (objects != null) objects.ThrowIfDisposed ();
  363. if (rejectLevels != null) rejectLevels.ThrowIfDisposed ();
  364. if (levelWeights != null) levelWeights.ThrowIfDisposed ();
  365. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  366. Mat objects_mat = objects;
  367. Mat rejectLevels_mat = rejectLevels;
  368. Mat levelWeights_mat = levelWeights;
  369. objdetect_CascadeClassifier_detectMultiScale3_11(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
  370. return;
  371. #else
  372. return;
  373. #endif
  374. }
  375. //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights, scaleFactor, minNeighbors, flags, minSize)
  376. public void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize)
  377. {
  378. ThrowIfDisposed ();
  379. if (image != null) image.ThrowIfDisposed ();
  380. if (objects != null) objects.ThrowIfDisposed ();
  381. if (rejectLevels != null) rejectLevels.ThrowIfDisposed ();
  382. if (levelWeights != null) levelWeights.ThrowIfDisposed ();
  383. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  384. Mat objects_mat = objects;
  385. Mat rejectLevels_mat = rejectLevels;
  386. Mat levelWeights_mat = levelWeights;
  387. objdetect_CascadeClassifier_detectMultiScale3_12(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height);
  388. return;
  389. #else
  390. return;
  391. #endif
  392. }
  393. //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights, scaleFactor, minNeighbors, flags)
  394. public void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags)
  395. {
  396. ThrowIfDisposed ();
  397. if (image != null) image.ThrowIfDisposed ();
  398. if (objects != null) objects.ThrowIfDisposed ();
  399. if (rejectLevels != null) rejectLevels.ThrowIfDisposed ();
  400. if (levelWeights != null) levelWeights.ThrowIfDisposed ();
  401. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  402. Mat objects_mat = objects;
  403. Mat rejectLevels_mat = rejectLevels;
  404. Mat levelWeights_mat = levelWeights;
  405. objdetect_CascadeClassifier_detectMultiScale3_13(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags);
  406. return;
  407. #else
  408. return;
  409. #endif
  410. }
  411. //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights, scaleFactor, minNeighbors)
  412. public void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors)
  413. {
  414. ThrowIfDisposed ();
  415. if (image != null) image.ThrowIfDisposed ();
  416. if (objects != null) objects.ThrowIfDisposed ();
  417. if (rejectLevels != null) rejectLevels.ThrowIfDisposed ();
  418. if (levelWeights != null) levelWeights.ThrowIfDisposed ();
  419. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  420. Mat objects_mat = objects;
  421. Mat rejectLevels_mat = rejectLevels;
  422. Mat levelWeights_mat = levelWeights;
  423. objdetect_CascadeClassifier_detectMultiScale3_14(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors);
  424. return;
  425. #else
  426. return;
  427. #endif
  428. }
  429. //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights, scaleFactor)
  430. public void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor)
  431. {
  432. ThrowIfDisposed ();
  433. if (image != null) image.ThrowIfDisposed ();
  434. if (objects != null) objects.ThrowIfDisposed ();
  435. if (rejectLevels != null) rejectLevels.ThrowIfDisposed ();
  436. if (levelWeights != null) levelWeights.ThrowIfDisposed ();
  437. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  438. Mat objects_mat = objects;
  439. Mat rejectLevels_mat = rejectLevels;
  440. Mat levelWeights_mat = levelWeights;
  441. objdetect_CascadeClassifier_detectMultiScale3_15(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor);
  442. return;
  443. #else
  444. return;
  445. #endif
  446. }
  447. //javadoc: CascadeClassifier::detectMultiScale3(image, objects, rejectLevels, levelWeights)
  448. public void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
  449. {
  450. ThrowIfDisposed ();
  451. if (image != null) image.ThrowIfDisposed ();
  452. if (objects != null) objects.ThrowIfDisposed ();
  453. if (rejectLevels != null) rejectLevels.ThrowIfDisposed ();
  454. if (levelWeights != null) levelWeights.ThrowIfDisposed ();
  455. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  456. Mat objects_mat = objects;
  457. Mat rejectLevels_mat = rejectLevels;
  458. Mat levelWeights_mat = levelWeights;
  459. objdetect_CascadeClassifier_detectMultiScale3_16(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
  460. return;
  461. #else
  462. return;
  463. #endif
  464. }
  465. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  466. const string LIBNAME = "__Internal";
  467. #else
  468. const string LIBNAME = "opencvforunity";
  469. #endif
  470. // C++: cv::CascadeClassifier::CascadeClassifier(String filename)
  471. [DllImport (LIBNAME)]
  472. private static extern IntPtr objdetect_CascadeClassifier_CascadeClassifier_10 (string filename);
  473. // C++: cv::CascadeClassifier::CascadeClassifier()
  474. [DllImport (LIBNAME)]
  475. private static extern IntPtr objdetect_CascadeClassifier_CascadeClassifier_11 ();
  476. // C++: Size cv::CascadeClassifier::getOriginalWindowSize()
  477. [DllImport (LIBNAME)]
  478. private static extern void objdetect_CascadeClassifier_getOriginalWindowSize_10 (IntPtr nativeObj, double[] retVal);
  479. // C++: static bool cv::CascadeClassifier::convert(String oldcascade, String newcascade)
  480. [DllImport (LIBNAME)]
  481. private static extern bool objdetect_CascadeClassifier_convert_10 (string oldcascade, string newcascade);
  482. // C++: bool cv::CascadeClassifier::empty()
  483. [DllImport (LIBNAME)]
  484. private static extern bool objdetect_CascadeClassifier_empty_10 (IntPtr nativeObj);
  485. // C++: bool cv::CascadeClassifier::isOldFormatCascade()
  486. [DllImport (LIBNAME)]
  487. private static extern bool objdetect_CascadeClassifier_isOldFormatCascade_10 (IntPtr nativeObj);
  488. // C++: bool cv::CascadeClassifier::load(String filename)
  489. [DllImport (LIBNAME)]
  490. private static extern bool objdetect_CascadeClassifier_load_10 (IntPtr nativeObj, string filename);
  491. // C++: int cv::CascadeClassifier::getFeatureType()
  492. [DllImport (LIBNAME)]
  493. private static extern int objdetect_CascadeClassifier_getFeatureType_10 (IntPtr nativeObj);
  494. // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size())
  495. [DllImport (LIBNAME)]
  496. private static extern void objdetect_CascadeClassifier_detectMultiScale_10 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height);
  497. [DllImport (LIBNAME)]
  498. private static extern void objdetect_CascadeClassifier_detectMultiScale_11 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height);
  499. [DllImport (LIBNAME)]
  500. private static extern void objdetect_CascadeClassifier_detectMultiScale_12 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, double scaleFactor, int minNeighbors, int flags);
  501. [DllImport (LIBNAME)]
  502. private static extern void objdetect_CascadeClassifier_detectMultiScale_13 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, double scaleFactor, int minNeighbors);
  503. [DllImport (LIBNAME)]
  504. private static extern void objdetect_CascadeClassifier_detectMultiScale_14 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, double scaleFactor);
  505. [DllImport (LIBNAME)]
  506. private static extern void objdetect_CascadeClassifier_detectMultiScale_15 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj);
  507. // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, vector_int& numDetections, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size())
  508. [DllImport (LIBNAME)]
  509. private static extern void objdetect_CascadeClassifier_detectMultiScale2_10 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr numDetections_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height);
  510. [DllImport (LIBNAME)]
  511. private static extern void objdetect_CascadeClassifier_detectMultiScale2_11 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr numDetections_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height);
  512. [DllImport (LIBNAME)]
  513. private static extern void objdetect_CascadeClassifier_detectMultiScale2_12 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr numDetections_mat_nativeObj, double scaleFactor, int minNeighbors, int flags);
  514. [DllImport (LIBNAME)]
  515. private static extern void objdetect_CascadeClassifier_detectMultiScale2_13 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr numDetections_mat_nativeObj, double scaleFactor, int minNeighbors);
  516. [DllImport (LIBNAME)]
  517. private static extern void objdetect_CascadeClassifier_detectMultiScale2_14 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr numDetections_mat_nativeObj, double scaleFactor);
  518. [DllImport (LIBNAME)]
  519. private static extern void objdetect_CascadeClassifier_detectMultiScale2_15 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr numDetections_mat_nativeObj);
  520. // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, vector_int& rejectLevels, vector_double& levelWeights, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size(), bool outputRejectLevels = false)
  521. [DllImport (LIBNAME)]
  522. private static extern void objdetect_CascadeClassifier_detectMultiScale3_10 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr rejectLevels_mat_nativeObj, IntPtr levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height, bool outputRejectLevels);
  523. [DllImport (LIBNAME)]
  524. private static extern void objdetect_CascadeClassifier_detectMultiScale3_11 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr rejectLevels_mat_nativeObj, IntPtr levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height);
  525. [DllImport (LIBNAME)]
  526. private static extern void objdetect_CascadeClassifier_detectMultiScale3_12 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr rejectLevels_mat_nativeObj, IntPtr levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height);
  527. [DllImport (LIBNAME)]
  528. private static extern void objdetect_CascadeClassifier_detectMultiScale3_13 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr rejectLevels_mat_nativeObj, IntPtr levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags);
  529. [DllImport (LIBNAME)]
  530. private static extern void objdetect_CascadeClassifier_detectMultiScale3_14 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr rejectLevels_mat_nativeObj, IntPtr levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors);
  531. [DllImport (LIBNAME)]
  532. private static extern void objdetect_CascadeClassifier_detectMultiScale3_15 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr rejectLevels_mat_nativeObj, IntPtr levelWeights_mat_nativeObj, double scaleFactor);
  533. [DllImport (LIBNAME)]
  534. private static extern void objdetect_CascadeClassifier_detectMultiScale3_16 (IntPtr nativeObj, IntPtr image_nativeObj, IntPtr objects_mat_nativeObj, IntPtr rejectLevels_mat_nativeObj, IntPtr levelWeights_mat_nativeObj);
  535. // native support for java finalize()
  536. [DllImport (LIBNAME)]
  537. private static extern void objdetect_CascadeClassifier_delete (IntPtr nativeObj);
  538. }
  539. }