Plot2d.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.PlotModule
  7. {
  8. // C++: class Plot2d
  9. /**
  10. * plot Plot function for Mat data
  11. */
  12. public class Plot2d : 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. plot_Plot2d_delete(nativeObj);
  25. nativeObj = IntPtr.Zero;
  26. }
  27. }
  28. finally
  29. {
  30. base.Dispose(disposing);
  31. }
  32. }
  33. protected internal Plot2d(IntPtr addr) : base(addr) { }
  34. // internal usage only
  35. public static new Plot2d __fromPtr__(IntPtr addr) { return new Plot2d(addr); }
  36. //
  37. // C++: void cv::plot::Plot2d::setMinX(double _plotMinX)
  38. //
  39. public void setMinX(double _plotMinX)
  40. {
  41. ThrowIfDisposed();
  42. plot_Plot2d_setMinX_10(nativeObj, _plotMinX);
  43. }
  44. //
  45. // C++: void cv::plot::Plot2d::setMinY(double _plotMinY)
  46. //
  47. public void setMinY(double _plotMinY)
  48. {
  49. ThrowIfDisposed();
  50. plot_Plot2d_setMinY_10(nativeObj, _plotMinY);
  51. }
  52. //
  53. // C++: void cv::plot::Plot2d::setMaxX(double _plotMaxX)
  54. //
  55. public void setMaxX(double _plotMaxX)
  56. {
  57. ThrowIfDisposed();
  58. plot_Plot2d_setMaxX_10(nativeObj, _plotMaxX);
  59. }
  60. //
  61. // C++: void cv::plot::Plot2d::setMaxY(double _plotMaxY)
  62. //
  63. public void setMaxY(double _plotMaxY)
  64. {
  65. ThrowIfDisposed();
  66. plot_Plot2d_setMaxY_10(nativeObj, _plotMaxY);
  67. }
  68. //
  69. // C++: void cv::plot::Plot2d::setPlotLineWidth(int _plotLineWidth)
  70. //
  71. public void setPlotLineWidth(int _plotLineWidth)
  72. {
  73. ThrowIfDisposed();
  74. plot_Plot2d_setPlotLineWidth_10(nativeObj, _plotLineWidth);
  75. }
  76. //
  77. // C++: void cv::plot::Plot2d::setNeedPlotLine(bool _needPlotLine)
  78. //
  79. /**
  80. * Switches data visualization mode
  81. *
  82. * param _needPlotLine if true then neighbour plot points will be connected by lines.
  83. * In other case data will be plotted as a set of standalone points.
  84. */
  85. public void setNeedPlotLine(bool _needPlotLine)
  86. {
  87. ThrowIfDisposed();
  88. plot_Plot2d_setNeedPlotLine_10(nativeObj, _needPlotLine);
  89. }
  90. //
  91. // C++: void cv::plot::Plot2d::setPlotLineColor(Scalar _plotLineColor)
  92. //
  93. public void setPlotLineColor(Scalar _plotLineColor)
  94. {
  95. ThrowIfDisposed();
  96. plot_Plot2d_setPlotLineColor_10(nativeObj, _plotLineColor.val[0], _plotLineColor.val[1], _plotLineColor.val[2], _plotLineColor.val[3]);
  97. }
  98. //
  99. // C++: void cv::plot::Plot2d::setPlotBackgroundColor(Scalar _plotBackgroundColor)
  100. //
  101. public void setPlotBackgroundColor(Scalar _plotBackgroundColor)
  102. {
  103. ThrowIfDisposed();
  104. plot_Plot2d_setPlotBackgroundColor_10(nativeObj, _plotBackgroundColor.val[0], _plotBackgroundColor.val[1], _plotBackgroundColor.val[2], _plotBackgroundColor.val[3]);
  105. }
  106. //
  107. // C++: void cv::plot::Plot2d::setPlotAxisColor(Scalar _plotAxisColor)
  108. //
  109. public void setPlotAxisColor(Scalar _plotAxisColor)
  110. {
  111. ThrowIfDisposed();
  112. plot_Plot2d_setPlotAxisColor_10(nativeObj, _plotAxisColor.val[0], _plotAxisColor.val[1], _plotAxisColor.val[2], _plotAxisColor.val[3]);
  113. }
  114. //
  115. // C++: void cv::plot::Plot2d::setPlotGridColor(Scalar _plotGridColor)
  116. //
  117. public void setPlotGridColor(Scalar _plotGridColor)
  118. {
  119. ThrowIfDisposed();
  120. plot_Plot2d_setPlotGridColor_10(nativeObj, _plotGridColor.val[0], _plotGridColor.val[1], _plotGridColor.val[2], _plotGridColor.val[3]);
  121. }
  122. //
  123. // C++: void cv::plot::Plot2d::setPlotTextColor(Scalar _plotTextColor)
  124. //
  125. public void setPlotTextColor(Scalar _plotTextColor)
  126. {
  127. ThrowIfDisposed();
  128. plot_Plot2d_setPlotTextColor_10(nativeObj, _plotTextColor.val[0], _plotTextColor.val[1], _plotTextColor.val[2], _plotTextColor.val[3]);
  129. }
  130. //
  131. // C++: void cv::plot::Plot2d::setPlotSize(int _plotSizeWidth, int _plotSizeHeight)
  132. //
  133. public void setPlotSize(int _plotSizeWidth, int _plotSizeHeight)
  134. {
  135. ThrowIfDisposed();
  136. plot_Plot2d_setPlotSize_10(nativeObj, _plotSizeWidth, _plotSizeHeight);
  137. }
  138. //
  139. // C++: void cv::plot::Plot2d::setShowGrid(bool needShowGrid)
  140. //
  141. public void setShowGrid(bool needShowGrid)
  142. {
  143. ThrowIfDisposed();
  144. plot_Plot2d_setShowGrid_10(nativeObj, needShowGrid);
  145. }
  146. //
  147. // C++: void cv::plot::Plot2d::setShowText(bool needShowText)
  148. //
  149. public void setShowText(bool needShowText)
  150. {
  151. ThrowIfDisposed();
  152. plot_Plot2d_setShowText_10(nativeObj, needShowText);
  153. }
  154. //
  155. // C++: void cv::plot::Plot2d::setGridLinesNumber(int gridLinesNumber)
  156. //
  157. public void setGridLinesNumber(int gridLinesNumber)
  158. {
  159. ThrowIfDisposed();
  160. plot_Plot2d_setGridLinesNumber_10(nativeObj, gridLinesNumber);
  161. }
  162. //
  163. // C++: void cv::plot::Plot2d::setInvertOrientation(bool _invertOrientation)
  164. //
  165. public void setInvertOrientation(bool _invertOrientation)
  166. {
  167. ThrowIfDisposed();
  168. plot_Plot2d_setInvertOrientation_10(nativeObj, _invertOrientation);
  169. }
  170. //
  171. // C++: void cv::plot::Plot2d::setPointIdxToPrint(int pointIdx)
  172. //
  173. /**
  174. * Sets the index of a point which coordinates will be printed on the top left corner of the plot (if ShowText flag is true).
  175. *
  176. * param pointIdx index of the required point in data array.
  177. */
  178. public void setPointIdxToPrint(int pointIdx)
  179. {
  180. ThrowIfDisposed();
  181. plot_Plot2d_setPointIdxToPrint_10(nativeObj, pointIdx);
  182. }
  183. //
  184. // C++: void cv::plot::Plot2d::render(Mat& _plotResult)
  185. //
  186. public void render(Mat _plotResult)
  187. {
  188. ThrowIfDisposed();
  189. if (_plotResult != null) _plotResult.ThrowIfDisposed();
  190. plot_Plot2d_render_10(nativeObj, _plotResult.nativeObj);
  191. }
  192. //
  193. // C++: static Ptr_Plot2d cv::plot::Plot2d::create(Mat data)
  194. //
  195. /**
  196. * Creates Plot2d object
  197. *
  198. * param data \(1xN\) or \(Nx1\) matrix containing \(Y\) values of points to plot. \(X\) values
  199. * will be equal to indexes of correspondind elements in data matrix.
  200. * return automatically generated
  201. */
  202. public static Plot2d create(Mat data)
  203. {
  204. if (data != null) data.ThrowIfDisposed();
  205. return Plot2d.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(plot_Plot2d_create_10(data.nativeObj)));
  206. }
  207. //
  208. // C++: static Ptr_Plot2d cv::plot::Plot2d::create(Mat dataX, Mat dataY)
  209. //
  210. /**
  211. * Creates Plot2d object
  212. *
  213. * param dataX \(1xN\) or \(Nx1\) matrix \(X\) values of points to plot.
  214. * param dataY \(1xN\) or \(Nx1\) matrix containing \(Y\) values of points to plot.
  215. * return automatically generated
  216. */
  217. public static Plot2d create(Mat dataX, Mat dataY)
  218. {
  219. if (dataX != null) dataX.ThrowIfDisposed();
  220. if (dataY != null) dataY.ThrowIfDisposed();
  221. return Plot2d.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(plot_Plot2d_create_11(dataX.nativeObj, dataY.nativeObj)));
  222. }
  223. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  224. const string LIBNAME = "__Internal";
  225. #else
  226. const string LIBNAME = "opencvforunity";
  227. #endif
  228. // C++: void cv::plot::Plot2d::setMinX(double _plotMinX)
  229. [DllImport(LIBNAME)]
  230. private static extern void plot_Plot2d_setMinX_10(IntPtr nativeObj, double _plotMinX);
  231. // C++: void cv::plot::Plot2d::setMinY(double _plotMinY)
  232. [DllImport(LIBNAME)]
  233. private static extern void plot_Plot2d_setMinY_10(IntPtr nativeObj, double _plotMinY);
  234. // C++: void cv::plot::Plot2d::setMaxX(double _plotMaxX)
  235. [DllImport(LIBNAME)]
  236. private static extern void plot_Plot2d_setMaxX_10(IntPtr nativeObj, double _plotMaxX);
  237. // C++: void cv::plot::Plot2d::setMaxY(double _plotMaxY)
  238. [DllImport(LIBNAME)]
  239. private static extern void plot_Plot2d_setMaxY_10(IntPtr nativeObj, double _plotMaxY);
  240. // C++: void cv::plot::Plot2d::setPlotLineWidth(int _plotLineWidth)
  241. [DllImport(LIBNAME)]
  242. private static extern void plot_Plot2d_setPlotLineWidth_10(IntPtr nativeObj, int _plotLineWidth);
  243. // C++: void cv::plot::Plot2d::setNeedPlotLine(bool _needPlotLine)
  244. [DllImport(LIBNAME)]
  245. private static extern void plot_Plot2d_setNeedPlotLine_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool _needPlotLine);
  246. // C++: void cv::plot::Plot2d::setPlotLineColor(Scalar _plotLineColor)
  247. [DllImport(LIBNAME)]
  248. private static extern void plot_Plot2d_setPlotLineColor_10(IntPtr nativeObj, double _plotLineColor_val0, double _plotLineColor_val1, double _plotLineColor_val2, double _plotLineColor_val3);
  249. // C++: void cv::plot::Plot2d::setPlotBackgroundColor(Scalar _plotBackgroundColor)
  250. [DllImport(LIBNAME)]
  251. private static extern void plot_Plot2d_setPlotBackgroundColor_10(IntPtr nativeObj, double _plotBackgroundColor_val0, double _plotBackgroundColor_val1, double _plotBackgroundColor_val2, double _plotBackgroundColor_val3);
  252. // C++: void cv::plot::Plot2d::setPlotAxisColor(Scalar _plotAxisColor)
  253. [DllImport(LIBNAME)]
  254. private static extern void plot_Plot2d_setPlotAxisColor_10(IntPtr nativeObj, double _plotAxisColor_val0, double _plotAxisColor_val1, double _plotAxisColor_val2, double _plotAxisColor_val3);
  255. // C++: void cv::plot::Plot2d::setPlotGridColor(Scalar _plotGridColor)
  256. [DllImport(LIBNAME)]
  257. private static extern void plot_Plot2d_setPlotGridColor_10(IntPtr nativeObj, double _plotGridColor_val0, double _plotGridColor_val1, double _plotGridColor_val2, double _plotGridColor_val3);
  258. // C++: void cv::plot::Plot2d::setPlotTextColor(Scalar _plotTextColor)
  259. [DllImport(LIBNAME)]
  260. private static extern void plot_Plot2d_setPlotTextColor_10(IntPtr nativeObj, double _plotTextColor_val0, double _plotTextColor_val1, double _plotTextColor_val2, double _plotTextColor_val3);
  261. // C++: void cv::plot::Plot2d::setPlotSize(int _plotSizeWidth, int _plotSizeHeight)
  262. [DllImport(LIBNAME)]
  263. private static extern void plot_Plot2d_setPlotSize_10(IntPtr nativeObj, int _plotSizeWidth, int _plotSizeHeight);
  264. // C++: void cv::plot::Plot2d::setShowGrid(bool needShowGrid)
  265. [DllImport(LIBNAME)]
  266. private static extern void plot_Plot2d_setShowGrid_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool needShowGrid);
  267. // C++: void cv::plot::Plot2d::setShowText(bool needShowText)
  268. [DllImport(LIBNAME)]
  269. private static extern void plot_Plot2d_setShowText_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool needShowText);
  270. // C++: void cv::plot::Plot2d::setGridLinesNumber(int gridLinesNumber)
  271. [DllImport(LIBNAME)]
  272. private static extern void plot_Plot2d_setGridLinesNumber_10(IntPtr nativeObj, int gridLinesNumber);
  273. // C++: void cv::plot::Plot2d::setInvertOrientation(bool _invertOrientation)
  274. [DllImport(LIBNAME)]
  275. private static extern void plot_Plot2d_setInvertOrientation_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool _invertOrientation);
  276. // C++: void cv::plot::Plot2d::setPointIdxToPrint(int pointIdx)
  277. [DllImport(LIBNAME)]
  278. private static extern void plot_Plot2d_setPointIdxToPrint_10(IntPtr nativeObj, int pointIdx);
  279. // C++: void cv::plot::Plot2d::render(Mat& _plotResult)
  280. [DllImport(LIBNAME)]
  281. private static extern void plot_Plot2d_render_10(IntPtr nativeObj, IntPtr _plotResult_nativeObj);
  282. // C++: static Ptr_Plot2d cv::plot::Plot2d::create(Mat data)
  283. [DllImport(LIBNAME)]
  284. private static extern IntPtr plot_Plot2d_create_10(IntPtr data_nativeObj);
  285. // C++: static Ptr_Plot2d cv::plot::Plot2d::create(Mat dataX, Mat dataY)
  286. [DllImport(LIBNAME)]
  287. private static extern IntPtr plot_Plot2d_create_11(IntPtr dataX_nativeObj, IntPtr dataY_nativeObj);
  288. // native support for java finalize()
  289. [DllImport(LIBNAME)]
  290. private static extern void plot_Plot2d_delete(IntPtr nativeObj);
  291. }
  292. }