NativeMethods_flann.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System.Diagnostics.Contracts;
  2. using System.Runtime.InteropServices;
  3. using OpenCvSharp.Flann;
  4. #pragma warning disable 1591
  5. #pragma warning disable CA1401 // P/Invokes should not be visible
  6. #pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments
  7. #pragma warning disable IDE1006 // Naming style
  8. namespace OpenCvSharp.Internal;
  9. static partial class NativeMethods
  10. {
  11. #region Index
  12. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  13. public static extern ExceptionStatus flann_Index_new(IntPtr features, IntPtr @params, int distType, out IntPtr returnValue);
  14. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  15. public static extern ExceptionStatus flann_Index_delete(IntPtr obj);
  16. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  17. public static extern ExceptionStatus flann_Index_knnSearch1(
  18. IntPtr obj, [In] float[] queries, int queriesLength, [Out] int[] indices, [Out] float[] dists, int knn, IntPtr @params);
  19. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  20. public static extern ExceptionStatus flann_Index_knnSearch2(
  21. IntPtr obj, IntPtr queries, IntPtr indices, IntPtr dists, int knn, IntPtr @params);
  22. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  23. public static extern ExceptionStatus flann_Index_knnSearch3(
  24. IntPtr obj, IntPtr queries, [Out] int[] indices, [Out] float[] dists, int knn, IntPtr @params);
  25. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  26. public static extern ExceptionStatus flann_Index_radiusSearch1(
  27. IntPtr obj, [In] float[] queries, int queriesLength, [Out] int[] indices, int indicesLength, [Out] float[] dists, int distsLength, double radius, int maxResults, IntPtr @params);
  28. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  29. public static extern ExceptionStatus flann_Index_radiusSearch2(
  30. IntPtr obj, IntPtr queries, IntPtr indices, IntPtr dists, double radius, int maxResults, IntPtr @params);
  31. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  32. public static extern ExceptionStatus flann_Index_radiusSearch3(
  33. IntPtr obj, IntPtr queries, [Out] int[] indices, int indicesLength, [Out] float[] dists, int distsLength, double radius, int maxResults, IntPtr @params);
  34. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  35. public static extern ExceptionStatus flann_Index_save(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename);
  36. #endregion
  37. #region IndexParams
  38. #region IndexParams
  39. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  40. public static extern ExceptionStatus flann_Ptr_IndexParams_new(out IntPtr returnValue);
  41. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  42. public static extern ExceptionStatus flann_Ptr_IndexParams_get(IntPtr ptr, out IntPtr returnValue);
  43. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  44. public static extern ExceptionStatus flann_Ptr_IndexParams_delete(IntPtr obj);
  45. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  46. public static extern ExceptionStatus flann_IndexParams_getString(
  47. IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string? defaultVal, IntPtr returnValue);
  48. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  49. public static extern ExceptionStatus flann_IndexParams_getInt(
  50. IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int defaultVal, out int returnValue);
  51. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  52. public static extern ExceptionStatus flann_IndexParams_getDouble(
  53. IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, double defaultVal, out double returnValue);
  54. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  55. public static extern ExceptionStatus flann_IndexParams_setString(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string value);
  56. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  57. public static extern ExceptionStatus flann_IndexParams_setInt(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int value);
  58. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  59. public static extern ExceptionStatus flann_IndexParams_setDouble(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, double value);
  60. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  61. public static extern ExceptionStatus flann_IndexParams_setFloat(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, float value);
  62. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)]
  63. public static extern ExceptionStatus flann_IndexParams_setBool(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int value);
  64. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  65. public static extern ExceptionStatus flann_IndexParams_setAlgorithm(IntPtr obj, int value);
  66. #endregion
  67. #region LinearIndexParams
  68. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  69. public static extern ExceptionStatus flann_Ptr_LinearIndexParams_new(out IntPtr returnValue);
  70. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  71. public static extern ExceptionStatus flann_Ptr_LinearIndexParams_get(IntPtr ptr, out IntPtr returnValue);
  72. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  73. public static extern ExceptionStatus flann_Ptr_LinearIndexParams_delete(IntPtr obj);
  74. #endregion
  75. #region KDTreeIndexParams
  76. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  77. public static extern ExceptionStatus flann_Ptr_KDTreeIndexParams_new(int trees, out IntPtr returnValue);
  78. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  79. public static extern ExceptionStatus flann_Ptr_KDTreeIndexParams_get(IntPtr ptr, out IntPtr returnValue);
  80. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  81. public static extern ExceptionStatus flann_Ptr_KDTreeIndexParams_delete(IntPtr obj);
  82. #endregion
  83. #region KMeansIndexParams
  84. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  85. public static extern ExceptionStatus flann_Ptr_KMeansIndexParams_new(
  86. int branching, int iterations, [MarshalAs(UnmanagedType.I4)] FlannCentersInit centersInit, float cbIndex, out IntPtr returnValue);
  87. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  88. public static extern ExceptionStatus flann_Ptr_KMeansIndexParams_get(IntPtr ptr, out IntPtr returnValue);
  89. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  90. public static extern ExceptionStatus flann_Ptr_KMeansIndexParams_delete(IntPtr obj);
  91. #endregion
  92. #region LshIndexParams
  93. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  94. public static extern ExceptionStatus flann_Ptr_LshIndexParams_new(
  95. int tableNumber, int keySize, int multiProbeLevel, out IntPtr returnValue);
  96. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  97. public static extern ExceptionStatus flann_Ptr_LshIndexParams_get(IntPtr ptr, out IntPtr returnValue);
  98. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  99. public static extern ExceptionStatus flann_Ptr_LshIndexParams_delete(IntPtr obj);
  100. #endregion
  101. #region CompositeIndexParams
  102. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  103. public static extern ExceptionStatus flann_Ptr_CompositeIndexParams_new(
  104. int trees, int branching, int iterations, FlannCentersInit centersInit, float cbIndex, out IntPtr returnValue);
  105. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  106. public static extern ExceptionStatus flann_Ptr_CompositeIndexParams_get(IntPtr ptr, out IntPtr returnValue);
  107. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  108. public static extern ExceptionStatus flann_Ptr_CompositeIndexParams_delete(IntPtr obj);
  109. #endregion
  110. #region AutotunedIndexParams
  111. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  112. public static extern ExceptionStatus flann_Ptr_AutotunedIndexParams_new(
  113. float targetPrecision, float buildWeight, float memoryWeight, float sampleFraction, out IntPtr returnValue);
  114. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  115. public static extern ExceptionStatus flann_Ptr_AutotunedIndexParams_get(IntPtr ptr, out IntPtr returnValue);
  116. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  117. public static extern ExceptionStatus flann_Ptr_AutotunedIndexParams_delete(IntPtr obj);
  118. #endregion
  119. #region SavedIndexParams
  120. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  121. public static extern ExceptionStatus flann_Ptr_SavedIndexParams_new(
  122. [MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr returnValue);
  123. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  124. public static extern ExceptionStatus flann_Ptr_SavedIndexParams_get(IntPtr ptr, out IntPtr returnValue);
  125. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  126. public static extern ExceptionStatus flann_Ptr_SavedIndexParams_delete(IntPtr obj);
  127. #endregion
  128. #region SearchParams
  129. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  130. public static extern ExceptionStatus flann_Ptr_SearchParams_new(int checks, float eps, int sorted, out IntPtr returnValue);
  131. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  132. public static extern ExceptionStatus flann_Ptr_SearchParams_get(IntPtr ptr, out IntPtr returnValue);
  133. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  134. public static extern ExceptionStatus flann_Ptr_SearchParams_delete(IntPtr obj);
  135. #endregion
  136. #endregion
  137. }