/*! * \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 contours; /*! contours of holes in character, rectified */ vector holes; /*! 4 corners' positions of roi in original image */ Point2fVec quads = Point2fVec(4); /*! confidence of each recognition */ std::map confs; /*! Projection vector */ vector projVec; /*! Distance vector */ vector 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 chars; }; struct OCRFontDBConfig { /*! uniformed pattern size */ Size patternSize; /*! features used in classifier, empty means auto-selected */ vector 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 lines; typedef std::shared_ptr Ptr; }; #endif // TextInstance_h_