MergeMertens.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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 MergeMertens
  9. //javadoc: MergeMertens
  10. public class MergeMertens : MergeExposures {
  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_MergeMertens_delete(nativeObj);
  19. nativeObj = IntPtr.Zero;
  20. }
  21. } finally {
  22. base.Dispose(disposing);
  23. }
  24. #else
  25. return;
  26. #endif
  27. }
  28. protected internal MergeMertens(IntPtr addr)
  29. : base(addr) {
  30. }
  31. // internal usage only
  32. public static new MergeMertens __fromPtr__(IntPtr addr) {
  33. return new MergeMertens(addr);
  34. }
  35. //
  36. // C++: float cv::MergeMertens::getContrastWeight()
  37. //
  38. //javadoc: MergeMertens::getContrastWeight()
  39. public float getContrastWeight() {
  40. ThrowIfDisposed();
  41. #if (UNITY_ANDROID && !UNITY_EDITOR)
  42. float retVal = photo_MergeMertens_getContrastWeight_10(nativeObj);
  43. return retVal;
  44. #else
  45. return -1;
  46. #endif
  47. }
  48. //
  49. // C++: float cv::MergeMertens::getExposureWeight()
  50. //
  51. //javadoc: MergeMertens::getExposureWeight()
  52. public float getExposureWeight() {
  53. ThrowIfDisposed();
  54. #if (UNITY_ANDROID && !UNITY_EDITOR)
  55. float retVal = photo_MergeMertens_getExposureWeight_10(nativeObj);
  56. return retVal;
  57. #else
  58. return -1;
  59. #endif
  60. }
  61. //
  62. // C++: float cv::MergeMertens::getSaturationWeight()
  63. //
  64. //javadoc: MergeMertens::getSaturationWeight()
  65. public float getSaturationWeight() {
  66. ThrowIfDisposed();
  67. #if (UNITY_ANDROID && !UNITY_EDITOR)
  68. float retVal = photo_MergeMertens_getSaturationWeight_10(nativeObj);
  69. return retVal;
  70. #else
  71. return -1;
  72. #endif
  73. }
  74. //
  75. // C++: void cv::MergeMertens::process(vector_Mat src, Mat& dst, Mat times, Mat response)
  76. //
  77. //javadoc: MergeMertens::process(src, dst, times, response)
  78. public override void process(List<Mat> src, Mat dst, Mat times, Mat response) {
  79. ThrowIfDisposed();
  80. if (dst != null)
  81. dst.ThrowIfDisposed();
  82. if (times != null)
  83. times.ThrowIfDisposed();
  84. if (response != null)
  85. response.ThrowIfDisposed();
  86. #if (UNITY_ANDROID && !UNITY_EDITOR)
  87. Mat src_mat = Converters.vector_Mat_to_Mat(src);
  88. photo_MergeMertens_process_10(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj);
  89. return;
  90. #else
  91. return;
  92. #endif
  93. }
  94. //
  95. // C++: void cv::MergeMertens::process(vector_Mat src, Mat& dst)
  96. //
  97. //javadoc: MergeMertens::process(src, dst)
  98. public void process(List<Mat> src, Mat dst) {
  99. ThrowIfDisposed();
  100. if (dst != null)
  101. dst.ThrowIfDisposed();
  102. #if (UNITY_ANDROID && !UNITY_EDITOR)
  103. Mat src_mat = Converters.vector_Mat_to_Mat(src);
  104. photo_MergeMertens_process_11(nativeObj, src_mat.nativeObj, dst.nativeObj);
  105. return;
  106. #else
  107. return;
  108. #endif
  109. }
  110. //
  111. // C++: void cv::MergeMertens::setContrastWeight(float contrast_weiht)
  112. //
  113. //javadoc: MergeMertens::setContrastWeight(contrast_weiht)
  114. public void setContrastWeight(float contrast_weiht) {
  115. ThrowIfDisposed();
  116. #if (UNITY_ANDROID && !UNITY_EDITOR)
  117. photo_MergeMertens_setContrastWeight_10(nativeObj, contrast_weiht);
  118. return;
  119. #else
  120. return;
  121. #endif
  122. }
  123. //
  124. // C++: void cv::MergeMertens::setExposureWeight(float exposure_weight)
  125. //
  126. //javadoc: MergeMertens::setExposureWeight(exposure_weight)
  127. public void setExposureWeight(float exposure_weight) {
  128. ThrowIfDisposed();
  129. #if (UNITY_ANDROID && !UNITY_EDITOR)
  130. photo_MergeMertens_setExposureWeight_10(nativeObj, exposure_weight);
  131. return;
  132. #else
  133. return;
  134. #endif
  135. }
  136. //
  137. // C++: void cv::MergeMertens::setSaturationWeight(float saturation_weight)
  138. //
  139. //javadoc: MergeMertens::setSaturationWeight(saturation_weight)
  140. public void setSaturationWeight(float saturation_weight) {
  141. ThrowIfDisposed();
  142. #if (UNITY_ANDROID && !UNITY_EDITOR)
  143. photo_MergeMertens_setSaturationWeight_10(nativeObj, saturation_weight);
  144. return;
  145. #else
  146. return;
  147. #endif
  148. }
  149. #if (UNITY_ANDROID && !UNITY_EDITOR)
  150. const string LIBNAME = "opencvforunity";
  151. // C++: float cv::MergeMertens::getContrastWeight()
  152. [DllImport(LIBNAME)]
  153. private static extern float photo_MergeMertens_getContrastWeight_10(IntPtr nativeObj);
  154. // C++: float cv::MergeMertens::getExposureWeight()
  155. [DllImport(LIBNAME)]
  156. private static extern float photo_MergeMertens_getExposureWeight_10(IntPtr nativeObj);
  157. // C++: float cv::MergeMertens::getSaturationWeight()
  158. [DllImport(LIBNAME)]
  159. private static extern float photo_MergeMertens_getSaturationWeight_10(IntPtr nativeObj);
  160. // C++: void cv::MergeMertens::process(vector_Mat src, Mat& dst, Mat times, Mat response)
  161. [DllImport(LIBNAME)]
  162. private static extern void photo_MergeMertens_process_10(IntPtr nativeObj, IntPtr src_mat_nativeObj, IntPtr dst_nativeObj, IntPtr times_nativeObj, IntPtr response_nativeObj);
  163. // C++: void cv::MergeMertens::process(vector_Mat src, Mat& dst)
  164. [DllImport(LIBNAME)]
  165. private static extern void photo_MergeMertens_process_11(IntPtr nativeObj, IntPtr src_mat_nativeObj, IntPtr dst_nativeObj);
  166. // C++: void cv::MergeMertens::setContrastWeight(float contrast_weiht)
  167. [DllImport(LIBNAME)]
  168. private static extern void photo_MergeMertens_setContrastWeight_10(IntPtr nativeObj, float contrast_weiht);
  169. // C++: void cv::MergeMertens::setExposureWeight(float exposure_weight)
  170. [DllImport(LIBNAME)]
  171. private static extern void photo_MergeMertens_setExposureWeight_10(IntPtr nativeObj, float exposure_weight);
  172. // C++: void cv::MergeMertens::setSaturationWeight(float saturation_weight)
  173. [DllImport(LIBNAME)]
  174. private static extern void photo_MergeMertens_setSaturationWeight_10(IntPtr nativeObj, float saturation_weight);
  175. // native support for java finalize()
  176. [DllImport(LIBNAME)]
  177. private static extern void photo_MergeMertens_delete(IntPtr nativeObj);
  178. #endif
  179. }
  180. }