|
@@ -194,7 +194,9 @@ bool paperPreIdentify::getCardTemplate(string strCardId, string strIp)
|
|
if(strs.size() == 2)
|
|
if(strs.size() == 2)
|
|
strTaskId = strs.at(1);
|
|
strTaskId = strs.at(1);
|
|
string strSchoolId = to_string(m_nSchoolId);
|
|
string strSchoolId = to_string(m_nSchoolId);
|
|
- string strUrl = strIp + "/teacher/third/card/location?cardId=" + strCardId + "&taskId=" + strTaskId + "&schoolId=" + strSchoolId;
|
|
|
|
|
|
+ if(!strIp.empty() && strIp[strIp.length() - 1] != '/')
|
|
|
|
+ strIp += "/";
|
|
|
|
+ string strUrl = strIp + "teacher/third/card/location?cardId=" + strCardId + "&taskId=" + strTaskId + "&schoolId=" + strSchoolId;
|
|
//调用后端接口获取模板信息
|
|
//调用后端接口获取模板信息
|
|
void* curl = curl_easy_init();
|
|
void* curl = curl_easy_init();
|
|
curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
|
|
curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
|
|
@@ -202,15 +204,21 @@ bool paperPreIdentify::getCardTemplate(string strCardId, string strIp)
|
|
struct curl_slist *headers = NULL;
|
|
struct curl_slist *headers = NULL;
|
|
headers = curl_slist_append(headers, "Accept: *,*/*");
|
|
headers = curl_slist_append(headers, "Accept: *,*/*");
|
|
headers = curl_slist_append(headers, "Accept-Language: zh-cn");
|
|
headers = curl_slist_append(headers, "Accept-Language: zh-cn");
|
|
|
|
+// headers = curl_slist_append(headers, "Accept-Encoding: gzip, deflate");
|
|
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
|
|
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
|
|
headers = curl_slist_append(headers, "Authorization:Basic ZnhiLXNoOmVDbGo0TlRoSHlMY05USE0wZWl3ZWpVUExCcGFlZQ==");
|
|
headers = curl_slist_append(headers, "Authorization:Basic ZnhiLXNoOmVDbGo0TlRoSHlMY05USE0wZWl3ZWpVUExCcGFlZQ==");
|
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
|
|
|
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
|
|
|
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
|
string strJson;
|
|
string strJson;
|
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &strJson);
|
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &strJson);
|
|
CURLcode res = curl_easy_perform(curl);
|
|
CURLcode res = curl_easy_perform(curl);
|
|
if (res != CURLE_OK)
|
|
if (res != CURLE_OK)
|
|
|
|
+ {
|
|
|
|
+ string strError = curl_easy_strerror(res);
|
|
return false;
|
|
return false;
|
|
|
|
+ }
|
|
curl_easy_cleanup(curl);
|
|
curl_easy_cleanup(curl);
|
|
//解析json
|
|
//解析json
|
|
Json::Reader reader;
|
|
Json::Reader reader;
|
|
@@ -325,6 +333,18 @@ bool paperPreIdentify::findTopAnchors(Mat tMat)
|
|
}
|
|
}
|
|
CvRect rect;
|
|
CvRect rect;
|
|
float k = 0, b = 0;
|
|
float k = 0, b = 0;
|
|
|
|
+ //剔除杂质点
|
|
|
|
+ if(list.size() > 3)
|
|
|
|
+ {
|
|
|
|
+ int nCount = list.size() - 3;
|
|
|
|
+ sort(list.begin(), list.end(), [](CvRect r1, CvRect r2){
|
|
|
|
+ return r1.y < r2.y;
|
|
|
|
+ });
|
|
|
|
+ if(abs(list[2].y - list[1].y) > 5)
|
|
|
|
+ nCount++;
|
|
|
|
+ while(nCount--)
|
|
|
|
+ list.pop_back();
|
|
|
|
+ }
|
|
if (list.size() > 1)
|
|
if (list.size() > 1)
|
|
{
|
|
{
|
|
bool bV = false;
|
|
bool bV = false;
|