Commit 262f2763 by wangquyuan

add by wqy

1 parent 58ac7830
......@@ -5,7 +5,7 @@
"work_timeout":10,
"logpath":"/tmp",
"device":"gpu",
"models": {
"face_detector":"SeetaFaceDetector6.0.IPC.sta",
......
......@@ -134,8 +134,17 @@ target_link_libraries(${PROJECT_NAME} -L/usr/local/lib -lORZ_static)
#include_directories(${SeetaCV_INCLUDE_DIRS})
#target_link_libraries(${PROJECT_NAME} ${SeetaCV_LIBRARIES})
#include_directories(/wqy/tools/opencv4_home/include/opencv4)
#target_link_libraries(${PROJECT_NAME} -L/wqy/tools/opencv4_home/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs)
include_directories(/wqy/tools/opencv4_home/include/opencv4)
target_link_libraries(${PROJECT_NAME} -L/wqy/tools/opencv4_home/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_video -lopencv_videoio)
include_directories(/wqy/test/qtproject/emotions/include)
target_link_libraries(${PROJECT_NAME} -L/wqy/test/qtproject/emotions/lib64 -lSeetaPoseEstimation600 -lSeetaActionUnit600 -lSeetaEmotionRecognizer200 -lSeetaEyeStateDetector200 -lSeetaFaceTracking600 -lSeetaFaceLandmarker600 -lSeetaAuthorize -ltennis -lslm_runtime -lSeetaFaceDetector600 -lSeetaFaceRecognizer610)
target_link_libraries(${PROJECT_NAME} -pthread -lrt)
......
......@@ -49,6 +49,7 @@ public:
//JSONField( self, MysqlConfig, db );
JSONField( self, std::string, device ) = "cpu";
JSONField( self, ModelsConfig, models );
};
......
......@@ -35,4 +35,11 @@ void geturlparameters(const std::string &str, std::map<std::string, std::string>
std::string encodetojson(const std::string &str);
bool is_space_char(unsigned char c);
int skip_space_chars(const std::string &str, std::string::size_type nbegin);
int parse_http_parameters(const std::string & body, std::map<std::string,std::string> &paramters);
#endif
......@@ -3,45 +3,16 @@
static std::vector<ErrorCode> errors =
{
{0, "ok"},
{1, "json format is incorrect"},
{2, "signature is incorrect" },
{3, "authorization parameter is incorrect"},
{1, "do not find face"},
{2, "create detector engine failed" },
{3, "face recognize failed "},
{4, "parameters are incorrect"},
{5, "request is not support yet"},
{6, "database is not avilable"},
{7, "request format is incorrect"},
{7, "image data parse failed"},
{8, "this pot is not existed"},
{9, "this pot is offline"},
{10, "this pot is timeout"},
{11, "this transactionid is invalid"},
{12, "this template's child template is not empty"},
{13, "this template is being used by pots"},
{14, "this parameter version is not found"},
{15, "this table is not existed"},
{16, "this data version is too old"},
{17, "this table already exists"},
{18, "this template already exists"},
{19, "this pot's parameter is empty"},
{20, "this template is not existed"},
{21, "user do not register"},
{22, "user do not login"},
{23, "do not find token parameter"},
{24, "the image size is more than 64k"},
{25, "the username already exists"},
{26, "the insert data do not match the table columns"},
{27, "this template type already exists"},
};
......
......@@ -32,7 +32,7 @@ Config *g_config = NULL;
CSequence *g_seq = NULL;
//extern DataTableUpdate g_datatableupdate;
std::string gmodelpath;
using websocketpp::lib::placeholders::_1;
using websocketpp::lib::placeholders::_2;
......@@ -172,6 +172,7 @@ int main( int argc, char *argv[] )
return 0;
}
gmodelpath = exepath + "models/";
g_config = parse_config( exepath + "config.json" );
if( !g_config )
{
......@@ -179,6 +180,7 @@ int main( int argc, char *argv[] )
return -1;
}
std::cout << "device:" << g_config->device << std::endl;
std::cout << "face_detector:" << g_config->models.face_detector << std::endl;
std::cout << "face_landmarker81:" << g_config->models.face_landmarker81 << std::endl;
std::cout << "face_landmarker5:" << g_config->models.face_landmarker5 << std::endl;
......
......@@ -483,4 +483,73 @@ std::string encodetojson(const std::string &str)
}
return oss.str();
}
bool is_space_char(unsigned char c)
{
return (c == 9 || c == 32);
}
int skip_space_chars(const std::string &str, std::string::size_type nbegin)
{
while(is_space_char(str[nbegin]))
{
if(nbegin >= str.length() - 1)
return nbegin;
nbegin++;
}
return nbegin;
}
static int parse_paramter(const std::string &str, std::string &name, std::string &value)
{
std::string::size_type nfind = str.find("=");
if(nfind != std::string::npos)
{
name = str.substr(0, nfind);
value = str.substr(nfind + 1);
name = decodeuricomponent(name);//urldecode(name);
value = decodeuricomponent(value);//urldecode(value);
return 0;
}
return -1;
}
int parse_http_parameters(const std::string & body, std::map<std::string,std::string> &paramters)
{
//LOG(_INFO_,"recv post req:%s ",GETNULLSTR(command));
std::string::size_type nbegin,nend, nfind;
nbegin = nend = 0;
nbegin = skip_space_chars(body, 0);
std::string name,value;
std::string strtmp;
//std::map<std::string, std::string> paramters;
while(1)
{
name = value = "";
nfind = body.find("&", nbegin);
if(nfind != std::string::npos)
{
strtmp = body.substr(nbegin, nfind - nbegin);
if(parse_paramter(strtmp, name, value) >= 0)
{
paramters[name] = value;
}
nbegin = nfind + 1;
continue;
}else if(nbegin < body.length())
{
strtmp = body.substr(nbegin);
if(parse_paramter(strtmp, name, value) >= 0)
{
paramters[name] = value;
}
break;
}
}
return paramters.size();
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!