212 lines
6.5 KiB
C++
212 lines
6.5 KiB
C++
/***********************************************************
|
|
* File generated by the HALCON-Compiler hcomp version 18.05
|
|
* Usage: Interface to C++
|
|
*
|
|
* Software by: MVTec Software GmbH, www.mvtec.com
|
|
***********************************************************/
|
|
|
|
|
|
#ifndef HCPP_HOCRBOX
|
|
#define HCPP_HOCRBOX
|
|
|
|
namespace HalconCpp
|
|
{
|
|
|
|
// Represents an instance of an OCR box classifier.
|
|
class LIntExport HOCRBox : public HHandle
|
|
{
|
|
|
|
public:
|
|
|
|
// Create an uninitialized instance
|
|
HOCRBox():HHandle() {}
|
|
|
|
// Copy constructor
|
|
HOCRBox(const HOCRBox& source) : HHandle(source) {}
|
|
|
|
// Copy constructor
|
|
HOCRBox(const HHandle& handle);
|
|
|
|
// Create HOCRBox from handle, taking ownership
|
|
explicit HOCRBox(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_box')!
|
|
virtual void AssertType(Hphandle handle) const;
|
|
|
|
public:
|
|
|
|
// Deep copy of all data represented by this object instance
|
|
HOCRBox Clone() const;
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
* Operator-based class constructors
|
|
*****************************************************************************/
|
|
|
|
// read_ocr: Read an OCR classifier from a file.
|
|
explicit HOCRBox(const HString& FileName);
|
|
|
|
// read_ocr: Read an OCR classifier from a file.
|
|
explicit HOCRBox(const char* FileName);
|
|
|
|
// create_ocr_class_box: Create a new OCR-classifier.
|
|
explicit HOCRBox(Hlong WidthPattern, Hlong HeightPattern, Hlong Interpolation, const HTuple& Features, const HTuple& Character);
|
|
|
|
// create_ocr_class_box: Create a new OCR-classifier.
|
|
explicit HOCRBox(Hlong WidthPattern, Hlong HeightPattern, Hlong Interpolation, const HString& Features, const HTuple& Character);
|
|
|
|
// create_ocr_class_box: Create a new OCR-classifier.
|
|
explicit HOCRBox(Hlong WidthPattern, Hlong HeightPattern, Hlong Interpolation, const char* Features, const HTuple& Character);
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
* Operators *
|
|
***************************************************************************/
|
|
|
|
// Serialize an OCR classifier.
|
|
HSerializedItem SerializeOcr() const;
|
|
|
|
// Deserialize a serialized OCR classifier.
|
|
void DeserializeOcr(const HSerializedItem& SerializedItemHandle);
|
|
|
|
// Writing an OCR classifier into a file.
|
|
void WriteOcr(const HString& FileName) const;
|
|
|
|
// Writing an OCR classifier into a file.
|
|
void WriteOcr(const char* FileName) const;
|
|
|
|
// Read an OCR classifier from a file.
|
|
void ReadOcr(const HString& FileName);
|
|
|
|
// Read an OCR classifier from a file.
|
|
void ReadOcr(const char* FileName);
|
|
|
|
// Classify one character.
|
|
HTuple DoOcrSingle(const HRegion& Character, const HImage& Image, HTuple* Confidences) const;
|
|
|
|
// Classify characters.
|
|
HTuple DoOcrMulti(const HRegion& Character, const HImage& Image, HTuple* Confidence) const;
|
|
|
|
// Classify characters.
|
|
HString DoOcrMulti(const HRegion& Character, const HImage& Image, double* Confidence) const;
|
|
|
|
// Get information about an OCR classifier.
|
|
void InfoOcrClassBox(Hlong* WidthPattern, Hlong* HeightPattern, Hlong* Interpolation, Hlong* WidthMaxChar, Hlong* HeightMaxChar, HTuple* Features, HTuple* Characters) const;
|
|
|
|
// Create a new OCR-classifier.
|
|
void CreateOcrClassBox(Hlong WidthPattern, Hlong HeightPattern, Hlong Interpolation, const HTuple& Features, const HTuple& Character);
|
|
|
|
// Create a new OCR-classifier.
|
|
void CreateOcrClassBox(Hlong WidthPattern, Hlong HeightPattern, Hlong Interpolation, const HString& Features, const HTuple& Character);
|
|
|
|
// Create a new OCR-classifier.
|
|
void CreateOcrClassBox(Hlong WidthPattern, Hlong HeightPattern, Hlong Interpolation, const char* Features, const HTuple& Character);
|
|
|
|
// Train an OCR classifier by the input of regions.
|
|
double TraindOcrClassBox(const HRegion& Character, const HImage& Image, const HTuple& Class) const;
|
|
|
|
// Train an OCR classifier by the input of regions.
|
|
double TraindOcrClassBox(const HRegion& Character, const HImage& Image, const HString& Class) const;
|
|
|
|
// Train an OCR classifier by the input of regions.
|
|
double TraindOcrClassBox(const HRegion& Character, const HImage& Image, const char* Class) const;
|
|
|
|
// Train an OCR classifier with the help of a training file.
|
|
double TrainfOcrClassBox(const HTuple& TrainingFile) const;
|
|
|
|
// Train an OCR classifier with the help of a training file.
|
|
double TrainfOcrClassBox(const HString& TrainingFile) const;
|
|
|
|
// Train an OCR classifier with the help of a training file.
|
|
double TrainfOcrClassBox(const char* TrainingFile) const;
|
|
|
|
// Define a new conversion table for the characters.
|
|
void OcrChangeChar(const HTuple& Character) const;
|
|
|
|
// Deallocation of the memory of an OCR classifier.
|
|
void CloseOcr() const;
|
|
|
|
// Test an OCR classifier.
|
|
HTuple TestdOcrClassBox(const HRegion& Character, const HImage& Image, const HTuple& Class) const;
|
|
|
|
// Test an OCR classifier.
|
|
double TestdOcrClassBox(const HRegion& Character, const HImage& Image, const HString& Class) const;
|
|
|
|
// Test an OCR classifier.
|
|
double TestdOcrClassBox(const HRegion& Character, const HImage& Image, const char* Class) const;
|
|
|
|
// Access the features which correspond to a character.
|
|
HTuple OcrGetFeatures(const HImage& Character) const;
|
|
|
|
};
|
|
|
|
// forward declarations and types for internal array implementation
|
|
|
|
template<class T> class HSmartPtr;
|
|
template<class T> class HHandleBaseArrayRef;
|
|
|
|
typedef HHandleBaseArrayRef<HOCRBox> HOCRBoxArrayRef;
|
|
typedef HSmartPtr< HOCRBoxArrayRef > HOCRBoxArrayPtr;
|
|
|
|
|
|
// Represents multiple tool instances
|
|
class LIntExport HOCRBoxArray : public HHandleBaseArray
|
|
{
|
|
|
|
public:
|
|
|
|
// Create empty array
|
|
HOCRBoxArray();
|
|
|
|
// Create array from native array of tool instances
|
|
HOCRBoxArray(HOCRBox* classes, Hlong length);
|
|
|
|
// Copy constructor
|
|
HOCRBoxArray(const HOCRBoxArray &tool_array);
|
|
|
|
// Destructor
|
|
virtual ~HOCRBoxArray();
|
|
|
|
// Assignment operator
|
|
HOCRBoxArray &operator=(const HOCRBoxArray &tool_array);
|
|
|
|
// Clears array and all tool instances
|
|
virtual void Clear();
|
|
|
|
// Get array of native tool instances
|
|
const HOCRBox* 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
|
|
HOCRBoxArrayPtr *mArrayPtr;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|