ai_engine_header.h 1.74 KB
/*
 * @Author: yangzilong
 * @Date: 2021-12-01 15:14:02
 * @Last Modified by: yangzilong
 * @Last Modified time: Do not edit
 * @Email: yangzilong@objecteye.com
 * @Description:
 */

#pragma once

#include <cmath>
#include <type_traits>
#include <string>
#include "../ai_platform/det_obj_header.h"
#include "../util/vpc_util.h"
#include "../ai_platform/common_header.h"

namespace ai_engine_module {
template <typename T> T clip(const T &val, const T &min, const T &max) {
  if (std::is_integral<T>::value)
    return std::min(std::max(val, min), max);
  return val;
}

using obj_id_t = long;
using task_id_t = std::string;

enum class direction_t {
  NEGATIVE = 0,
  POSITIVE = 1,
};

struct unique_obj_id_t {
  obj_id_t obj_id;
  task_id_t task_id;

  bool operator<(const unique_obj_id_t &obj) const {
    if (obj_id < obj.obj_id)
      return true;

    else if (obj_id == obj.obj_id) {
      if (strcmp(task_id.c_str(), obj.task_id.c_str()) < 0)
        return true;
    }
    return false;
  }

};

struct obj_key_t {
  obj_id_t obj_id;
  task_id_t task_id;
  algorithm_type_t algor_type;

  bool operator<(const obj_key_t &obj) const {
    if (obj_id < obj.obj_id)
      return true;

    else if (obj_id == obj.obj_id) {
      if (strcmp(task_id.c_str(), obj.task_id.c_str()) < 0)
        return true;

      else if (strcmp(task_id.c_str(), obj.task_id.c_str()) == 0) {
        if (static_cast<int>(algor_type) < static_cast<int>(obj.algor_type))
          return true;
        else
          return false;
      }
    }
    return false;
  }
};

struct trace_t {
  box_t box;
  point_t point;
};

typedef struct result_data_t {
  box_t box;
  acldvppPicDesc* origin_img_desc{nullptr};
  acldvppPicDesc* roi_img_desc{nullptr};
} result_data_t;

} // namespace ai_engine_module