HClassLUT.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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_HCLASSLUT
  8. #define HCPP_HCLASSLUT
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a classification lookup table
  12. class LIntExport HClassLUT : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HClassLUT():HHandle() {}
  17. // Copy constructor
  18. HClassLUT(const HClassLUT& source) : HHandle(source) {}
  19. // Copy constructor
  20. HClassLUT(const HHandle& handle);
  21. // Create HClassLUT from handle, taking ownership
  22. explicit HClassLUT(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 ('class_lut')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // create_class_lut_knn: Create a look-up table using a k-nearest neighbors classifier (k-NN) to classify byte images.
  39. explicit HClassLUT(const HClassKnn& KNNHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  40. // create_class_lut_gmm: Create a look-up table using a gaussian mixture model to classify byte images.
  41. explicit HClassLUT(const HClassGmm& GMMHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  42. // create_class_lut_svm: Create a look-up table using a Support-Vector-Machine to classify byte images.
  43. explicit HClassLUT(const HClassSvm& SVMHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  44. // create_class_lut_mlp: Create a look-up table using a multi-layer perceptron to classify byte images.
  45. explicit HClassLUT(const HClassMlp& MLPHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  46. /***************************************************************************
  47. * Operators *
  48. ***************************************************************************/
  49. // Classify a byte image using a look-up table.
  50. HRegion ClassifyImageClassLut(const HImage& Image) const;
  51. // Clear a look-up table classifier.
  52. static void ClearClassLut(const HClassLUTArray& ClassLUTHandle);
  53. // Clear a look-up table classifier.
  54. void ClearClassLut() const;
  55. // Create a look-up table using a k-nearest neighbors classifier (k-NN) to classify byte images.
  56. void CreateClassLutKnn(const HClassKnn& KNNHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  57. // Create a look-up table using a gaussian mixture model to classify byte images.
  58. void CreateClassLutGmm(const HClassGmm& GMMHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  59. // Create a look-up table using a Support-Vector-Machine to classify byte images.
  60. void CreateClassLutSvm(const HClassSvm& SVMHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  61. // Create a look-up table using a multi-layer perceptron to classify byte images.
  62. void CreateClassLutMlp(const HClassMlp& MLPHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  63. };
  64. // forward declarations and types for internal array implementation
  65. template<class T> class HSmartPtr;
  66. template<class T> class HHandleBaseArrayRef;
  67. typedef HHandleBaseArrayRef<HClassLUT> HClassLUTArrayRef;
  68. typedef HSmartPtr< HClassLUTArrayRef > HClassLUTArrayPtr;
  69. // Represents multiple tool instances
  70. class LIntExport HClassLUTArray : public HHandleBaseArray
  71. {
  72. public:
  73. // Create empty array
  74. HClassLUTArray();
  75. // Create array from native array of tool instances
  76. HClassLUTArray(HClassLUT* classes, Hlong length);
  77. // Copy constructor
  78. HClassLUTArray(const HClassLUTArray &tool_array);
  79. // Destructor
  80. virtual ~HClassLUTArray();
  81. // Assignment operator
  82. HClassLUTArray &operator=(const HClassLUTArray &tool_array);
  83. // Clears array and all tool instances
  84. virtual void Clear();
  85. // Get array of native tool instances
  86. const HClassLUT* Tools() const;
  87. // Get number of tools
  88. virtual Hlong Length() const;
  89. // Create tool array from tuple of handles
  90. virtual void SetFromTuple(const HTuple& handles);
  91. // Get tuple of handles for tool array
  92. virtual HTuple ConvertToTuple() const;
  93. protected:
  94. // Smart pointer to internal data container
  95. HClassLUTArrayPtr *mArrayPtr;
  96. };
  97. }
  98. #endif