HSurfaceModel.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /***********************************************************
  2. * File generated by the HALCON-Compiler hcomp version 20.11
  3. * Usage: Interface to C++
  4. *
  5. * Software by: MVTec Software GmbH, www.mvtec.com
  6. ***********************************************************/
  7. #ifndef HCPP_HSURFACEMODEL
  8. #define HCPP_HSURFACEMODEL
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a surface model.
  12. class LIntExport HSurfaceModel : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HSurfaceModel():HHandle() {}
  17. // Copy constructor
  18. HSurfaceModel(const HSurfaceModel& source) : HHandle(source) {}
  19. // Copy constructor
  20. HSurfaceModel(const HHandle& handle);
  21. // Create HSurfaceModel from handle, taking ownership
  22. explicit HSurfaceModel(Hlong handle);
  23. bool operator==(const HHandle& obj) const
  24. {
  25. return HHandleBase::operator==(obj);
  26. }
  27. bool operator!=(const HHandle& obj) const
  28. {
  29. return HHandleBase::operator!=(obj);
  30. }
  31. protected:
  32. // Verify matching semantic type ('surface_model')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. // Deep copy of all data represented by this object instance
  36. HSurfaceModel Clone() const;
  37. /*****************************************************************************
  38. * Operator-based class constructors
  39. *****************************************************************************/
  40. // read_surface_model: Read a surface model from a file.
  41. explicit HSurfaceModel(const HString& FileName);
  42. // read_surface_model: Read a surface model from a file.
  43. explicit HSurfaceModel(const char* FileName);
  44. #ifdef _WIN32
  45. // read_surface_model: Read a surface model from a file.
  46. explicit HSurfaceModel(const wchar_t* FileName);
  47. #endif
  48. // create_surface_model: Create the data structure needed to perform surface-based matching.
  49. explicit HSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, const HTuple& GenParamName, const HTuple& GenParamValue);
  50. // create_surface_model: Create the data structure needed to perform surface-based matching.
  51. explicit HSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, const HString& GenParamName, const HString& GenParamValue);
  52. // create_surface_model: Create the data structure needed to perform surface-based matching.
  53. explicit HSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, const char* GenParamName, const char* GenParamValue);
  54. #ifdef _WIN32
  55. // create_surface_model: Create the data structure needed to perform surface-based matching.
  56. explicit HSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, const wchar_t* GenParamName, const wchar_t* GenParamValue);
  57. #endif
  58. /***************************************************************************
  59. * Operators *
  60. ***************************************************************************/
  61. // Free the memory of a surface model.
  62. static void ClearSurfaceModel(const HSurfaceModelArray& SurfaceModelID);
  63. // Free the memory of a surface model.
  64. void ClearSurfaceModel() const;
  65. // Deserialize a surface model.
  66. void DeserializeSurfaceModel(const HSerializedItem& SerializedItemHandle);
  67. // Serialize a surface_model.
  68. HSerializedItem SerializeSurfaceModel() const;
  69. // Read a surface model from a file.
  70. void ReadSurfaceModel(const HString& FileName);
  71. // Read a surface model from a file.
  72. void ReadSurfaceModel(const char* FileName);
  73. #ifdef _WIN32
  74. // Read a surface model from a file.
  75. void ReadSurfaceModel(const wchar_t* FileName);
  76. #endif
  77. // Write a surface model to a file.
  78. void WriteSurfaceModel(const HString& FileName) const;
  79. // Write a surface model to a file.
  80. void WriteSurfaceModel(const char* FileName) const;
  81. #ifdef _WIN32
  82. // Write a surface model to a file.
  83. void WriteSurfaceModel(const wchar_t* FileName) const;
  84. #endif
  85. // Refine the pose of a surface model in a 3D scene.
  86. HPoseArray RefineSurfaceModelPose(const HObjectModel3D& ObjectModel3D, const HPoseArray& InitialPose, const HTuple& MinScore, const HString& ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResultArray* SurfaceMatchingResultID) const;
  87. // Refine the pose of a surface model in a 3D scene.
  88. HPose RefineSurfaceModelPose(const HObjectModel3D& ObjectModel3D, const HPose& InitialPose, double MinScore, const HString& ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  89. // Refine the pose of a surface model in a 3D scene.
  90. HPose RefineSurfaceModelPose(const HObjectModel3D& ObjectModel3D, const HPose& InitialPose, double MinScore, const char* ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  91. #ifdef _WIN32
  92. // Refine the pose of a surface model in a 3D scene.
  93. HPose RefineSurfaceModelPose(const HObjectModel3D& ObjectModel3D, const HPose& InitialPose, double MinScore, const wchar_t* ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  94. #endif
  95. // Find the best matches of a surface model in a 3D scene.
  96. HPoseArray FindSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, double KeyPointFraction, const HTuple& MinScore, const HString& ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResultArray* SurfaceMatchingResultID) const;
  97. // Find the best matches of a surface model in a 3D scene.
  98. HPose FindSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, double KeyPointFraction, double MinScore, const HString& ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  99. // Find the best matches of a surface model in a 3D scene.
  100. HPose FindSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, double KeyPointFraction, double MinScore, const char* ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  101. #ifdef _WIN32
  102. // Find the best matches of a surface model in a 3D scene.
  103. HPose FindSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, double KeyPointFraction, double MinScore, const wchar_t* ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  104. #endif
  105. // Return the parameters and properties of a surface model.
  106. HTuple GetSurfaceModelParam(const HTuple& GenParamName) const;
  107. // Return the parameters and properties of a surface model.
  108. HTuple GetSurfaceModelParam(const HString& GenParamName) const;
  109. // Return the parameters and properties of a surface model.
  110. HTuple GetSurfaceModelParam(const char* GenParamName) const;
  111. #ifdef _WIN32
  112. // Return the parameters and properties of a surface model.
  113. HTuple GetSurfaceModelParam(const wchar_t* GenParamName) const;
  114. #endif
  115. // Create the data structure needed to perform surface-based matching.
  116. void CreateSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, const HTuple& GenParamName, const HTuple& GenParamValue);
  117. // Create the data structure needed to perform surface-based matching.
  118. void CreateSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, const HString& GenParamName, const HString& GenParamValue);
  119. // Create the data structure needed to perform surface-based matching.
  120. void CreateSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, const char* GenParamName, const char* GenParamValue);
  121. #ifdef _WIN32
  122. // Create the data structure needed to perform surface-based matching.
  123. void CreateSurfaceModel(const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, const wchar_t* GenParamName, const wchar_t* GenParamValue);
  124. #endif
  125. // Find the best matches of a surface model in a 3D scene and images.
  126. HPoseArray FindSurfaceModelImage(const HImage& Image, const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, double KeyPointFraction, const HTuple& MinScore, const HString& ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResultArray* SurfaceMatchingResultID) const;
  127. // Find the best matches of a surface model in a 3D scene and images.
  128. HPose FindSurfaceModelImage(const HImage& Image, const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, double KeyPointFraction, double MinScore, const HString& ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  129. // Find the best matches of a surface model in a 3D scene and images.
  130. HPose FindSurfaceModelImage(const HImage& Image, const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, double KeyPointFraction, double MinScore, const char* ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  131. #ifdef _WIN32
  132. // Find the best matches of a surface model in a 3D scene and images.
  133. HPose FindSurfaceModelImage(const HImage& Image, const HObjectModel3D& ObjectModel3D, double RelSamplingDistance, double KeyPointFraction, double MinScore, const wchar_t* ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  134. #endif
  135. // Refine the pose of a surface model in a 3D scene and in images.
  136. HPoseArray RefineSurfaceModelPoseImage(const HImage& Image, const HObjectModel3D& ObjectModel3D, const HPoseArray& InitialPose, const HTuple& MinScore, const HString& ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResultArray* SurfaceMatchingResultID) const;
  137. // Refine the pose of a surface model in a 3D scene and in images.
  138. HPose RefineSurfaceModelPoseImage(const HImage& Image, const HObjectModel3D& ObjectModel3D, const HPose& InitialPose, double MinScore, const HString& ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  139. // Refine the pose of a surface model in a 3D scene and in images.
  140. HPose RefineSurfaceModelPoseImage(const HImage& Image, const HObjectModel3D& ObjectModel3D, const HPose& InitialPose, double MinScore, const char* ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  141. #ifdef _WIN32
  142. // Refine the pose of a surface model in a 3D scene and in images.
  143. HPose RefineSurfaceModelPoseImage(const HImage& Image, const HObjectModel3D& ObjectModel3D, const HPose& InitialPose, double MinScore, const wchar_t* ReturnResultHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HSurfaceMatchingResult* SurfaceMatchingResultID) const;
  144. #endif
  145. // Set parameters and properties of a surface model.
  146. void SetSurfaceModelParam(const HString& GenParamName, const HTuple& GenParamValue) const;
  147. // Set parameters and properties of a surface model.
  148. void SetSurfaceModelParam(const HString& GenParamName, double GenParamValue) const;
  149. // Set parameters and properties of a surface model.
  150. void SetSurfaceModelParam(const char* GenParamName, double GenParamValue) const;
  151. #ifdef _WIN32
  152. // Set parameters and properties of a surface model.
  153. void SetSurfaceModelParam(const wchar_t* GenParamName, double GenParamValue) const;
  154. #endif
  155. // Find boxes in 3D data.
  156. static HPoseArray FindBox3d(const HObjectModel3D& ObjectModel3DScene, const HTuple& SideLen1, const HTuple& SideLen2, const HTuple& SideLen3, const HTuple& MinScore, const HDict& GenParam, HTuple* Score, HObjectModel3DArray* ObjectModel3DBox, HDict* BoxInformation);
  157. // Find boxes in 3D data.
  158. static HPose FindBox3d(const HObjectModel3D& ObjectModel3DScene, const HTuple& SideLen1, const HTuple& SideLen2, const HTuple& SideLen3, double MinScore, const HDict& GenParam, HTuple* Score, HObjectModel3DArray* ObjectModel3DBox, HDict* BoxInformation);
  159. };
  160. // forward declarations and types for internal array implementation
  161. template<class T> class HSmartPtr;
  162. template<class T> class HHandleBaseArrayRef;
  163. typedef HHandleBaseArrayRef<HSurfaceModel> HSurfaceModelArrayRef;
  164. typedef HSmartPtr< HSurfaceModelArrayRef > HSurfaceModelArrayPtr;
  165. // Represents multiple tool instances
  166. class LIntExport HSurfaceModelArray : public HHandleBaseArray
  167. {
  168. public:
  169. // Create empty array
  170. HSurfaceModelArray();
  171. // Create array from native array of tool instances
  172. HSurfaceModelArray(HSurfaceModel* classes, Hlong length);
  173. // Copy constructor
  174. HSurfaceModelArray(const HSurfaceModelArray &tool_array);
  175. // Destructor
  176. virtual ~HSurfaceModelArray();
  177. // Assignment operator
  178. HSurfaceModelArray &operator=(const HSurfaceModelArray &tool_array);
  179. // Clears array and all tool instances
  180. virtual void Clear();
  181. // Get array of native tool instances
  182. const HSurfaceModel* Tools() const;
  183. // Get number of tools
  184. virtual Hlong Length() const;
  185. // Create tool array from tuple of handles
  186. virtual void SetFromTuple(const HTuple& handles);
  187. // Get tuple of handles for tool array
  188. virtual HTuple ConvertToTuple() const;
  189. protected:
  190. // Smart pointer to internal data container
  191. HSurfaceModelArrayPtr *mArrayPtr;
  192. };
  193. }
  194. #endif