Tonemap.cs 2.9 KB

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