HDlModelOcr.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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_HDLMODELOCR
  8. #define HCPP_HDLMODELOCR
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a Deep Neural Network based OCR model.
  12. class LIntExport HDlModelOcr : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HDlModelOcr():HHandle() {}
  17. // Copy constructor
  18. HDlModelOcr(const HDlModelOcr& source) : HHandle(source) {}
  19. // Copy constructor
  20. HDlModelOcr(const HHandle& handle);
  21. // Create HDlModelOcr from handle, taking ownership
  22. explicit HDlModelOcr(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 ('deep_ocr')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // create_deep_ocr: Create a Deep OCR model.
  39. explicit HDlModelOcr(const HTuple& GenParamName, const HTuple& GenParamValue);
  40. // create_deep_ocr: Create a Deep OCR model.
  41. explicit HDlModelOcr(const HString& GenParamName, const HString& GenParamValue);
  42. // create_deep_ocr: Create a Deep OCR model.
  43. explicit HDlModelOcr(const char* GenParamName, const char* GenParamValue);
  44. #ifdef _WIN32
  45. // create_deep_ocr: Create a Deep OCR model.
  46. explicit HDlModelOcr(const wchar_t* GenParamName, const wchar_t* GenParamValue);
  47. #endif
  48. // read_deep_ocr: Read a Deep OCR model from a file.
  49. explicit HDlModelOcr(const HString& FileName);
  50. // read_deep_ocr: Read a Deep OCR model from a file.
  51. explicit HDlModelOcr(const char* FileName);
  52. #ifdef _WIN32
  53. // read_deep_ocr: Read a Deep OCR model from a file.
  54. explicit HDlModelOcr(const wchar_t* FileName);
  55. #endif
  56. /***************************************************************************
  57. * Operators *
  58. ***************************************************************************/
  59. // Apply a Deep OCR model on a set of images for inference.
  60. HDictArray ApplyDeepOcr(const HImage& Image, const HString& Mode) const;
  61. // Apply a Deep OCR model on a set of images for inference.
  62. HDictArray ApplyDeepOcr(const HImage& Image, const char* Mode) const;
  63. #ifdef _WIN32
  64. // Apply a Deep OCR model on a set of images for inference.
  65. HDictArray ApplyDeepOcr(const HImage& Image, const wchar_t* Mode) const;
  66. #endif
  67. // Create a Deep OCR model.
  68. void CreateDeepOcr(const HTuple& GenParamName, const HTuple& GenParamValue);
  69. // Create a Deep OCR model.
  70. void CreateDeepOcr(const HString& GenParamName, const HString& GenParamValue);
  71. // Create a Deep OCR model.
  72. void CreateDeepOcr(const char* GenParamName, const char* GenParamValue);
  73. #ifdef _WIN32
  74. // Create a Deep OCR model.
  75. void CreateDeepOcr(const wchar_t* GenParamName, const wchar_t* GenParamValue);
  76. #endif
  77. // Return the parameters of a Deep OCR model.
  78. HTuple GetDeepOcrParam(const HString& GenParamName) const;
  79. // Return the parameters of a Deep OCR model.
  80. HTuple GetDeepOcrParam(const char* GenParamName) const;
  81. #ifdef _WIN32
  82. // Return the parameters of a Deep OCR model.
  83. HTuple GetDeepOcrParam(const wchar_t* GenParamName) const;
  84. #endif
  85. // Read a Deep OCR model from a file.
  86. void ReadDeepOcr(const HString& FileName);
  87. // Read a Deep OCR model from a file.
  88. void ReadDeepOcr(const char* FileName);
  89. #ifdef _WIN32
  90. // Read a Deep OCR model from a file.
  91. void ReadDeepOcr(const wchar_t* FileName);
  92. #endif
  93. // Set the parameters of a Deep OCR model.
  94. void SetDeepOcrParam(const HString& GenParamName, const HTuple& GenParamValue) const;
  95. // Set the parameters of a Deep OCR model.
  96. void SetDeepOcrParam(const HString& GenParamName, double GenParamValue) const;
  97. // Set the parameters of a Deep OCR model.
  98. void SetDeepOcrParam(const char* GenParamName, double GenParamValue) const;
  99. #ifdef _WIN32
  100. // Set the parameters of a Deep OCR model.
  101. void SetDeepOcrParam(const wchar_t* GenParamName, double GenParamValue) const;
  102. #endif
  103. // Write a Deep OCR model in a file.
  104. void WriteDeepOcr(const HString& FileName) const;
  105. // Write a Deep OCR model in a file.
  106. void WriteDeepOcr(const char* FileName) const;
  107. #ifdef _WIN32
  108. // Write a Deep OCR model in a file.
  109. void WriteDeepOcr(const wchar_t* FileName) const;
  110. #endif
  111. };
  112. // forward declarations and types for internal array implementation
  113. template<class T> class HSmartPtr;
  114. template<class T> class HHandleBaseArrayRef;
  115. typedef HHandleBaseArrayRef<HDlModelOcr> HDlModelOcrArrayRef;
  116. typedef HSmartPtr< HDlModelOcrArrayRef > HDlModelOcrArrayPtr;
  117. // Represents multiple tool instances
  118. class LIntExport HDlModelOcrArray : public HHandleBaseArray
  119. {
  120. public:
  121. // Create empty array
  122. HDlModelOcrArray();
  123. // Create array from native array of tool instances
  124. HDlModelOcrArray(HDlModelOcr* classes, Hlong length);
  125. // Copy constructor
  126. HDlModelOcrArray(const HDlModelOcrArray &tool_array);
  127. // Destructor
  128. virtual ~HDlModelOcrArray();
  129. // Assignment operator
  130. HDlModelOcrArray &operator=(const HDlModelOcrArray &tool_array);
  131. // Clears array and all tool instances
  132. virtual void Clear();
  133. // Get array of native tool instances
  134. const HDlModelOcr* Tools() const;
  135. // Get number of tools
  136. virtual Hlong Length() const;
  137. // Create tool array from tuple of handles
  138. virtual void SetFromTuple(const HTuple& handles);
  139. // Get tuple of handles for tool array
  140. virtual HTuple ConvertToTuple() const;
  141. protected:
  142. // Smart pointer to internal data container
  143. HDlModelOcrArrayPtr *mArrayPtr;
  144. };
  145. }
  146. #endif