HTextureInspectionModel.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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_HTEXTUREINSPECTIONMODEL
  8. #define HCPP_HTEXTUREINSPECTIONMODEL
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a texture model for texture inspection.
  12. class LIntExport HTextureInspectionModel : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HTextureInspectionModel():HHandle() {}
  17. // Copy constructor
  18. HTextureInspectionModel(const HTextureInspectionModel& source) : HHandle(source) {}
  19. // Copy constructor
  20. HTextureInspectionModel(const HHandle& handle);
  21. // Create HTextureInspectionModel from handle, taking ownership
  22. explicit HTextureInspectionModel(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 ('texture_inspection_model')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. // Deep copy of all data represented by this object instance
  36. HTextureInspectionModel Clone() const;
  37. /*****************************************************************************
  38. * Operator-based class constructors
  39. *****************************************************************************/
  40. // create_texture_inspection_model: Create a texture inspection model.
  41. explicit HTextureInspectionModel(const HString& ModelType);
  42. // create_texture_inspection_model: Create a texture inspection model.
  43. explicit HTextureInspectionModel(const char* ModelType);
  44. #ifdef _WIN32
  45. // create_texture_inspection_model: Create a texture inspection model.
  46. explicit HTextureInspectionModel(const wchar_t* ModelType);
  47. #endif
  48. /***************************************************************************
  49. * Operators *
  50. ***************************************************************************/
  51. // Add training images to the texture inspection model.
  52. HTuple AddTextureInspectionModelImage(const HImage& Image) const;
  53. // Inspection of the texture within an image.
  54. HRegion ApplyTextureInspectionModel(const HImage& Image, HTextureInspectionResult* TextureInspectionResultID) const;
  55. // Clear a texture inspection model and free the allocated memory.
  56. static void ClearTextureInspectionModel(const HTextureInspectionModelArray& TextureInspectionModel);
  57. // Clear a texture inspection model and free the allocated memory.
  58. void ClearTextureInspectionModel() const;
  59. // Create a texture inspection model.
  60. void CreateTextureInspectionModel(const HString& ModelType);
  61. // Create a texture inspection model.
  62. void CreateTextureInspectionModel(const char* ModelType);
  63. #ifdef _WIN32
  64. // Create a texture inspection model.
  65. void CreateTextureInspectionModel(const wchar_t* ModelType);
  66. #endif
  67. // Deserialize a serialized texture inspection model.
  68. void DeserializeTextureInspectionModel(const HSerializedItem& SerializedItemHandle);
  69. // Get the training images contained in a texture inspection model.
  70. HImage GetTextureInspectionModelImage() const;
  71. // Query parameters of a texture inspection model.
  72. HTuple GetTextureInspectionModelParam(const HTuple& GenParamName) const;
  73. // Query parameters of a texture inspection model.
  74. HTuple GetTextureInspectionModelParam(const HString& GenParamName) const;
  75. // Query parameters of a texture inspection model.
  76. HTuple GetTextureInspectionModelParam(const char* GenParamName) const;
  77. #ifdef _WIN32
  78. // Query parameters of a texture inspection model.
  79. HTuple GetTextureInspectionModelParam(const wchar_t* GenParamName) const;
  80. #endif
  81. // Read a texture inspection model from a file.
  82. void ReadTextureInspectionModel(const HString& FileName);
  83. // Read a texture inspection model from a file.
  84. void ReadTextureInspectionModel(const char* FileName);
  85. #ifdef _WIN32
  86. // Read a texture inspection model from a file.
  87. void ReadTextureInspectionModel(const wchar_t* FileName);
  88. #endif
  89. // Clear all or a user-defined subset of the images of a texture inspection model.
  90. static HTuple RemoveTextureInspectionModelImage(const HTextureInspectionModelArray& TextureInspectionModel, const HTuple& Indices);
  91. // Clear all or a user-defined subset of the images of a texture inspection model.
  92. HTuple RemoveTextureInspectionModelImage(const HTuple& Indices) const;
  93. // Serialize a texture inspection model.
  94. HSerializedItem SerializeTextureInspectionModel() const;
  95. // Set parameters of a texture inspection model.
  96. void SetTextureInspectionModelParam(const HTuple& GenParamName, const HTuple& GenParamValue) const;
  97. // Set parameters of a texture inspection model.
  98. void SetTextureInspectionModelParam(const HString& GenParamName, Hlong GenParamValue) const;
  99. // Set parameters of a texture inspection model.
  100. void SetTextureInspectionModelParam(const char* GenParamName, Hlong GenParamValue) const;
  101. #ifdef _WIN32
  102. // Set parameters of a texture inspection model.
  103. void SetTextureInspectionModelParam(const wchar_t* GenParamName, Hlong GenParamValue) const;
  104. #endif
  105. // Train a texture inspection model.
  106. void TrainTextureInspectionModel() const;
  107. // Write a texture inspection model to a file.
  108. void WriteTextureInspectionModel(const HString& FileName) const;
  109. // Write a texture inspection model to a file.
  110. void WriteTextureInspectionModel(const char* FileName) const;
  111. #ifdef _WIN32
  112. // Write a texture inspection model to a file.
  113. void WriteTextureInspectionModel(const wchar_t* FileName) const;
  114. #endif
  115. };
  116. // forward declarations and types for internal array implementation
  117. template<class T> class HSmartPtr;
  118. template<class T> class HHandleBaseArrayRef;
  119. typedef HHandleBaseArrayRef<HTextureInspectionModel> HTextureInspectionModelArrayRef;
  120. typedef HSmartPtr< HTextureInspectionModelArrayRef > HTextureInspectionModelArrayPtr;
  121. // Represents multiple tool instances
  122. class LIntExport HTextureInspectionModelArray : public HHandleBaseArray
  123. {
  124. public:
  125. // Create empty array
  126. HTextureInspectionModelArray();
  127. // Create array from native array of tool instances
  128. HTextureInspectionModelArray(HTextureInspectionModel* classes, Hlong length);
  129. // Copy constructor
  130. HTextureInspectionModelArray(const HTextureInspectionModelArray &tool_array);
  131. // Destructor
  132. virtual ~HTextureInspectionModelArray();
  133. // Assignment operator
  134. HTextureInspectionModelArray &operator=(const HTextureInspectionModelArray &tool_array);
  135. // Clears array and all tool instances
  136. virtual void Clear();
  137. // Get array of native tool instances
  138. const HTextureInspectionModel* Tools() const;
  139. // Get number of tools
  140. virtual Hlong Length() const;
  141. // Create tool array from tuple of handles
  142. virtual void SetFromTuple(const HTuple& handles);
  143. // Get tuple of handles for tool array
  144. virtual HTuple ConvertToTuple() const;
  145. protected:
  146. // Smart pointer to internal data container
  147. HTextureInspectionModelArrayPtr *mArrayPtr;
  148. };
  149. }
  150. #endif