HSampleIdentifier.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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_HSAMPLEIDENTIFIER
  8. #define HCPP_HSAMPLEIDENTIFIER
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a sample identifier.
  12. class LIntExport HSampleIdentifier : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HSampleIdentifier():HHandle() {}
  17. // Copy constructor
  18. HSampleIdentifier(const HSampleIdentifier& source) : HHandle(source) {}
  19. // Copy constructor
  20. HSampleIdentifier(const HHandle& handle);
  21. // Create HSampleIdentifier from handle, taking ownership
  22. explicit HSampleIdentifier(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 ('sample_identifier')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. // Deep copy of all data represented by this object instance
  36. HSampleIdentifier Clone() const;
  37. /*****************************************************************************
  38. * Operator-based class constructors
  39. *****************************************************************************/
  40. // read_sample_identifier: Read a sample identifier from a file.
  41. explicit HSampleIdentifier(const HString& FileName);
  42. // read_sample_identifier: Read a sample identifier from a file.
  43. explicit HSampleIdentifier(const char* FileName);
  44. #ifdef _WIN32
  45. // read_sample_identifier: Read a sample identifier from a file.
  46. explicit HSampleIdentifier(const wchar_t* FileName);
  47. #endif
  48. // create_sample_identifier: Create a new sample identifier.
  49. explicit HSampleIdentifier(const HTuple& GenParamName, const HTuple& GenParamValue);
  50. /***************************************************************************
  51. * Operators *
  52. ***************************************************************************/
  53. // Free the memory of a sample identifier.
  54. void ClearSampleIdentifier() const;
  55. // Deserialize a serialized sample identifier.
  56. void DeserializeSampleIdentifier(const HSerializedItem& SerializedItemHandle);
  57. // Read a sample identifier from a file.
  58. void ReadSampleIdentifier(const HString& FileName);
  59. // Read a sample identifier from a file.
  60. void ReadSampleIdentifier(const char* FileName);
  61. #ifdef _WIN32
  62. // Read a sample identifier from a file.
  63. void ReadSampleIdentifier(const wchar_t* FileName);
  64. #endif
  65. // Serialize a sample identifier.
  66. HSerializedItem SerializeSampleIdentifier() const;
  67. // Write a sample identifier to a file.
  68. void WriteSampleIdentifier(const HString& FileName) const;
  69. // Write a sample identifier to a file.
  70. void WriteSampleIdentifier(const char* FileName) const;
  71. #ifdef _WIN32
  72. // Write a sample identifier to a file.
  73. void WriteSampleIdentifier(const wchar_t* FileName) const;
  74. #endif
  75. // Identify objects with a sample identifier.
  76. HTuple ApplySampleIdentifier(const HImage& Image, Hlong NumResults, double RatingThreshold, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Rating) const;
  77. // Identify objects with a sample identifier.
  78. Hlong ApplySampleIdentifier(const HImage& Image, Hlong NumResults, double RatingThreshold, const HTuple& GenParamName, const HTuple& GenParamValue, double* Rating) const;
  79. // Get selected parameters of a sample identifier.
  80. HTuple GetSampleIdentifierParam(const HString& GenParamName) const;
  81. // Get selected parameters of a sample identifier.
  82. HTuple GetSampleIdentifierParam(const char* GenParamName) const;
  83. #ifdef _WIN32
  84. // Get selected parameters of a sample identifier.
  85. HTuple GetSampleIdentifierParam(const wchar_t* GenParamName) const;
  86. #endif
  87. // Set selected parameters of a sample identifier.
  88. void SetSampleIdentifierParam(const HString& GenParamName, const HTuple& GenParamValue) const;
  89. // Set selected parameters of a sample identifier.
  90. void SetSampleIdentifierParam(const HString& GenParamName, double GenParamValue) const;
  91. // Set selected parameters of a sample identifier.
  92. void SetSampleIdentifierParam(const char* GenParamName, double GenParamValue) const;
  93. #ifdef _WIN32
  94. // Set selected parameters of a sample identifier.
  95. void SetSampleIdentifierParam(const wchar_t* GenParamName, double GenParamValue) const;
  96. #endif
  97. // Retrieve information about an object of a sample identifier.
  98. HTuple GetSampleIdentifierObjectInfo(const HTuple& ObjectIdx, const HTuple& InfoName) const;
  99. // Retrieve information about an object of a sample identifier.
  100. HTuple GetSampleIdentifierObjectInfo(Hlong ObjectIdx, const HString& InfoName) const;
  101. // Retrieve information about an object of a sample identifier.
  102. HTuple GetSampleIdentifierObjectInfo(Hlong ObjectIdx, const char* InfoName) const;
  103. #ifdef _WIN32
  104. // Retrieve information about an object of a sample identifier.
  105. HTuple GetSampleIdentifierObjectInfo(Hlong ObjectIdx, const wchar_t* InfoName) const;
  106. #endif
  107. // Define a name or a description for an object of a sample identifier.
  108. void SetSampleIdentifierObjectInfo(const HTuple& ObjectIdx, const HString& InfoName, const HTuple& InfoValue) const;
  109. // Define a name or a description for an object of a sample identifier.
  110. void SetSampleIdentifierObjectInfo(Hlong ObjectIdx, const HString& InfoName, const HString& InfoValue) const;
  111. // Define a name or a description for an object of a sample identifier.
  112. void SetSampleIdentifierObjectInfo(Hlong ObjectIdx, const char* InfoName, const char* InfoValue) const;
  113. #ifdef _WIN32
  114. // Define a name or a description for an object of a sample identifier.
  115. void SetSampleIdentifierObjectInfo(Hlong ObjectIdx, const wchar_t* InfoName, const wchar_t* InfoValue) const;
  116. #endif
  117. // Remove training data from a sample identifier.
  118. void RemoveSampleIdentifierTrainingData(const HTuple& ObjectIdx, const HTuple& ObjectSampleIdx) const;
  119. // Remove training data from a sample identifier.
  120. void RemoveSampleIdentifierTrainingData(Hlong ObjectIdx, Hlong ObjectSampleIdx) const;
  121. // Remove preparation data from a sample identifier.
  122. void RemoveSampleIdentifierPreparationData(const HTuple& ObjectIdx, const HTuple& ObjectSampleIdx) const;
  123. // Remove preparation data from a sample identifier.
  124. void RemoveSampleIdentifierPreparationData(Hlong ObjectIdx, Hlong ObjectSampleIdx) const;
  125. // Train a sample identifier.
  126. void TrainSampleIdentifier(const HTuple& GenParamName, const HTuple& GenParamValue) const;
  127. // Add training data to an existing sample identifier.
  128. Hlong AddSampleIdentifierTrainingData(const HImage& SampleImage, const HTuple& ObjectIdx, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  129. // Add training data to an existing sample identifier.
  130. Hlong AddSampleIdentifierTrainingData(const HImage& SampleImage, Hlong ObjectIdx, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  131. // Adapt the internal data structure of a sample identifier to the objects to be identified.
  132. void PrepareSampleIdentifier(const HString& RemovePreparationData, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  133. // Adapt the internal data structure of a sample identifier to the objects to be identified.
  134. void PrepareSampleIdentifier(const char* RemovePreparationData, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  135. #ifdef _WIN32
  136. // Adapt the internal data structure of a sample identifier to the objects to be identified.
  137. void PrepareSampleIdentifier(const wchar_t* RemovePreparationData, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  138. #endif
  139. // Add preparation data to an existing sample identifier.
  140. Hlong AddSampleIdentifierPreparationData(const HImage& SampleImage, const HTuple& ObjectIdx, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  141. // Add preparation data to an existing sample identifier.
  142. Hlong AddSampleIdentifierPreparationData(const HImage& SampleImage, Hlong ObjectIdx, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  143. // Create a new sample identifier.
  144. void CreateSampleIdentifier(const HTuple& GenParamName, const HTuple& GenParamValue);
  145. };
  146. // forward declarations and types for internal array implementation
  147. template<class T> class HSmartPtr;
  148. template<class T> class HHandleBaseArrayRef;
  149. typedef HHandleBaseArrayRef<HSampleIdentifier> HSampleIdentifierArrayRef;
  150. typedef HSmartPtr< HSampleIdentifierArrayRef > HSampleIdentifierArrayPtr;
  151. // Represents multiple tool instances
  152. class LIntExport HSampleIdentifierArray : public HHandleBaseArray
  153. {
  154. public:
  155. // Create empty array
  156. HSampleIdentifierArray();
  157. // Create array from native array of tool instances
  158. HSampleIdentifierArray(HSampleIdentifier* classes, Hlong length);
  159. // Copy constructor
  160. HSampleIdentifierArray(const HSampleIdentifierArray &tool_array);
  161. // Destructor
  162. virtual ~HSampleIdentifierArray();
  163. // Assignment operator
  164. HSampleIdentifierArray &operator=(const HSampleIdentifierArray &tool_array);
  165. // Clears array and all tool instances
  166. virtual void Clear();
  167. // Get array of native tool instances
  168. const HSampleIdentifier* Tools() const;
  169. // Get number of tools
  170. virtual Hlong Length() const;
  171. // Create tool array from tuple of handles
  172. virtual void SetFromTuple(const HTuple& handles);
  173. // Get tuple of handles for tool array
  174. virtual HTuple ConvertToTuple() const;
  175. protected:
  176. // Smart pointer to internal data container
  177. HSampleIdentifierArrayPtr *mArrayPtr;
  178. };
  179. }
  180. #endif