Moved all OpenCV functions to the image_opencv.cpp/h

This commit is contained in:
AlexeyAB
2019-04-04 22:57:05 +03:00
parent 6231b748c4
commit f19d1440cb
38 changed files with 1462 additions and 1156 deletions

View File

@ -384,53 +384,6 @@ LIB_API std::vector<bbox_t> Detector::tracking_id(std::vector<bbox_t> cur_bbox_v
}
LIB_API bool Detector::send_json_http(std::vector<bbox_t> cur_bbox_vec, std::vector<std::string> obj_names, int frame_id, std::string filename, int timeout, int port)
{
//int timeout = 400000;
//int port = 8070;
//send_json(local_dets, local_nboxes, l.classes, demo_names, frame_id, demo_json_port, timeout);
std::string send_str;
char *tmp_buf = (char *)calloc(1024, sizeof(char));
if (!filename.empty()) {
sprintf(tmp_buf, "{\n \"frame_id\":%d, \n \"filename\":\"%s\", \n \"objects\": [ \n", frame_id, filename.c_str());
}
else {
sprintf(tmp_buf, "{\n \"frame_id\":%d, \n \"objects\": [ \n", frame_id);
}
send_str = tmp_buf;
free(tmp_buf);
for (auto & i : cur_bbox_vec) {
char *buf = (char *)calloc(2048, sizeof(char));
sprintf(buf, " {\"class_id\":%d, \"name\":\"%s\", \"absolute_coordinates\":{\"center_x\":%d, \"center_y\":%d, \"width\":%d, \"height\":%d}, \"confidence\":%f",
i.obj_id, obj_names[i.obj_id].c_str(), i.x, i.y, i.w, i.h, i.prob);
//sprintf(buf, " {\"class_id\":%d, \"name\":\"%s\", \"relative_coordinates\":{\"center_x\":%f, \"center_y\":%f, \"width\":%f, \"height\":%f}, \"confidence\":%f",
// i.obj_id, obj_names[i.obj_id], i.x, i.y, i.w, i.h, i.prob);
send_str += buf;
if (!std::isnan(i.z_3d)) {
sprintf(buf, "\n , \"coordinates_in_meters\":{\"x_3d\":%.2f, \"y_3d\":%.2f, \"z_3d\":%.2f}",
i.x_3d, i.y_3d, i.z_3d);
send_str += buf;
}
send_str += "}\n";
free(buf);
}
//send_str += "\n ] \n}, \n";
send_str += "\n ] \n}";
send_json_custom(send_str.c_str(), port, timeout);
return true;
}
void *Detector::get_cuda_context()
{
#ifdef GPU