/*********************************************************** * File generated by the HALCON-Compiler hcomp version 20.11 * Usage: Interface to C++ * * Software by: MVTec Software GmbH, www.mvtec.com ***********************************************************/ #ifndef HCPP_HCOMPONENTMODEL #define HCPP_HCOMPONENTMODEL namespace HalconCpp { // Represents an instance of a model for the component-based matching. class LIntExport HComponentModel : public HHandle { public: // Create an uninitialized instance HComponentModel():HHandle() {} // Copy constructor HComponentModel(const HComponentModel& source) : HHandle(source) {} // Copy constructor HComponentModel(const HHandle& handle); // Create HComponentModel from handle, taking ownership explicit HComponentModel(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 ('component_model')! virtual void AssertType(Hphandle handle) const; public: // Deep copy of all data represented by this object instance HComponentModel Clone() const; /***************************************************************************** * Operator-based class constructors *****************************************************************************/ // read_component_model: Read a component model from a file. explicit HComponentModel(const HString& FileName); // read_component_model: Read a component model from a file. explicit HComponentModel(const char* FileName); #ifdef _WIN32 // read_component_model: Read a component model from a file. explicit HComponentModel(const wchar_t* FileName); #endif // create_component_model: Prepare a component model for matching based on explicitly specified components and relations. explicit HComponentModel(const HImage& ModelImage, const HRegion& ComponentRegions, const HTuple& VariationRow, const HTuple& VariationColumn, const HTuple& VariationAngle, double AngleStart, double AngleExtent, const HTuple& ContrastLowComp, const HTuple& ContrastHighComp, const HTuple& MinSizeComp, const HTuple& MinContrastComp, const HTuple& MinScoreComp, const HTuple& NumLevelsComp, const HTuple& AngleStepComp, const HString& OptimizationComp, const HTuple& MetricComp, const HTuple& PregenerationComp, HTuple* RootRanking); // create_component_model: Prepare a component model for matching based on explicitly specified components and relations. explicit HComponentModel(const HImage& ModelImage, const HRegion& ComponentRegions, Hlong VariationRow, Hlong VariationColumn, double VariationAngle, double AngleStart, double AngleExtent, Hlong ContrastLowComp, Hlong ContrastHighComp, Hlong MinSizeComp, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const HString& OptimizationComp, const HString& MetricComp, const HString& PregenerationComp, Hlong* RootRanking); // create_component_model: Prepare a component model for matching based on explicitly specified components and relations. explicit HComponentModel(const HImage& ModelImage, const HRegion& ComponentRegions, Hlong VariationRow, Hlong VariationColumn, double VariationAngle, double AngleStart, double AngleExtent, Hlong ContrastLowComp, Hlong ContrastHighComp, Hlong MinSizeComp, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const char* OptimizationComp, const char* MetricComp, const char* PregenerationComp, Hlong* RootRanking); #ifdef _WIN32 // create_component_model: Prepare a component model for matching based on explicitly specified components and relations. explicit HComponentModel(const HImage& ModelImage, const HRegion& ComponentRegions, Hlong VariationRow, Hlong VariationColumn, double VariationAngle, double AngleStart, double AngleExtent, Hlong ContrastLowComp, Hlong ContrastHighComp, Hlong MinSizeComp, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const wchar_t* OptimizationComp, const wchar_t* MetricComp, const wchar_t* PregenerationComp, Hlong* RootRanking); #endif // create_trained_component_model: Prepare a component model for matching based on trained components. explicit HComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, const HTuple& MinContrastComp, const HTuple& MinScoreComp, const HTuple& NumLevelsComp, const HTuple& AngleStepComp, const HString& OptimizationComp, const HTuple& MetricComp, const HTuple& PregenerationComp, HTuple* RootRanking); // create_trained_component_model: Prepare a component model for matching based on trained components. explicit HComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const HString& OptimizationComp, const HString& MetricComp, const HString& PregenerationComp, Hlong* RootRanking); // create_trained_component_model: Prepare a component model for matching based on trained components. explicit HComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const char* OptimizationComp, const char* MetricComp, const char* PregenerationComp, Hlong* RootRanking); #ifdef _WIN32 // create_trained_component_model: Prepare a component model for matching based on trained components. explicit HComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const wchar_t* OptimizationComp, const wchar_t* MetricComp, const wchar_t* PregenerationComp, Hlong* RootRanking); #endif /*************************************************************************** * Operators * ***************************************************************************/ // Return the components of a found instance of a component model. HRegion GetFoundComponentModel(const HTuple& ModelStart, const HTuple& ModelEnd, const HTuple& RowComp, const HTuple& ColumnComp, const HTuple& AngleComp, const HTuple& ScoreComp, const HTuple& ModelComp, Hlong ModelMatch, const HString& MarkOrientation, HTuple* RowCompInst, HTuple* ColumnCompInst, HTuple* AngleCompInst, HTuple* ScoreCompInst) const; // Return the components of a found instance of a component model. HRegion GetFoundComponentModel(Hlong ModelStart, Hlong ModelEnd, double RowComp, double ColumnComp, double AngleComp, double ScoreComp, Hlong ModelComp, Hlong ModelMatch, const HString& MarkOrientation, double* RowCompInst, double* ColumnCompInst, double* AngleCompInst, double* ScoreCompInst) const; // Return the components of a found instance of a component model. HRegion GetFoundComponentModel(Hlong ModelStart, Hlong ModelEnd, double RowComp, double ColumnComp, double AngleComp, double ScoreComp, Hlong ModelComp, Hlong ModelMatch, const char* MarkOrientation, double* RowCompInst, double* ColumnCompInst, double* AngleCompInst, double* ScoreCompInst) const; #ifdef _WIN32 // Return the components of a found instance of a component model. HRegion GetFoundComponentModel(Hlong ModelStart, Hlong ModelEnd, double RowComp, double ColumnComp, double AngleComp, double ScoreComp, Hlong ModelComp, Hlong ModelMatch, const wchar_t* MarkOrientation, double* RowCompInst, double* ColumnCompInst, double* AngleCompInst, double* ScoreCompInst) const; #endif // Find the best matches of a component model in an image. HTuple FindComponentModel(const HImage& Image, const HTuple& RootComponent, const HTuple& AngleStartRoot, const HTuple& AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& IfRootNotFound, const HString& IfComponentNotFound, const HString& PosePrediction, const HTuple& MinScoreComp, const HTuple& SubPixelComp, const HTuple& NumLevelsComp, const HTuple& GreedinessComp, HTuple* ModelEnd, HTuple* Score, HTuple* RowComp, HTuple* ColumnComp, HTuple* AngleComp, HTuple* ScoreComp, HTuple* ModelComp) const; // Find the best matches of a component model in an image. Hlong FindComponentModel(const HImage& Image, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& IfRootNotFound, const HString& IfComponentNotFound, const HString& PosePrediction, double MinScoreComp, const HString& SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp) const; // Find the best matches of a component model in an image. Hlong FindComponentModel(const HImage& Image, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const char* IfRootNotFound, const char* IfComponentNotFound, const char* PosePrediction, double MinScoreComp, const char* SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp) const; #ifdef _WIN32 // Find the best matches of a component model in an image. Hlong FindComponentModel(const HImage& Image, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const wchar_t* IfRootNotFound, const wchar_t* IfComponentNotFound, const wchar_t* PosePrediction, double MinScoreComp, const wchar_t* SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp) const; #endif // Free the memory of a component model. void ClearComponentModel() const; // Return the search tree of a component model. HRegion GetComponentModelTree(HRegion* Relations, const HTuple& RootComponent, const HTuple& Image, HTuple* StartNode, HTuple* EndNode, HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2, HTuple* AngleStart, HTuple* AngleExtent) const; // Return the search tree of a component model. HRegion GetComponentModelTree(HRegion* Relations, Hlong RootComponent, const HString& Image, Hlong* StartNode, Hlong* EndNode, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent) const; // Return the search tree of a component model. HRegion GetComponentModelTree(HRegion* Relations, Hlong RootComponent, const char* Image, Hlong* StartNode, Hlong* EndNode, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent) const; #ifdef _WIN32 // Return the search tree of a component model. HRegion GetComponentModelTree(HRegion* Relations, Hlong RootComponent, const wchar_t* Image, Hlong* StartNode, Hlong* EndNode, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent) const; #endif // Return the parameters of a component model. HTuple GetComponentModelParams(HTuple* RootRanking, HShapeModelArray* ShapeModelIDs) const; // Return the parameters of a component model. double GetComponentModelParams(Hlong* RootRanking, HShapeModel* ShapeModelIDs) const; // Deserialize a serialized component model. void DeserializeComponentModel(const HSerializedItem& SerializedItemHandle); // Serialize a component model. HSerializedItem SerializeComponentModel() const; // Read a component model from a file. void ReadComponentModel(const HString& FileName); // Read a component model from a file. void ReadComponentModel(const char* FileName); #ifdef _WIN32 // Read a component model from a file. void ReadComponentModel(const wchar_t* FileName); #endif // Write a component model to a file. void WriteComponentModel(const HString& FileName) const; // Write a component model to a file. void WriteComponentModel(const char* FileName) const; #ifdef _WIN32 // Write a component model to a file. void WriteComponentModel(const wchar_t* FileName) const; #endif // Prepare a component model for matching based on explicitly specified components and relations. HTuple CreateComponentModel(const HImage& ModelImage, const HRegion& ComponentRegions, const HTuple& VariationRow, const HTuple& VariationColumn, const HTuple& VariationAngle, double AngleStart, double AngleExtent, const HTuple& ContrastLowComp, const HTuple& ContrastHighComp, const HTuple& MinSizeComp, const HTuple& MinContrastComp, const HTuple& MinScoreComp, const HTuple& NumLevelsComp, const HTuple& AngleStepComp, const HString& OptimizationComp, const HTuple& MetricComp, const HTuple& PregenerationComp); // Prepare a component model for matching based on explicitly specified components and relations. Hlong CreateComponentModel(const HImage& ModelImage, const HRegion& ComponentRegions, Hlong VariationRow, Hlong VariationColumn, double VariationAngle, double AngleStart, double AngleExtent, Hlong ContrastLowComp, Hlong ContrastHighComp, Hlong MinSizeComp, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const HString& OptimizationComp, const HString& MetricComp, const HString& PregenerationComp); // Prepare a component model for matching based on explicitly specified components and relations. Hlong CreateComponentModel(const HImage& ModelImage, const HRegion& ComponentRegions, Hlong VariationRow, Hlong VariationColumn, double VariationAngle, double AngleStart, double AngleExtent, Hlong ContrastLowComp, Hlong ContrastHighComp, Hlong MinSizeComp, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const char* OptimizationComp, const char* MetricComp, const char* PregenerationComp); #ifdef _WIN32 // Prepare a component model for matching based on explicitly specified components and relations. Hlong CreateComponentModel(const HImage& ModelImage, const HRegion& ComponentRegions, Hlong VariationRow, Hlong VariationColumn, double VariationAngle, double AngleStart, double AngleExtent, Hlong ContrastLowComp, Hlong ContrastHighComp, Hlong MinSizeComp, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const wchar_t* OptimizationComp, const wchar_t* MetricComp, const wchar_t* PregenerationComp); #endif // Prepare a component model for matching based on trained components. HTuple CreateTrainedComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, const HTuple& MinContrastComp, const HTuple& MinScoreComp, const HTuple& NumLevelsComp, const HTuple& AngleStepComp, const HString& OptimizationComp, const HTuple& MetricComp, const HTuple& PregenerationComp); // Prepare a component model for matching based on trained components. Hlong CreateTrainedComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const HString& OptimizationComp, const HString& MetricComp, const HString& PregenerationComp); // Prepare a component model for matching based on trained components. Hlong CreateTrainedComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const char* OptimizationComp, const char* MetricComp, const char* PregenerationComp); #ifdef _WIN32 // Prepare a component model for matching based on trained components. Hlong CreateTrainedComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const wchar_t* OptimizationComp, const wchar_t* MetricComp, const wchar_t* PregenerationComp); #endif }; // forward declarations and types for internal array implementation template class HSmartPtr; template class HHandleBaseArrayRef; typedef HHandleBaseArrayRef HComponentModelArrayRef; typedef HSmartPtr< HComponentModelArrayRef > HComponentModelArrayPtr; // Represents multiple tool instances class LIntExport HComponentModelArray : public HHandleBaseArray { public: // Create empty array HComponentModelArray(); // Create array from native array of tool instances HComponentModelArray(HComponentModel* classes, Hlong length); // Copy constructor HComponentModelArray(const HComponentModelArray &tool_array); // Destructor virtual ~HComponentModelArray(); // Assignment operator HComponentModelArray &operator=(const HComponentModelArray &tool_array); // Clears array and all tool instances virtual void Clear(); // Get array of native tool instances const HComponentModel* 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 HComponentModelArrayPtr *mArrayPtr; }; } #endif