HXLDPoly.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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_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. /***************************************************************************
  27. * Operators *
  28. ***************************************************************************/
  29. // Compute the union of closed polygons.
  30. HXLDPoly Union2ClosedPolygonsXld(const HXLDPoly& Polygons2) const;
  31. // Compute the symmetric difference of closed polygons.
  32. HXLDPoly SymmDifferenceClosedPolygonsXld(const HXLDPoly& Polygons2) const;
  33. // Compute the difference of closed polygons.
  34. HXLDPoly DifferenceClosedPolygonsXld(const HXLDPoly& Sub) const;
  35. // Intersect closed polygons.
  36. HXLDPoly IntersectionClosedPolygonsXld(const HXLDPoly& Polygons2) const;
  37. // Read XLD polygons from a file in ARC/INFO generate format.
  38. void ReadPolygonXldArcInfo(const HString& FileName);
  39. // Read XLD polygons from a file in ARC/INFO generate format.
  40. void ReadPolygonXldArcInfo(const char* FileName);
  41. #ifdef _WIN32
  42. // Read XLD polygons from a file in ARC/INFO generate format.
  43. void ReadPolygonXldArcInfo(const wchar_t* FileName);
  44. #endif
  45. // Write XLD polygons to a file in ARC/INFO generate format.
  46. void WritePolygonXldArcInfo(const HString& FileName) const;
  47. // Write XLD polygons to a file in ARC/INFO generate format.
  48. void WritePolygonXldArcInfo(const char* FileName) const;
  49. #ifdef _WIN32
  50. // Write XLD polygons to a file in ARC/INFO generate format.
  51. void WritePolygonXldArcInfo(const wchar_t* FileName) const;
  52. #endif
  53. // Combine road hypotheses from two resolution levels.
  54. HXLDPoly CombineRoadsXld(const HXLDModPara& ModParallels, const HXLDExtPara& ExtParallels, const HXLDPoly& CenterLines, const HTuple& MaxAngleParallel, const HTuple& MaxAngleColinear, const HTuple& MaxDistanceParallel, const HTuple& MaxDistanceColinear) const;
  55. // Combine road hypotheses from two resolution levels.
  56. HXLDPoly CombineRoadsXld(const HXLDModPara& ModParallels, const HXLDExtPara& ExtParallels, const HXLDPoly& CenterLines, double MaxAngleParallel, double MaxAngleColinear, double MaxDistanceParallel, double MaxDistanceColinear) const;
  57. // Extract parallel XLD polygons.
  58. HXLDPara GenParallelsXld(const HTuple& Len, const HTuple& Dist, const HTuple& Alpha, const HString& Merge) const;
  59. // Extract parallel XLD polygons.
  60. HXLDPara GenParallelsXld(double Len, double Dist, double Alpha, const HString& Merge) const;
  61. // Extract parallel XLD polygons.
  62. HXLDPara GenParallelsXld(double Len, double Dist, double Alpha, const char* Merge) const;
  63. #ifdef _WIN32
  64. // Extract parallel XLD polygons.
  65. HXLDPara GenParallelsXld(double Len, double Dist, double Alpha, const wchar_t* Merge) const;
  66. #endif
  67. // Return an XLD polygon's data (as lines).
  68. void GetLinesXld(HTuple* BeginRow, HTuple* BeginCol, HTuple* EndRow, HTuple* EndCol, HTuple* Length, HTuple* Phi) const;
  69. // Return an XLD polygon's data.
  70. void GetPolygonXld(HTuple* Row, HTuple* Col, HTuple* Length, HTuple* Phi) const;
  71. // Split XLD contours at dominant points.
  72. HXLDCont SplitContoursXld(const HString& Mode, Hlong Weight, Hlong Smooth) const;
  73. // Split XLD contours at dominant points.
  74. HXLDCont SplitContoursXld(const char* Mode, Hlong Weight, Hlong Smooth) const;
  75. #ifdef _WIN32
  76. // Split XLD contours at dominant points.
  77. HXLDCont SplitContoursXld(const wchar_t* Mode, Hlong Weight, Hlong Smooth) const;
  78. #endif
  79. // Apply an arbitrary affine transformation to XLD polygons.
  80. HXLDPoly AffineTransPolygonXld(const HHomMat2D& HomMat2D) const;
  81. // Calculate the difference of two object tuples.
  82. HXLDPoly ObjDiff(const HXLDPoly& ObjectsSub) const;
  83. // Copy an iconic object in the HALCON database.
  84. HXLDPoly CopyObj(Hlong Index, Hlong NumObj) const;
  85. // Concatenate two iconic object tuples.
  86. HXLDPoly ConcatObj(const HXLDPoly& Objects2) const;
  87. // Select objects from an object tuple.
  88. HXLDPoly SelectObj(const HTuple& Index) const;
  89. // Select objects from an object tuple.
  90. HXLDPoly SelectObj(Hlong Index) const;
  91. // Compare iconic objects regarding equality.
  92. Hlong CompareObj(const HXLDPoly& Objects2, const HTuple& Epsilon) const;
  93. // Compare iconic objects regarding equality.
  94. Hlong CompareObj(const HXLDPoly& Objects2, double Epsilon) const;
  95. // Compare image objects regarding equality.
  96. Hlong TestEqualObj(const HXLDPoly& Objects2) const;
  97. // Create a region from an XLD polygon.
  98. HRegion GenRegionPolygonXld(const HString& Mode) const;
  99. // Create a region from an XLD polygon.
  100. HRegion GenRegionPolygonXld(const char* Mode) const;
  101. #ifdef _WIN32
  102. // Create a region from an XLD polygon.
  103. HRegion GenRegionPolygonXld(const wchar_t* Mode) const;
  104. #endif
  105. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  106. HImage GenGridRectificationMap(const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType) const;
  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 HString& 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 char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType) const;
  111. #ifdef _WIN32
  112. // Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
  113. HImage GenGridRectificationMap(const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType) const;
  114. #endif
  115. // Read XLD polygons from a DXF file.
  116. HTuple ReadPolygonXldDxf(const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue);
  117. // Read XLD polygons from a DXF file.
  118. HString ReadPolygonXldDxf(const HString& FileName, const HString& GenParamName, double GenParamValue);
  119. // Read XLD polygons from a DXF file.
  120. HString ReadPolygonXldDxf(const char* FileName, const char* GenParamName, double GenParamValue);
  121. #ifdef _WIN32
  122. // Read XLD polygons from a DXF file.
  123. HString ReadPolygonXldDxf(const wchar_t* FileName, const wchar_t* GenParamName, double GenParamValue);
  124. #endif
  125. // Write XLD polygons to a file in DXF format.
  126. void WritePolygonXldDxf(const HString& FileName) const;
  127. // Write XLD polygons to a file in DXF format.
  128. void WritePolygonXldDxf(const char* FileName) const;
  129. #ifdef _WIN32
  130. // Write XLD polygons to a file in DXF format.
  131. void WritePolygonXldDxf(const wchar_t* FileName) const;
  132. #endif
  133. // Choose all contours or polygons containing a given point.
  134. HXLDPoly SelectXldPoint(const HTuple& Row, const HTuple& Column) const;
  135. // Choose all contours or polygons containing a given point.
  136. HXLDPoly SelectXldPoint(double Row, double Column) const;
  137. // Select contours or polygons using shape features.
  138. HXLDPoly SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const;
  139. // Select contours or polygons using shape features.
  140. HXLDPoly SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const;
  141. // Select contours or polygons using shape features.
  142. HXLDPoly SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const;
  143. #ifdef _WIN32
  144. // Select contours or polygons using shape features.
  145. HXLDPoly SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const;
  146. #endif
  147. // Transform the shape of contours or polygons.
  148. HXLDPoly ShapeTransXld(const HString& Type) const;
  149. // Transform the shape of contours or polygons.
  150. HXLDPoly ShapeTransXld(const char* Type) const;
  151. #ifdef _WIN32
  152. // Transform the shape of contours or polygons.
  153. HXLDPoly ShapeTransXld(const wchar_t* Type) const;
  154. #endif
  155. // Insert objects into an iconic object tuple.
  156. HXLDPoly InsertObj(const HXLDPoly& ObjectsInsert, Hlong Index) const;
  157. // Remove objects from an iconic object tuple.
  158. HXLDPoly RemoveObj(const HTuple& Index) const;
  159. // Remove objects from an iconic object tuple.
  160. HXLDPoly RemoveObj(Hlong Index) const;
  161. // Replaces one or more elements of an iconic object tuple.
  162. HXLDPoly ReplaceObj(const HXLDPoly& ObjectsReplace, const HTuple& Index) const;
  163. // Replaces one or more elements of an iconic object tuple.
  164. HXLDPoly ReplaceObj(const HXLDPoly& ObjectsReplace, Hlong Index) const;
  165. private:
  166. // Verify matching semantic type ('xld_poly')!
  167. void AssertObjectClass();
  168. };
  169. }
  170. #endif