HMeasure.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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_HMEASURE
  8. #define HCPP_HMEASURE
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a tool to measure distances.
  12. class LIntExport HMeasure : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HMeasure():HHandle() {}
  17. // Copy constructor
  18. HMeasure(const HMeasure& source) : HHandle(source) {}
  19. // Copy constructor
  20. HMeasure(const HHandle& handle);
  21. // Create HMeasure from handle, taking ownership
  22. explicit HMeasure(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 ('measure')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. // Deep copy of all data represented by this object instance
  36. HMeasure Clone() const;
  37. /*****************************************************************************
  38. * Operator-based class constructors
  39. *****************************************************************************/
  40. // gen_measure_arc: Prepare the extraction of straight edges perpendicular to an annular arc.
  41. explicit HMeasure(const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& Radius, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& AnnulusRadius, Hlong Width, Hlong Height, const HString& Interpolation);
  42. // gen_measure_arc: Prepare the extraction of straight edges perpendicular to an annular arc.
  43. explicit HMeasure(double CenterRow, double CenterCol, double Radius, double AngleStart, double AngleExtent, double AnnulusRadius, Hlong Width, Hlong Height, const HString& Interpolation);
  44. // gen_measure_arc: Prepare the extraction of straight edges perpendicular to an annular arc.
  45. explicit HMeasure(double CenterRow, double CenterCol, double Radius, double AngleStart, double AngleExtent, double AnnulusRadius, Hlong Width, Hlong Height, const char* Interpolation);
  46. #ifdef _WIN32
  47. // gen_measure_arc: Prepare the extraction of straight edges perpendicular to an annular arc.
  48. explicit HMeasure(double CenterRow, double CenterCol, double Radius, double AngleStart, double AngleExtent, double AnnulusRadius, Hlong Width, Hlong Height, const wchar_t* Interpolation);
  49. #endif
  50. // gen_measure_rectangle2: Prepare the extraction of straight edges perpendicular to a rectangle.
  51. explicit HMeasure(const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2, Hlong Width, Hlong Height, const HString& Interpolation);
  52. // gen_measure_rectangle2: Prepare the extraction of straight edges perpendicular to a rectangle.
  53. explicit HMeasure(double Row, double Column, double Phi, double Length1, double Length2, Hlong Width, Hlong Height, const HString& Interpolation);
  54. // gen_measure_rectangle2: Prepare the extraction of straight edges perpendicular to a rectangle.
  55. explicit HMeasure(double Row, double Column, double Phi, double Length1, double Length2, Hlong Width, Hlong Height, const char* Interpolation);
  56. #ifdef _WIN32
  57. // gen_measure_rectangle2: Prepare the extraction of straight edges perpendicular to a rectangle.
  58. explicit HMeasure(double Row, double Column, double Phi, double Length1, double Length2, Hlong Width, Hlong Height, const wchar_t* Interpolation);
  59. #endif
  60. /***************************************************************************
  61. * Operators *
  62. ***************************************************************************/
  63. // Serialize a measure object.
  64. HSerializedItem SerializeMeasure() const;
  65. // Deserialize a serialized measure object.
  66. void DeserializeMeasure(const HSerializedItem& SerializedItemHandle);
  67. // Write a measure object to a file.
  68. void WriteMeasure(const HString& FileName) const;
  69. // Write a measure object to a file.
  70. void WriteMeasure(const char* FileName) const;
  71. #ifdef _WIN32
  72. // Write a measure object to a file.
  73. void WriteMeasure(const wchar_t* FileName) const;
  74. #endif
  75. // Read a measure object from a file.
  76. void ReadMeasure(const HString& FileName);
  77. // Read a measure object from a file.
  78. void ReadMeasure(const char* FileName);
  79. #ifdef _WIN32
  80. // Read a measure object from a file.
  81. void ReadMeasure(const wchar_t* FileName);
  82. #endif
  83. // Extracting points with a particular gray value along a rectangle or an annular arc.
  84. void MeasureThresh(const HImage& Image, double Sigma, double Threshold, const HString& Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance) const;
  85. // Extracting points with a particular gray value along a rectangle or an annular arc.
  86. void MeasureThresh(const HImage& Image, double Sigma, double Threshold, const char* Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance) const;
  87. #ifdef _WIN32
  88. // Extracting points with a particular gray value along a rectangle or an annular arc.
  89. void MeasureThresh(const HImage& Image, double Sigma, double Threshold, const wchar_t* Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance) const;
  90. #endif
  91. // Delete a measure object.
  92. void CloseMeasure() const;
  93. // Extract a gray value profile perpendicular to a rectangle or annular arc.
  94. HTuple MeasureProjection(const HImage& Image) const;
  95. // Reset a fuzzy function.
  96. void ResetFuzzyMeasure(const HString& SetType) const;
  97. // Reset a fuzzy function.
  98. void ResetFuzzyMeasure(const char* SetType) const;
  99. #ifdef _WIN32
  100. // Reset a fuzzy function.
  101. void ResetFuzzyMeasure(const wchar_t* SetType) const;
  102. #endif
  103. // Specify a normalized fuzzy function for edge pairs.
  104. void SetFuzzyMeasureNormPair(const HTuple& PairSize, const HString& SetType, const HFunction1D& Function) const;
  105. // Specify a normalized fuzzy function for edge pairs.
  106. void SetFuzzyMeasureNormPair(double PairSize, const HString& SetType, const HFunction1D& Function) const;
  107. // Specify a normalized fuzzy function for edge pairs.
  108. void SetFuzzyMeasureNormPair(double PairSize, const char* SetType, const HFunction1D& Function) const;
  109. #ifdef _WIN32
  110. // Specify a normalized fuzzy function for edge pairs.
  111. void SetFuzzyMeasureNormPair(double PairSize, const wchar_t* SetType, const HFunction1D& Function) const;
  112. #endif
  113. // Specify a fuzzy function.
  114. void SetFuzzyMeasure(const HString& SetType, const HFunction1D& Function) const;
  115. // Specify a fuzzy function.
  116. void SetFuzzyMeasure(const char* SetType, const HFunction1D& Function) const;
  117. #ifdef _WIN32
  118. // Specify a fuzzy function.
  119. void SetFuzzyMeasure(const wchar_t* SetType, const HFunction1D& Function) const;
  120. #endif
  121. // Extract straight edge pairs perpendicular to a rectangle or an annular arc.
  122. void FuzzyMeasurePairing(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const HString& Transition, const HString& Pairing, Hlong NumPairs, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowPairCenter, HTuple* ColumnPairCenter, HTuple* FuzzyScore, HTuple* IntraDistance) const;
  123. // Extract straight edge pairs perpendicular to a rectangle or an annular arc.
  124. void FuzzyMeasurePairing(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const char* Transition, const char* Pairing, Hlong NumPairs, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowPairCenter, HTuple* ColumnPairCenter, HTuple* FuzzyScore, HTuple* IntraDistance) const;
  125. #ifdef _WIN32
  126. // Extract straight edge pairs perpendicular to a rectangle or an annular arc.
  127. void FuzzyMeasurePairing(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const wchar_t* Transition, const wchar_t* Pairing, Hlong NumPairs, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowPairCenter, HTuple* ColumnPairCenter, HTuple* FuzzyScore, HTuple* IntraDistance) const;
  128. #endif
  129. // Extract straight edge pairs perpendicular to a rectangle or an annular arc.
  130. void FuzzyMeasurePairs(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const HString& Transition, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowEdgeCenter, HTuple* ColumnEdgeCenter, HTuple* FuzzyScore, HTuple* IntraDistance, HTuple* InterDistance) const;
  131. // Extract straight edge pairs perpendicular to a rectangle or an annular arc.
  132. void FuzzyMeasurePairs(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const char* Transition, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowEdgeCenter, HTuple* ColumnEdgeCenter, HTuple* FuzzyScore, HTuple* IntraDistance, HTuple* InterDistance) const;
  133. #ifdef _WIN32
  134. // Extract straight edge pairs perpendicular to a rectangle or an annular arc.
  135. void FuzzyMeasurePairs(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const wchar_t* Transition, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowEdgeCenter, HTuple* ColumnEdgeCenter, HTuple* FuzzyScore, HTuple* IntraDistance, HTuple* InterDistance) const;
  136. #endif
  137. // Extract straight edges perpendicular to a rectangle or an annular arc.
  138. void FuzzyMeasurePos(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const HString& Transition, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* FuzzyScore, HTuple* Distance) const;
  139. // Extract straight edges perpendicular to a rectangle or an annular arc.
  140. void FuzzyMeasurePos(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const char* Transition, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* FuzzyScore, HTuple* Distance) const;
  141. #ifdef _WIN32
  142. // Extract straight edges perpendicular to a rectangle or an annular arc.
  143. void FuzzyMeasurePos(const HImage& Image, double Sigma, double AmpThresh, double FuzzyThresh, const wchar_t* Transition, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* FuzzyScore, HTuple* Distance) const;
  144. #endif
  145. // Extract straight edge pairs perpendicular to a rectangle or annular arc.
  146. void MeasurePairs(const HImage& Image, double Sigma, double Threshold, const HString& Transition, const HString& Select, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* IntraDistance, HTuple* InterDistance) const;
  147. // Extract straight edge pairs perpendicular to a rectangle or annular arc.
  148. void MeasurePairs(const HImage& Image, double Sigma, double Threshold, const char* Transition, const char* Select, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* IntraDistance, HTuple* InterDistance) const;
  149. #ifdef _WIN32
  150. // Extract straight edge pairs perpendicular to a rectangle or annular arc.
  151. void MeasurePairs(const HImage& Image, double Sigma, double Threshold, const wchar_t* Transition, const wchar_t* Select, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* IntraDistance, HTuple* InterDistance) const;
  152. #endif
  153. // Extract straight edges perpendicular to a rectangle or annular arc.
  154. void MeasurePos(const HImage& Image, double Sigma, double Threshold, const HString& Transition, const HString& Select, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* Distance) const;
  155. // Extract straight edges perpendicular to a rectangle or annular arc.
  156. void MeasurePos(const HImage& Image, double Sigma, double Threshold, const char* Transition, const char* Select, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* Distance) const;
  157. #ifdef _WIN32
  158. // Extract straight edges perpendicular to a rectangle or annular arc.
  159. void MeasurePos(const HImage& Image, double Sigma, double Threshold, const wchar_t* Transition, const wchar_t* Select, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* Distance) const;
  160. #endif
  161. // Translate a measure object.
  162. void TranslateMeasure(const HTuple& Row, const HTuple& Column) const;
  163. // Translate a measure object.
  164. void TranslateMeasure(double Row, double Column) const;
  165. // Prepare the extraction of straight edges perpendicular to an annular arc.
  166. void GenMeasureArc(const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& Radius, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& AnnulusRadius, Hlong Width, Hlong Height, const HString& Interpolation);
  167. // Prepare the extraction of straight edges perpendicular to an annular arc.
  168. void GenMeasureArc(double CenterRow, double CenterCol, double Radius, double AngleStart, double AngleExtent, double AnnulusRadius, Hlong Width, Hlong Height, const HString& Interpolation);
  169. // Prepare the extraction of straight edges perpendicular to an annular arc.
  170. void GenMeasureArc(double CenterRow, double CenterCol, double Radius, double AngleStart, double AngleExtent, double AnnulusRadius, Hlong Width, Hlong Height, const char* Interpolation);
  171. #ifdef _WIN32
  172. // Prepare the extraction of straight edges perpendicular to an annular arc.
  173. void GenMeasureArc(double CenterRow, double CenterCol, double Radius, double AngleStart, double AngleExtent, double AnnulusRadius, Hlong Width, Hlong Height, const wchar_t* Interpolation);
  174. #endif
  175. // Prepare the extraction of straight edges perpendicular to a rectangle.
  176. void GenMeasureRectangle2(const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2, Hlong Width, Hlong Height, const HString& Interpolation);
  177. // Prepare the extraction of straight edges perpendicular to a rectangle.
  178. void GenMeasureRectangle2(double Row, double Column, double Phi, double Length1, double Length2, Hlong Width, Hlong Height, const HString& Interpolation);
  179. // Prepare the extraction of straight edges perpendicular to a rectangle.
  180. void GenMeasureRectangle2(double Row, double Column, double Phi, double Length1, double Length2, Hlong Width, Hlong Height, const char* Interpolation);
  181. #ifdef _WIN32
  182. // Prepare the extraction of straight edges perpendicular to a rectangle.
  183. void GenMeasureRectangle2(double Row, double Column, double Phi, double Length1, double Length2, Hlong Width, Hlong Height, const wchar_t* Interpolation);
  184. #endif
  185. };
  186. // forward declarations and types for internal array implementation
  187. template<class T> class HSmartPtr;
  188. template<class T> class HHandleBaseArrayRef;
  189. typedef HHandleBaseArrayRef<HMeasure> HMeasureArrayRef;
  190. typedef HSmartPtr< HMeasureArrayRef > HMeasureArrayPtr;
  191. // Represents multiple tool instances
  192. class LIntExport HMeasureArray : public HHandleBaseArray
  193. {
  194. public:
  195. // Create empty array
  196. HMeasureArray();
  197. // Create array from native array of tool instances
  198. HMeasureArray(HMeasure* classes, Hlong length);
  199. // Copy constructor
  200. HMeasureArray(const HMeasureArray &tool_array);
  201. // Destructor
  202. virtual ~HMeasureArray();
  203. // Assignment operator
  204. HMeasureArray &operator=(const HMeasureArray &tool_array);
  205. // Clears array and all tool instances
  206. virtual void Clear();
  207. // Get array of native tool instances
  208. const HMeasure* Tools() const;
  209. // Get number of tools
  210. virtual Hlong Length() const;
  211. // Create tool array from tuple of handles
  212. virtual void SetFromTuple(const HTuple& handles);
  213. // Get tuple of handles for tool array
  214. virtual HTuple ConvertToTuple() const;
  215. protected:
  216. // Smart pointer to internal data container
  217. HMeasureArrayPtr *mArrayPtr;
  218. };
  219. }
  220. #endif