CalibrateDebevec.cs 4.3 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 CalibrateDebevec
  9. /**
  10. * Inverse camera response function is extracted for each brightness value by minimizing an objective
  11. * function as linear system. Objective function is constructed using pixel values on the same position
  12. * in all images, extra term is added to make the result smoother.
  13. *
  14. * For more information see CITE: DM97 .
  15. */
  16. public class CalibrateDebevec : CalibrateCRF
  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_CalibrateDebevec_delete(nativeObj);
  29. nativeObj = IntPtr.Zero;
  30. }
  31. }
  32. finally
  33. {
  34. base.Dispose(disposing);
  35. }
  36. }
  37. protected internal CalibrateDebevec(IntPtr addr) : base(addr) { }
  38. // internal usage only
  39. public static new CalibrateDebevec __fromPtr__(IntPtr addr) { return new CalibrateDebevec(addr); }
  40. //
  41. // C++: float cv::CalibrateDebevec::getLambda()
  42. //
  43. public float getLambda()
  44. {
  45. ThrowIfDisposed();
  46. return photo_CalibrateDebevec_getLambda_10(nativeObj);
  47. }
  48. //
  49. // C++: void cv::CalibrateDebevec::setLambda(float lambda)
  50. //
  51. public void setLambda(float lambda)
  52. {
  53. ThrowIfDisposed();
  54. photo_CalibrateDebevec_setLambda_10(nativeObj, lambda);
  55. }
  56. //
  57. // C++: int cv::CalibrateDebevec::getSamples()
  58. //
  59. public int getSamples()
  60. {
  61. ThrowIfDisposed();
  62. return photo_CalibrateDebevec_getSamples_10(nativeObj);
  63. }
  64. //
  65. // C++: void cv::CalibrateDebevec::setSamples(int samples)
  66. //
  67. public void setSamples(int samples)
  68. {
  69. ThrowIfDisposed();
  70. photo_CalibrateDebevec_setSamples_10(nativeObj, samples);
  71. }
  72. //
  73. // C++: bool cv::CalibrateDebevec::getRandom()
  74. //
  75. public bool getRandom()
  76. {
  77. ThrowIfDisposed();
  78. return photo_CalibrateDebevec_getRandom_10(nativeObj);
  79. }
  80. //
  81. // C++: void cv::CalibrateDebevec::setRandom(bool random)
  82. //
  83. public void setRandom(bool random)
  84. {
  85. ThrowIfDisposed();
  86. photo_CalibrateDebevec_setRandom_10(nativeObj, random);
  87. }
  88. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  89. const string LIBNAME = "__Internal";
  90. #else
  91. const string LIBNAME = "opencvforunity";
  92. #endif
  93. // C++: float cv::CalibrateDebevec::getLambda()
  94. [DllImport(LIBNAME)]
  95. private static extern float photo_CalibrateDebevec_getLambda_10(IntPtr nativeObj);
  96. // C++: void cv::CalibrateDebevec::setLambda(float lambda)
  97. [DllImport(LIBNAME)]
  98. private static extern void photo_CalibrateDebevec_setLambda_10(IntPtr nativeObj, float lambda);
  99. // C++: int cv::CalibrateDebevec::getSamples()
  100. [DllImport(LIBNAME)]
  101. private static extern int photo_CalibrateDebevec_getSamples_10(IntPtr nativeObj);
  102. // C++: void cv::CalibrateDebevec::setSamples(int samples)
  103. [DllImport(LIBNAME)]
  104. private static extern void photo_CalibrateDebevec_setSamples_10(IntPtr nativeObj, int samples);
  105. // C++: bool cv::CalibrateDebevec::getRandom()
  106. [DllImport(LIBNAME)]
  107. [return: MarshalAs(UnmanagedType.U1)]
  108. private static extern bool photo_CalibrateDebevec_getRandom_10(IntPtr nativeObj);
  109. // C++: void cv::CalibrateDebevec::setRandom(bool random)
  110. [DllImport(LIBNAME)]
  111. private static extern void photo_CalibrateDebevec_setRandom_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool random);
  112. // native support for java finalize()
  113. [DllImport(LIBNAME)]
  114. private static extern void photo_CalibrateDebevec_delete(IntPtr nativeObj);
  115. }
  116. }