You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wheeldetect/3part/Cyclops/include/TextInstance.h

79 lines
1.9 KiB
C++

/*!
* \file TextInstance.h
* \date 2020/04/26
*
* \author Lin, Chi
* Contact: lin.chi@hzleaper.com
*
*
* \note
*/
#ifndef __TextInstance_h_
#define __TextInstance_h_
#include "CVUtils.h"
#include "StdUtils.h"
struct OCRChar
{
/*! type, digits or character */
OCRCharType charType = OCRCharType::Unknown;
/*! usually one single character */
std::string value;
/*! image of character, rectified */
Mat img;
/*! contours of character, multiple for i j and dot-printed, rectified */
vector<Point2fVec> contours;
/*! contours of holes in character, rectified */
vector<Point2fVec> holes;
/*! 4 corners' positions of roi in original image */
Point2fVec quads = Point2fVec(4);
/*! confidence of each recognition */
std::map<string, float> confs;
/*! Projection vector */
vector<double> projVec;
/*! Distance vector */
vector<double> distVec;
/*! Size in float */
Size2f size;
};
struct OCRLine
{
/*! 4 corners' positions of roi in original image */
Point2fVec quads = Point2fVec(4);
/*! combination of all characters in the line */
std::string value;
/*! all characters */
vector<OCRChar> chars;
};
struct OCRFontDBConfig
{
/*! uniformed pattern size */
Size patternSize;
/*! features used in classifier, empty means auto-selected */
vector<FeatureType> fTypes;
/*! classifier model */
MLModel mType;
/*! pixel value type for pixel-based feature, see PPFeature::PixelValueType */
int pixValueType;
/*! projection type for pixel-based feature, see PPFeature::ProjectionType */
int projType;
};
struct TextInstance
{
DotPrint dotPrint = DotPrint::Auto; // after segmentation, it should be either yes or no
Size dotGridSize; // after segmentation, it should be not empty
Polarity polarity = Polarity::Either; // after segmentation, it should be either black or white
vector<OCRLine> lines;
typedef std::shared_ptr<TextInstance> Ptr;
};
#endif // TextInstance_h_