HShapeModel3D.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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_HSHAPEMODEL3D
  8. #define HCPP_HSHAPEMODEL3D
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a 3D shape model for 3D matching.
  12. class LIntExport HShapeModel3D : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HShapeModel3D():HHandle() {}
  17. // Copy constructor
  18. HShapeModel3D(const HShapeModel3D& source) : HHandle(source) {}
  19. // Copy constructor
  20. HShapeModel3D(const HHandle& handle);
  21. // Create HShapeModel3D from handle, taking ownership
  22. explicit HShapeModel3D(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 ('shape_model_3d')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. // Deep copy of all data represented by this object instance
  36. HShapeModel3D Clone() const;
  37. /*****************************************************************************
  38. * Operator-based class constructors
  39. *****************************************************************************/
  40. // read_shape_model_3d: Read a 3D shape model from a file.
  41. explicit HShapeModel3D(const HString& FileName);
  42. // read_shape_model_3d: Read a 3D shape model from a file.
  43. explicit HShapeModel3D(const char* FileName);
  44. #ifdef _WIN32
  45. // read_shape_model_3d: Read a 3D shape model from a file.
  46. explicit HShapeModel3D(const wchar_t* FileName);
  47. #endif
  48. // create_shape_model_3d: Prepare a 3D object model for matching.
  49. explicit HShapeModel3D(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue);
  50. // create_shape_model_3d: Prepare a 3D object model for matching.
  51. explicit HShapeModel3D(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HString& GenParamName, Hlong GenParamValue);
  52. // create_shape_model_3d: Prepare a 3D object model for matching.
  53. explicit HShapeModel3D(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const char* OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const char* GenParamName, Hlong GenParamValue);
  54. #ifdef _WIN32
  55. // create_shape_model_3d: Prepare a 3D object model for matching.
  56. explicit HShapeModel3D(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const wchar_t* OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const wchar_t* GenParamName, Hlong GenParamValue);
  57. #endif
  58. /***************************************************************************
  59. * Operators *
  60. ***************************************************************************/
  61. // Free the memory of a 3D shape model.
  62. static void ClearShapeModel3d(const HShapeModel3DArray& ShapeModel3DID);
  63. // Free the memory of a 3D shape model.
  64. void ClearShapeModel3d() const;
  65. // Deserialize a serialized 3D shape model.
  66. void DeserializeShapeModel3d(const HSerializedItem& SerializedItemHandle);
  67. // Serialize a 3D shape model.
  68. HSerializedItem SerializeShapeModel3d() const;
  69. // Read a 3D shape model from a file.
  70. void ReadShapeModel3d(const HString& FileName);
  71. // Read a 3D shape model from a file.
  72. void ReadShapeModel3d(const char* FileName);
  73. #ifdef _WIN32
  74. // Read a 3D shape model from a file.
  75. void ReadShapeModel3d(const wchar_t* FileName);
  76. #endif
  77. // Write a 3D shape model to a file.
  78. void WriteShapeModel3d(const HString& FileName) const;
  79. // Write a 3D shape model to a file.
  80. void WriteShapeModel3d(const char* FileName) const;
  81. #ifdef _WIN32
  82. // Write a 3D shape model to a file.
  83. void WriteShapeModel3d(const wchar_t* FileName) const;
  84. #endif
  85. // Transform a pose that refers to the coordinate system of a 3D object model to a pose that refers to the reference coordinate system of a 3D shape model and vice versa.
  86. HPose TransPoseShapeModel3d(const HPose& PoseIn, const HString& Transformation) const;
  87. // Transform a pose that refers to the coordinate system of a 3D object model to a pose that refers to the reference coordinate system of a 3D shape model and vice versa.
  88. HPose TransPoseShapeModel3d(const HPose& PoseIn, const char* Transformation) const;
  89. #ifdef _WIN32
  90. // Transform a pose that refers to the coordinate system of a 3D object model to a pose that refers to the reference coordinate system of a 3D shape model and vice versa.
  91. HPose TransPoseShapeModel3d(const HPose& PoseIn, const wchar_t* Transformation) const;
  92. #endif
  93. // Project the edges of a 3D shape model into image coordinates.
  94. HXLDCont ProjectShapeModel3d(const HCamPar& CamParam, const HPose& Pose, const HString& HiddenSurfaceRemoval, const HTuple& MinFaceAngle) const;
  95. // Project the edges of a 3D shape model into image coordinates.
  96. HXLDCont ProjectShapeModel3d(const HCamPar& CamParam, const HPose& Pose, const HString& HiddenSurfaceRemoval, double MinFaceAngle) const;
  97. // Project the edges of a 3D shape model into image coordinates.
  98. HXLDCont ProjectShapeModel3d(const HCamPar& CamParam, const HPose& Pose, const char* HiddenSurfaceRemoval, double MinFaceAngle) const;
  99. #ifdef _WIN32
  100. // Project the edges of a 3D shape model into image coordinates.
  101. HXLDCont ProjectShapeModel3d(const HCamPar& CamParam, const HPose& Pose, const wchar_t* HiddenSurfaceRemoval, double MinFaceAngle) const;
  102. #endif
  103. // Return the contour representation of a 3D shape model view.
  104. HXLDCont GetShapeModel3dContours(Hlong Level, Hlong View, HPose* ViewPose) const;
  105. // Return the parameters of a 3D shape model.
  106. HTuple GetShapeModel3dParams(const HTuple& GenParamName) const;
  107. // Return the parameters of a 3D shape model.
  108. HTuple GetShapeModel3dParams(const HString& GenParamName) const;
  109. // Return the parameters of a 3D shape model.
  110. HTuple GetShapeModel3dParams(const char* GenParamName) const;
  111. #ifdef _WIN32
  112. // Return the parameters of a 3D shape model.
  113. HTuple GetShapeModel3dParams(const wchar_t* GenParamName) const;
  114. #endif
  115. // Find the best matches of a 3D shape model in an image.
  116. HPoseArray FindShapeModel3d(const HImage& Image, double MinScore, double Greediness, const HTuple& NumLevels, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* CovPose, HTuple* Score) const;
  117. // Prepare a 3D object model for matching.
  118. void CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue);
  119. // Prepare a 3D object model for matching.
  120. void CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HString& GenParamName, Hlong GenParamValue);
  121. // Prepare a 3D object model for matching.
  122. void CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const char* OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const char* GenParamName, Hlong GenParamValue);
  123. #ifdef _WIN32
  124. // Prepare a 3D object model for matching.
  125. void CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const wchar_t* OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const wchar_t* GenParamName, Hlong GenParamValue);
  126. #endif
  127. };
  128. // forward declarations and types for internal array implementation
  129. template<class T> class HSmartPtr;
  130. template<class T> class HHandleBaseArrayRef;
  131. typedef HHandleBaseArrayRef<HShapeModel3D> HShapeModel3DArrayRef;
  132. typedef HSmartPtr< HShapeModel3DArrayRef > HShapeModel3DArrayPtr;
  133. // Represents multiple tool instances
  134. class LIntExport HShapeModel3DArray : public HHandleBaseArray
  135. {
  136. public:
  137. // Create empty array
  138. HShapeModel3DArray();
  139. // Create array from native array of tool instances
  140. HShapeModel3DArray(HShapeModel3D* classes, Hlong length);
  141. // Copy constructor
  142. HShapeModel3DArray(const HShapeModel3DArray &tool_array);
  143. // Destructor
  144. virtual ~HShapeModel3DArray();
  145. // Assignment operator
  146. HShapeModel3DArray &operator=(const HShapeModel3DArray &tool_array);
  147. // Clears array and all tool instances
  148. virtual void Clear();
  149. // Get array of native tool instances
  150. const HShapeModel3D* Tools() const;
  151. // Get number of tools
  152. virtual Hlong Length() const;
  153. // Create tool array from tuple of handles
  154. virtual void SetFromTuple(const HTuple& handles);
  155. // Get tuple of handles for tool array
  156. virtual HTuple ConvertToTuple() const;
  157. protected:
  158. // Smart pointer to internal data container
  159. HShapeModel3DArrayPtr *mArrayPtr;
  160. };
  161. }
  162. #endif