AlignMTB.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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.PhotoModule
  8. {
  9. // C++: class AlignMTB
  10. //javadoc: AlignMTB
  11. public class AlignMTB : AlignExposures
  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. photo_AlignMTB_delete (nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal AlignMTB (IntPtr addr)
  32. : base (addr)
  33. {
  34. }
  35. // internal usage only
  36. public static new AlignMTB __fromPtr__ (IntPtr addr)
  37. {
  38. return new AlignMTB (addr);
  39. }
  40. //
  41. // C++: Point cv::AlignMTB::calculateShift(Mat img0, Mat img1)
  42. //
  43. //javadoc: AlignMTB::calculateShift(img0, img1)
  44. public Point calculateShift (Mat img0, Mat img1)
  45. {
  46. ThrowIfDisposed ();
  47. if (img0 != null)
  48. img0.ThrowIfDisposed ();
  49. if (img1 != null)
  50. img1.ThrowIfDisposed ();
  51. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  52. double[] tmpArray = new double[2];
  53. photo_AlignMTB_calculateShift_10 (nativeObj, img0.nativeObj, img1.nativeObj, tmpArray);
  54. Point retVal = new Point (tmpArray);
  55. return retVal;
  56. #else
  57. return null;
  58. #endif
  59. }
  60. //
  61. // C++: bool cv::AlignMTB::getCut()
  62. //
  63. //javadoc: AlignMTB::getCut()
  64. public bool getCut ()
  65. {
  66. ThrowIfDisposed ();
  67. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  68. bool retVal = photo_AlignMTB_getCut_10 (nativeObj);
  69. return retVal;
  70. #else
  71. return false;
  72. #endif
  73. }
  74. //
  75. // C++: int cv::AlignMTB::getExcludeRange()
  76. //
  77. //javadoc: AlignMTB::getExcludeRange()
  78. public int getExcludeRange ()
  79. {
  80. ThrowIfDisposed ();
  81. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  82. int retVal = photo_AlignMTB_getExcludeRange_10 (nativeObj);
  83. return retVal;
  84. #else
  85. return -1;
  86. #endif
  87. }
  88. //
  89. // C++: int cv::AlignMTB::getMaxBits()
  90. //
  91. //javadoc: AlignMTB::getMaxBits()
  92. public int getMaxBits ()
  93. {
  94. ThrowIfDisposed ();
  95. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  96. int retVal = photo_AlignMTB_getMaxBits_10 (nativeObj);
  97. return retVal;
  98. #else
  99. return -1;
  100. #endif
  101. }
  102. //
  103. // C++: void cv::AlignMTB::computeBitmaps(Mat img, Mat& tb, Mat& eb)
  104. //
  105. //javadoc: AlignMTB::computeBitmaps(img, tb, eb)
  106. public void computeBitmaps (Mat img, Mat tb, Mat eb)
  107. {
  108. ThrowIfDisposed ();
  109. if (img != null)
  110. img.ThrowIfDisposed ();
  111. if (tb != null)
  112. tb.ThrowIfDisposed ();
  113. if (eb != null)
  114. eb.ThrowIfDisposed ();
  115. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  116. photo_AlignMTB_computeBitmaps_10 (nativeObj, img.nativeObj, tb.nativeObj, eb.nativeObj);
  117. return;
  118. #else
  119. return;
  120. #endif
  121. }
  122. //
  123. // C++: void cv::AlignMTB::process(vector_Mat src, vector_Mat dst, Mat times, Mat response)
  124. //
  125. //javadoc: AlignMTB::process(src, dst, times, response)
  126. public override void process (List<Mat> src, List<Mat> dst, Mat times, Mat response)
  127. {
  128. ThrowIfDisposed ();
  129. if (times != null)
  130. times.ThrowIfDisposed ();
  131. if (response != null)
  132. response.ThrowIfDisposed ();
  133. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  134. Mat src_mat = Converters.vector_Mat_to_Mat (src);
  135. Mat dst_mat = Converters.vector_Mat_to_Mat (dst);
  136. photo_AlignMTB_process_10 (nativeObj, src_mat.nativeObj, dst_mat.nativeObj, times.nativeObj, response.nativeObj);
  137. return;
  138. #else
  139. return;
  140. #endif
  141. }
  142. //
  143. // C++: void cv::AlignMTB::process(vector_Mat src, vector_Mat dst)
  144. //
  145. //javadoc: AlignMTB::process(src, dst)
  146. public void process (List<Mat> src, List<Mat> dst)
  147. {
  148. ThrowIfDisposed ();
  149. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  150. Mat src_mat = Converters.vector_Mat_to_Mat (src);
  151. Mat dst_mat = Converters.vector_Mat_to_Mat (dst);
  152. photo_AlignMTB_process_11 (nativeObj, src_mat.nativeObj, dst_mat.nativeObj);
  153. return;
  154. #else
  155. return;
  156. #endif
  157. }
  158. //
  159. // C++: void cv::AlignMTB::setCut(bool value)
  160. //
  161. //javadoc: AlignMTB::setCut(value)
  162. public void setCut (bool value)
  163. {
  164. ThrowIfDisposed ();
  165. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  166. photo_AlignMTB_setCut_10 (nativeObj, value);
  167. return;
  168. #else
  169. return;
  170. #endif
  171. }
  172. //
  173. // C++: void cv::AlignMTB::setExcludeRange(int exclude_range)
  174. //
  175. //javadoc: AlignMTB::setExcludeRange(exclude_range)
  176. public void setExcludeRange (int exclude_range)
  177. {
  178. ThrowIfDisposed ();
  179. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  180. photo_AlignMTB_setExcludeRange_10 (nativeObj, exclude_range);
  181. return;
  182. #else
  183. return;
  184. #endif
  185. }
  186. //
  187. // C++: void cv::AlignMTB::setMaxBits(int max_bits)
  188. //
  189. //javadoc: AlignMTB::setMaxBits(max_bits)
  190. public void setMaxBits (int max_bits)
  191. {
  192. ThrowIfDisposed ();
  193. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  194. photo_AlignMTB_setMaxBits_10 (nativeObj, max_bits);
  195. return;
  196. #else
  197. return;
  198. #endif
  199. }
  200. //
  201. // C++: void cv::AlignMTB::shiftMat(Mat src, Mat& dst, Point shift)
  202. //
  203. //javadoc: AlignMTB::shiftMat(src, dst, shift)
  204. public void shiftMat (Mat src, Mat dst, Point shift)
  205. {
  206. ThrowIfDisposed ();
  207. if (src != null)
  208. src.ThrowIfDisposed ();
  209. if (dst != null)
  210. dst.ThrowIfDisposed ();
  211. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  212. photo_AlignMTB_shiftMat_10 (nativeObj, src.nativeObj, dst.nativeObj, shift.x, shift.y);
  213. return;
  214. #else
  215. return;
  216. #endif
  217. }
  218. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  219. const string LIBNAME = "__Internal";
  220. #else
  221. const string LIBNAME = "opencvforunity";
  222. #endif
  223. // C++: Point cv::AlignMTB::calculateShift(Mat img0, Mat img1)
  224. [DllImport (LIBNAME)]
  225. private static extern void photo_AlignMTB_calculateShift_10 (IntPtr nativeObj, IntPtr img0_nativeObj, IntPtr img1_nativeObj, double[] retVal);
  226. // C++: bool cv::AlignMTB::getCut()
  227. [DllImport (LIBNAME)]
  228. private static extern bool photo_AlignMTB_getCut_10 (IntPtr nativeObj);
  229. // C++: int cv::AlignMTB::getExcludeRange()
  230. [DllImport (LIBNAME)]
  231. private static extern int photo_AlignMTB_getExcludeRange_10 (IntPtr nativeObj);
  232. // C++: int cv::AlignMTB::getMaxBits()
  233. [DllImport (LIBNAME)]
  234. private static extern int photo_AlignMTB_getMaxBits_10 (IntPtr nativeObj);
  235. // C++: void cv::AlignMTB::computeBitmaps(Mat img, Mat& tb, Mat& eb)
  236. [DllImport (LIBNAME)]
  237. private static extern void photo_AlignMTB_computeBitmaps_10 (IntPtr nativeObj, IntPtr img_nativeObj, IntPtr tb_nativeObj, IntPtr eb_nativeObj);
  238. // C++: void cv::AlignMTB::process(vector_Mat src, vector_Mat dst, Mat times, Mat response)
  239. [DllImport (LIBNAME)]
  240. private static extern void photo_AlignMTB_process_10 (IntPtr nativeObj, IntPtr src_mat_nativeObj, IntPtr dst_mat_nativeObj, IntPtr times_nativeObj, IntPtr response_nativeObj);
  241. // C++: void cv::AlignMTB::process(vector_Mat src, vector_Mat dst)
  242. [DllImport (LIBNAME)]
  243. private static extern void photo_AlignMTB_process_11 (IntPtr nativeObj, IntPtr src_mat_nativeObj, IntPtr dst_mat_nativeObj);
  244. // C++: void cv::AlignMTB::setCut(bool value)
  245. [DllImport (LIBNAME)]
  246. private static extern void photo_AlignMTB_setCut_10 (IntPtr nativeObj, bool value);
  247. // C++: void cv::AlignMTB::setExcludeRange(int exclude_range)
  248. [DllImport (LIBNAME)]
  249. private static extern void photo_AlignMTB_setExcludeRange_10 (IntPtr nativeObj, int exclude_range);
  250. // C++: void cv::AlignMTB::setMaxBits(int max_bits)
  251. [DllImport (LIBNAME)]
  252. private static extern void photo_AlignMTB_setMaxBits_10 (IntPtr nativeObj, int max_bits);
  253. // C++: void cv::AlignMTB::shiftMat(Mat src, Mat& dst, Point shift)
  254. [DllImport (LIBNAME)]
  255. private static extern void photo_AlignMTB_shiftMat_10 (IntPtr nativeObj, IntPtr src_nativeObj, IntPtr dst_nativeObj, double shift_x, double shift_y);
  256. // native support for java finalize()
  257. [DllImport (LIBNAME)]
  258. private static extern void photo_AlignMTB_delete (IntPtr nativeObj);
  259. }
  260. }