HBarCode.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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_HBARCODE
  8. #define HCPP_HBARCODE
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a bar code reader.
  12. class LIntExport HBarCode : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HBarCode():HHandle() {}
  17. // Copy constructor
  18. HBarCode(const HBarCode& source) : HHandle(source) {}
  19. // Copy constructor
  20. HBarCode(const HHandle& handle);
  21. // Create HBarCode from handle, taking ownership
  22. explicit HBarCode(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 ('barcode')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. // Deep copy of all data represented by this object instance
  36. HBarCode Clone() const;
  37. /*****************************************************************************
  38. * Operator-based class constructors
  39. *****************************************************************************/
  40. // read_bar_code_model: Read a bar code model from a file and create a new model.
  41. explicit HBarCode(const HString& FileName);
  42. // read_bar_code_model: Read a bar code model from a file and create a new model.
  43. explicit HBarCode(const char* FileName);
  44. #ifdef _WIN32
  45. // read_bar_code_model: Read a bar code model from a file and create a new model.
  46. explicit HBarCode(const wchar_t* FileName);
  47. #endif
  48. // create_bar_code_model: Create a model of a bar code reader.
  49. explicit HBarCode(const HTuple& GenParamName, const HTuple& GenParamValue);
  50. // create_bar_code_model: Create a model of a bar code reader.
  51. explicit HBarCode(const HString& GenParamName, double GenParamValue);
  52. // create_bar_code_model: Create a model of a bar code reader.
  53. explicit HBarCode(const char* GenParamName, double GenParamValue);
  54. #ifdef _WIN32
  55. // create_bar_code_model: Create a model of a bar code reader.
  56. explicit HBarCode(const wchar_t* GenParamName, double GenParamValue);
  57. #endif
  58. /***************************************************************************
  59. * Operators *
  60. ***************************************************************************/
  61. // Deserialize a bar code model.
  62. void DeserializeBarCodeModel(const HSerializedItem& SerializedItemHandle);
  63. // Serialize a bar code model.
  64. HSerializedItem SerializeBarCodeModel() const;
  65. // Read a bar code model from a file and create a new model.
  66. void ReadBarCodeModel(const HString& FileName);
  67. // Read a bar code model from a file and create a new model.
  68. void ReadBarCodeModel(const char* FileName);
  69. #ifdef _WIN32
  70. // Read a bar code model from a file and create a new model.
  71. void ReadBarCodeModel(const wchar_t* FileName);
  72. #endif
  73. // Write a bar code model to a file.
  74. void WriteBarCodeModel(const HString& FileName) const;
  75. // Write a bar code model to a file.
  76. void WriteBarCodeModel(const char* FileName) const;
  77. #ifdef _WIN32
  78. // Write a bar code model to a file.
  79. void WriteBarCodeModel(const wchar_t* FileName) const;
  80. #endif
  81. // Access iconic objects that were created during the search or decoding of bar code symbols.
  82. HObject GetBarCodeObject(const HTuple& CandidateHandle, const HString& ObjectName) const;
  83. // Access iconic objects that were created during the search or decoding of bar code symbols.
  84. HObject GetBarCodeObject(const HString& CandidateHandle, const HString& ObjectName) const;
  85. // Access iconic objects that were created during the search or decoding of bar code symbols.
  86. HObject GetBarCodeObject(const char* CandidateHandle, const char* ObjectName) const;
  87. #ifdef _WIN32
  88. // Access iconic objects that were created during the search or decoding of bar code symbols.
  89. HObject GetBarCodeObject(const wchar_t* CandidateHandle, const wchar_t* ObjectName) const;
  90. #endif
  91. // Get the alphanumerical results that were accumulated during the decoding of bar code symbols.
  92. HTuple GetBarCodeResult(const HTuple& CandidateHandle, const HString& ResultName) const;
  93. // Get the alphanumerical results that were accumulated during the decoding of bar code symbols.
  94. HTuple GetBarCodeResult(const HString& CandidateHandle, const HString& ResultName) const;
  95. // Get the alphanumerical results that were accumulated during the decoding of bar code symbols.
  96. HTuple GetBarCodeResult(const char* CandidateHandle, const char* ResultName) const;
  97. #ifdef _WIN32
  98. // Get the alphanumerical results that were accumulated during the decoding of bar code symbols.
  99. HTuple GetBarCodeResult(const wchar_t* CandidateHandle, const wchar_t* ResultName) const;
  100. #endif
  101. // Decode bar code symbols within a rectangle.
  102. HTuple DecodeBarCodeRectangle2(const HImage& Image, const HTuple& CodeType, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2) const;
  103. // Decode bar code symbols within a rectangle.
  104. HString DecodeBarCodeRectangle2(const HImage& Image, const HString& CodeType, double Row, double Column, double Phi, double Length1, double Length2) const;
  105. // Decode bar code symbols within a rectangle.
  106. HString DecodeBarCodeRectangle2(const HImage& Image, const char* CodeType, double Row, double Column, double Phi, double Length1, double Length2) const;
  107. #ifdef _WIN32
  108. // Decode bar code symbols within a rectangle.
  109. HString DecodeBarCodeRectangle2(const HImage& Image, const wchar_t* CodeType, double Row, double Column, double Phi, double Length1, double Length2) const;
  110. #endif
  111. // Detect and read bar code symbols in an image.
  112. HRegion FindBarCode(const HImage& Image, const HTuple& CodeType, HTuple* DecodedDataStrings) const;
  113. // Detect and read bar code symbols in an image.
  114. HRegion FindBarCode(const HImage& Image, const HString& CodeType, HString* DecodedDataStrings) const;
  115. // Detect and read bar code symbols in an image.
  116. HRegion FindBarCode(const HImage& Image, const char* CodeType, HString* DecodedDataStrings) const;
  117. #ifdef _WIN32
  118. // Detect and read bar code symbols in an image.
  119. HRegion FindBarCode(const HImage& Image, const wchar_t* CodeType, HString* DecodedDataStrings) const;
  120. #endif
  121. // Get the names of the parameters that can be used in set_bar_code* and get_bar_code* operators for a given bar code model
  122. HTuple QueryBarCodeParams(const HString& Properties) const;
  123. // Get the names of the parameters that can be used in set_bar_code* and get_bar_code* operators for a given bar code model
  124. HTuple QueryBarCodeParams(const char* Properties) const;
  125. #ifdef _WIN32
  126. // Get the names of the parameters that can be used in set_bar_code* and get_bar_code* operators for a given bar code model
  127. HTuple QueryBarCodeParams(const wchar_t* Properties) const;
  128. #endif
  129. // Get parameters that are used by the bar code reader when processing a specific bar code type.
  130. HTuple GetBarCodeParamSpecific(const HTuple& CodeTypes, const HTuple& GenParamName) const;
  131. // Get parameters that are used by the bar code reader when processing a specific bar code type.
  132. HTuple GetBarCodeParamSpecific(const HString& CodeTypes, const HString& GenParamName) const;
  133. // Get parameters that are used by the bar code reader when processing a specific bar code type.
  134. HTuple GetBarCodeParamSpecific(const char* CodeTypes, const char* GenParamName) const;
  135. #ifdef _WIN32
  136. // Get parameters that are used by the bar code reader when processing a specific bar code type.
  137. HTuple GetBarCodeParamSpecific(const wchar_t* CodeTypes, const wchar_t* GenParamName) const;
  138. #endif
  139. // Get one or several parameters that describe the bar code model.
  140. HTuple GetBarCodeParam(const HTuple& GenParamName) const;
  141. // Get one or several parameters that describe the bar code model.
  142. HTuple GetBarCodeParam(const HString& GenParamName) const;
  143. // Get one or several parameters that describe the bar code model.
  144. HTuple GetBarCodeParam(const char* GenParamName) const;
  145. #ifdef _WIN32
  146. // Get one or several parameters that describe the bar code model.
  147. HTuple GetBarCodeParam(const wchar_t* GenParamName) const;
  148. #endif
  149. // Set selected parameters of the bar code model for selected bar code types
  150. void SetBarCodeParamSpecific(const HTuple& CodeTypes, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  151. // Set selected parameters of the bar code model for selected bar code types
  152. void SetBarCodeParamSpecific(const HString& CodeTypes, const HString& GenParamName, const HTuple& GenParamValue) const;
  153. // Set selected parameters of the bar code model for selected bar code types
  154. void SetBarCodeParamSpecific(const char* CodeTypes, const char* GenParamName, const HTuple& GenParamValue) const;
  155. #ifdef _WIN32
  156. // Set selected parameters of the bar code model for selected bar code types
  157. void SetBarCodeParamSpecific(const wchar_t* CodeTypes, const wchar_t* GenParamName, const HTuple& GenParamValue) const;
  158. #endif
  159. // Set selected parameters of the bar code model.
  160. void SetBarCodeParam(const HTuple& GenParamName, const HTuple& GenParamValue) const;
  161. // Set selected parameters of the bar code model.
  162. void SetBarCodeParam(const HString& GenParamName, double GenParamValue) const;
  163. // Set selected parameters of the bar code model.
  164. void SetBarCodeParam(const char* GenParamName, double GenParamValue) const;
  165. #ifdef _WIN32
  166. // Set selected parameters of the bar code model.
  167. void SetBarCodeParam(const wchar_t* GenParamName, double GenParamValue) const;
  168. #endif
  169. // Delete a bar code model and free the allocated memory
  170. static void ClearBarCodeModel(const HBarCodeArray& BarCodeHandle);
  171. // Delete a bar code model and free the allocated memory
  172. void ClearBarCodeModel() const;
  173. // Create a model of a bar code reader.
  174. void CreateBarCodeModel(const HTuple& GenParamName, const HTuple& GenParamValue);
  175. // Create a model of a bar code reader.
  176. void CreateBarCodeModel(const HString& GenParamName, double GenParamValue);
  177. // Create a model of a bar code reader.
  178. void CreateBarCodeModel(const char* GenParamName, double GenParamValue);
  179. #ifdef _WIN32
  180. // Create a model of a bar code reader.
  181. void CreateBarCodeModel(const wchar_t* GenParamName, double GenParamValue);
  182. #endif
  183. };
  184. // forward declarations and types for internal array implementation
  185. template<class T> class HSmartPtr;
  186. template<class T> class HHandleBaseArrayRef;
  187. typedef HHandleBaseArrayRef<HBarCode> HBarCodeArrayRef;
  188. typedef HSmartPtr< HBarCodeArrayRef > HBarCodeArrayPtr;
  189. // Represents multiple tool instances
  190. class LIntExport HBarCodeArray : public HHandleBaseArray
  191. {
  192. public:
  193. // Create empty array
  194. HBarCodeArray();
  195. // Create array from native array of tool instances
  196. HBarCodeArray(HBarCode* classes, Hlong length);
  197. // Copy constructor
  198. HBarCodeArray(const HBarCodeArray &tool_array);
  199. // Destructor
  200. virtual ~HBarCodeArray();
  201. // Assignment operator
  202. HBarCodeArray &operator=(const HBarCodeArray &tool_array);
  203. // Clears array and all tool instances
  204. virtual void Clear();
  205. // Get array of native tool instances
  206. const HBarCode* Tools() const;
  207. // Get number of tools
  208. virtual Hlong Length() const;
  209. // Create tool array from tuple of handles
  210. virtual void SetFromTuple(const HTuple& handles);
  211. // Get tuple of handles for tool array
  212. virtual HTuple ConvertToTuple() const;
  213. protected:
  214. // Smart pointer to internal data container
  215. HBarCodeArrayPtr *mArrayPtr;
  216. };
  217. }
  218. #endif