HXLDPoly.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /***********************************************************
  2. * File generated by the HALCON-Compiler hcomp version 22.05
  3. * Usage: Interface to C++
  4. *
  5. * Software by: MVTec Software GmbH, www.mvtec.com
  6. ***********************************************************/
  7. #ifndef HCPP_HXLDPOLY
  8. #define HCPP_HXLDPOLY
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of an XLD polygon object(-array).
  12. class LIntExport HXLDPoly : public HXLD
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HXLDPoly():HXLD() {}
  17. // Copy constructor
  18. HXLDPoly(const HXLDPoly& source) : HXLD(source) {}
  19. // Copy constructor
  20. HXLDPoly(const HObject& object);
  21. // Create HXLDPoly from object id. For copy=false takes
  22. // over management of input key. Type of key must match!
  23. explicit HXLDPoly(Hkey key, bool copy=true);
  24. // Access of object tuple element
  25. const HXLDPoly operator [] (Hlong index) const;
  26. // Deep copy of all data represented by this object instance
  27. HXLDPoly Clone() const;
  28. /***************************************************************************
  29. * Operators *
  30. ***************************************************************************/
  31. // Compute the union of closed polygons.
  32. HXLDPoly Union2ClosedPolygonsXld(const HXLDPoly& Polygons2) const;
  33. // Compute the symmetric difference of closed polygons.
  34. HXLDPoly SymmDifferenceClosedPolygonsXld(const HXLDPoly& Polygons2) const;
  35. // Compute the difference of closed polygons.
  36. HXLDPoly DifferenceClosedPolygonsXld(const HXLDPoly& Sub) const;
  37. // Intersect closed polygons.
  38. HXLDPoly IntersectionClosedPolygonsXld(const HXLDPoly& Polygons2) const;
  39. // Read XLD polygons from a file in ARC/INFO generate format.
  40. void ReadPolygonXldArcInfo(const HString& FileName);
  41. // Read XLD polygons from a file in ARC/INFO generate format.
  42. void ReadPolygonXldArcInfo(const char* FileName);
  43. #ifdef _WIN32
  44. // Read XLD polygons from a file in ARC/INFO generate format.
  45. void ReadPolygonXldArcInfo(const wchar_t* FileName);
  46. #endif
  47. // Write XLD polygons to a file in ARC/INFO generate format.
  48. void WritePolygonXldArcInfo(const HString& FileName) const;
  49. // Write XLD polygons to a file in ARC/INFO generate format.
  50. void WritePolygonXldArcInfo(const char* FileName) const;
  51. #ifdef _WIN32
  52. // Write XLD polygons to a file in ARC/INFO generate format.
  53. void WritePolygonXldArcInfo(const wchar_t* FileName) const;
  54. #endif
  55. // Combine road hypotheses from two resolution levels.
  56. HXLDPoly CombineRoadsXld(const HXLDModPara& ModParallels, const HXLDExtPara& ExtParallels, const HXLDPoly& CenterLines, const HTuple& MaxAngleParallel, const HTuple& MaxAngleColinear, const HTuple& MaxDistanceParallel, const HTuple& MaxDistanceColinear) const;
  57. // Combine road hypotheses from two resolution levels.
  58. HXLDPoly CombineRoadsXld(const HXLDModPara& ModParallels, const HXLDExtPara& ExtParallels, const HXLDPoly& CenterLines, double MaxAngleParallel, double MaxAngleColinear, double MaxDistanceParallel, double MaxDistanceColinear) const;
  59. // Extract parallel XLD polygons.
  60. HXLDPara GenParallelsXld(const HTuple& Len, const HTuple& Dist, const HTuple& Alpha, const HString& Merge) const;
  61. // Extract parallel XLD polygons.
  62. HXLDPara GenParallelsXld(double Len, double Dist, double Alpha, const HString& Merge) const;
  63. // Extract parallel XLD polygons.
  64. HXLDPara GenParallelsXld(double Len, double Dist, double Alpha, const char* Merge) const;
  65. #ifdef _WIN32
  66. // Extract parallel XLD polygons.
  67. HXLDPara GenParallelsXld(double Len, double Dist, double Alpha, const wchar_t* Merge) const;
  68. #endif
  69. // Return an XLD polygon's data (as lines).
  70. void GetLinesXld(HTuple* BeginRow, HTuple* BeginCol, HTuple* EndRow, HTuple* EndCol, HTuple* Length, HTuple* Phi) const;
  71. // Return an XLD polygon's data.
  72. void GetPolygonXld(HTuple* Row, HTuple* Col, HTuple* Length, HTuple* Phi) const;
  73. // Split XLD contours at dominant points.
  74. HXLDCont SplitContoursXld(const HString& Mode, Hlong Weight, Hlong Smooth) const;
  75. // Split XLD contours at dominant points.
  76. HXLDCont SplitContoursXld(const char* Mode, Hlong Weight, Hlong Smooth) const;
  77. #ifdef _WIN32
  78. // Split XLD contours at dominant points.
  79. HXLDCont SplitContoursXld(const wchar_t* Mode, Hlong Weight, Hlong Smooth) const;
  80. #endif
  81. // Apply an arbitrary affine transformation to XLD polygons.
  82. HXLDPoly AffineTransPolygonXld(const HHomMat2D& HomMat2D) const;
  83. // Calculate the difference of two object tuples.
  84. HXLDPoly ObjDiff(const HXLDPoly& ObjectsSub) const;
  85. // Copy an iconic object in the HALCON database.
  86. HXLDPoly CopyObj(Hlong Index, Hlong NumObj) const;
  87. // Concatenate two iconic object tuples.
  88. HXLDPoly ConcatObj(const HXLDPoly& Objects2) const;
  89. // Select objects from an object tuple.
  90. HXLDPoly SelectObj(const HTuple& Index) const;
  91. // Select objects from an object tuple.
  92. HXLDPoly SelectObj(Hlong Index) const;
  93. // Compare iconic objects regarding equality.
  94. Hlong CompareObj(const HXLDPoly& Objects2, const HTuple& Epsilon) const;
  95. // Compare iconic objects regarding equality.
  96. Hlong CompareObj(const HXLDPoly& Objects2, double Epsilon) const;
  97. // Compare image objects regarding equality.
  98. Hlong TestEqualObj(const HXLDPoly& Objects2) const;
  99. // Create a region from an XLD polygon.
  100. HRegion GenRegionPolygonXld(const HString& Mode) const;
  101. // Create a region from an XLD polygon.
  102. HRegion GenRegionPolygonXld(const char* Mode) const;
  103. #ifdef _WIN32
  104. // Create a region from an XLD polygon.
  105. HRegion GenRegionPolygonXld(const wchar_t* Mode) const;
  106. #endif
  107. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  108. HImage GenGridRectificationMap(const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType) const;
  109. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  110. HImage GenGridRectificationMap(const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType) const;
  111. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  112. HImage GenGridRectificationMap(const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType) const;
  113. #ifdef _WIN32
  114. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  115. HImage GenGridRectificationMap(const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType) const;
  116. #endif
  117. // Deserialize a serialized XLD object.
  118. void DeserializeXld(const HSerializedItem& SerializedItemHandle);
  119. // Serialize an XLD object.
  120. HSerializedItem SerializeXld() const;
  121. // Read XLD polygons from a DXF file.
  122. HTuple ReadPolygonXldDxf(const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue);
  123. // Read XLD polygons from a DXF file.
  124. HString ReadPolygonXldDxf(const HString& FileName, const HString& GenParamName, double GenParamValue);
  125. // Read XLD polygons from a DXF file.
  126. HString ReadPolygonXldDxf(const char* FileName, const char* GenParamName, double GenParamValue);
  127. #ifdef _WIN32
  128. // Read XLD polygons from a DXF file.
  129. HString ReadPolygonXldDxf(const wchar_t* FileName, const wchar_t* GenParamName, double GenParamValue);
  130. #endif
  131. // Write XLD polygons to a file in DXF format.
  132. void WritePolygonXldDxf(const HString& FileName) const;
  133. // Write XLD polygons to a file in DXF format.
  134. void WritePolygonXldDxf(const char* FileName) const;
  135. #ifdef _WIN32
  136. // Write XLD polygons to a file in DXF format.
  137. void WritePolygonXldDxf(const wchar_t* FileName) const;
  138. #endif
  139. // Choose all contours or polygons containing a given point.
  140. HXLDPoly SelectXldPoint(const HTuple& Row, const HTuple& Column) const;
  141. // Choose all contours or polygons containing a given point.
  142. HXLDPoly SelectXldPoint(double Row, double Column) const;
  143. // Select contours or polygons using shape features.
  144. HXLDPoly SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const;
  145. // Select contours or polygons using shape features.
  146. HXLDPoly SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const;
  147. // Select contours or polygons using shape features.
  148. HXLDPoly SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const;
  149. #ifdef _WIN32
  150. // Select contours or polygons using shape features.
  151. HXLDPoly SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const;
  152. #endif
  153. // Transform the shape of contours or polygons.
  154. HXLDPoly ShapeTransXld(const HString& Type) const;
  155. // Transform the shape of contours or polygons.
  156. HXLDPoly ShapeTransXld(const char* Type) const;
  157. #ifdef _WIN32
  158. // Transform the shape of contours or polygons.
  159. HXLDPoly ShapeTransXld(const wchar_t* Type) const;
  160. #endif
  161. // Insert objects into an iconic object tuple.
  162. HXLDPoly InsertObj(const HXLDPoly& ObjectsInsert, Hlong Index) const;
  163. // Remove objects from an iconic object tuple.
  164. HXLDPoly RemoveObj(const HTuple& Index) const;
  165. // Remove objects from an iconic object tuple.
  166. HXLDPoly RemoveObj(Hlong Index) const;
  167. // Replaces one or more elements of an iconic object tuple.
  168. HXLDPoly ReplaceObj(const HXLDPoly& ObjectsReplace, const HTuple& Index) const;
  169. // Replaces one or more elements of an iconic object tuple.
  170. HXLDPoly ReplaceObj(const HXLDPoly& ObjectsReplace, Hlong Index) const;
  171. private:
  172. // Verify matching semantic type ('xld_poly')!
  173. void AssertObjectClass();
  174. };
  175. }
  176. #endif