CalibrateCRF.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 CalibrateCRF
  9. /**
  10. * The base class for camera response calibration algorithms.
  11. */
  12. public class CalibrateCRF : Algorithm
  13. {
  14. protected override void Dispose(bool disposing)
  15. {
  16. try
  17. {
  18. if (disposing)
  19. {
  20. }
  21. if (IsEnabledDispose)
  22. {
  23. if (nativeObj != IntPtr.Zero)
  24. photo_CalibrateCRF_delete(nativeObj);
  25. nativeObj = IntPtr.Zero;
  26. }
  27. }
  28. finally
  29. {
  30. base.Dispose(disposing);
  31. }
  32. }
  33. protected internal CalibrateCRF(IntPtr addr) : base(addr) { }
  34. // internal usage only
  35. public static new CalibrateCRF __fromPtr__(IntPtr addr) { return new CalibrateCRF(addr); }
  36. //
  37. // C++: void cv::CalibrateCRF::process(vector_Mat src, Mat& dst, Mat times)
  38. //
  39. /**
  40. * Recovers inverse camera response.
  41. *
  42. * param src vector of input images
  43. * param dst 256x1 matrix with inverse camera response function
  44. * param times vector of exposure time values for each image
  45. */
  46. public void process(List<Mat> src, Mat dst, Mat times)
  47. {
  48. ThrowIfDisposed();
  49. if (dst != null) dst.ThrowIfDisposed();
  50. if (times != null) times.ThrowIfDisposed();
  51. Mat src_mat = Converters.vector_Mat_to_Mat(src);
  52. photo_CalibrateCRF_process_10(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj);
  53. }
  54. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  55. const string LIBNAME = "__Internal";
  56. #else
  57. const string LIBNAME = "opencvforunity";
  58. #endif
  59. // C++: void cv::CalibrateCRF::process(vector_Mat src, Mat& dst, Mat times)
  60. [DllImport(LIBNAME)]
  61. private static extern void photo_CalibrateCRF_process_10(IntPtr nativeObj, IntPtr src_mat_nativeObj, IntPtr dst_nativeObj, IntPtr times_nativeObj);
  62. // native support for java finalize()
  63. [DllImport(LIBNAME)]
  64. private static extern void photo_CalibrateCRF_delete(IntPtr nativeObj);
  65. }
  66. }