AlignMTB.cs 9.0 KB

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