123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #pragma once
- #ifndef PUTTEXT_H_
- #define PUTTEXT_H_
- #include <string>
- #include <opencv2/opencv.hpp>
- #include "lib_common_depence.h"
- using namespace std;
- #define font_family "宋体"
- #define font_size 30
- #define chk_width 30
- #define main_wdith 1430
- #if QQM_ADD
- #define max_line 3 // 每张三个示例图
- #else
- #define max_line 14
- #endif // QQM_ADD
- void GetStringSize(HDC hDC, const char* str, int* w, int* h);
- //获取字符串的宽高
- cv::Size GetTextSize(const char* str, int fontSize, const char *fn = "Arial", bool italic = false, bool underline = false);
- void putTextZH(cv::Mat &dst, cv::Size & rSize, const char* str, cv::Point org, cv::Scalar color, int fontSize,
- const char *fn = "Arial", bool italic = false, bool underline = false);
- /// 数据收集卡 功能样式设计
- /********************************************************
- * @function : 获取字符串的画布上的宽度
- * @brief : brief
- * @input : str: 字符串
- * @input : fontSize: 信息区域字体大小
- * @input : ttBoxW: 填涂框宽度
- * @input : tiSl: 题号和题干的距离
- * @input : backPix: 每行的预留空间
- * @return :
- * @author : qqm 2022/08/31 19:42
- *********************************************************/
- int getLineStrWidth(string str, int fontSize, int ttBoxW, int tiSl, int backPix);
- /********************************************************
- * @function : 生成一张数据收集卡
- * @brief : brief
- * @input : cols: 栏数
- * @input : index: 关联ID
- * @input : fontSize: 信息区域字体大小
- * @input : linGrayPix: 横线的灰度值
- * @input : vecLines: 本张数据行
- * @input : engShow: 是否显示词性
- * @return :
- * @author : qqm 2022/08/31 19:42
- *********************************************************/
- int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool engShow, std::vector<tuple<string, string>>& vecLines, CString dir, std::string& strPngPath, std::string tips);
- // just for physics
- int dataCollectionPaperPhysics(int cols, int index, int fontSize, int lineGrayPix, bool engShow, std::vector<tuple<string, string>>& vecLines, CString dir, std::string& strPngPath, std::string tips);
- /********************************************************
- * @function : 答题卡切割
- * @brief : brief
- * @input : pageNum: 页面二进制编码
- * @input : strJsonPath: 模板Json路径
- * @input : strPaperPath: 答题卡路径
- * @input : strSavePath: 存储路径
- * @input : vecTranslate: 百度识别后返回的
- * @return : > 0 失败
- * @author : qqm 2022/08/31 19:42
- *********************************************************/
- int cutPaper(int pageNum, std::string strJsonPath, std::string strPaperPath, std::string strSavePath, vector<std::tuple<cv::Rect, std::string>>& vecTranslate);
- int PareseModeJson(preinfo::templatesInfo& temeplatInfo);
- int cutPaper(std::string strImagePath, std::string strCurDir, vector<std::tuple<cv::Rect, std::string>>& vecTranslate);
- #endif // PUTTEXT_H_
|