MergeExposures.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 MergeExposures
  9. /**
  10. * The base class algorithms that can merge exposure sequence to a single image.
  11. */
  12. public class MergeExposures : 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_MergeExposures_delete(nativeObj);
  25. nativeObj = IntPtr.Zero;
  26. }
  27. }
  28. finally
  29. {
  30. base.Dispose(disposing);
  31. }
  32. }
  33. protected internal MergeExposures(IntPtr addr) : base(addr) { }
  34. // internal usage only
  35. public static new MergeExposures __fromPtr__(IntPtr addr) { return new MergeExposures(addr); }
  36. //
  37. // C++: void cv::MergeExposures::process(vector_Mat src, Mat& dst, Mat times, Mat response)
  38. //
  39. /**
  40. * Merges images.
  41. *
  42. * param src vector of input images
  43. * param dst result image
  44. * param times vector of exposure time values for each image
  45. * param response 256x1 matrix with inverse camera response function for each pixel value, it should
  46. * have the same number of channels as images.
  47. */
  48. public virtual void process(List<Mat> src, Mat dst, Mat times, Mat response)
  49. {
  50. ThrowIfDisposed();
  51. if (dst != null) dst.ThrowIfDisposed();
  52. if (times != null) times.ThrowIfDisposed();
  53. if (response != null) response.ThrowIfDisposed();
  54. Mat src_mat = Converters.vector_Mat_to_Mat(src);
  55. photo_MergeExposures_process_10(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj);
  56. }
  57. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  58. const string LIBNAME = "__Internal";
  59. #else
  60. const string LIBNAME = "opencvforunity";
  61. #endif
  62. // C++: void cv::MergeExposures::process(vector_Mat src, Mat& dst, Mat times, Mat response)
  63. [DllImport(LIBNAME)]
  64. private static extern void photo_MergeExposures_process_10(IntPtr nativeObj, IntPtr src_mat_nativeObj, IntPtr dst_nativeObj, IntPtr times_nativeObj, IntPtr response_nativeObj);
  65. // native support for java finalize()
  66. [DllImport(LIBNAME)]
  67. private static extern void photo_MergeExposures_delete(IntPtr nativeObj);
  68. }
  69. }