StereoBM.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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.Calib3dModule
  8. {
  9. // C++: class StereoBM
  10. //javadoc: StereoBM
  11. public class StereoBM : StereoMatcher
  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. calib3d_StereoBM_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal StereoBM (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new StereoBM __fromPtr__ (IntPtr addr) { return new StereoBM (addr); }
  34. // C++: enum <unnamed>
  35. public const int PREFILTER_NORMALIZED_RESPONSE = 0;
  36. public const int PREFILTER_XSOBEL = 1;
  37. //
  38. // C++: static Ptr_StereoBM cv::StereoBM::create(int numDisparities = 0, int blockSize = 21)
  39. //
  40. //javadoc: StereoBM::create(numDisparities, blockSize)
  41. public static StereoBM create (int numDisparities, int blockSize)
  42. {
  43. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  44. StereoBM retVal = StereoBM.__fromPtr__(calib3d_StereoBM_create_10(numDisparities, blockSize));
  45. return retVal;
  46. #else
  47. return null;
  48. #endif
  49. }
  50. //javadoc: StereoBM::create(numDisparities)
  51. public static StereoBM create (int numDisparities)
  52. {
  53. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  54. StereoBM retVal = StereoBM.__fromPtr__(calib3d_StereoBM_create_11(numDisparities));
  55. return retVal;
  56. #else
  57. return null;
  58. #endif
  59. }
  60. //javadoc: StereoBM::create()
  61. public static StereoBM create ()
  62. {
  63. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  64. StereoBM retVal = StereoBM.__fromPtr__(calib3d_StereoBM_create_12());
  65. return retVal;
  66. #else
  67. return null;
  68. #endif
  69. }
  70. //
  71. // C++: Rect cv::StereoBM::getROI1()
  72. //
  73. //javadoc: StereoBM::getROI1()
  74. public Rect getROI1 ()
  75. {
  76. ThrowIfDisposed ();
  77. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  78. double[] tmpArray = new double[4];
  79. calib3d_StereoBM_getROI1_10(nativeObj, tmpArray);
  80. Rect retVal = new Rect (tmpArray);
  81. return retVal;
  82. #else
  83. return null;
  84. #endif
  85. }
  86. //
  87. // C++: Rect cv::StereoBM::getROI2()
  88. //
  89. //javadoc: StereoBM::getROI2()
  90. public Rect getROI2 ()
  91. {
  92. ThrowIfDisposed ();
  93. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  94. double[] tmpArray = new double[4];
  95. calib3d_StereoBM_getROI2_10(nativeObj, tmpArray);
  96. Rect retVal = new Rect (tmpArray);
  97. return retVal;
  98. #else
  99. return null;
  100. #endif
  101. }
  102. //
  103. // C++: int cv::StereoBM::getPreFilterCap()
  104. //
  105. //javadoc: StereoBM::getPreFilterCap()
  106. public int getPreFilterCap ()
  107. {
  108. ThrowIfDisposed ();
  109. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  110. int retVal = calib3d_StereoBM_getPreFilterCap_10(nativeObj);
  111. return retVal;
  112. #else
  113. return -1;
  114. #endif
  115. }
  116. //
  117. // C++: int cv::StereoBM::getPreFilterSize()
  118. //
  119. //javadoc: StereoBM::getPreFilterSize()
  120. public int getPreFilterSize ()
  121. {
  122. ThrowIfDisposed ();
  123. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  124. int retVal = calib3d_StereoBM_getPreFilterSize_10(nativeObj);
  125. return retVal;
  126. #else
  127. return -1;
  128. #endif
  129. }
  130. //
  131. // C++: int cv::StereoBM::getPreFilterType()
  132. //
  133. //javadoc: StereoBM::getPreFilterType()
  134. public int getPreFilterType ()
  135. {
  136. ThrowIfDisposed ();
  137. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  138. int retVal = calib3d_StereoBM_getPreFilterType_10(nativeObj);
  139. return retVal;
  140. #else
  141. return -1;
  142. #endif
  143. }
  144. //
  145. // C++: int cv::StereoBM::getSmallerBlockSize()
  146. //
  147. //javadoc: StereoBM::getSmallerBlockSize()
  148. public int getSmallerBlockSize ()
  149. {
  150. ThrowIfDisposed ();
  151. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  152. int retVal = calib3d_StereoBM_getSmallerBlockSize_10(nativeObj);
  153. return retVal;
  154. #else
  155. return -1;
  156. #endif
  157. }
  158. //
  159. // C++: int cv::StereoBM::getTextureThreshold()
  160. //
  161. //javadoc: StereoBM::getTextureThreshold()
  162. public int getTextureThreshold ()
  163. {
  164. ThrowIfDisposed ();
  165. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  166. int retVal = calib3d_StereoBM_getTextureThreshold_10(nativeObj);
  167. return retVal;
  168. #else
  169. return -1;
  170. #endif
  171. }
  172. //
  173. // C++: int cv::StereoBM::getUniquenessRatio()
  174. //
  175. //javadoc: StereoBM::getUniquenessRatio()
  176. public int getUniquenessRatio ()
  177. {
  178. ThrowIfDisposed ();
  179. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  180. int retVal = calib3d_StereoBM_getUniquenessRatio_10(nativeObj);
  181. return retVal;
  182. #else
  183. return -1;
  184. #endif
  185. }
  186. //
  187. // C++: void cv::StereoBM::setPreFilterCap(int preFilterCap)
  188. //
  189. //javadoc: StereoBM::setPreFilterCap(preFilterCap)
  190. public void setPreFilterCap (int preFilterCap)
  191. {
  192. ThrowIfDisposed ();
  193. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  194. calib3d_StereoBM_setPreFilterCap_10(nativeObj, preFilterCap);
  195. return;
  196. #else
  197. return;
  198. #endif
  199. }
  200. //
  201. // C++: void cv::StereoBM::setPreFilterSize(int preFilterSize)
  202. //
  203. //javadoc: StereoBM::setPreFilterSize(preFilterSize)
  204. public void setPreFilterSize (int preFilterSize)
  205. {
  206. ThrowIfDisposed ();
  207. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  208. calib3d_StereoBM_setPreFilterSize_10(nativeObj, preFilterSize);
  209. return;
  210. #else
  211. return;
  212. #endif
  213. }
  214. //
  215. // C++: void cv::StereoBM::setPreFilterType(int preFilterType)
  216. //
  217. //javadoc: StereoBM::setPreFilterType(preFilterType)
  218. public void setPreFilterType (int preFilterType)
  219. {
  220. ThrowIfDisposed ();
  221. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  222. calib3d_StereoBM_setPreFilterType_10(nativeObj, preFilterType);
  223. return;
  224. #else
  225. return;
  226. #endif
  227. }
  228. //
  229. // C++: void cv::StereoBM::setROI1(Rect roi1)
  230. //
  231. //javadoc: StereoBM::setROI1(roi1)
  232. public void setROI1 (Rect roi1)
  233. {
  234. ThrowIfDisposed ();
  235. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  236. calib3d_StereoBM_setROI1_10(nativeObj, roi1.x, roi1.y, roi1.width, roi1.height);
  237. return;
  238. #else
  239. return;
  240. #endif
  241. }
  242. //
  243. // C++: void cv::StereoBM::setROI2(Rect roi2)
  244. //
  245. //javadoc: StereoBM::setROI2(roi2)
  246. public void setROI2 (Rect roi2)
  247. {
  248. ThrowIfDisposed ();
  249. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  250. calib3d_StereoBM_setROI2_10(nativeObj, roi2.x, roi2.y, roi2.width, roi2.height);
  251. return;
  252. #else
  253. return;
  254. #endif
  255. }
  256. //
  257. // C++: void cv::StereoBM::setSmallerBlockSize(int blockSize)
  258. //
  259. //javadoc: StereoBM::setSmallerBlockSize(blockSize)
  260. public void setSmallerBlockSize (int blockSize)
  261. {
  262. ThrowIfDisposed ();
  263. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  264. calib3d_StereoBM_setSmallerBlockSize_10(nativeObj, blockSize);
  265. return;
  266. #else
  267. return;
  268. #endif
  269. }
  270. //
  271. // C++: void cv::StereoBM::setTextureThreshold(int textureThreshold)
  272. //
  273. //javadoc: StereoBM::setTextureThreshold(textureThreshold)
  274. public void setTextureThreshold (int textureThreshold)
  275. {
  276. ThrowIfDisposed ();
  277. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  278. calib3d_StereoBM_setTextureThreshold_10(nativeObj, textureThreshold);
  279. return;
  280. #else
  281. return;
  282. #endif
  283. }
  284. //
  285. // C++: void cv::StereoBM::setUniquenessRatio(int uniquenessRatio)
  286. //
  287. //javadoc: StereoBM::setUniquenessRatio(uniquenessRatio)
  288. public void setUniquenessRatio (int uniquenessRatio)
  289. {
  290. ThrowIfDisposed ();
  291. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  292. calib3d_StereoBM_setUniquenessRatio_10(nativeObj, uniquenessRatio);
  293. return;
  294. #else
  295. return;
  296. #endif
  297. }
  298. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  299. const string LIBNAME = "__Internal";
  300. #else
  301. const string LIBNAME = "opencvforunity";
  302. #endif
  303. // C++: static Ptr_StereoBM cv::StereoBM::create(int numDisparities = 0, int blockSize = 21)
  304. [DllImport (LIBNAME)]
  305. private static extern IntPtr calib3d_StereoBM_create_10 (int numDisparities, int blockSize);
  306. [DllImport (LIBNAME)]
  307. private static extern IntPtr calib3d_StereoBM_create_11 (int numDisparities);
  308. [DllImport (LIBNAME)]
  309. private static extern IntPtr calib3d_StereoBM_create_12 ();
  310. // C++: Rect cv::StereoBM::getROI1()
  311. [DllImport (LIBNAME)]
  312. private static extern void calib3d_StereoBM_getROI1_10 (IntPtr nativeObj, double[] retVal);
  313. // C++: Rect cv::StereoBM::getROI2()
  314. [DllImport (LIBNAME)]
  315. private static extern void calib3d_StereoBM_getROI2_10 (IntPtr nativeObj, double[] retVal);
  316. // C++: int cv::StereoBM::getPreFilterCap()
  317. [DllImport (LIBNAME)]
  318. private static extern int calib3d_StereoBM_getPreFilterCap_10 (IntPtr nativeObj);
  319. // C++: int cv::StereoBM::getPreFilterSize()
  320. [DllImport (LIBNAME)]
  321. private static extern int calib3d_StereoBM_getPreFilterSize_10 (IntPtr nativeObj);
  322. // C++: int cv::StereoBM::getPreFilterType()
  323. [DllImport (LIBNAME)]
  324. private static extern int calib3d_StereoBM_getPreFilterType_10 (IntPtr nativeObj);
  325. // C++: int cv::StereoBM::getSmallerBlockSize()
  326. [DllImport (LIBNAME)]
  327. private static extern int calib3d_StereoBM_getSmallerBlockSize_10 (IntPtr nativeObj);
  328. // C++: int cv::StereoBM::getTextureThreshold()
  329. [DllImport (LIBNAME)]
  330. private static extern int calib3d_StereoBM_getTextureThreshold_10 (IntPtr nativeObj);
  331. // C++: int cv::StereoBM::getUniquenessRatio()
  332. [DllImport (LIBNAME)]
  333. private static extern int calib3d_StereoBM_getUniquenessRatio_10 (IntPtr nativeObj);
  334. // C++: void cv::StereoBM::setPreFilterCap(int preFilterCap)
  335. [DllImport (LIBNAME)]
  336. private static extern void calib3d_StereoBM_setPreFilterCap_10 (IntPtr nativeObj, int preFilterCap);
  337. // C++: void cv::StereoBM::setPreFilterSize(int preFilterSize)
  338. [DllImport (LIBNAME)]
  339. private static extern void calib3d_StereoBM_setPreFilterSize_10 (IntPtr nativeObj, int preFilterSize);
  340. // C++: void cv::StereoBM::setPreFilterType(int preFilterType)
  341. [DllImport (LIBNAME)]
  342. private static extern void calib3d_StereoBM_setPreFilterType_10 (IntPtr nativeObj, int preFilterType);
  343. // C++: void cv::StereoBM::setROI1(Rect roi1)
  344. [DllImport (LIBNAME)]
  345. private static extern void calib3d_StereoBM_setROI1_10 (IntPtr nativeObj, int roi1_x, int roi1_y, int roi1_width, int roi1_height);
  346. // C++: void cv::StereoBM::setROI2(Rect roi2)
  347. [DllImport (LIBNAME)]
  348. private static extern void calib3d_StereoBM_setROI2_10 (IntPtr nativeObj, int roi2_x, int roi2_y, int roi2_width, int roi2_height);
  349. // C++: void cv::StereoBM::setSmallerBlockSize(int blockSize)
  350. [DllImport (LIBNAME)]
  351. private static extern void calib3d_StereoBM_setSmallerBlockSize_10 (IntPtr nativeObj, int blockSize);
  352. // C++: void cv::StereoBM::setTextureThreshold(int textureThreshold)
  353. [DllImport (LIBNAME)]
  354. private static extern void calib3d_StereoBM_setTextureThreshold_10 (IntPtr nativeObj, int textureThreshold);
  355. // C++: void cv::StereoBM::setUniquenessRatio(int uniquenessRatio)
  356. [DllImport (LIBNAME)]
  357. private static extern void calib3d_StereoBM_setUniquenessRatio_10 (IntPtr nativeObj, int uniquenessRatio);
  358. // native support for java finalize()
  359. [DllImport (LIBNAME)]
  360. private static extern void calib3d_StereoBM_delete (IntPtr nativeObj);
  361. }
  362. }