nndeploy C++ API  0.2.0
nndeploy C++ API
result.h
Go to the documentation of this file.
1 #ifndef _NNDEPLOY_OCR_RESULT_H_
2 #define _NNDEPLOY_OCR_RESULT_H_
3 
4 #include "nndeploy/base/any.h"
5 #include "nndeploy/base/common.h"
7 #include "nndeploy/base/log.h"
8 #include "nndeploy/base/macro.h"
9 #include "nndeploy/base/object.h"
10 #include "nndeploy/base/param.h"
11 #include "nndeploy/base/status.h"
12 #include "nndeploy/base/string.h"
13 #include "nndeploy/base/type.h"
14 #include "nndeploy/device/buffer.h"
15 #include "nndeploy/device/device.h"
17 #include "nndeploy/device/tensor.h"
18 #include "opencv2/core.hpp"
19 #include "opencv2/imgproc.hpp"
20 
21 namespace nndeploy {
22 namespace ocr {
23 
30  public:
31  OCRResult(){};
32  virtual ~OCRResult(){};
33 
34  // 文本检测结果:每个检测到的文本区域的边界框坐标
35  // 每个数组包含8个整数:[x1, y1, x2, y2, x3, y3, x4, y4] 表示四个顶点坐标
36  std::vector<std::array<int, 8>> boxes_;
37  std::vector<cv::Mat> image_list_;
38  std::vector<int> classifier_result;
39  // 文本识别结果:识别出的文本内容
40  std::vector<std::string> text_;
41  // 文本识别置信度分数:每个识别文本的可信度,范围通常为[0, 1]
42  std::vector<float> rec_scores_;
43 
44  // 文本方向分类置信度分数:判断文本是否需要旋转的置信度
45  std::vector<float> cls_scores_;
46  // 文本方向分类标签:0表示正向,1表示需要180度旋转
47  std::vector<int32_t> cls_labels_;
48 
49  // 表格检测结果:表格中每个单元格的边界框坐标
50  // 格式与boxes_相同,每个数组包含8个整数表示四个顶点坐标
51  std::vector<std::array<int, 8>> table_boxes_;
52  // 表格结构识别结果:表格的结构标记,如<td>、<tr>等HTML标签
53  std::vector<std::string> table_structure_;
54  // 完整的表格HTML代码:将表格内容和结构组合成完整的HTML表格
55  std::string table_html_;
58 
59  // 清空所有结果数据
60  void clear();
61  // 获取所有识别文本的连接字符串
62  std::string getText();
63 };
64 
65 } // namespace ocr
66 } // namespace nndeploy
67 
68 #endif /* _NNDEPLOY_OCR_RESULT_H_ */
OCR识别结果类
Definition: result.h:29
std::vector< int > classifier_result
Definition: result.h:38
std::vector< float > cls_scores_
Definition: result.h:45
std::vector< std::array< int, 8 > > table_boxes_
Definition: result.h:51
std::vector< std::array< int, 8 > > boxes_
Definition: result.h:32
std::vector< cv::Mat > image_list_
Definition: result.h:37
std::vector< int32_t > cls_labels_
Definition: result.h:47
std::vector< std::string > table_structure_
Definition: result.h:53
std::vector< float > rec_scores_
Definition: result.h:42
virtual ~OCRResult()
Definition: result.h:32
std::vector< std::string > text_
Definition: result.h:40
std::string table_html_
Definition: result.h:55
#define NNDEPLOY_CC_API
api
Definition: macro.h:29