CalibrateRobertson.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 CalibrateRobertson
  9. /**
  10. * Inverse camera response function is extracted for each brightness value by minimizing an objective
  11. * function as linear system. This algorithm uses all image pixels.
  12. *
  13. * For more information see CITE: RB99 .
  14. */
  15. public class CalibrateRobertson : CalibrateCRF
  16. {
  17. protected override void Dispose(bool disposing)
  18. {
  19. try
  20. {
  21. if (disposing)
  22. {
  23. }
  24. if (IsEnabledDispose)
  25. {
  26. if (nativeObj != IntPtr.Zero)
  27. photo_CalibrateRobertson_delete(nativeObj);
  28. nativeObj = IntPtr.Zero;
  29. }
  30. }
  31. finally
  32. {
  33. base.Dispose(disposing);
  34. }
  35. }
  36. protected internal CalibrateRobertson(IntPtr addr) : base(addr) { }
  37. // internal usage only
  38. public static new CalibrateRobertson __fromPtr__(IntPtr addr) { return new CalibrateRobertson(addr); }
  39. //
  40. // C++: int cv::CalibrateRobertson::getMaxIter()
  41. //
  42. public int getMaxIter()
  43. {
  44. ThrowIfDisposed();
  45. return photo_CalibrateRobertson_getMaxIter_10(nativeObj);
  46. }
  47. //
  48. // C++: void cv::CalibrateRobertson::setMaxIter(int max_iter)
  49. //
  50. public void setMaxIter(int max_iter)
  51. {
  52. ThrowIfDisposed();
  53. photo_CalibrateRobertson_setMaxIter_10(nativeObj, max_iter);
  54. }
  55. //
  56. // C++: float cv::CalibrateRobertson::getThreshold()
  57. //
  58. public float getThreshold()
  59. {
  60. ThrowIfDisposed();
  61. return photo_CalibrateRobertson_getThreshold_10(nativeObj);
  62. }
  63. //
  64. // C++: void cv::CalibrateRobertson::setThreshold(float threshold)
  65. //
  66. public void setThreshold(float threshold)
  67. {
  68. ThrowIfDisposed();
  69. photo_CalibrateRobertson_setThreshold_10(nativeObj, threshold);
  70. }
  71. //
  72. // C++: Mat cv::CalibrateRobertson::getRadiance()
  73. //
  74. public Mat getRadiance()
  75. {
  76. ThrowIfDisposed();
  77. return new Mat(DisposableObject.ThrowIfNullIntPtr(photo_CalibrateRobertson_getRadiance_10(nativeObj)));
  78. }
  79. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  80. const string LIBNAME = "__Internal";
  81. #else
  82. const string LIBNAME = "opencvforunity";
  83. #endif
  84. // C++: int cv::CalibrateRobertson::getMaxIter()
  85. [DllImport(LIBNAME)]
  86. private static extern int photo_CalibrateRobertson_getMaxIter_10(IntPtr nativeObj);
  87. // C++: void cv::CalibrateRobertson::setMaxIter(int max_iter)
  88. [DllImport(LIBNAME)]
  89. private static extern void photo_CalibrateRobertson_setMaxIter_10(IntPtr nativeObj, int max_iter);
  90. // C++: float cv::CalibrateRobertson::getThreshold()
  91. [DllImport(LIBNAME)]
  92. private static extern float photo_CalibrateRobertson_getThreshold_10(IntPtr nativeObj);
  93. // C++: void cv::CalibrateRobertson::setThreshold(float threshold)
  94. [DllImport(LIBNAME)]
  95. private static extern void photo_CalibrateRobertson_setThreshold_10(IntPtr nativeObj, float threshold);
  96. // C++: Mat cv::CalibrateRobertson::getRadiance()
  97. [DllImport(LIBNAME)]
  98. private static extern IntPtr photo_CalibrateRobertson_getRadiance_10(IntPtr nativeObj);
  99. // native support for java finalize()
  100. [DllImport(LIBNAME)]
  101. private static extern void photo_CalibrateRobertson_delete(IntPtr nativeObj);
  102. }
  103. }