Blame view

src/ai_engine_module/ai_engine_header.h 1.74 KB
09c2d08c   Hu Chunming   arm交付版
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  /*
   * @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