|
@@ -368,7 +368,7 @@ std::string JsonToString(const Json::Value & root)
|
|
return stream.str();
|
|
return stream.str();
|
|
}
|
|
}
|
|
|
|
|
|
-int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool engShow, std::vector<string>& vecLines, CString dir, std::string& strPngPath) {
|
|
|
|
|
|
+int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool engShow, std::vector<tuple<string, string>>& vecLines, CString dir, std::string& strPngPath) {
|
|
/* 这里要做一些栏数 和 vecLines的对应值确认 */
|
|
/* 这里要做一些栏数 和 vecLines的对应值确认 */
|
|
if (2 == cols && 14 * 2 == vecLines.size())
|
|
if (2 == cols && 14 * 2 == vecLines.size())
|
|
; // ok
|
|
; // ok
|
|
@@ -418,8 +418,8 @@ int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool
|
|
//generatePageJson(vecPts, vecBoxPages);
|
|
//generatePageJson(vecPts, vecBoxPages);
|
|
|
|
|
|
// 画警示信息
|
|
// 画警示信息
|
|
- string strMesInfo = "1、请在每题下方的横线上书写本题的内容!\
|
|
|
|
- \n\n2、题号不需要书写,标点符号需要原样书写。☆\
|
|
|
|
|
|
+ string strMesInfo = "1、请在题目下面的横线上书写题目结果!\
|
|
|
|
+ \n\n2、请用黑色笔书写。☆\
|
|
\n\n3、如果本题书写有误,进行了涂抹修改等操作,请将题号前矩形框用任意笔进行填涂!☆☆\n";
|
|
\n\n3、如果本题书写有误,进行了涂抹修改等操作,请将题号前矩形框用任意笔进行填涂!☆☆\n";
|
|
putTextZH(img, fSize, strMesInfo.c_str(), cv::Point(leftPos + 20, topPos + 20), Scalar(0), 25, "宋体");
|
|
putTextZH(img, fSize, strMesInfo.c_str(), cv::Point(leftPos + 20, topPos + 20), Scalar(0), 25, "宋体");
|
|
int lineTop1 = topPos + 20 + fSize.height + 20;
|
|
int lineTop1 = topPos + 20 + fSize.height + 20;
|
|
@@ -481,7 +481,8 @@ int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool
|
|
cv::Rect rcNum(ptNum.x, ptNum.y, fSize.width, fSize.height);
|
|
cv::Rect rcNum(ptNum.x, ptNum.y, fSize.width, fSize.height);
|
|
|
|
|
|
strStinfo.clear();
|
|
strStinfo.clear();
|
|
- string strTgInfo = vecLines[vecIndex];
|
|
|
|
|
|
+ string strTgInfo = std::get<0>(vecLines[vecIndex]);
|
|
|
|
+ string strSolution = std::get<1>(vecLines[vecIndex]);
|
|
if (!engShow)
|
|
if (!engShow)
|
|
; /* 移除词性 */
|
|
; /* 移除词性 */
|
|
//char szTemp[2048];
|
|
//char szTemp[2048];
|
|
@@ -518,6 +519,7 @@ int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool
|
|
queInfo["width"] = rcQues.width;
|
|
queInfo["width"] = rcQues.width;
|
|
queInfo["height"] = rcQues.height;
|
|
queInfo["height"] = rcQues.height;
|
|
queInfo["info"] = strTgInfo.c_str();
|
|
queInfo["info"] = strTgInfo.c_str();
|
|
|
|
+ queInfo["solution"] = strSolution.c_str();
|
|
|
|
|
|
Json::Value ansInfo;
|
|
Json::Value ansInfo;
|
|
ansInfo["x"] = rcAns.x;
|
|
ansInfo["x"] = rcAns.x;
|
|
@@ -681,6 +683,7 @@ int cutPaper(int pageNum, std::string strJsonPath, std::string strPaperPath, std
|
|
|
|
|
|
std::string id = row["id"].asString();
|
|
std::string id = row["id"].asString();
|
|
std::string info = row["queInfo"]["info"].asString();
|
|
std::string info = row["queInfo"]["info"].asString();
|
|
|
|
+ std::string solution = row["queInfo"]["solution"].asString();
|
|
|
|
|
|
Json::Value ttbox = row["ttbox"];
|
|
Json::Value ttbox = row["ttbox"];
|
|
Json::Value ansInfo = row["ansInfo"];
|
|
Json::Value ansInfo = row["ansInfo"];
|
|
@@ -696,15 +699,22 @@ int cutPaper(int pageNum, std::string strJsonPath, std::string strPaperPath, std
|
|
bool ret = analysis_ttbox_mark(gray_src, rc_ttbox);
|
|
bool ret = analysis_ttbox_mark(gray_src, rc_ttbox);
|
|
|
|
|
|
char szTxtPath[MAX_PATH] = { 0 };
|
|
char szTxtPath[MAX_PATH] = { 0 };
|
|
|
|
+ char szStdPath[MAX_PATH] = { 0 };
|
|
char szJpgPath[MAX_PATH] = { 0 };
|
|
char szJpgPath[MAX_PATH] = { 0 };
|
|
DWORD dwCount = GetTickCount();
|
|
DWORD dwCount = GetTickCount();
|
|
- sprintf(szTxtPath, "%s\\%s\\%d_%s_%ld.txt", strSavePath.c_str(), ret ? "abnormal" : "normal", pageNum, id.c_str(), dwCount);
|
|
|
|
|
|
+ sprintf(szTxtPath, "%s\\%s\\%d_%s_%ld_yy.txt", strSavePath.c_str(), ret ? "abnormal" : "normal", pageNum, id.c_str(), dwCount);
|
|
|
|
+ sprintf(szStdPath, "%s\\%s\\%d_%s_%ld_zz.txt", strSavePath.c_str(), ret ? "abnormal" : "normal", pageNum, id.c_str(), dwCount);
|
|
sprintf(szJpgPath, "%s\\%s\\%d_%s_%ld.jpg", strSavePath.c_str(), ret ? "abnormal" : "normal", pageNum, id.c_str(), dwCount);
|
|
sprintf(szJpgPath, "%s\\%s\\%d_%s_%ld.jpg", strSavePath.c_str(), ret ? "abnormal" : "normal", pageNum, id.c_str(), dwCount);
|
|
|
|
|
|
- CFile zip;
|
|
|
|
- zip.Open(CA2T(szTxtPath), CFile::modeCreate | CFile::modeWrite);
|
|
|
|
- zip.Write((void*)info.c_str(), info.length());
|
|
|
|
- zip.Close();
|
|
|
|
|
|
+ CFile zip1;
|
|
|
|
+ zip1.Open(CA2T(szTxtPath), CFile::modeCreate | CFile::modeWrite);
|
|
|
|
+ zip1.Write((void*)info.c_str(), info.length());
|
|
|
|
+ zip1.Close();
|
|
|
|
+
|
|
|
|
+ CFile zip2;
|
|
|
|
+ zip2.Open(CA2T(szStdPath), CFile::modeCreate | CFile::modeWrite);
|
|
|
|
+ zip2.Write((void*)solution.c_str(), solution.length());
|
|
|
|
+ zip2.Close();
|
|
|
|
|
|
cv::Mat cut = src(rc_ansInfo);
|
|
cv::Mat cut = src(rc_ansInfo);
|
|
cv::imwrite(szJpgPath, cut);
|
|
cv::imwrite(szJpgPath, cut);
|