123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- /***********************************************************
- * File generated by the HALCON-Compiler hcomp version 20.11
- * Usage: Interface to C++
- *
- * Software by: MVTec Software GmbH, www.mvtec.com
- ***********************************************************/
- #ifndef HCPP_HOCRMLP
- #define HCPP_HOCRMLP
- namespace HalconCpp
- {
- // Represents an instance of a MLP OCR classifier.
- class LIntExport HOCRMlp : public HHandle
- {
- public:
- // Create an uninitialized instance
- HOCRMlp():HHandle() {}
- // Copy constructor
- HOCRMlp(const HOCRMlp& source) : HHandle(source) {}
- // Copy constructor
- HOCRMlp(const HHandle& handle);
- // Create HOCRMlp from handle, taking ownership
- explicit HOCRMlp(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 ('ocr_mlp')!
- virtual void AssertType(Hphandle handle) const;
- public:
- // Deep copy of all data represented by this object instance
- HOCRMlp Clone() const;
- /*****************************************************************************
- * Operator-based class constructors
- *****************************************************************************/
- // read_ocr_class_mlp: Read an OCR classifier from a file.
- explicit HOCRMlp(const HString& FileName);
- // read_ocr_class_mlp: Read an OCR classifier from a file.
- explicit HOCRMlp(const char* FileName);
- #ifdef _WIN32
- // read_ocr_class_mlp: Read an OCR classifier from a file.
- explicit HOCRMlp(const wchar_t* FileName);
- #endif
- // create_ocr_class_mlp: Create an OCR classifier using a multilayer perceptron.
- explicit HOCRMlp(Hlong WidthCharacter, Hlong HeightCharacter, const HString& Interpolation, const HTuple& Features, const HTuple& Characters, Hlong NumHidden, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed);
- // create_ocr_class_mlp: Create an OCR classifier using a multilayer perceptron.
- explicit HOCRMlp(Hlong WidthCharacter, Hlong HeightCharacter, const HString& Interpolation, const HString& Features, const HTuple& Characters, Hlong NumHidden, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed);
- // create_ocr_class_mlp: Create an OCR classifier using a multilayer perceptron.
- explicit HOCRMlp(Hlong WidthCharacter, Hlong HeightCharacter, const char* Interpolation, const char* Features, const HTuple& Characters, Hlong NumHidden, const char* Preprocessing, Hlong NumComponents, Hlong RandSeed);
- #ifdef _WIN32
- // create_ocr_class_mlp: Create an OCR classifier using a multilayer perceptron.
- explicit HOCRMlp(Hlong WidthCharacter, Hlong HeightCharacter, const wchar_t* Interpolation, const wchar_t* Features, const HTuple& Characters, Hlong NumHidden, const wchar_t* Preprocessing, Hlong NumComponents, Hlong RandSeed);
- #endif
- /***************************************************************************
- * Operators *
- ***************************************************************************/
- // Select an optimal combination of features to classify OCR data from a (protected) training file.
- HTuple SelectFeatureSetTrainfMlpProtected(const HTuple& TrainingFile, const HTuple& Password, const HTuple& FeatureList, const HString& SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- // Select an optimal combination of features to classify OCR data from a (protected) training file.
- HTuple SelectFeatureSetTrainfMlpProtected(const HString& TrainingFile, const HString& Password, const HString& FeatureList, const HString& SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- // Select an optimal combination of features to classify OCR data from a (protected) training file.
- HTuple SelectFeatureSetTrainfMlpProtected(const char* TrainingFile, const char* Password, const char* FeatureList, const char* SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- #ifdef _WIN32
- // Select an optimal combination of features to classify OCR data from a (protected) training file.
- HTuple SelectFeatureSetTrainfMlpProtected(const wchar_t* TrainingFile, const wchar_t* Password, const wchar_t* FeatureList, const wchar_t* SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- #endif
- // Selects an optimal combination of features to classify OCR data.
- HTuple SelectFeatureSetTrainfMlp(const HTuple& TrainingFile, const HTuple& FeatureList, const HString& SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- // Selects an optimal combination of features to classify OCR data.
- HTuple SelectFeatureSetTrainfMlp(const HString& TrainingFile, const HString& FeatureList, const HString& SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- // Selects an optimal combination of features to classify OCR data.
- HTuple SelectFeatureSetTrainfMlp(const char* TrainingFile, const char* FeatureList, const char* SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- #ifdef _WIN32
- // Selects an optimal combination of features to classify OCR data.
- HTuple SelectFeatureSetTrainfMlp(const wchar_t* TrainingFile, const wchar_t* FeatureList, const wchar_t* SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- #endif
- // Clear an OCR classifier.
- static void ClearOcrClassMlp(const HOCRMlpArray& OCRHandle);
- // Clear an OCR classifier.
- void ClearOcrClassMlp() const;
- // Deserialize a serialized MLP-based OCR classifier.
- void DeserializeOcrClassMlp(const HSerializedItem& SerializedItemHandle);
- // Serialize a MLP-based OCR classifier.
- HSerializedItem SerializeOcrClassMlp() const;
- // Read an OCR classifier from a file.
- void ReadOcrClassMlp(const HString& FileName);
- // Read an OCR classifier from a file.
- void ReadOcrClassMlp(const char* FileName);
- #ifdef _WIN32
- // Read an OCR classifier from a file.
- void ReadOcrClassMlp(const wchar_t* FileName);
- #endif
- // Write an OCR classifier to a file.
- void WriteOcrClassMlp(const HString& FileName) const;
- // Write an OCR classifier to a file.
- void WriteOcrClassMlp(const char* FileName) const;
- #ifdef _WIN32
- // Write an OCR classifier to a file.
- void WriteOcrClassMlp(const wchar_t* FileName) const;
- #endif
- // Compute the features of a character.
- HTuple GetFeaturesOcrClassMlp(const HImage& Character, const HString& Transform) const;
- // Compute the features of a character.
- HTuple GetFeaturesOcrClassMlp(const HImage& Character, const char* Transform) const;
- #ifdef _WIN32
- // Compute the features of a character.
- HTuple GetFeaturesOcrClassMlp(const HImage& Character, const wchar_t* Transform) const;
- #endif
- // Classify a related group of characters with an OCR classifier.
- HTuple DoOcrWordMlp(const HRegion& Character, const HImage& Image, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, HTuple* Confidence, HString* Word, double* Score) const;
- // Classify a related group of characters with an OCR classifier.
- HString DoOcrWordMlp(const HRegion& Character, const HImage& Image, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
- // Classify a related group of characters with an OCR classifier.
- HString DoOcrWordMlp(const HRegion& Character, const HImage& Image, const char* Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
- #ifdef _WIN32
- // Classify a related group of characters with an OCR classifier.
- HString DoOcrWordMlp(const HRegion& Character, const HImage& Image, const wchar_t* Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
- #endif
- // Classify multiple characters with an OCR classifier.
- HTuple DoOcrMultiClassMlp(const HRegion& Character, const HImage& Image, HTuple* Confidence) const;
- // Classify multiple characters with an OCR classifier.
- HString DoOcrMultiClassMlp(const HRegion& Character, const HImage& Image, double* Confidence) const;
- // Classify a single character with an OCR classifier.
- HTuple DoOcrSingleClassMlp(const HRegion& Character, const HImage& Image, const HTuple& Num, HTuple* Confidence) const;
- // Classify a single character with an OCR classifier.
- HString DoOcrSingleClassMlp(const HRegion& Character, const HImage& Image, const HTuple& Num, double* Confidence) const;
- // Train an OCR classifier with data from a (protected) training file.
- double TrainfOcrClassMlpProtected(const HTuple& TrainingFile, const HTuple& Password, Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- // Train an OCR classifier with data from a (protected) training file.
- double TrainfOcrClassMlpProtected(const HString& TrainingFile, const HString& Password, Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- // Train an OCR classifier with data from a (protected) training file.
- double TrainfOcrClassMlpProtected(const char* TrainingFile, const char* Password, Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- #ifdef _WIN32
- // Train an OCR classifier with data from a (protected) training file.
- double TrainfOcrClassMlpProtected(const wchar_t* TrainingFile, const wchar_t* Password, Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- #endif
- // Train an OCR classifier.
- double TrainfOcrClassMlp(const HTuple& TrainingFile, Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- // Train an OCR classifier.
- double TrainfOcrClassMlp(const HString& TrainingFile, Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- // Train an OCR classifier.
- double TrainfOcrClassMlp(const char* TrainingFile, Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- #ifdef _WIN32
- // Train an OCR classifier.
- double TrainfOcrClassMlp(const wchar_t* TrainingFile, Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- #endif
- // Compute the information content of the preprocessed feature vectors of an OCR classifier.
- HTuple GetPrepInfoOcrClassMlp(const HTuple& TrainingFile, const HString& Preprocessing, HTuple* CumInformationCont) const;
- // Compute the information content of the preprocessed feature vectors of an OCR classifier.
- HTuple GetPrepInfoOcrClassMlp(const HString& TrainingFile, const HString& Preprocessing, HTuple* CumInformationCont) const;
- // Compute the information content of the preprocessed feature vectors of an OCR classifier.
- HTuple GetPrepInfoOcrClassMlp(const char* TrainingFile, const char* Preprocessing, HTuple* CumInformationCont) const;
- #ifdef _WIN32
- // Compute the information content of the preprocessed feature vectors of an OCR classifier.
- HTuple GetPrepInfoOcrClassMlp(const wchar_t* TrainingFile, const wchar_t* Preprocessing, HTuple* CumInformationCont) const;
- #endif
- // Return the rejection class parameters of an OCR classifier.
- HTuple GetRejectionParamsOcrClassMlp(const HTuple& GenParamName) const;
- // Return the rejection class parameters of an OCR classifier.
- HString GetRejectionParamsOcrClassMlp(const HString& GenParamName) const;
- // Return the rejection class parameters of an OCR classifier.
- HString GetRejectionParamsOcrClassMlp(const char* GenParamName) const;
- #ifdef _WIN32
- // Return the rejection class parameters of an OCR classifier.
- HString GetRejectionParamsOcrClassMlp(const wchar_t* GenParamName) const;
- #endif
- // Set the rejection class parameters of an OCR classifier.
- void SetRejectionParamsOcrClassMlp(const HTuple& GenParamName, const HTuple& GenParamValue) const;
- // Set the rejection class parameters of an OCR classifier.
- void SetRejectionParamsOcrClassMlp(const HString& GenParamName, const HString& GenParamValue) const;
- // Set the rejection class parameters of an OCR classifier.
- void SetRejectionParamsOcrClassMlp(const char* GenParamName, const char* GenParamValue) const;
- #ifdef _WIN32
- // Set the rejection class parameters of an OCR classifier.
- void SetRejectionParamsOcrClassMlp(const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
- #endif
- // Return the regularization parameters of an OCR classifier.
- HTuple GetRegularizationParamsOcrClassMlp(const HString& GenParamName) const;
- // Return the regularization parameters of an OCR classifier.
- HTuple GetRegularizationParamsOcrClassMlp(const char* GenParamName) const;
- #ifdef _WIN32
- // Return the regularization parameters of an OCR classifier.
- HTuple GetRegularizationParamsOcrClassMlp(const wchar_t* GenParamName) const;
- #endif
- // Set the regularization parameters of an OCR classifier.
- void SetRegularizationParamsOcrClassMlp(const HString& GenParamName, const HTuple& GenParamValue) const;
- // Set the regularization parameters of an OCR classifier.
- void SetRegularizationParamsOcrClassMlp(const HString& GenParamName, double GenParamValue) const;
- // Set the regularization parameters of an OCR classifier.
- void SetRegularizationParamsOcrClassMlp(const char* GenParamName, double GenParamValue) const;
- #ifdef _WIN32
- // Set the regularization parameters of an OCR classifier.
- void SetRegularizationParamsOcrClassMlp(const wchar_t* GenParamName, double GenParamValue) const;
- #endif
- // Return the parameters of an OCR classifier.
- void GetParamsOcrClassMlp(Hlong* WidthCharacter, Hlong* HeightCharacter, HString* Interpolation, HTuple* Features, HTuple* Characters, Hlong* NumHidden, HString* Preprocessing, Hlong* NumComponents) const;
- // Return the parameters of an OCR classifier.
- void GetParamsOcrClassMlp(Hlong* WidthCharacter, Hlong* HeightCharacter, HString* Interpolation, HString* Features, HTuple* Characters, Hlong* NumHidden, HString* Preprocessing, Hlong* NumComponents) const;
- // Create an OCR classifier using a multilayer perceptron.
- void CreateOcrClassMlp(Hlong WidthCharacter, Hlong HeightCharacter, const HString& Interpolation, const HTuple& Features, const HTuple& Characters, Hlong NumHidden, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed);
- // Create an OCR classifier using a multilayer perceptron.
- void CreateOcrClassMlp(Hlong WidthCharacter, Hlong HeightCharacter, const HString& Interpolation, const HString& Features, const HTuple& Characters, Hlong NumHidden, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed);
- // Create an OCR classifier using a multilayer perceptron.
- void CreateOcrClassMlp(Hlong WidthCharacter, Hlong HeightCharacter, const char* Interpolation, const char* Features, const HTuple& Characters, Hlong NumHidden, const char* Preprocessing, Hlong NumComponents, Hlong RandSeed);
- #ifdef _WIN32
- // Create an OCR classifier using a multilayer perceptron.
- void CreateOcrClassMlp(Hlong WidthCharacter, Hlong HeightCharacter, const wchar_t* Interpolation, const wchar_t* Features, const HTuple& Characters, Hlong NumHidden, const wchar_t* Preprocessing, Hlong NumComponents, Hlong RandSeed);
- #endif
- };
- // forward declarations and types for internal array implementation
- template<class T> class HSmartPtr;
- template<class T> class HHandleBaseArrayRef;
- typedef HHandleBaseArrayRef<HOCRMlp> HOCRMlpArrayRef;
- typedef HSmartPtr< HOCRMlpArrayRef > HOCRMlpArrayPtr;
- // Represents multiple tool instances
- class LIntExport HOCRMlpArray : public HHandleBaseArray
- {
- public:
- // Create empty array
- HOCRMlpArray();
- // Create array from native array of tool instances
- HOCRMlpArray(HOCRMlp* classes, Hlong length);
- // Copy constructor
- HOCRMlpArray(const HOCRMlpArray &tool_array);
- // Destructor
- virtual ~HOCRMlpArray();
- // Assignment operator
- HOCRMlpArray &operator=(const HOCRMlpArray &tool_array);
- // Clears array and all tool instances
- virtual void Clear();
- // Get array of native tool instances
- const HOCRMlp* 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
- HOCRMlpArrayPtr *mArrayPtr;
- };
- }
- #endif
|