Fuzzy.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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.FuzzyModule {
  8. // C++: class Fuzzy
  9. //javadoc: Fuzzy
  10. public class Fuzzy {
  11. // C++: enum <unnamed>
  12. public const int LINEAR = 1;
  13. public const int SINUS = 2;
  14. public const int ONE_STEP = 1;
  15. public const int MULTI_STEP = 2;
  16. public const int ITERATIVE = 3;
  17. //
  18. // C++: int cv::ft::FT02D_iteration(Mat matrix, Mat kernel, Mat& output, Mat mask, Mat& maskOutput, bool firstStop)
  19. //
  20. //javadoc: FT02D_iteration(matrix, kernel, output, mask, maskOutput, firstStop)
  21. public static int FT02D_iteration(Mat matrix, Mat kernel, Mat output, Mat mask, Mat maskOutput, bool firstStop) {
  22. if (matrix != null) matrix.ThrowIfDisposed();
  23. if (kernel != null) kernel.ThrowIfDisposed();
  24. if (output != null) output.ThrowIfDisposed();
  25. if (mask != null) mask.ThrowIfDisposed();
  26. if (maskOutput != null) maskOutput.ThrowIfDisposed();
  27. #if (UNITY_ANDROID && !UNITY_EDITOR)
  28. int retVal = fuzzy_Fuzzy_FT02D_1iteration_10(matrix.nativeObj, kernel.nativeObj, output.nativeObj, mask.nativeObj, maskOutput.nativeObj, firstStop);
  29. return retVal;
  30. #else
  31. return -1;
  32. #endif
  33. }
  34. //
  35. // C++: void cv::ft::FT02D_FL_process(Mat matrix, int radius, Mat& output)
  36. //
  37. //javadoc: FT02D_FL_process(matrix, radius, output)
  38. public static void FT02D_FL_process(Mat matrix, int radius, Mat output) {
  39. if (matrix != null) matrix.ThrowIfDisposed();
  40. if (output != null) output.ThrowIfDisposed();
  41. #if (UNITY_ANDROID && !UNITY_EDITOR)
  42. fuzzy_Fuzzy_FT02D_1FL_1process_10(matrix.nativeObj, radius, output.nativeObj);
  43. return;
  44. #else
  45. return;
  46. #endif
  47. }
  48. //
  49. // C++: void cv::ft::FT02D_FL_process_float(Mat matrix, int radius, Mat& output)
  50. //
  51. //javadoc: FT02D_FL_process_float(matrix, radius, output)
  52. public static void FT02D_FL_process_float(Mat matrix, int radius, Mat output) {
  53. if (matrix != null) matrix.ThrowIfDisposed();
  54. if (output != null) output.ThrowIfDisposed();
  55. #if (UNITY_ANDROID && !UNITY_EDITOR)
  56. fuzzy_Fuzzy_FT02D_1FL_1process_1float_10(matrix.nativeObj, radius, output.nativeObj);
  57. return;
  58. #else
  59. return;
  60. #endif
  61. }
  62. //
  63. // C++: void cv::ft::FT02D_components(Mat matrix, Mat kernel, Mat& components, Mat mask = Mat())
  64. //
  65. //javadoc: FT02D_components(matrix, kernel, components, mask)
  66. public static void FT02D_components(Mat matrix, Mat kernel, Mat components, Mat mask) {
  67. if (matrix != null) matrix.ThrowIfDisposed();
  68. if (kernel != null) kernel.ThrowIfDisposed();
  69. if (components != null) components.ThrowIfDisposed();
  70. if (mask != null) mask.ThrowIfDisposed();
  71. #if (UNITY_ANDROID && !UNITY_EDITOR)
  72. fuzzy_Fuzzy_FT02D_1components_10(matrix.nativeObj, kernel.nativeObj, components.nativeObj, mask.nativeObj);
  73. return;
  74. #else
  75. return;
  76. #endif
  77. }
  78. //javadoc: FT02D_components(matrix, kernel, components)
  79. public static void FT02D_components(Mat matrix, Mat kernel, Mat components) {
  80. if (matrix != null) matrix.ThrowIfDisposed();
  81. if (kernel != null) kernel.ThrowIfDisposed();
  82. if (components != null) components.ThrowIfDisposed();
  83. #if (UNITY_ANDROID && !UNITY_EDITOR)
  84. fuzzy_Fuzzy_FT02D_1components_11(matrix.nativeObj, kernel.nativeObj, components.nativeObj);
  85. return;
  86. #else
  87. return;
  88. #endif
  89. }
  90. //
  91. // C++: void cv::ft::FT02D_inverseFT(Mat components, Mat kernel, Mat& output, int width, int height)
  92. //
  93. //javadoc: FT02D_inverseFT(components, kernel, output, width, height)
  94. public static void FT02D_inverseFT(Mat components, Mat kernel, Mat output, int width, int height) {
  95. if (components != null) components.ThrowIfDisposed();
  96. if (kernel != null) kernel.ThrowIfDisposed();
  97. if (output != null) output.ThrowIfDisposed();
  98. #if (UNITY_ANDROID && !UNITY_EDITOR)
  99. fuzzy_Fuzzy_FT02D_1inverseFT_10(components.nativeObj, kernel.nativeObj, output.nativeObj, width, height);
  100. return;
  101. #else
  102. return;
  103. #endif
  104. }
  105. //
  106. // C++: void cv::ft::FT02D_process(Mat matrix, Mat kernel, Mat& output, Mat mask = Mat())
  107. //
  108. //javadoc: FT02D_process(matrix, kernel, output, mask)
  109. public static void FT02D_process(Mat matrix, Mat kernel, Mat output, Mat mask) {
  110. if (matrix != null) matrix.ThrowIfDisposed();
  111. if (kernel != null) kernel.ThrowIfDisposed();
  112. if (output != null) output.ThrowIfDisposed();
  113. if (mask != null) mask.ThrowIfDisposed();
  114. #if (UNITY_ANDROID && !UNITY_EDITOR)
  115. fuzzy_Fuzzy_FT02D_1process_10(matrix.nativeObj, kernel.nativeObj, output.nativeObj, mask.nativeObj);
  116. return;
  117. #else
  118. return;
  119. #endif
  120. }
  121. //javadoc: FT02D_process(matrix, kernel, output)
  122. public static void FT02D_process(Mat matrix, Mat kernel, Mat output) {
  123. if (matrix != null) matrix.ThrowIfDisposed();
  124. if (kernel != null) kernel.ThrowIfDisposed();
  125. if (output != null) output.ThrowIfDisposed();
  126. #if (UNITY_ANDROID && !UNITY_EDITOR)
  127. fuzzy_Fuzzy_FT02D_1process_11(matrix.nativeObj, kernel.nativeObj, output.nativeObj);
  128. return;
  129. #else
  130. return;
  131. #endif
  132. }
  133. //
  134. // C++: void cv::ft::FT12D_components(Mat matrix, Mat kernel, Mat& components)
  135. //
  136. //javadoc: FT12D_components(matrix, kernel, components)
  137. public static void FT12D_components(Mat matrix, Mat kernel, Mat components) {
  138. if (matrix != null) matrix.ThrowIfDisposed();
  139. if (kernel != null) kernel.ThrowIfDisposed();
  140. if (components != null) components.ThrowIfDisposed();
  141. #if (UNITY_ANDROID && !UNITY_EDITOR)
  142. fuzzy_Fuzzy_FT12D_1components_10(matrix.nativeObj, kernel.nativeObj, components.nativeObj);
  143. return;
  144. #else
  145. return;
  146. #endif
  147. }
  148. //
  149. // C++: void cv::ft::FT12D_createPolynomMatrixHorizontal(int radius, Mat& matrix, int chn)
  150. //
  151. //javadoc: FT12D_createPolynomMatrixHorizontal(radius, matrix, chn)
  152. public static void FT12D_createPolynomMatrixHorizontal(int radius, Mat matrix, int chn) {
  153. if (matrix != null) matrix.ThrowIfDisposed();
  154. #if (UNITY_ANDROID && !UNITY_EDITOR)
  155. fuzzy_Fuzzy_FT12D_1createPolynomMatrixHorizontal_10(radius, matrix.nativeObj, chn);
  156. return;
  157. #else
  158. return;
  159. #endif
  160. }
  161. //
  162. // C++: void cv::ft::FT12D_createPolynomMatrixVertical(int radius, Mat& matrix, int chn)
  163. //
  164. //javadoc: FT12D_createPolynomMatrixVertical(radius, matrix, chn)
  165. public static void FT12D_createPolynomMatrixVertical(int radius, Mat matrix, int chn) {
  166. if (matrix != null) matrix.ThrowIfDisposed();
  167. #if (UNITY_ANDROID && !UNITY_EDITOR)
  168. fuzzy_Fuzzy_FT12D_1createPolynomMatrixVertical_10(radius, matrix.nativeObj, chn);
  169. return;
  170. #else
  171. return;
  172. #endif
  173. }
  174. //
  175. // C++: void cv::ft::FT12D_inverseFT(Mat components, Mat kernel, Mat& output, int width, int height)
  176. //
  177. //javadoc: FT12D_inverseFT(components, kernel, output, width, height)
  178. public static void FT12D_inverseFT(Mat components, Mat kernel, Mat output, int width, int height) {
  179. if (components != null) components.ThrowIfDisposed();
  180. if (kernel != null) kernel.ThrowIfDisposed();
  181. if (output != null) output.ThrowIfDisposed();
  182. #if (UNITY_ANDROID && !UNITY_EDITOR)
  183. fuzzy_Fuzzy_FT12D_1inverseFT_10(components.nativeObj, kernel.nativeObj, output.nativeObj, width, height);
  184. return;
  185. #else
  186. return;
  187. #endif
  188. }
  189. //
  190. // C++: void cv::ft::FT12D_polynomial(Mat matrix, Mat kernel, Mat& c00, Mat& c10, Mat& c01, Mat& components, Mat mask = Mat())
  191. //
  192. //javadoc: FT12D_polynomial(matrix, kernel, c00, c10, c01, components, mask)
  193. public static void FT12D_polynomial(Mat matrix, Mat kernel, Mat c00, Mat c10, Mat c01, Mat components, Mat mask) {
  194. if (matrix != null) matrix.ThrowIfDisposed();
  195. if (kernel != null) kernel.ThrowIfDisposed();
  196. if (c00 != null) c00.ThrowIfDisposed();
  197. if (c10 != null) c10.ThrowIfDisposed();
  198. if (c01 != null) c01.ThrowIfDisposed();
  199. if (components != null) components.ThrowIfDisposed();
  200. if (mask != null) mask.ThrowIfDisposed();
  201. #if (UNITY_ANDROID && !UNITY_EDITOR)
  202. fuzzy_Fuzzy_FT12D_1polynomial_10(matrix.nativeObj, kernel.nativeObj, c00.nativeObj, c10.nativeObj, c01.nativeObj, components.nativeObj, mask.nativeObj);
  203. return;
  204. #else
  205. return;
  206. #endif
  207. }
  208. //javadoc: FT12D_polynomial(matrix, kernel, c00, c10, c01, components)
  209. public static void FT12D_polynomial(Mat matrix, Mat kernel, Mat c00, Mat c10, Mat c01, Mat components) {
  210. if (matrix != null) matrix.ThrowIfDisposed();
  211. if (kernel != null) kernel.ThrowIfDisposed();
  212. if (c00 != null) c00.ThrowIfDisposed();
  213. if (c10 != null) c10.ThrowIfDisposed();
  214. if (c01 != null) c01.ThrowIfDisposed();
  215. if (components != null) components.ThrowIfDisposed();
  216. #if (UNITY_ANDROID && !UNITY_EDITOR)
  217. fuzzy_Fuzzy_FT12D_1polynomial_11(matrix.nativeObj, kernel.nativeObj, c00.nativeObj, c10.nativeObj, c01.nativeObj, components.nativeObj);
  218. return;
  219. #else
  220. return;
  221. #endif
  222. }
  223. //
  224. // C++: void cv::ft::FT12D_process(Mat matrix, Mat kernel, Mat& output, Mat mask = Mat())
  225. //
  226. //javadoc: FT12D_process(matrix, kernel, output, mask)
  227. public static void FT12D_process(Mat matrix, Mat kernel, Mat output, Mat mask) {
  228. if (matrix != null) matrix.ThrowIfDisposed();
  229. if (kernel != null) kernel.ThrowIfDisposed();
  230. if (output != null) output.ThrowIfDisposed();
  231. if (mask != null) mask.ThrowIfDisposed();
  232. #if (UNITY_ANDROID && !UNITY_EDITOR)
  233. fuzzy_Fuzzy_FT12D_1process_10(matrix.nativeObj, kernel.nativeObj, output.nativeObj, mask.nativeObj);
  234. return;
  235. #else
  236. return;
  237. #endif
  238. }
  239. //javadoc: FT12D_process(matrix, kernel, output)
  240. public static void FT12D_process(Mat matrix, Mat kernel, Mat output) {
  241. if (matrix != null) matrix.ThrowIfDisposed();
  242. if (kernel != null) kernel.ThrowIfDisposed();
  243. if (output != null) output.ThrowIfDisposed();
  244. #if (UNITY_ANDROID && !UNITY_EDITOR)
  245. fuzzy_Fuzzy_FT12D_1process_11(matrix.nativeObj, kernel.nativeObj, output.nativeObj);
  246. return;
  247. #else
  248. return;
  249. #endif
  250. }
  251. //
  252. // C++: void cv::ft::createKernel(Mat A, Mat B, Mat& kernel, int chn)
  253. //
  254. //javadoc: createKernel1(A, B, kernel, chn)
  255. public static void createKernel1(Mat A, Mat B, Mat kernel, int chn) {
  256. if (A != null) A.ThrowIfDisposed();
  257. if (B != null) B.ThrowIfDisposed();
  258. if (kernel != null) kernel.ThrowIfDisposed();
  259. #if (UNITY_ANDROID && !UNITY_EDITOR)
  260. fuzzy_Fuzzy_createKernel1_10(A.nativeObj, B.nativeObj, kernel.nativeObj, chn);
  261. return;
  262. #else
  263. return;
  264. #endif
  265. }
  266. //
  267. // C++: void cv::ft::createKernel(int function, int radius, Mat& kernel, int chn)
  268. //
  269. //javadoc: createKernel(function, radius, kernel, chn)
  270. public static void createKernel(int function, int radius, Mat kernel, int chn) {
  271. if (kernel != null) kernel.ThrowIfDisposed();
  272. #if (UNITY_ANDROID && !UNITY_EDITOR)
  273. fuzzy_Fuzzy_createKernel_10(function, radius, kernel.nativeObj, chn);
  274. return;
  275. #else
  276. return;
  277. #endif
  278. }
  279. //
  280. // C++: void cv::ft::filter(Mat image, Mat kernel, Mat& output)
  281. //
  282. //javadoc: filter(image, kernel, output)
  283. public static void filter(Mat image, Mat kernel, Mat output) {
  284. if (image != null) image.ThrowIfDisposed();
  285. if (kernel != null) kernel.ThrowIfDisposed();
  286. if (output != null) output.ThrowIfDisposed();
  287. #if (UNITY_ANDROID && !UNITY_EDITOR)
  288. fuzzy_Fuzzy_filter_10(image.nativeObj, kernel.nativeObj, output.nativeObj);
  289. return;
  290. #else
  291. return;
  292. #endif
  293. }
  294. //
  295. // C++: void cv::ft::inpaint(Mat image, Mat mask, Mat& output, int radius, int function, int algorithm)
  296. //
  297. //javadoc: inpaint(image, mask, output, radius, function, algorithm)
  298. public static void inpaint(Mat image, Mat mask, Mat output, int radius, int function, int algorithm) {
  299. if (image != null) image.ThrowIfDisposed();
  300. if (mask != null) mask.ThrowIfDisposed();
  301. if (output != null) output.ThrowIfDisposed();
  302. #if (UNITY_ANDROID && !UNITY_EDITOR)
  303. fuzzy_Fuzzy_inpaint_10(image.nativeObj, mask.nativeObj, output.nativeObj, radius, function, algorithm);
  304. return;
  305. #else
  306. return;
  307. #endif
  308. }
  309. #if (UNITY_ANDROID && !UNITY_EDITOR)
  310. const string LIBNAME = "opencvforunity";
  311. // C++: int cv::ft::FT02D_iteration(Mat matrix, Mat kernel, Mat& output, Mat mask, Mat& maskOutput, bool firstStop)
  312. [DllImport(LIBNAME)]
  313. private static extern int fuzzy_Fuzzy_FT02D_1iteration_10(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr output_nativeObj, IntPtr mask_nativeObj, IntPtr maskOutput_nativeObj, bool firstStop);
  314. // C++: void cv::ft::FT02D_FL_process(Mat matrix, int radius, Mat& output)
  315. [DllImport(LIBNAME)]
  316. private static extern void fuzzy_Fuzzy_FT02D_1FL_1process_10(IntPtr matrix_nativeObj, int radius, IntPtr output_nativeObj);
  317. // C++: void cv::ft::FT02D_FL_process_float(Mat matrix, int radius, Mat& output)
  318. [DllImport(LIBNAME)]
  319. private static extern void fuzzy_Fuzzy_FT02D_1FL_1process_1float_10(IntPtr matrix_nativeObj, int radius, IntPtr output_nativeObj);
  320. // C++: void cv::ft::FT02D_components(Mat matrix, Mat kernel, Mat& components, Mat mask = Mat())
  321. [DllImport(LIBNAME)]
  322. private static extern void fuzzy_Fuzzy_FT02D_1components_10(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr components_nativeObj, IntPtr mask_nativeObj);
  323. [DllImport(LIBNAME)]
  324. private static extern void fuzzy_Fuzzy_FT02D_1components_11(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr components_nativeObj);
  325. // C++: void cv::ft::FT02D_inverseFT(Mat components, Mat kernel, Mat& output, int width, int height)
  326. [DllImport(LIBNAME)]
  327. private static extern void fuzzy_Fuzzy_FT02D_1inverseFT_10(IntPtr components_nativeObj, IntPtr kernel_nativeObj, IntPtr output_nativeObj, int width, int height);
  328. // C++: void cv::ft::FT02D_process(Mat matrix, Mat kernel, Mat& output, Mat mask = Mat())
  329. [DllImport(LIBNAME)]
  330. private static extern void fuzzy_Fuzzy_FT02D_1process_10(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr output_nativeObj, IntPtr mask_nativeObj);
  331. [DllImport(LIBNAME)]
  332. private static extern void fuzzy_Fuzzy_FT02D_1process_11(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr output_nativeObj);
  333. // C++: void cv::ft::FT12D_components(Mat matrix, Mat kernel, Mat& components)
  334. [DllImport(LIBNAME)]
  335. private static extern void fuzzy_Fuzzy_FT12D_1components_10(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr components_nativeObj);
  336. // C++: void cv::ft::FT12D_createPolynomMatrixHorizontal(int radius, Mat& matrix, int chn)
  337. [DllImport(LIBNAME)]
  338. private static extern void fuzzy_Fuzzy_FT12D_1createPolynomMatrixHorizontal_10(int radius, IntPtr matrix_nativeObj, int chn);
  339. // C++: void cv::ft::FT12D_createPolynomMatrixVertical(int radius, Mat& matrix, int chn)
  340. [DllImport(LIBNAME)]
  341. private static extern void fuzzy_Fuzzy_FT12D_1createPolynomMatrixVertical_10(int radius, IntPtr matrix_nativeObj, int chn);
  342. // C++: void cv::ft::FT12D_inverseFT(Mat components, Mat kernel, Mat& output, int width, int height)
  343. [DllImport(LIBNAME)]
  344. private static extern void fuzzy_Fuzzy_FT12D_1inverseFT_10(IntPtr components_nativeObj, IntPtr kernel_nativeObj, IntPtr output_nativeObj, int width, int height);
  345. // C++: void cv::ft::FT12D_polynomial(Mat matrix, Mat kernel, Mat& c00, Mat& c10, Mat& c01, Mat& components, Mat mask = Mat())
  346. [DllImport(LIBNAME)]
  347. private static extern void fuzzy_Fuzzy_FT12D_1polynomial_10(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr c00_nativeObj, IntPtr c10_nativeObj, IntPtr c01_nativeObj, IntPtr components_nativeObj, IntPtr mask_nativeObj);
  348. [DllImport(LIBNAME)]
  349. private static extern void fuzzy_Fuzzy_FT12D_1polynomial_11(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr c00_nativeObj, IntPtr c10_nativeObj, IntPtr c01_nativeObj, IntPtr components_nativeObj);
  350. // C++: void cv::ft::FT12D_process(Mat matrix, Mat kernel, Mat& output, Mat mask = Mat())
  351. [DllImport(LIBNAME)]
  352. private static extern void fuzzy_Fuzzy_FT12D_1process_10(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr output_nativeObj, IntPtr mask_nativeObj);
  353. [DllImport(LIBNAME)]
  354. private static extern void fuzzy_Fuzzy_FT12D_1process_11(IntPtr matrix_nativeObj, IntPtr kernel_nativeObj, IntPtr output_nativeObj);
  355. // C++: void cv::ft::createKernel(Mat A, Mat B, Mat& kernel, int chn)
  356. [DllImport(LIBNAME)]
  357. private static extern void fuzzy_Fuzzy_createKernel1_10(IntPtr A_nativeObj, IntPtr B_nativeObj, IntPtr kernel_nativeObj, int chn);
  358. // C++: void cv::ft::createKernel(int function, int radius, Mat& kernel, int chn)
  359. [DllImport(LIBNAME)]
  360. private static extern void fuzzy_Fuzzy_createKernel_10(int function, int radius, IntPtr kernel_nativeObj, int chn);
  361. // C++: void cv::ft::filter(Mat image, Mat kernel, Mat& output)
  362. [DllImport(LIBNAME)]
  363. private static extern void fuzzy_Fuzzy_filter_10(IntPtr image_nativeObj, IntPtr kernel_nativeObj, IntPtr output_nativeObj);
  364. // C++: void cv::ft::inpaint(Mat image, Mat mask, Mat& output, int radius, int function, int algorithm)
  365. [DllImport(LIBNAME)]
  366. private static extern void fuzzy_Fuzzy_inpaint_10(IntPtr image_nativeObj, IntPtr mask_nativeObj, IntPtr output_nativeObj, int radius, int function, int algorithm);
  367. #endif
  368. }
  369. }