StereoSGBM.cs 15 KB

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