Tonemap.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 Tonemap
  10. //javadoc: Tonemap
  11. public class Tonemap : Algorithm
  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_Tonemap_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal Tonemap (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new Tonemap __fromPtr__ (IntPtr addr) { return new Tonemap (addr); }
  34. //
  35. // C++: float cv::Tonemap::getGamma()
  36. //
  37. //javadoc: Tonemap::getGamma()
  38. public float getGamma ()
  39. {
  40. ThrowIfDisposed ();
  41. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  42. float retVal = photo_Tonemap_getGamma_10(nativeObj);
  43. return retVal;
  44. #else
  45. return -1;
  46. #endif
  47. }
  48. //
  49. // C++: void cv::Tonemap::process(Mat src, Mat& dst)
  50. //
  51. //javadoc: Tonemap::process(src, dst)
  52. public void process (Mat src, Mat dst)
  53. {
  54. ThrowIfDisposed ();
  55. if (src != null) src.ThrowIfDisposed ();
  56. if (dst != null) dst.ThrowIfDisposed ();
  57. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  58. photo_Tonemap_process_10(nativeObj, src.nativeObj, dst.nativeObj);
  59. return;
  60. #else
  61. return;
  62. #endif
  63. }
  64. //
  65. // C++: void cv::Tonemap::setGamma(float gamma)
  66. //
  67. //javadoc: Tonemap::setGamma(gamma)
  68. public void setGamma (float gamma)
  69. {
  70. ThrowIfDisposed ();
  71. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  72. photo_Tonemap_setGamma_10(nativeObj, gamma);
  73. return;
  74. #else
  75. return;
  76. #endif
  77. }
  78. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  79. const string LIBNAME = "__Internal";
  80. #else
  81. const string LIBNAME = "opencvforunity";
  82. #endif
  83. // C++: float cv::Tonemap::getGamma()
  84. [DllImport (LIBNAME)]
  85. private static extern float photo_Tonemap_getGamma_10 (IntPtr nativeObj);
  86. // C++: void cv::Tonemap::process(Mat src, Mat& dst)
  87. [DllImport (LIBNAME)]
  88. private static extern void photo_Tonemap_process_10 (IntPtr nativeObj, IntPtr src_nativeObj, IntPtr dst_nativeObj);
  89. // C++: void cv::Tonemap::setGamma(float gamma)
  90. [DllImport (LIBNAME)]
  91. private static extern void photo_Tonemap_setGamma_10 (IntPtr nativeObj, float gamma);
  92. // native support for java finalize()
  93. [DllImport (LIBNAME)]
  94. private static extern void photo_Tonemap_delete (IntPtr nativeObj);
  95. }
  96. }