common_header.h 625 Bytes
#ifndef ___COMMON_HEADER_H__
#define ___COMMON_HEADER_H__

#include <cmath>
#include <type_traits>

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 {
  string task_id;
  string object_id;
  bool bSave;
};

#endif // ___COMMON_HEADER_H__