HOCV.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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_HOCV
  8. #define HCPP_HOCV
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a tool for optical character verification.
  12. class LIntExport HOCV : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HOCV():HHandle() {}
  17. // Copy constructor
  18. HOCV(const HOCV& source) : HHandle(source) {}
  19. // Copy constructor
  20. HOCV(const HHandle& handle);
  21. // Create HOCV from handle, taking ownership
  22. explicit HOCV(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 ('ocv')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. // Deep copy of all data represented by this object instance
  36. HOCV Clone() const;
  37. /*****************************************************************************
  38. * Operator-based class constructors
  39. *****************************************************************************/
  40. // read_ocv: Reading an OCV tool from file.
  41. explicit HOCV(const HString& FileName);
  42. // read_ocv: Reading an OCV tool from file.
  43. explicit HOCV(const char* FileName);
  44. #ifdef _WIN32
  45. // read_ocv: Reading an OCV tool from file.
  46. explicit HOCV(const wchar_t* FileName);
  47. #endif
  48. // create_ocv_proj: Create a new OCV tool based on gray value projections.
  49. explicit HOCV(const HTuple& PatternNames);
  50. /***************************************************************************
  51. * Operators *
  52. ***************************************************************************/
  53. // Verification of a pattern using an OCV tool.
  54. HTuple DoOcvSimple(const HImage& Pattern, const HTuple& PatternName, const HString& AdaptPos, const HString& AdaptSize, const HString& AdaptAngle, const HString& AdaptGray, double Threshold) const;
  55. // Verification of a pattern using an OCV tool.
  56. double DoOcvSimple(const HImage& Pattern, const HString& PatternName, const HString& AdaptPos, const HString& AdaptSize, const HString& AdaptAngle, const HString& AdaptGray, double Threshold) const;
  57. // Verification of a pattern using an OCV tool.
  58. double DoOcvSimple(const HImage& Pattern, const char* PatternName, const char* AdaptPos, const char* AdaptSize, const char* AdaptAngle, const char* AdaptGray, double Threshold) const;
  59. #ifdef _WIN32
  60. // Verification of a pattern using an OCV tool.
  61. double DoOcvSimple(const HImage& Pattern, const wchar_t* PatternName, const wchar_t* AdaptPos, const wchar_t* AdaptSize, const wchar_t* AdaptAngle, const wchar_t* AdaptGray, double Threshold) const;
  62. #endif
  63. // Training of an OCV tool.
  64. void TraindOcvProj(const HImage& Pattern, const HTuple& Name, const HString& Mode) const;
  65. // Training of an OCV tool.
  66. void TraindOcvProj(const HImage& Pattern, const HString& Name, const HString& Mode) const;
  67. // Training of an OCV tool.
  68. void TraindOcvProj(const HImage& Pattern, const char* Name, const char* Mode) const;
  69. #ifdef _WIN32
  70. // Training of an OCV tool.
  71. void TraindOcvProj(const HImage& Pattern, const wchar_t* Name, const wchar_t* Mode) const;
  72. #endif
  73. // Deserialize a serialized OCV tool.
  74. void DeserializeOcv(const HSerializedItem& SerializedItemHandle);
  75. // Serialize an OCV tool.
  76. HSerializedItem SerializeOcv() const;
  77. // Reading an OCV tool from file.
  78. void ReadOcv(const HString& FileName);
  79. // Reading an OCV tool from file.
  80. void ReadOcv(const char* FileName);
  81. #ifdef _WIN32
  82. // Reading an OCV tool from file.
  83. void ReadOcv(const wchar_t* FileName);
  84. #endif
  85. // Saving an OCV tool to file.
  86. void WriteOcv(const HString& FileName) const;
  87. // Saving an OCV tool to file.
  88. void WriteOcv(const char* FileName) const;
  89. #ifdef _WIN32
  90. // Saving an OCV tool to file.
  91. void WriteOcv(const wchar_t* FileName) const;
  92. #endif
  93. // Clear an OCV tool.
  94. void CloseOcv() const;
  95. // Create a new OCV tool based on gray value projections.
  96. void CreateOcvProj(const HTuple& PatternNames);
  97. // Create a new OCV tool based on gray value projections.
  98. void CreateOcvProj(const HString& PatternNames);
  99. // Create a new OCV tool based on gray value projections.
  100. void CreateOcvProj(const char* PatternNames);
  101. #ifdef _WIN32
  102. // Create a new OCV tool based on gray value projections.
  103. void CreateOcvProj(const wchar_t* PatternNames);
  104. #endif
  105. };
  106. // forward declarations and types for internal array implementation
  107. template<class T> class HSmartPtr;
  108. template<class T> class HHandleBaseArrayRef;
  109. typedef HHandleBaseArrayRef<HOCV> HOCVArrayRef;
  110. typedef HSmartPtr< HOCVArrayRef > HOCVArrayPtr;
  111. // Represents multiple tool instances
  112. class LIntExport HOCVArray : public HHandleBaseArray
  113. {
  114. public:
  115. // Create empty array
  116. HOCVArray();
  117. // Create array from native array of tool instances
  118. HOCVArray(HOCV* classes, Hlong length);
  119. // Copy constructor
  120. HOCVArray(const HOCVArray &tool_array);
  121. // Destructor
  122. virtual ~HOCVArray();
  123. // Assignment operator
  124. HOCVArray &operator=(const HOCVArray &tool_array);
  125. // Clears array and all tool instances
  126. virtual void Clear();
  127. // Get array of native tool instances
  128. const HOCV* Tools() const;
  129. // Get number of tools
  130. virtual Hlong Length() const;
  131. // Create tool array from tuple of handles
  132. virtual void SetFromTuple(const HTuple& handles);
  133. // Get tuple of handles for tool array
  134. virtual HTuple ConvertToTuple() const;
  135. protected:
  136. // Smart pointer to internal data container
  137. HOCVArrayPtr *mArrayPtr;
  138. };
  139. }
  140. #endif