/*********************************************************** * File generated by the HALCON-Compiler hcomp version 20.11 * Usage: Interface to C++ * * Software by: MVTec Software GmbH, www.mvtec.com ***********************************************************/ #ifndef HCPP_HCLASSBOX #define HCPP_HCLASSBOX namespace HalconCpp { // Represents an instance of a classifier. class LIntExport HClassBox : public HHandle { public: // Copy constructor HClassBox(const HClassBox& source) : HHandle(source) {} // Copy constructor HClassBox(const HHandle& handle); // Create HClassBox from handle, taking ownership explicit HClassBox(Hlong handle); bool operator==(const HHandle& obj) const { return HHandleBase::operator==(obj); } bool operator!=(const HHandle& obj) const { return HHandleBase::operator!=(obj); } protected: // Verify matching semantic type ('class_box')! virtual void AssertType(Hphandle handle) const; public: // Deep copy of all data represented by this object instance HClassBox Clone() const; /***************************************************************************** * Operator-based class constructors *****************************************************************************/ // create_class_box: Create a new classifier. explicit HClassBox(); /*************************************************************************** * Operators * ***************************************************************************/ // Train a classificator using a multi-channel image. void LearnNdimBox(const HRegion& Foreground, const HRegion& Background, const HImage& MultiChannelImage) const; // Classify pixels using hyper-cuboids. HRegion ClassNdimBox(const HImage& MultiChannelImage) const; // Deserialize a serialized classifier. void DeserializeClassBox(const HSerializedItem& SerializedItemHandle) const; // Serialize a classifier. HSerializedItem SerializeClassBox() const; // Save a classifier in a file. void WriteClassBox(const HString& FileName) const; // Save a classifier in a file. void WriteClassBox(const char* FileName) const; #ifdef _WIN32 // Save a classifier in a file. void WriteClassBox(const wchar_t* FileName) const; #endif // Set system parameters for classification. void SetClassBoxParam(const HString& Flag, const HTuple& Value) const; // Set system parameters for classification. void SetClassBoxParam(const HString& Flag, double Value) const; // Set system parameters for classification. void SetClassBoxParam(const char* Flag, double Value) const; #ifdef _WIN32 // Set system parameters for classification. void SetClassBoxParam(const wchar_t* Flag, double Value) const; #endif // Read a classifier from a file. void ReadClassBox(const HString& FileName) const; // Read a classifier from a file. void ReadClassBox(const char* FileName) const; #ifdef _WIN32 // Read a classifier from a file. void ReadClassBox(const wchar_t* FileName) const; #endif // Train the classifier with one data set. void LearnSampsetBox(const HFeatureSet& SampKey, const HString& Outfile, Hlong NSamples, double StopError, Hlong ErrorN) const; // Train the classifier with one data set. void LearnSampsetBox(const HFeatureSet& SampKey, const char* Outfile, Hlong NSamples, double StopError, Hlong ErrorN) const; #ifdef _WIN32 // Train the classifier with one data set. void LearnSampsetBox(const HFeatureSet& SampKey, const wchar_t* Outfile, Hlong NSamples, double StopError, Hlong ErrorN) const; #endif // Train the classifier. void LearnClassBox(const HTuple& Features, Hlong Class) const; // Get information about the current parameter. HTuple GetClassBoxParam(const HString& Flag) const; // Get information about the current parameter. HTuple GetClassBoxParam(const char* Flag) const; #ifdef _WIN32 // Get information about the current parameter. HTuple GetClassBoxParam(const wchar_t* Flag) const; #endif // Destroy the classifier. void CloseClassBox() const; // Create a new classifier. void CreateClassBox(); // Describe the classes of a box classifier. HTuple DescriptClassBox(Hlong Dimensions, HTuple* BoxIdx, HTuple* BoxLowerBound, HTuple* BoxHigherBound, HTuple* BoxNumSamplesTrain, HTuple* BoxNumSamplesWrong) const; // Describe the classes of a box classifier. Hlong DescriptClassBox(Hlong Dimensions, Hlong* BoxIdx, Hlong* BoxLowerBound, Hlong* BoxHigherBound, Hlong* BoxNumSamplesTrain, Hlong* BoxNumSamplesWrong) const; // Classify a set of arrays. double TestSampsetBox(const HFeatureSet& SampKey) const; // Classify a tuple of attributes with rejection class. Hlong EnquireRejectClassBox(const HTuple& FeatureList) const; // Classify a tuple of attributes. Hlong EnquireClassBox(const HTuple& FeatureList) const; }; // forward declarations and types for internal array implementation template class HSmartPtr; template class HHandleBaseArrayRef; typedef HHandleBaseArrayRef HClassBoxArrayRef; typedef HSmartPtr< HClassBoxArrayRef > HClassBoxArrayPtr; // Represents multiple tool instances class LIntExport HClassBoxArray : public HHandleBaseArray { public: // Create empty array HClassBoxArray(); // Create array from native array of tool instances HClassBoxArray(HClassBox* classes, Hlong length); // Copy constructor HClassBoxArray(const HClassBoxArray &tool_array); // Destructor virtual ~HClassBoxArray(); // Assignment operator HClassBoxArray &operator=(const HClassBoxArray &tool_array); // Clears array and all tool instances virtual void Clear(); // Get array of native tool instances const HClassBox* Tools() const; // Get number of tools virtual Hlong Length() const; // Create tool array from tuple of handles virtual void SetFromTuple(const HTuple& handles); // Get tuple of handles for tool array virtual HTuple ConvertToTuple() const; protected: // Smart pointer to internal data container HClassBoxArrayPtr *mArrayPtr; }; } #endif