GeneralizedHough.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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.ImgprocModule {
  8. // C++: class GeneralizedHough
  9. //javadoc: GeneralizedHough
  10. public class GeneralizedHough : Algorithm {
  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. imgproc_GeneralizedHough_delete(nativeObj);
  19. nativeObj = IntPtr.Zero;
  20. }
  21. } finally {
  22. base.Dispose(disposing);
  23. }
  24. #else
  25. return;
  26. #endif
  27. }
  28. protected internal GeneralizedHough(IntPtr addr) : base(addr) { }
  29. // internal usage only
  30. public static new GeneralizedHough __fromPtr__(IntPtr addr) { return new GeneralizedHough(addr); }
  31. //
  32. // C++: double cv::GeneralizedHough::getDp()
  33. //
  34. //javadoc: GeneralizedHough::getDp()
  35. public double getDp() {
  36. ThrowIfDisposed();
  37. #if (UNITY_ANDROID && !UNITY_EDITOR)
  38. double retVal = imgproc_GeneralizedHough_getDp_10(nativeObj);
  39. return retVal;
  40. #else
  41. return -1;
  42. #endif
  43. }
  44. //
  45. // C++: double cv::GeneralizedHough::getMinDist()
  46. //
  47. //javadoc: GeneralizedHough::getMinDist()
  48. public double getMinDist() {
  49. ThrowIfDisposed();
  50. #if (UNITY_ANDROID && !UNITY_EDITOR)
  51. double retVal = imgproc_GeneralizedHough_getMinDist_10(nativeObj);
  52. return retVal;
  53. #else
  54. return -1;
  55. #endif
  56. }
  57. //
  58. // C++: int cv::GeneralizedHough::getCannyHighThresh()
  59. //
  60. //javadoc: GeneralizedHough::getCannyHighThresh()
  61. public int getCannyHighThresh() {
  62. ThrowIfDisposed();
  63. #if (UNITY_ANDROID && !UNITY_EDITOR)
  64. int retVal = imgproc_GeneralizedHough_getCannyHighThresh_10(nativeObj);
  65. return retVal;
  66. #else
  67. return -1;
  68. #endif
  69. }
  70. //
  71. // C++: int cv::GeneralizedHough::getCannyLowThresh()
  72. //
  73. //javadoc: GeneralizedHough::getCannyLowThresh()
  74. public int getCannyLowThresh() {
  75. ThrowIfDisposed();
  76. #if (UNITY_ANDROID && !UNITY_EDITOR)
  77. int retVal = imgproc_GeneralizedHough_getCannyLowThresh_10(nativeObj);
  78. return retVal;
  79. #else
  80. return -1;
  81. #endif
  82. }
  83. //
  84. // C++: int cv::GeneralizedHough::getMaxBufferSize()
  85. //
  86. //javadoc: GeneralizedHough::getMaxBufferSize()
  87. public int getMaxBufferSize() {
  88. ThrowIfDisposed();
  89. #if (UNITY_ANDROID && !UNITY_EDITOR)
  90. int retVal = imgproc_GeneralizedHough_getMaxBufferSize_10(nativeObj);
  91. return retVal;
  92. #else
  93. return -1;
  94. #endif
  95. }
  96. //
  97. // C++: void cv::GeneralizedHough::detect(Mat edges, Mat dx, Mat dy, Mat& positions, Mat& votes = Mat())
  98. //
  99. //javadoc: GeneralizedHough::detect(edges, dx, dy, positions, votes)
  100. public void detect(Mat edges, Mat dx, Mat dy, Mat positions, Mat votes) {
  101. ThrowIfDisposed();
  102. if (edges != null) edges.ThrowIfDisposed();
  103. if (dx != null) dx.ThrowIfDisposed();
  104. if (dy != null) dy.ThrowIfDisposed();
  105. if (positions != null) positions.ThrowIfDisposed();
  106. if (votes != null) votes.ThrowIfDisposed();
  107. #if (UNITY_ANDROID && !UNITY_EDITOR)
  108. imgproc_GeneralizedHough_detect_10(nativeObj, edges.nativeObj, dx.nativeObj, dy.nativeObj, positions.nativeObj, votes.nativeObj);
  109. return;
  110. #else
  111. return;
  112. #endif
  113. }
  114. //javadoc: GeneralizedHough::detect(edges, dx, dy, positions)
  115. public void detect(Mat edges, Mat dx, Mat dy, Mat positions) {
  116. ThrowIfDisposed();
  117. if (edges != null) edges.ThrowIfDisposed();
  118. if (dx != null) dx.ThrowIfDisposed();
  119. if (dy != null) dy.ThrowIfDisposed();
  120. if (positions != null) positions.ThrowIfDisposed();
  121. #if (UNITY_ANDROID && !UNITY_EDITOR)
  122. imgproc_GeneralizedHough_detect_11(nativeObj, edges.nativeObj, dx.nativeObj, dy.nativeObj, positions.nativeObj);
  123. return;
  124. #else
  125. return;
  126. #endif
  127. }
  128. //
  129. // C++: void cv::GeneralizedHough::detect(Mat image, Mat& positions, Mat& votes = Mat())
  130. //
  131. //javadoc: GeneralizedHough::detect(image, positions, votes)
  132. public void detect(Mat image, Mat positions, Mat votes) {
  133. ThrowIfDisposed();
  134. if (image != null) image.ThrowIfDisposed();
  135. if (positions != null) positions.ThrowIfDisposed();
  136. if (votes != null) votes.ThrowIfDisposed();
  137. #if (UNITY_ANDROID && !UNITY_EDITOR)
  138. imgproc_GeneralizedHough_detect_12(nativeObj, image.nativeObj, positions.nativeObj, votes.nativeObj);
  139. return;
  140. #else
  141. return;
  142. #endif
  143. }
  144. //javadoc: GeneralizedHough::detect(image, positions)
  145. public void detect(Mat image, Mat positions) {
  146. ThrowIfDisposed();
  147. if (image != null) image.ThrowIfDisposed();
  148. if (positions != null) positions.ThrowIfDisposed();
  149. #if (UNITY_ANDROID && !UNITY_EDITOR)
  150. imgproc_GeneralizedHough_detect_13(nativeObj, image.nativeObj, positions.nativeObj);
  151. return;
  152. #else
  153. return;
  154. #endif
  155. }
  156. //
  157. // C++: void cv::GeneralizedHough::setCannyHighThresh(int cannyHighThresh)
  158. //
  159. //javadoc: GeneralizedHough::setCannyHighThresh(cannyHighThresh)
  160. public void setCannyHighThresh(int cannyHighThresh) {
  161. ThrowIfDisposed();
  162. #if (UNITY_ANDROID && !UNITY_EDITOR)
  163. imgproc_GeneralizedHough_setCannyHighThresh_10(nativeObj, cannyHighThresh);
  164. return;
  165. #else
  166. return;
  167. #endif
  168. }
  169. //
  170. // C++: void cv::GeneralizedHough::setCannyLowThresh(int cannyLowThresh)
  171. //
  172. //javadoc: GeneralizedHough::setCannyLowThresh(cannyLowThresh)
  173. public void setCannyLowThresh(int cannyLowThresh) {
  174. ThrowIfDisposed();
  175. #if (UNITY_ANDROID && !UNITY_EDITOR)
  176. imgproc_GeneralizedHough_setCannyLowThresh_10(nativeObj, cannyLowThresh);
  177. return;
  178. #else
  179. return;
  180. #endif
  181. }
  182. //
  183. // C++: void cv::GeneralizedHough::setDp(double dp)
  184. //
  185. //javadoc: GeneralizedHough::setDp(dp)
  186. public void setDp(double dp) {
  187. ThrowIfDisposed();
  188. #if (UNITY_ANDROID && !UNITY_EDITOR)
  189. imgproc_GeneralizedHough_setDp_10(nativeObj, dp);
  190. return;
  191. #else
  192. return;
  193. #endif
  194. }
  195. //
  196. // C++: void cv::GeneralizedHough::setMaxBufferSize(int maxBufferSize)
  197. //
  198. //javadoc: GeneralizedHough::setMaxBufferSize(maxBufferSize)
  199. public void setMaxBufferSize(int maxBufferSize) {
  200. ThrowIfDisposed();
  201. #if (UNITY_ANDROID && !UNITY_EDITOR)
  202. imgproc_GeneralizedHough_setMaxBufferSize_10(nativeObj, maxBufferSize);
  203. return;
  204. #else
  205. return;
  206. #endif
  207. }
  208. //
  209. // C++: void cv::GeneralizedHough::setMinDist(double minDist)
  210. //
  211. //javadoc: GeneralizedHough::setMinDist(minDist)
  212. public void setMinDist(double minDist) {
  213. ThrowIfDisposed();
  214. #if (UNITY_ANDROID && !UNITY_EDITOR)
  215. imgproc_GeneralizedHough_setMinDist_10(nativeObj, minDist);
  216. return;
  217. #else
  218. return;
  219. #endif
  220. }
  221. //
  222. // C++: void cv::GeneralizedHough::setTemplate(Mat edges, Mat dx, Mat dy, Point templCenter = Point(-1, -1))
  223. //
  224. //javadoc: GeneralizedHough::setTemplate(edges, dx, dy, templCenter)
  225. public void setTemplate(Mat edges, Mat dx, Mat dy, Point templCenter) {
  226. ThrowIfDisposed();
  227. if (edges != null) edges.ThrowIfDisposed();
  228. if (dx != null) dx.ThrowIfDisposed();
  229. if (dy != null) dy.ThrowIfDisposed();
  230. #if (UNITY_ANDROID && !UNITY_EDITOR)
  231. imgproc_GeneralizedHough_setTemplate_10(nativeObj, edges.nativeObj, dx.nativeObj, dy.nativeObj, templCenter.x, templCenter.y);
  232. return;
  233. #else
  234. return;
  235. #endif
  236. }
  237. //javadoc: GeneralizedHough::setTemplate(edges, dx, dy)
  238. public void setTemplate(Mat edges, Mat dx, Mat dy) {
  239. ThrowIfDisposed();
  240. if (edges != null) edges.ThrowIfDisposed();
  241. if (dx != null) dx.ThrowIfDisposed();
  242. if (dy != null) dy.ThrowIfDisposed();
  243. #if (UNITY_ANDROID && !UNITY_EDITOR)
  244. imgproc_GeneralizedHough_setTemplate_11(nativeObj, edges.nativeObj, dx.nativeObj, dy.nativeObj);
  245. return;
  246. #else
  247. return;
  248. #endif
  249. }
  250. //
  251. // C++: void cv::GeneralizedHough::setTemplate(Mat templ, Point templCenter = Point(-1, -1))
  252. //
  253. //javadoc: GeneralizedHough::setTemplate(templ, templCenter)
  254. public void setTemplate(Mat templ, Point templCenter) {
  255. ThrowIfDisposed();
  256. if (templ != null) templ.ThrowIfDisposed();
  257. #if (UNITY_ANDROID && !UNITY_EDITOR)
  258. imgproc_GeneralizedHough_setTemplate_12(nativeObj, templ.nativeObj, templCenter.x, templCenter.y);
  259. return;
  260. #else
  261. return;
  262. #endif
  263. }
  264. //javadoc: GeneralizedHough::setTemplate(templ)
  265. public void setTemplate(Mat templ) {
  266. ThrowIfDisposed();
  267. if (templ != null) templ.ThrowIfDisposed();
  268. #if (UNITY_ANDROID && !UNITY_EDITOR)
  269. imgproc_GeneralizedHough_setTemplate_13(nativeObj, templ.nativeObj);
  270. return;
  271. #else
  272. return;
  273. #endif
  274. }
  275. #if (UNITY_ANDROID && !UNITY_EDITOR)
  276. const string LIBNAME = "opencvforunity";
  277. // C++: double cv::GeneralizedHough::getDp()
  278. [DllImport(LIBNAME)]
  279. private static extern double imgproc_GeneralizedHough_getDp_10(IntPtr nativeObj);
  280. // C++: double cv::GeneralizedHough::getMinDist()
  281. [DllImport(LIBNAME)]
  282. private static extern double imgproc_GeneralizedHough_getMinDist_10(IntPtr nativeObj);
  283. // C++: int cv::GeneralizedHough::getCannyHighThresh()
  284. [DllImport(LIBNAME)]
  285. private static extern int imgproc_GeneralizedHough_getCannyHighThresh_10(IntPtr nativeObj);
  286. // C++: int cv::GeneralizedHough::getCannyLowThresh()
  287. [DllImport(LIBNAME)]
  288. private static extern int imgproc_GeneralizedHough_getCannyLowThresh_10(IntPtr nativeObj);
  289. // C++: int cv::GeneralizedHough::getMaxBufferSize()
  290. [DllImport(LIBNAME)]
  291. private static extern int imgproc_GeneralizedHough_getMaxBufferSize_10(IntPtr nativeObj);
  292. // C++: void cv::GeneralizedHough::detect(Mat edges, Mat dx, Mat dy, Mat& positions, Mat& votes = Mat())
  293. [DllImport(LIBNAME)]
  294. private static extern void imgproc_GeneralizedHough_detect_10(IntPtr nativeObj, IntPtr edges_nativeObj, IntPtr dx_nativeObj, IntPtr dy_nativeObj, IntPtr positions_nativeObj, IntPtr votes_nativeObj);
  295. [DllImport(LIBNAME)]
  296. private static extern void imgproc_GeneralizedHough_detect_11(IntPtr nativeObj, IntPtr edges_nativeObj, IntPtr dx_nativeObj, IntPtr dy_nativeObj, IntPtr positions_nativeObj);
  297. // C++: void cv::GeneralizedHough::detect(Mat image, Mat& positions, Mat& votes = Mat())
  298. [DllImport(LIBNAME)]
  299. private static extern void imgproc_GeneralizedHough_detect_12(IntPtr nativeObj, IntPtr image_nativeObj, IntPtr positions_nativeObj, IntPtr votes_nativeObj);
  300. [DllImport(LIBNAME)]
  301. private static extern void imgproc_GeneralizedHough_detect_13(IntPtr nativeObj, IntPtr image_nativeObj, IntPtr positions_nativeObj);
  302. // C++: void cv::GeneralizedHough::setCannyHighThresh(int cannyHighThresh)
  303. [DllImport(LIBNAME)]
  304. private static extern void imgproc_GeneralizedHough_setCannyHighThresh_10(IntPtr nativeObj, int cannyHighThresh);
  305. // C++: void cv::GeneralizedHough::setCannyLowThresh(int cannyLowThresh)
  306. [DllImport(LIBNAME)]
  307. private static extern void imgproc_GeneralizedHough_setCannyLowThresh_10(IntPtr nativeObj, int cannyLowThresh);
  308. // C++: void cv::GeneralizedHough::setDp(double dp)
  309. [DllImport(LIBNAME)]
  310. private static extern void imgproc_GeneralizedHough_setDp_10(IntPtr nativeObj, double dp);
  311. // C++: void cv::GeneralizedHough::setMaxBufferSize(int maxBufferSize)
  312. [DllImport(LIBNAME)]
  313. private static extern void imgproc_GeneralizedHough_setMaxBufferSize_10(IntPtr nativeObj, int maxBufferSize);
  314. // C++: void cv::GeneralizedHough::setMinDist(double minDist)
  315. [DllImport(LIBNAME)]
  316. private static extern void imgproc_GeneralizedHough_setMinDist_10(IntPtr nativeObj, double minDist);
  317. // C++: void cv::GeneralizedHough::setTemplate(Mat edges, Mat dx, Mat dy, Point templCenter = Point(-1, -1))
  318. [DllImport(LIBNAME)]
  319. private static extern void imgproc_GeneralizedHough_setTemplate_10(IntPtr nativeObj, IntPtr edges_nativeObj, IntPtr dx_nativeObj, IntPtr dy_nativeObj, double templCenter_x, double templCenter_y);
  320. [DllImport(LIBNAME)]
  321. private static extern void imgproc_GeneralizedHough_setTemplate_11(IntPtr nativeObj, IntPtr edges_nativeObj, IntPtr dx_nativeObj, IntPtr dy_nativeObj);
  322. // C++: void cv::GeneralizedHough::setTemplate(Mat templ, Point templCenter = Point(-1, -1))
  323. [DllImport(LIBNAME)]
  324. private static extern void imgproc_GeneralizedHough_setTemplate_12(IntPtr nativeObj, IntPtr templ_nativeObj, double templCenter_x, double templCenter_y);
  325. [DllImport(LIBNAME)]
  326. private static extern void imgproc_GeneralizedHough_setTemplate_13(IntPtr nativeObj, IntPtr templ_nativeObj);
  327. // native support for java finalize()
  328. [DllImport(LIBNAME)]
  329. private static extern void imgproc_GeneralizedHough_delete(IntPtr nativeObj);
  330. #endif
  331. }
  332. }