HXLD.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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_HXLD
  8. #define HCPP_HXLD
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of an XLD object-(array).
  12. class LIntExport HXLD : public HObject
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HXLD():HObject() {}
  17. // Copy constructor
  18. HXLD(const HXLD& source) : HObject(source) {}
  19. // Copy constructor
  20. HXLD(const HObject& object);
  21. // Create HXLD from object id. For copy=false takes
  22. // over management of input key. Type of key must match!
  23. explicit HXLD(Hkey key, bool copy=true);
  24. // Access of object tuple element
  25. const HXLD operator [] (Hlong index) const;
  26. // Deep copy of all data represented by this object instance
  27. HXLD Clone() const;
  28. /***************************************************************************
  29. * Operators *
  30. ***************************************************************************/
  31. // Return an XLD parallel's data (as lines).
  32. void GetParallelsXld(HTuple* Row1, HTuple* Col1, HTuple* Length1, HTuple* Phi1, HTuple* Row2, HTuple* Col2, HTuple* Length2, HTuple* Phi2) const;
  33. // Display an XLD object.
  34. void DispXld(const HWindow& WindowHandle) const;
  35. // Receive an XLD object over a socket connection.
  36. void ReceiveXld(const HSocket& Socket);
  37. // Send an XLD object over a socket connection.
  38. void SendXld(const HSocket& Socket) const;
  39. // Calculate the difference of two object tuples.
  40. HXLD ObjDiff(const HXLD& ObjectsSub) const;
  41. // Paint XLD objects into an image.
  42. HImage PaintXld(const HImage& Image, const HTuple& Grayval) const;
  43. // Paint XLD objects into an image.
  44. HImage PaintXld(const HImage& Image, double Grayval) const;
  45. // Copy an iconic object in the HALCON database.
  46. HXLD CopyObj(Hlong Index, Hlong NumObj) const;
  47. // Concatenate two iconic object tuples.
  48. HXLD ConcatObj(const HXLD& Objects2) const;
  49. // Select objects from an object tuple.
  50. HXLD SelectObj(const HTuple& Index) const;
  51. // Select objects from an object tuple.
  52. HXLD SelectObj(Hlong Index) const;
  53. // Compare iconic objects regarding equality.
  54. Hlong CompareObj(const HXLD& Objects2, const HTuple& Epsilon) const;
  55. // Compare iconic objects regarding equality.
  56. Hlong CompareObj(const HXLD& Objects2, double Epsilon) const;
  57. // Compare image objects regarding equality.
  58. Hlong TestEqualObj(const HXLD& Objects2) const;
  59. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  60. HImage GenGridRectificationMap(const HImage& Image, HXLD* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType) const;
  61. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  62. HImage GenGridRectificationMap(const HImage& Image, HXLD* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType) const;
  63. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  64. HImage GenGridRectificationMap(const HImage& Image, HXLD* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType) const;
  65. #ifdef _WIN32
  66. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  67. HImage GenGridRectificationMap(const HImage& Image, HXLD* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType) const;
  68. #endif
  69. // Deserialize a serialized XLD object.
  70. void DeserializeXld(const HSerializedItem& SerializedItemHandle);
  71. // Serialize an XLD object.
  72. HSerializedItem SerializeXld() const;
  73. // Test whether contours or polygons are closed.
  74. HTuple TestClosedXld() const;
  75. // Arbitrary geometric moments of contours or polygons treated as point clouds.
  76. HTuple MomentsAnyPointsXld(const HString& Mode, const HTuple& Area, const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& P, const HTuple& Q) const;
  77. // Arbitrary geometric moments of contours or polygons treated as point clouds.
  78. double MomentsAnyPointsXld(const HString& Mode, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const;
  79. // Arbitrary geometric moments of contours or polygons treated as point clouds.
  80. double MomentsAnyPointsXld(const char* Mode, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const;
  81. #ifdef _WIN32
  82. // Arbitrary geometric moments of contours or polygons treated as point clouds.
  83. double MomentsAnyPointsXld(const wchar_t* Mode, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const;
  84. #endif
  85. // Anisometry of contours or polygons treated as point clouds.
  86. HTuple EccentricityPointsXld() const;
  87. // Parameters of the equivalent ellipse of contours or polygons treated as point clouds.
  88. HTuple EllipticAxisPointsXld(HTuple* Rb, HTuple* Phi) const;
  89. // Parameters of the equivalent ellipse of contours or polygons treated as point clouds.
  90. double EllipticAxisPointsXld(double* Rb, double* Phi) const;
  91. // Orientation of contours or polygons treated as point clouds.
  92. HTuple OrientationPointsXld() const;
  93. // Geometric moments M20@f$M_{20}$, M02@f$M_{02}$, and M11@f$M_{11}$ of contours or polygons treated as point clouds.
  94. HTuple MomentsPointsXld(HTuple* M20, HTuple* M02) const;
  95. // Geometric moments M20@f$M_{20}$, M02@f$M_{02}$, and M11@f$M_{11}$ of contours or polygons treated as point clouds.
  96. double MomentsPointsXld(double* M20, double* M02) const;
  97. // Area and center of gravity (centroid) of contours and polygons treated as point clouds.
  98. HTuple AreaCenterPointsXld(HTuple* Row, HTuple* Column) const;
  99. // Area and center of gravity (centroid) of contours and polygons treated as point clouds.
  100. double AreaCenterPointsXld(double* Row, double* Column) const;
  101. // Test XLD contours or polygons for self intersection.
  102. HTuple TestSelfIntersectionXld(const HString& CloseXLD) const;
  103. // Test XLD contours or polygons for self intersection.
  104. HTuple TestSelfIntersectionXld(const char* CloseXLD) const;
  105. #ifdef _WIN32
  106. // Test XLD contours or polygons for self intersection.
  107. HTuple TestSelfIntersectionXld(const wchar_t* CloseXLD) const;
  108. #endif
  109. // Choose all contours or polygons containing a given point.
  110. HXLD SelectXldPoint(const HTuple& Row, const HTuple& Column) const;
  111. // Choose all contours or polygons containing a given point.
  112. HXLD SelectXldPoint(double Row, double Column) const;
  113. // Test whether one or more contours or polygons enclose the given point(s).
  114. HTuple TestXldPoint(const HTuple& Row, const HTuple& Column) const;
  115. // Test whether one or more contours or polygons enclose the given point(s).
  116. Hlong TestXldPoint(double Row, double Column) const;
  117. // Select contours or polygons using shape features.
  118. HXLD SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const;
  119. // Select contours or polygons using shape features.
  120. HXLD SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const;
  121. // Select contours or polygons using shape features.
  122. HXLD SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const;
  123. #ifdef _WIN32
  124. // Select contours or polygons using shape features.
  125. HXLD SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const;
  126. #endif
  127. // Orientation of contours or polygons.
  128. HTuple OrientationXld() const;
  129. // Shape features derived from the ellipse parameters of contours or polygons.
  130. HTuple EccentricityXld(HTuple* Bulkiness, HTuple* StructureFactor) const;
  131. // Shape features derived from the ellipse parameters of contours or polygons.
  132. double EccentricityXld(double* Bulkiness, double* StructureFactor) const;
  133. // Shape factor for the compactness of contours or polygons.
  134. HTuple CompactnessXld() const;
  135. // Maximum distance between two contour or polygon points.
  136. void DiameterXld(HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2, HTuple* Diameter) const;
  137. // Maximum distance between two contour or polygon points.
  138. void DiameterXld(double* Row1, double* Column1, double* Row2, double* Column2, double* Diameter) const;
  139. // Shape factor for the convexity of contours or polygons.
  140. HTuple ConvexityXld() const;
  141. // Shape factor for the circularity (similarity to a circle) of contours or polygons.
  142. HTuple CircularityXld() const;
  143. // Parameters of the equivalent ellipse of contours or polygons.
  144. HTuple EllipticAxisXld(HTuple* Rb, HTuple* Phi) const;
  145. // Parameters of the equivalent ellipse of contours or polygons.
  146. double EllipticAxisXld(double* Rb, double* Phi) const;
  147. // Smallest enclosing rectangle with arbitrary orientation of contours or polygons.
  148. void SmallestRectangle2Xld(HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2) const;
  149. // Smallest enclosing rectangle with arbitrary orientation of contours or polygons.
  150. void SmallestRectangle2Xld(double* Row, double* Column, double* Phi, double* Length1, double* Length2) const;
  151. // Enclosing rectangle parallel to the coordinate axes of contours or polygons.
  152. void SmallestRectangle1Xld(HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2) const;
  153. // Enclosing rectangle parallel to the coordinate axes of contours or polygons.
  154. void SmallestRectangle1Xld(double* Row1, double* Column1, double* Row2, double* Column2) const;
  155. // Smallest enclosing circle of contours or polygons.
  156. void SmallestCircleXld(HTuple* Row, HTuple* Column, HTuple* Radius) const;
  157. // Smallest enclosing circle of contours or polygons.
  158. void SmallestCircleXld(double* Row, double* Column, double* Radius) const;
  159. // Transform the shape of contours or polygons.
  160. HXLD ShapeTransXld(const HString& Type) const;
  161. // Transform the shape of contours or polygons.
  162. HXLD ShapeTransXld(const char* Type) const;
  163. #ifdef _WIN32
  164. // Transform the shape of contours or polygons.
  165. HXLD ShapeTransXld(const wchar_t* Type) const;
  166. #endif
  167. // Length of contours or polygons.
  168. HTuple LengthXld() const;
  169. // Arbitrary geometric moments of contours or polygons.
  170. HTuple MomentsAnyXld(const HString& Mode, const HTuple& PointOrder, const HTuple& Area, const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& P, const HTuple& Q) const;
  171. // Arbitrary geometric moments of contours or polygons.
  172. double MomentsAnyXld(const HString& Mode, const HString& PointOrder, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const;
  173. // Arbitrary geometric moments of contours or polygons.
  174. double MomentsAnyXld(const char* Mode, const char* PointOrder, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const;
  175. #ifdef _WIN32
  176. // Arbitrary geometric moments of contours or polygons.
  177. double MomentsAnyXld(const wchar_t* Mode, const wchar_t* PointOrder, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const;
  178. #endif
  179. // Geometric moments M20@f$M_{20}$, M02@f$M_{02}$, and M11@f$M_{11}$ of contours or polygons.
  180. HTuple MomentsXld(HTuple* M20, HTuple* M02) const;
  181. // Geometric moments M20@f$M_{20}$, M02@f$M_{02}$, and M11@f$M_{11}$ of contours or polygons.
  182. double MomentsXld(double* M20, double* M02) const;
  183. // Area and center of gravity (centroid) of contours and polygons.
  184. HTuple AreaCenterXld(HTuple* Row, HTuple* Column, HTuple* PointOrder) const;
  185. // Area and center of gravity (centroid) of contours and polygons.
  186. double AreaCenterXld(double* Row, double* Column, HString* PointOrder) const;
  187. // Determine the 3D pose of a rectangle from its perspective 2D projection
  188. HPoseArray GetRectanglePose(const HCamPar& CameraParam, const HTuple& Width, const HTuple& Height, const HString& WeightingMode, double ClippingFactor, HTuple* CovPose, HTuple* Error) const;
  189. // Determine the 3D pose of a rectangle from its perspective 2D projection
  190. HPose GetRectanglePose(const HCamPar& CameraParam, double Width, double Height, const HString& WeightingMode, double ClippingFactor, HTuple* CovPose, HTuple* Error) const;
  191. // Determine the 3D pose of a rectangle from its perspective 2D projection
  192. HPose GetRectanglePose(const HCamPar& CameraParam, double Width, double Height, const char* WeightingMode, double ClippingFactor, HTuple* CovPose, HTuple* Error) const;
  193. #ifdef _WIN32
  194. // Determine the 3D pose of a rectangle from its perspective 2D projection
  195. HPose GetRectanglePose(const HCamPar& CameraParam, double Width, double Height, const wchar_t* WeightingMode, double ClippingFactor, HTuple* CovPose, HTuple* Error) const;
  196. #endif
  197. // Determine the 3D pose of a circle from its perspective 2D projection.
  198. HTuple GetCirclePose(const HCamPar& CameraParam, const HTuple& Radius, const HString& OutputType, HTuple* Pose2) const;
  199. // Determine the 3D pose of a circle from its perspective 2D projection.
  200. HTuple GetCirclePose(const HCamPar& CameraParam, double Radius, const HString& OutputType, HTuple* Pose2) const;
  201. // Determine the 3D pose of a circle from its perspective 2D projection.
  202. HTuple GetCirclePose(const HCamPar& CameraParam, double Radius, const char* OutputType, HTuple* Pose2) const;
  203. #ifdef _WIN32
  204. // Determine the 3D pose of a circle from its perspective 2D projection.
  205. HTuple GetCirclePose(const HCamPar& CameraParam, double Radius, const wchar_t* OutputType, HTuple* Pose2) const;
  206. #endif
  207. // Compute the width, height, and aspect ratio of the enclosing rectangle parallel to the coordinate axes of contours or polygons.
  208. HTuple HeightWidthRatioXld(HTuple* Width, HTuple* Ratio) const;
  209. // Compute the width, height, and aspect ratio of the enclosing rectangle parallel to the coordinate axes of contours or polygons.
  210. double HeightWidthRatioXld(double* Width, double* Ratio) const;
  211. // Insert objects into an iconic object tuple.
  212. HXLD InsertObj(const HXLD& ObjectsInsert, Hlong Index) const;
  213. // Remove objects from an iconic object tuple.
  214. HXLD RemoveObj(const HTuple& Index) const;
  215. // Remove objects from an iconic object tuple.
  216. HXLD RemoveObj(Hlong Index) const;
  217. // Replaces one or more elements of an iconic object tuple.
  218. HXLD ReplaceObj(const HXLD& ObjectsReplace, const HTuple& Index) const;
  219. // Replaces one or more elements of an iconic object tuple.
  220. HXLD ReplaceObj(const HXLD& ObjectsReplace, Hlong Index) const;
  221. // Shape factor for the rectangularity of contours or polygons.
  222. HTuple RectangularityXld() const;
  223. private:
  224. // Verify matching semantic type ('xld')!
  225. void AssertObjectClass();
  226. };
  227. }
  228. #endif