/*********************************************************** * File generated by the HALCON-Compiler hcomp version 20.11 * Usage: Interface to C++ * * Software by: MVTec Software GmbH, www.mvtec.com ***********************************************************/ #ifndef HCPP_HCLASSGMM #define HCPP_HCLASSGMM namespace HalconCpp { // Represents an instance of a Gaussian mixture model. class LIntExport HClassGmm : public HHandle { public: // Create an uninitialized instance HClassGmm():HHandle() {} // Copy constructor HClassGmm(const HClassGmm& source) : HHandle(source) {} // Copy constructor HClassGmm(const HHandle& handle); // Create HClassGmm from handle, taking ownership explicit HClassGmm(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_gmm')! virtual void AssertType(Hphandle handle) const; public: // Deep copy of all data represented by this object instance HClassGmm Clone() const; /***************************************************************************** * Operator-based class constructors *****************************************************************************/ // read_class_gmm: Read a Gaussian Mixture Model from a file. explicit HClassGmm(const HString& FileName); // read_class_gmm: Read a Gaussian Mixture Model from a file. explicit HClassGmm(const char* FileName); #ifdef _WIN32 // read_class_gmm: Read a Gaussian Mixture Model from a file. explicit HClassGmm(const wchar_t* FileName); #endif // create_class_gmm: Create a Gaussian Mixture Model for classification explicit HClassGmm(Hlong NumDim, Hlong NumClasses, const HTuple& NumCenters, const HString& CovarType, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed); // create_class_gmm: Create a Gaussian Mixture Model for classification explicit HClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const HString& CovarType, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed); // create_class_gmm: Create a Gaussian Mixture Model for classification explicit HClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const char* CovarType, const char* Preprocessing, Hlong NumComponents, Hlong RandSeed); #ifdef _WIN32 // create_class_gmm: Create a Gaussian Mixture Model for classification explicit HClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const wchar_t* CovarType, const wchar_t* Preprocessing, Hlong NumComponents, Hlong RandSeed); #endif /*************************************************************************** * Operators * ***************************************************************************/ // Classify an image with a Gaussian Mixture Model. HRegion ClassifyImageClassGmm(const HImage& Image, double RejectionThreshold) const; // Add training samples from an image to the training data of a Gaussian Mixture Model. void AddSamplesImageClassGmm(const HImage& Image, const HRegion& ClassRegions, double Randomize) const; // Get the training data of a Gaussian Mixture Model (GMM). HClassTrainData GetClassTrainDataGmm() const; // Add training data to a Gaussian Mixture Model (GMM). void AddClassTrainDataGmm(const HClassTrainData& ClassTrainDataHandle) const; // Selects an optimal combination from a set of features to classify the provided data. HTuple SelectFeatureSetGmm(const HClassTrainData& ClassTrainDataHandle, const HString& SelectionMethod, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score); // Selects an optimal combination from a set of features to classify the provided data. HTuple SelectFeatureSetGmm(const HClassTrainData& ClassTrainDataHandle, const HString& SelectionMethod, const HString& GenParamName, double GenParamValue, HTuple* Score); // Selects an optimal combination from a set of features to classify the provided data. HTuple SelectFeatureSetGmm(const HClassTrainData& ClassTrainDataHandle, const char* SelectionMethod, const char* GenParamName, double GenParamValue, HTuple* Score); #ifdef _WIN32 // Selects an optimal combination from a set of features to classify the provided data. HTuple SelectFeatureSetGmm(const HClassTrainData& ClassTrainDataHandle, const wchar_t* SelectionMethod, const wchar_t* GenParamName, double GenParamValue, HTuple* Score); #endif // Create a look-up table using a gaussian mixture model to classify byte images. HClassLUT CreateClassLutGmm(const HTuple& GenParamName, const HTuple& GenParamValue) const; // Clear a Gaussian Mixture Model. static void ClearClassGmm(const HClassGmmArray& GMMHandle); // Clear a Gaussian Mixture Model. void ClearClassGmm() const; // Clear the training data of a Gaussian Mixture Model. static void ClearSamplesClassGmm(const HClassGmmArray& GMMHandle); // Clear the training data of a Gaussian Mixture Model. void ClearSamplesClassGmm() const; // Deserialize a serialized Gaussian Mixture Model. void DeserializeClassGmm(const HSerializedItem& SerializedItemHandle); // Serialize a Gaussian Mixture Model (GMM). HSerializedItem SerializeClassGmm() const; // Read a Gaussian Mixture Model from a file. void ReadClassGmm(const HString& FileName); // Read a Gaussian Mixture Model from a file. void ReadClassGmm(const char* FileName); #ifdef _WIN32 // Read a Gaussian Mixture Model from a file. void ReadClassGmm(const wchar_t* FileName); #endif // Write a Gaussian Mixture Model to a file. void WriteClassGmm(const HString& FileName) const; // Write a Gaussian Mixture Model to a file. void WriteClassGmm(const char* FileName) const; #ifdef _WIN32 // Write a Gaussian Mixture Model to a file. void WriteClassGmm(const wchar_t* FileName) const; #endif // Read the training data of a Gaussian Mixture Model from a file. void ReadSamplesClassGmm(const HString& FileName) const; // Read the training data of a Gaussian Mixture Model from a file. void ReadSamplesClassGmm(const char* FileName) const; #ifdef _WIN32 // Read the training data of a Gaussian Mixture Model from a file. void ReadSamplesClassGmm(const wchar_t* FileName) const; #endif // Write the training data of a Gaussian Mixture Model to a file. void WriteSamplesClassGmm(const HString& FileName) const; // Write the training data of a Gaussian Mixture Model to a file. void WriteSamplesClassGmm(const char* FileName) const; #ifdef _WIN32 // Write the training data of a Gaussian Mixture Model to a file. void WriteSamplesClassGmm(const wchar_t* FileName) const; #endif // Calculate the class of a feature vector by a Gaussian Mixture Model. HTuple ClassifyClassGmm(const HTuple& Features, Hlong Num, HTuple* ClassProb, HTuple* Density, HTuple* KSigmaProb) const; // Evaluate a feature vector by a Gaussian Mixture Model. HTuple EvaluateClassGmm(const HTuple& Features, double* Density, double* KSigmaProb) const; // Train a Gaussian Mixture Model. HTuple TrainClassGmm(Hlong MaxIter, double Threshold, const HString& ClassPriors, double Regularize, HTuple* Iter) const; // Train a Gaussian Mixture Model. HTuple TrainClassGmm(Hlong MaxIter, double Threshold, const char* ClassPriors, double Regularize, HTuple* Iter) const; #ifdef _WIN32 // Train a Gaussian Mixture Model. HTuple TrainClassGmm(Hlong MaxIter, double Threshold, const wchar_t* ClassPriors, double Regularize, HTuple* Iter) const; #endif // Compute the information content of the preprocessed feature vectors of a GMM. HTuple GetPrepInfoClassGmm(const HString& Preprocessing, HTuple* CumInformationCont) const; // Compute the information content of the preprocessed feature vectors of a GMM. HTuple GetPrepInfoClassGmm(const char* Preprocessing, HTuple* CumInformationCont) const; #ifdef _WIN32 // Compute the information content of the preprocessed feature vectors of a GMM. HTuple GetPrepInfoClassGmm(const wchar_t* Preprocessing, HTuple* CumInformationCont) const; #endif // Return the number of training samples stored in the training data of a Gaussian Mixture Model (GMM). Hlong GetSampleNumClassGmm() const; // Return a training sample from the training data of a Gaussian Mixture Models (GMM). HTuple GetSampleClassGmm(Hlong NumSample, Hlong* ClassID) const; // Add a training sample to the training data of a Gaussian Mixture Model. void AddSampleClassGmm(const HTuple& Features, Hlong ClassID, double Randomize) const; // Return the parameters of a Gaussian Mixture Model. Hlong GetParamsClassGmm(Hlong* NumClasses, HTuple* MinCenters, HTuple* MaxCenters, HString* CovarType) const; // Create a Gaussian Mixture Model for classification void CreateClassGmm(Hlong NumDim, Hlong NumClasses, const HTuple& NumCenters, const HString& CovarType, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed); // Create a Gaussian Mixture Model for classification void CreateClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const HString& CovarType, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed); // Create a Gaussian Mixture Model for classification void CreateClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const char* CovarType, const char* Preprocessing, Hlong NumComponents, Hlong RandSeed); #ifdef _WIN32 // Create a Gaussian Mixture Model for classification void CreateClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const wchar_t* CovarType, const wchar_t* Preprocessing, Hlong NumComponents, Hlong RandSeed); #endif }; // forward declarations and types for internal array implementation template class HSmartPtr; template class HHandleBaseArrayRef; typedef HHandleBaseArrayRef HClassGmmArrayRef; typedef HSmartPtr< HClassGmmArrayRef > HClassGmmArrayPtr; // Represents multiple tool instances class LIntExport HClassGmmArray : public HHandleBaseArray { public: // Create empty array HClassGmmArray(); // Create array from native array of tool instances HClassGmmArray(HClassGmm* classes, Hlong length); // Copy constructor HClassGmmArray(const HClassGmmArray &tool_array); // Destructor virtual ~HClassGmmArray(); // Assignment operator HClassGmmArray &operator=(const HClassGmmArray &tool_array); // Clears array and all tool instances virtual void Clear(); // Get array of native tool instances const HClassGmm* 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 HClassGmmArrayPtr *mArrayPtr; }; } #endif