TonemapDrago.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 TonemapDrago
  9. /**
  10. * Adaptive logarithmic mapping is a fast global tonemapping algorithm that scales the image in
  11. * logarithmic domain.
  12. *
  13. * Since it's a global operator the same function is applied to all the pixels, it is controlled by the
  14. * bias parameter.
  15. *
  16. * Optional saturation enhancement is possible as described in CITE: FL02 .
  17. *
  18. * For more information see CITE: DM03 .
  19. */
  20. public class TonemapDrago : Tonemap
  21. {
  22. protected override void Dispose(bool disposing)
  23. {
  24. try
  25. {
  26. if (disposing)
  27. {
  28. }
  29. if (IsEnabledDispose)
  30. {
  31. if (nativeObj != IntPtr.Zero)
  32. photo_TonemapDrago_delete(nativeObj);
  33. nativeObj = IntPtr.Zero;
  34. }
  35. }
  36. finally
  37. {
  38. base.Dispose(disposing);
  39. }
  40. }
  41. protected internal TonemapDrago(IntPtr addr) : base(addr) { }
  42. // internal usage only
  43. public static new TonemapDrago __fromPtr__(IntPtr addr) { return new TonemapDrago(addr); }
  44. //
  45. // C++: float cv::TonemapDrago::getSaturation()
  46. //
  47. public float getSaturation()
  48. {
  49. ThrowIfDisposed();
  50. return photo_TonemapDrago_getSaturation_10(nativeObj);
  51. }
  52. //
  53. // C++: void cv::TonemapDrago::setSaturation(float saturation)
  54. //
  55. public void setSaturation(float saturation)
  56. {
  57. ThrowIfDisposed();
  58. photo_TonemapDrago_setSaturation_10(nativeObj, saturation);
  59. }
  60. //
  61. // C++: float cv::TonemapDrago::getBias()
  62. //
  63. public float getBias()
  64. {
  65. ThrowIfDisposed();
  66. return photo_TonemapDrago_getBias_10(nativeObj);
  67. }
  68. //
  69. // C++: void cv::TonemapDrago::setBias(float bias)
  70. //
  71. public void setBias(float bias)
  72. {
  73. ThrowIfDisposed();
  74. photo_TonemapDrago_setBias_10(nativeObj, bias);
  75. }
  76. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  77. const string LIBNAME = "__Internal";
  78. #else
  79. const string LIBNAME = "opencvforunity";
  80. #endif
  81. // C++: float cv::TonemapDrago::getSaturation()
  82. [DllImport(LIBNAME)]
  83. private static extern float photo_TonemapDrago_getSaturation_10(IntPtr nativeObj);
  84. // C++: void cv::TonemapDrago::setSaturation(float saturation)
  85. [DllImport(LIBNAME)]
  86. private static extern void photo_TonemapDrago_setSaturation_10(IntPtr nativeObj, float saturation);
  87. // C++: float cv::TonemapDrago::getBias()
  88. [DllImport(LIBNAME)]
  89. private static extern float photo_TonemapDrago_getBias_10(IntPtr nativeObj);
  90. // C++: void cv::TonemapDrago::setBias(float bias)
  91. [DllImport(LIBNAME)]
  92. private static extern void photo_TonemapDrago_setBias_10(IntPtr nativeObj, float bias);
  93. // native support for java finalize()
  94. [DllImport(LIBNAME)]
  95. private static extern void photo_TonemapDrago_delete(IntPtr nativeObj);
  96. }
  97. }