|
@@ -9,11 +9,46 @@ namespace GNode
|
|
|
|
|
|
void AnalyzeNode::handle_data(std::shared_ptr<meta::BaseData>& meta_data)
|
|
|
{
|
|
|
+ if (config_data_ == nullptr)
|
|
|
+ {
|
|
|
+ PLOGE.printf("AnalyzeNode : [%s] config data is null", name_.c_str());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (config_data_->data_name != "AnalyzeConfigData")
|
|
|
+ {
|
|
|
+ PLOGE.printf("AnalyzeNode : [%s] Invalid config data %s", name_.c_str(), config_data_->data_name.c_str());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ auto config_data = std::dynamic_pointer_cast<meta::AnalyzeConfigData>(config_data_);
|
|
|
+ std::vector<std::string> task_names = config_data->task_names;
|
|
|
+ if (task_names.empty())
|
|
|
+ {
|
|
|
+ PLOGE.printf("AnalyzeNode : [%s] No task names provided", name_.c_str());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
auto frame_data = std::dynamic_pointer_cast<meta::FrameData>(meta_data);
|
|
|
int width = frame_data->image.cols;
|
|
|
int height = frame_data->image.rows;
|
|
|
- auto res = person_cross_line(frame_data->track_boxes, cv::Point(0, 0), cv::Point(width, height));
|
|
|
- frame_data->result = res;
|
|
|
+
|
|
|
+ for (const auto& task_name : task_names)
|
|
|
+ {
|
|
|
+ if (task_name == "cross_line")
|
|
|
+ {
|
|
|
+ if (frame_data->track_boxes.empty())
|
|
|
+ {
|
|
|
+ PLOGE.printf("AnalyzeNode : [%s] No track boxes available for cross_line task", name_.c_str());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ auto res = person_cross_line(frame_data->track_boxes, cv::Point(0, 0), cv::Point(width, height));
|
|
|
+ frame_data->result.insert(frame_data->result.end(), res.begin(), res.end());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PLOGE.printf("AnalyzeNode : [%s] Unknown task name %s", name_.c_str(), task_name.c_str());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|