HFeatureSet.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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_HFEATURESET
  8. #define HCPP_HFEATURESET
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a training used for the classifier.
  12. class LIntExport HFeatureSet : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HFeatureSet():HHandle() {}
  17. // Copy constructor
  18. HFeatureSet(const HFeatureSet& source) : HHandle(source) {}
  19. // Copy constructor
  20. HFeatureSet(const HHandle& handle);
  21. // Create HFeatureSet from handle, taking ownership
  22. explicit HFeatureSet(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 ('feature_set')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // read_sampset: Read a training data set from a file.
  39. explicit HFeatureSet(const HString& FileName);
  40. // read_sampset: Read a training data set from a file.
  41. explicit HFeatureSet(const char* FileName);
  42. #ifdef _WIN32
  43. // read_sampset: Read a training data set from a file.
  44. explicit HFeatureSet(const wchar_t* FileName);
  45. #endif
  46. /***************************************************************************
  47. * Operators *
  48. ***************************************************************************/
  49. // Read a training data set from a file.
  50. void ReadSampset(const HString& FileName);
  51. // Read a training data set from a file.
  52. void ReadSampset(const char* FileName);
  53. #ifdef _WIN32
  54. // Read a training data set from a file.
  55. void ReadSampset(const wchar_t* FileName);
  56. #endif
  57. // Train the classifier with one data set.
  58. void LearnSampsetBox(const HClassBox& ClassifHandle, const HString& Outfile, Hlong NSamples, double StopError, Hlong ErrorN) const;
  59. // Train the classifier with one data set.
  60. void LearnSampsetBox(const HClassBox& ClassifHandle, const char* Outfile, Hlong NSamples, double StopError, Hlong ErrorN) const;
  61. #ifdef _WIN32
  62. // Train the classifier with one data set.
  63. void LearnSampsetBox(const HClassBox& ClassifHandle, const wchar_t* Outfile, Hlong NSamples, double StopError, Hlong ErrorN) const;
  64. #endif
  65. // Free memory of a data set.
  66. void ClearSampset() const;
  67. // Classify a set of arrays.
  68. double TestSampsetBox(const HClassBox& ClassifHandle) const;
  69. };
  70. // forward declarations and types for internal array implementation
  71. template<class T> class HSmartPtr;
  72. template<class T> class HHandleBaseArrayRef;
  73. typedef HHandleBaseArrayRef<HFeatureSet> HFeatureSetArrayRef;
  74. typedef HSmartPtr< HFeatureSetArrayRef > HFeatureSetArrayPtr;
  75. // Represents multiple tool instances
  76. class LIntExport HFeatureSetArray : public HHandleBaseArray
  77. {
  78. public:
  79. // Create empty array
  80. HFeatureSetArray();
  81. // Create array from native array of tool instances
  82. HFeatureSetArray(HFeatureSet* classes, Hlong length);
  83. // Copy constructor
  84. HFeatureSetArray(const HFeatureSetArray &tool_array);
  85. // Destructor
  86. virtual ~HFeatureSetArray();
  87. // Assignment operator
  88. HFeatureSetArray &operator=(const HFeatureSetArray &tool_array);
  89. // Clears array and all tool instances
  90. virtual void Clear();
  91. // Get array of native tool instances
  92. const HFeatureSet* Tools() const;
  93. // Get number of tools
  94. virtual Hlong Length() const;
  95. // Create tool array from tuple of handles
  96. virtual void SetFromTuple(const HTuple& handles);
  97. // Get tuple of handles for tool array
  98. virtual HTuple ConvertToTuple() const;
  99. protected:
  100. // Smart pointer to internal data container
  101. HFeatureSetArrayPtr *mArrayPtr;
  102. };
  103. }
  104. #endif