Commit b9dd287c70529a8025d1f695ee487b8ba5cc7c84
1 parent
e25a1c16
举行过滤同步为多边形
Showing
2 changed files
with
26 additions
and
9 deletions
src/ai_engine_module/pedestrian_vehicle_retrograde.cpp
@@ -15,6 +15,7 @@ | @@ -15,6 +15,7 @@ | ||
15 | #include "../decoder/interface/DeviceMemory.hpp" | 15 | #include "../decoder/interface/DeviceMemory.hpp" |
16 | #include "../common/logger.hpp" | 16 | #include "../common/logger.hpp" |
17 | #include "../ai_platform/mvpt_process_assist.h" | 17 | #include "../ai_platform/mvpt_process_assist.h" |
18 | +#include "../helpers/img_util.h" | ||
18 | 19 | ||
19 | namespace ai_engine_module { | 20 | namespace ai_engine_module { |
20 | namespace pedestrian_vehicle_retrograde { | 21 | namespace pedestrian_vehicle_retrograde { |
@@ -50,11 +51,19 @@ bool is_valid_box(const int &cls, const algorithm_type_t &algor_type) { | @@ -50,11 +51,19 @@ bool is_valid_box(const int &cls, const algorithm_type_t &algor_type) { | ||
50 | 51 | ||
51 | bool is_valid_box(const box_t &box, const algorithm_type_t &algor_type, | 52 | bool is_valid_box(const box_t &box, const algorithm_type_t &algor_type, |
52 | const task_param_manager::algo_param_type_t_ *params_ptr = nullptr) { | 53 | const task_param_manager::algo_param_type_t_ *params_ptr = nullptr) { |
53 | - if (!params_ptr) | ||
54 | - return false; | 54 | + if (!params_ptr || params_ptr->basic_param == nullptr) |
55 | + return false; | ||
55 | 56 | ||
56 | - if (!snapshot_legal_inarea(params_ptr->basic_param->algor_valid_rect, box.left, box.top, box.right, box.bottom)) | ||
57 | - return false; | 57 | + universal_algor_adapt_param *adapt_param = params_ptr->basic_param->adapt_param; |
58 | + if (nullptr == adapt_param) { | ||
59 | + return false; | ||
60 | + } | ||
61 | + | ||
62 | + sy_point center; | ||
63 | + center.x_ = (box.right + box.left)/ 2 ; | ||
64 | + center.y_ = (box.bottom + box.top) / 2; | ||
65 | + if (!common::isInPolygon(adapt_param->points, adapt_param->points_count, center)) | ||
66 | + return false; | ||
58 | 67 | ||
59 | if (params_ptr->algor_param == nullptr) | 68 | if (params_ptr->algor_param == nullptr) |
60 | return false; | 69 | return false; |
src/ai_engine_module/pedestrian_vehicle_trespass.cpp
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | #include "../decoder/interface/DeviceMemory.hpp" | 17 | #include "../decoder/interface/DeviceMemory.hpp" |
18 | #include "../common/logger.hpp" | 18 | #include "../common/logger.hpp" |
19 | #include "../ai_platform/mvpt_process_assist.h" | 19 | #include "../ai_platform/mvpt_process_assist.h" |
20 | - | 20 | +#include "../helpers/img_util.h" |
21 | 21 | ||
22 | namespace ai_engine_module { | 22 | namespace ai_engine_module { |
23 | namespace pedestrian_vehicle_trespass { | 23 | namespace pedestrian_vehicle_trespass { |
@@ -55,11 +55,19 @@ bool is_valid_box(const int &cls, const algorithm_type_t &algor_type) { | @@ -55,11 +55,19 @@ bool is_valid_box(const int &cls, const algorithm_type_t &algor_type) { | ||
55 | 55 | ||
56 | bool is_valid_box(const box_t &box, const algorithm_type_t &algor_type, | 56 | bool is_valid_box(const box_t &box, const algorithm_type_t &algor_type, |
57 | const task_param_manager::algo_param_type_t_ *params_ptr = nullptr) { | 57 | const task_param_manager::algo_param_type_t_ *params_ptr = nullptr) { |
58 | - if (!params_ptr) | ||
59 | - return false; | 58 | + if (!params_ptr || params_ptr->basic_param == nullptr) |
59 | + return false; | ||
60 | 60 | ||
61 | - if (!snapshot_legal_inarea(params_ptr->basic_param->algor_valid_rect, box.left, box.top, box.right, box.bottom)) | ||
62 | - return false; | 61 | + universal_algor_adapt_param *adapt_param = params_ptr->basic_param->adapt_param; |
62 | + if (nullptr == adapt_param) { | ||
63 | + return false; | ||
64 | + } | ||
65 | + | ||
66 | + sy_point center; | ||
67 | + center.x_ = (box.right + box.left)/ 2 ; | ||
68 | + center.y_ = (box.bottom + box.top) / 2; | ||
69 | + if (!common::isInPolygon(adapt_param->points, adapt_param->points_count, center)) | ||
70 | + return false; | ||
63 | 71 | ||
64 | if (params_ptr->algor_param == nullptr) | 72 | if (params_ptr->algor_param == nullptr) |
65 | return false; | 73 | return false; |