|
@@ -443,6 +443,7 @@ int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool
|
|
|
int colWidth = fontW / cols; // 单栏的宽度
|
|
|
fSize.width = 0; fSize.height = 0;
|
|
|
Json::Value root(Json::arrayValue);
|
|
|
+ RNG rng;
|
|
|
for (int col = 0; col < cols; col++)
|
|
|
{ // 逐栏画题
|
|
|
int colTopPos = topPos;
|
|
@@ -482,6 +483,7 @@ int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool
|
|
|
cv::Rect rcAns(colLeftPos + 30, colTopPos + fSize.height, colWidth - ttBoxWidth, 1);
|
|
|
|
|
|
colTopPos = colTopPos + fSize.height * 3.5; //两行之间两倍的距离用于书写
|
|
|
+ lineGrayPix = rng.operator ()(220);
|
|
|
line(img, cv::Point(colLeftPos + 30, colTopPos), cv::Point(colLeftPos + colWidth - 1, colTopPos), Scalar(lineGrayPix, lineGrayPix, lineGrayPix), 1, 8, 0);
|
|
|
rcAns.height = colTopPos - rcAns.y + lineDis;
|
|
|
|
|
@@ -677,7 +679,9 @@ int cutPaper(int pageNum, std::string strJsonPath, std::string strPaperPath, std
|
|
|
pfGetPos(ansInfo, rc_ansInfo);
|
|
|
|
|
|
// 选择框灰度判断
|
|
|
- bool ret = analysis_ttbox_mark(src, rc_ttbox);
|
|
|
+ cv::Mat gray_src;
|
|
|
+ cv::cvtColor(src, gray_src, COLOR_BGR2GRAY);
|
|
|
+ bool ret = analysis_ttbox_mark(gray_src, rc_ttbox);
|
|
|
|
|
|
char szTxtPath[MAX_PATH] = { 0 };
|
|
|
char szJpgPath[MAX_PATH] = { 0 };
|
|
@@ -691,8 +695,7 @@ int cutPaper(int pageNum, std::string strJsonPath, std::string strPaperPath, std
|
|
|
zip.Close();
|
|
|
|
|
|
cv::Mat cut = src(rc_ansInfo);
|
|
|
- ret = cv::imwrite(szJpgPath, cut);
|
|
|
- return ret ? 0 : 1;
|
|
|
+ cv::imwrite(szJpgPath, cut);
|
|
|
}
|
|
|
|
|
|
return 0;
|