common_header.h 1.32 KB
#ifndef ___COMMON_HEADER_H__
#define ___COMMON_HEADER_H__

#include <cmath>
#include <type_traits>
#include <string>

struct point_t {
  int x, y;
};

struct box_t {
  long id; // -1: placeholder.
  float score;
  int top, left, right, bottom, cls;

  int width() const {
    return std::max(0, right - left);
  }

  int height() const {
    return std::max(0, bottom - top);
  }

  int cx() const {
    return std::max(0, int((left + right) * 0.5f));
  }

  int cy() const {
    return std::max(0, int((top + bottom) * 0.5f));
  }
};

struct RecoderInfo {
  std::string recoderPath;
  std::string task_id;
  std::string object_id;
  unsigned long long frame_nb;
  std::string mq_info;
};

//返回的检测物体结果信息
typedef struct video_object_info {
    char task_id[128];              //该物体属于的任务ID号
    int task_frame_count;     //该物体当前出现的帧号
    int object_id;            //该物体的ID号
    int left;                 //该物体位置的左坐标
    int top;                  //该物体位置的上坐标
    int right;                //该物体位置的右坐标
    int bottom;               //该物体位置的下坐标
    int index;                //该物体所属类别的编号
    double confidence;        //该物体的置信度
} video_object_info;

#endif // ___COMMON_HEADER_H__