TonemapMantiuk.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 TonemapMantiuk
  9. /**
  10. * This algorithm transforms image to contrast using gradients on all levels of gaussian pyramid,
  11. * transforms contrast values to HVS response and scales the response. After this the image is
  12. * reconstructed from new contrast values.
  13. *
  14. * For more information see CITE: MM06 .
  15. */
  16. public class TonemapMantiuk : Tonemap
  17. {
  18. protected override void Dispose(bool disposing)
  19. {
  20. try
  21. {
  22. if (disposing)
  23. {
  24. }
  25. if (IsEnabledDispose)
  26. {
  27. if (nativeObj != IntPtr.Zero)
  28. photo_TonemapMantiuk_delete(nativeObj);
  29. nativeObj = IntPtr.Zero;
  30. }
  31. }
  32. finally
  33. {
  34. base.Dispose(disposing);
  35. }
  36. }
  37. protected internal TonemapMantiuk(IntPtr addr) : base(addr) { }
  38. // internal usage only
  39. public static new TonemapMantiuk __fromPtr__(IntPtr addr) { return new TonemapMantiuk(addr); }
  40. //
  41. // C++: float cv::TonemapMantiuk::getScale()
  42. //
  43. public float getScale()
  44. {
  45. ThrowIfDisposed();
  46. return photo_TonemapMantiuk_getScale_10(nativeObj);
  47. }
  48. //
  49. // C++: void cv::TonemapMantiuk::setScale(float scale)
  50. //
  51. public void setScale(float scale)
  52. {
  53. ThrowIfDisposed();
  54. photo_TonemapMantiuk_setScale_10(nativeObj, scale);
  55. }
  56. //
  57. // C++: float cv::TonemapMantiuk::getSaturation()
  58. //
  59. public float getSaturation()
  60. {
  61. ThrowIfDisposed();
  62. return photo_TonemapMantiuk_getSaturation_10(nativeObj);
  63. }
  64. //
  65. // C++: void cv::TonemapMantiuk::setSaturation(float saturation)
  66. //
  67. public void setSaturation(float saturation)
  68. {
  69. ThrowIfDisposed();
  70. photo_TonemapMantiuk_setSaturation_10(nativeObj, saturation);
  71. }
  72. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  73. const string LIBNAME = "__Internal";
  74. #else
  75. const string LIBNAME = "opencvforunity";
  76. #endif
  77. // C++: float cv::TonemapMantiuk::getScale()
  78. [DllImport(LIBNAME)]
  79. private static extern float photo_TonemapMantiuk_getScale_10(IntPtr nativeObj);
  80. // C++: void cv::TonemapMantiuk::setScale(float scale)
  81. [DllImport(LIBNAME)]
  82. private static extern void photo_TonemapMantiuk_setScale_10(IntPtr nativeObj, float scale);
  83. // C++: float cv::TonemapMantiuk::getSaturation()
  84. [DllImport(LIBNAME)]
  85. private static extern float photo_TonemapMantiuk_getSaturation_10(IntPtr nativeObj);
  86. // C++: void cv::TonemapMantiuk::setSaturation(float saturation)
  87. [DllImport(LIBNAME)]
  88. private static extern void photo_TonemapMantiuk_setSaturation_10(IntPtr nativeObj, float saturation);
  89. // native support for java finalize()
  90. [DllImport(LIBNAME)]
  91. private static extern void photo_TonemapMantiuk_delete(IntPtr nativeObj);
  92. }
  93. }