StereoSGBM.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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 StereoSGBM
  10. //javadoc: StereoSGBM
  11. public class StereoSGBM : 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_StereoSGBM_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal StereoSGBM (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new StereoSGBM __fromPtr__ (IntPtr addr) { return new StereoSGBM (addr); }
  34. // C++: enum <unnamed>
  35. public const int MODE_SGBM = 0;
  36. public const int MODE_HH = 1;
  37. public const int MODE_SGBM_3WAY = 2;
  38. public const int MODE_HH4 = 3;
  39. //
  40. // C++: static Ptr_StereoSGBM cv::StereoSGBM::create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = StereoSGBM::MODE_SGBM)
  41. //
  42. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, mode)
  43. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, int mode)
  44. {
  45. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  46. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_10(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, mode));
  47. return retVal;
  48. #else
  49. return null;
  50. #endif
  51. }
  52. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange)
  53. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange)
  54. {
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_11(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange));
  57. return retVal;
  58. #else
  59. return null;
  60. #endif
  61. }
  62. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize)
  63. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize)
  64. {
  65. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  66. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_12(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize));
  67. return retVal;
  68. #else
  69. return null;
  70. #endif
  71. }
  72. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio)
  73. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio)
  74. {
  75. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  76. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_13(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio));
  77. return retVal;
  78. #else
  79. return null;
  80. #endif
  81. }
  82. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap)
  83. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap)
  84. {
  85. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  86. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_14(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap));
  87. return retVal;
  88. #else
  89. return null;
  90. #endif
  91. }
  92. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff)
  93. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff)
  94. {
  95. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  96. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_15(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff));
  97. return retVal;
  98. #else
  99. return null;
  100. #endif
  101. }
  102. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2)
  103. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize, int P1, int P2)
  104. {
  105. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  106. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_16(minDisparity, numDisparities, blockSize, P1, P2));
  107. return retVal;
  108. #else
  109. return null;
  110. #endif
  111. }
  112. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1)
  113. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize, int P1)
  114. {
  115. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  116. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_17(minDisparity, numDisparities, blockSize, P1));
  117. return retVal;
  118. #else
  119. return null;
  120. #endif
  121. }
  122. //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize)
  123. public static StereoSGBM create (int minDisparity, int numDisparities, int blockSize)
  124. {
  125. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  126. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_18(minDisparity, numDisparities, blockSize));
  127. return retVal;
  128. #else
  129. return null;
  130. #endif
  131. }
  132. //javadoc: StereoSGBM::create(minDisparity, numDisparities)
  133. public static StereoSGBM create (int minDisparity, int numDisparities)
  134. {
  135. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  136. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_19(minDisparity, numDisparities));
  137. return retVal;
  138. #else
  139. return null;
  140. #endif
  141. }
  142. //javadoc: StereoSGBM::create(minDisparity)
  143. public static StereoSGBM create (int minDisparity)
  144. {
  145. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  146. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_110(minDisparity));
  147. return retVal;
  148. #else
  149. return null;
  150. #endif
  151. }
  152. //javadoc: StereoSGBM::create()
  153. public static StereoSGBM create ()
  154. {
  155. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  156. StereoSGBM retVal = StereoSGBM.__fromPtr__(calib3d_StereoSGBM_create_111());
  157. return retVal;
  158. #else
  159. return null;
  160. #endif
  161. }
  162. //
  163. // C++: int cv::StereoSGBM::getMode()
  164. //
  165. //javadoc: StereoSGBM::getMode()
  166. public int getMode ()
  167. {
  168. ThrowIfDisposed ();
  169. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  170. int retVal = calib3d_StereoSGBM_getMode_10(nativeObj);
  171. return retVal;
  172. #else
  173. return -1;
  174. #endif
  175. }
  176. //
  177. // C++: int cv::StereoSGBM::getP1()
  178. //
  179. //javadoc: StereoSGBM::getP1()
  180. public int getP1 ()
  181. {
  182. ThrowIfDisposed ();
  183. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  184. int retVal = calib3d_StereoSGBM_getP1_10(nativeObj);
  185. return retVal;
  186. #else
  187. return -1;
  188. #endif
  189. }
  190. //
  191. // C++: int cv::StereoSGBM::getP2()
  192. //
  193. //javadoc: StereoSGBM::getP2()
  194. public int getP2 ()
  195. {
  196. ThrowIfDisposed ();
  197. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  198. int retVal = calib3d_StereoSGBM_getP2_10(nativeObj);
  199. return retVal;
  200. #else
  201. return -1;
  202. #endif
  203. }
  204. //
  205. // C++: int cv::StereoSGBM::getPreFilterCap()
  206. //
  207. //javadoc: StereoSGBM::getPreFilterCap()
  208. public int getPreFilterCap ()
  209. {
  210. ThrowIfDisposed ();
  211. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  212. int retVal = calib3d_StereoSGBM_getPreFilterCap_10(nativeObj);
  213. return retVal;
  214. #else
  215. return -1;
  216. #endif
  217. }
  218. //
  219. // C++: int cv::StereoSGBM::getUniquenessRatio()
  220. //
  221. //javadoc: StereoSGBM::getUniquenessRatio()
  222. public int getUniquenessRatio ()
  223. {
  224. ThrowIfDisposed ();
  225. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  226. int retVal = calib3d_StereoSGBM_getUniquenessRatio_10(nativeObj);
  227. return retVal;
  228. #else
  229. return -1;
  230. #endif
  231. }
  232. //
  233. // C++: void cv::StereoSGBM::setMode(int mode)
  234. //
  235. //javadoc: StereoSGBM::setMode(mode)
  236. public void setMode (int mode)
  237. {
  238. ThrowIfDisposed ();
  239. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  240. calib3d_StereoSGBM_setMode_10(nativeObj, mode);
  241. return;
  242. #else
  243. return;
  244. #endif
  245. }
  246. //
  247. // C++: void cv::StereoSGBM::setP1(int P1)
  248. //
  249. //javadoc: StereoSGBM::setP1(P1)
  250. public void setP1 (int P1)
  251. {
  252. ThrowIfDisposed ();
  253. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  254. calib3d_StereoSGBM_setP1_10(nativeObj, P1);
  255. return;
  256. #else
  257. return;
  258. #endif
  259. }
  260. //
  261. // C++: void cv::StereoSGBM::setP2(int P2)
  262. //
  263. //javadoc: StereoSGBM::setP2(P2)
  264. public void setP2 (int P2)
  265. {
  266. ThrowIfDisposed ();
  267. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  268. calib3d_StereoSGBM_setP2_10(nativeObj, P2);
  269. return;
  270. #else
  271. return;
  272. #endif
  273. }
  274. //
  275. // C++: void cv::StereoSGBM::setPreFilterCap(int preFilterCap)
  276. //
  277. //javadoc: StereoSGBM::setPreFilterCap(preFilterCap)
  278. public void setPreFilterCap (int preFilterCap)
  279. {
  280. ThrowIfDisposed ();
  281. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  282. calib3d_StereoSGBM_setPreFilterCap_10(nativeObj, preFilterCap);
  283. return;
  284. #else
  285. return;
  286. #endif
  287. }
  288. //
  289. // C++: void cv::StereoSGBM::setUniquenessRatio(int uniquenessRatio)
  290. //
  291. //javadoc: StereoSGBM::setUniquenessRatio(uniquenessRatio)
  292. public void setUniquenessRatio (int uniquenessRatio)
  293. {
  294. ThrowIfDisposed ();
  295. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  296. calib3d_StereoSGBM_setUniquenessRatio_10(nativeObj, uniquenessRatio);
  297. return;
  298. #else
  299. return;
  300. #endif
  301. }
  302. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  303. const string LIBNAME = "__Internal";
  304. #else
  305. const string LIBNAME = "opencvforunity";
  306. #endif
  307. // C++: static Ptr_StereoSGBM cv::StereoSGBM::create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = StereoSGBM::MODE_SGBM)
  308. [DllImport (LIBNAME)]
  309. private static extern IntPtr calib3d_StereoSGBM_create_10 (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, int mode);
  310. [DllImport (LIBNAME)]
  311. private static extern IntPtr calib3d_StereoSGBM_create_11 (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange);
  312. [DllImport (LIBNAME)]
  313. private static extern IntPtr calib3d_StereoSGBM_create_12 (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize);
  314. [DllImport (LIBNAME)]
  315. private static extern IntPtr calib3d_StereoSGBM_create_13 (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio);
  316. [DllImport (LIBNAME)]
  317. private static extern IntPtr calib3d_StereoSGBM_create_14 (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap);
  318. [DllImport (LIBNAME)]
  319. private static extern IntPtr calib3d_StereoSGBM_create_15 (int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff);
  320. [DllImport (LIBNAME)]
  321. private static extern IntPtr calib3d_StereoSGBM_create_16 (int minDisparity, int numDisparities, int blockSize, int P1, int P2);
  322. [DllImport (LIBNAME)]
  323. private static extern IntPtr calib3d_StereoSGBM_create_17 (int minDisparity, int numDisparities, int blockSize, int P1);
  324. [DllImport (LIBNAME)]
  325. private static extern IntPtr calib3d_StereoSGBM_create_18 (int minDisparity, int numDisparities, int blockSize);
  326. [DllImport (LIBNAME)]
  327. private static extern IntPtr calib3d_StereoSGBM_create_19 (int minDisparity, int numDisparities);
  328. [DllImport (LIBNAME)]
  329. private static extern IntPtr calib3d_StereoSGBM_create_110 (int minDisparity);
  330. [DllImport (LIBNAME)]
  331. private static extern IntPtr calib3d_StereoSGBM_create_111 ();
  332. // C++: int cv::StereoSGBM::getMode()
  333. [DllImport (LIBNAME)]
  334. private static extern int calib3d_StereoSGBM_getMode_10 (IntPtr nativeObj);
  335. // C++: int cv::StereoSGBM::getP1()
  336. [DllImport (LIBNAME)]
  337. private static extern int calib3d_StereoSGBM_getP1_10 (IntPtr nativeObj);
  338. // C++: int cv::StereoSGBM::getP2()
  339. [DllImport (LIBNAME)]
  340. private static extern int calib3d_StereoSGBM_getP2_10 (IntPtr nativeObj);
  341. // C++: int cv::StereoSGBM::getPreFilterCap()
  342. [DllImport (LIBNAME)]
  343. private static extern int calib3d_StereoSGBM_getPreFilterCap_10 (IntPtr nativeObj);
  344. // C++: int cv::StereoSGBM::getUniquenessRatio()
  345. [DllImport (LIBNAME)]
  346. private static extern int calib3d_StereoSGBM_getUniquenessRatio_10 (IntPtr nativeObj);
  347. // C++: void cv::StereoSGBM::setMode(int mode)
  348. [DllImport (LIBNAME)]
  349. private static extern void calib3d_StereoSGBM_setMode_10 (IntPtr nativeObj, int mode);
  350. // C++: void cv::StereoSGBM::setP1(int P1)
  351. [DllImport (LIBNAME)]
  352. private static extern void calib3d_StereoSGBM_setP1_10 (IntPtr nativeObj, int P1);
  353. // C++: void cv::StereoSGBM::setP2(int P2)
  354. [DllImport (LIBNAME)]
  355. private static extern void calib3d_StereoSGBM_setP2_10 (IntPtr nativeObj, int P2);
  356. // C++: void cv::StereoSGBM::setPreFilterCap(int preFilterCap)
  357. [DllImport (LIBNAME)]
  358. private static extern void calib3d_StereoSGBM_setPreFilterCap_10 (IntPtr nativeObj, int preFilterCap);
  359. // C++: void cv::StereoSGBM::setUniquenessRatio(int uniquenessRatio)
  360. [DllImport (LIBNAME)]
  361. private static extern void calib3d_StereoSGBM_setUniquenessRatio_10 (IntPtr nativeObj, int uniquenessRatio);
  362. // native support for java finalize()
  363. [DllImport (LIBNAME)]
  364. private static extern void calib3d_StereoSGBM_delete (IntPtr nativeObj);
  365. }
  366. }