TonemapReinhard.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.PhotoModule
  7. {
  8. // C++: class TonemapReinhard
  9. /**
  10. * This is a global tonemapping operator that models human visual system.
  11. *
  12. * Mapping function is controlled by adaptation parameter, that is computed using light adaptation and
  13. * color adaptation.
  14. *
  15. * For more information see CITE: RD05 .
  16. */
  17. public class TonemapReinhard : Tonemap
  18. {
  19. protected override void Dispose(bool disposing)
  20. {
  21. try
  22. {
  23. if (disposing)
  24. {
  25. }
  26. if (IsEnabledDispose)
  27. {
  28. if (nativeObj != IntPtr.Zero)
  29. photo_TonemapReinhard_delete(nativeObj);
  30. nativeObj = IntPtr.Zero;
  31. }
  32. }
  33. finally
  34. {
  35. base.Dispose(disposing);
  36. }
  37. }
  38. protected internal TonemapReinhard(IntPtr addr) : base(addr) { }
  39. // internal usage only
  40. public static new TonemapReinhard __fromPtr__(IntPtr addr) { return new TonemapReinhard(addr); }
  41. //
  42. // C++: float cv::TonemapReinhard::getIntensity()
  43. //
  44. public float getIntensity()
  45. {
  46. ThrowIfDisposed();
  47. return photo_TonemapReinhard_getIntensity_10(nativeObj);
  48. }
  49. //
  50. // C++: void cv::TonemapReinhard::setIntensity(float intensity)
  51. //
  52. public void setIntensity(float intensity)
  53. {
  54. ThrowIfDisposed();
  55. photo_TonemapReinhard_setIntensity_10(nativeObj, intensity);
  56. }
  57. //
  58. // C++: float cv::TonemapReinhard::getLightAdaptation()
  59. //
  60. public float getLightAdaptation()
  61. {
  62. ThrowIfDisposed();
  63. return photo_TonemapReinhard_getLightAdaptation_10(nativeObj);
  64. }
  65. //
  66. // C++: void cv::TonemapReinhard::setLightAdaptation(float light_adapt)
  67. //
  68. public void setLightAdaptation(float light_adapt)
  69. {
  70. ThrowIfDisposed();
  71. photo_TonemapReinhard_setLightAdaptation_10(nativeObj, light_adapt);
  72. }
  73. //
  74. // C++: float cv::TonemapReinhard::getColorAdaptation()
  75. //
  76. public float getColorAdaptation()
  77. {
  78. ThrowIfDisposed();
  79. return photo_TonemapReinhard_getColorAdaptation_10(nativeObj);
  80. }
  81. //
  82. // C++: void cv::TonemapReinhard::setColorAdaptation(float color_adapt)
  83. //
  84. public void setColorAdaptation(float color_adapt)
  85. {
  86. ThrowIfDisposed();
  87. photo_TonemapReinhard_setColorAdaptation_10(nativeObj, color_adapt);
  88. }
  89. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  90. const string LIBNAME = "__Internal";
  91. #else
  92. const string LIBNAME = "opencvforunity";
  93. #endif
  94. // C++: float cv::TonemapReinhard::getIntensity()
  95. [DllImport(LIBNAME)]
  96. private static extern float photo_TonemapReinhard_getIntensity_10(IntPtr nativeObj);
  97. // C++: void cv::TonemapReinhard::setIntensity(float intensity)
  98. [DllImport(LIBNAME)]
  99. private static extern void photo_TonemapReinhard_setIntensity_10(IntPtr nativeObj, float intensity);
  100. // C++: float cv::TonemapReinhard::getLightAdaptation()
  101. [DllImport(LIBNAME)]
  102. private static extern float photo_TonemapReinhard_getLightAdaptation_10(IntPtr nativeObj);
  103. // C++: void cv::TonemapReinhard::setLightAdaptation(float light_adapt)
  104. [DllImport(LIBNAME)]
  105. private static extern void photo_TonemapReinhard_setLightAdaptation_10(IntPtr nativeObj, float light_adapt);
  106. // C++: float cv::TonemapReinhard::getColorAdaptation()
  107. [DllImport(LIBNAME)]
  108. private static extern float photo_TonemapReinhard_getColorAdaptation_10(IntPtr nativeObj);
  109. // C++: void cv::TonemapReinhard::setColorAdaptation(float color_adapt)
  110. [DllImport(LIBNAME)]
  111. private static extern void photo_TonemapReinhard_setColorAdaptation_10(IntPtr nativeObj, float color_adapt);
  112. // native support for java finalize()
  113. [DllImport(LIBNAME)]
  114. private static extern void photo_TonemapReinhard_delete(IntPtr nativeObj);
  115. }
  116. }