WhiteBalancer.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.XphotoModule
  8. {
  9. // C++: class WhiteBalancer
  10. //javadoc: WhiteBalancer
  11. public class WhiteBalancer : Algorithm
  12. {
  13. protected override void Dispose (bool disposing)
  14. {
  15. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  16. try {
  17. if (disposing) {
  18. }
  19. if (IsEnabledDispose) {
  20. if (nativeObj != IntPtr.Zero)
  21. xphoto_WhiteBalancer_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal WhiteBalancer (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new WhiteBalancer __fromPtr__ (IntPtr addr) { return new WhiteBalancer (addr); }
  34. //
  35. // C++: void cv::xphoto::WhiteBalancer::balanceWhite(Mat src, Mat& dst)
  36. //
  37. //javadoc: WhiteBalancer::balanceWhite(src, dst)
  38. public void balanceWhite (Mat src, Mat dst)
  39. {
  40. ThrowIfDisposed ();
  41. if (src != null) src.ThrowIfDisposed ();
  42. if (dst != null) dst.ThrowIfDisposed ();
  43. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  44. xphoto_WhiteBalancer_balanceWhite_10(nativeObj, src.nativeObj, dst.nativeObj);
  45. return;
  46. #else
  47. return;
  48. #endif
  49. }
  50. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  51. const string LIBNAME = "__Internal";
  52. #else
  53. const string LIBNAME = "opencvforunity";
  54. #endif
  55. // C++: void cv::xphoto::WhiteBalancer::balanceWhite(Mat src, Mat& dst)
  56. [DllImport (LIBNAME)]
  57. private static extern void xphoto_WhiteBalancer_balanceWhite_10 (IntPtr nativeObj, IntPtr src_nativeObj, IntPtr dst_nativeObj);
  58. // native support for java finalize()
  59. [DllImport (LIBNAME)]
  60. private static extern void xphoto_WhiteBalancer_delete (IntPtr nativeObj);
  61. }
  62. }