From 291afb9c81aae1d15d9e3edcea618d0a2e1fc5a6 Mon Sep 17 00:00:00 2001
From: wangrong <wangrong@shsening.com>
Date: 星期三, 19 三月 2025 17:51:38 +0800
Subject: [PATCH] add samples
---
nodes/ba/vp_ba_crossline_node.cpp | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/nodes/ba/vp_ba_crossline_node.cpp b/nodes/ba/vp_ba_crossline_node.cpp
index c10721d..afaa38b 100644
--- a/nodes/ba/vp_ba_crossline_node.cpp
+++ b/nodes/ba/vp_ba_crossline_node.cpp
@@ -42,6 +42,9 @@
// for vp_frame_target only
for (auto& target : meta->targets) {
auto len = target->tracks.size();
+ if (target->primary_label != target->class_label_of_car) {
+ continue;
+ }
std::vector<int> involve_targets;
if (len > 1 && target->track_id >= 0) {
// check the last 2 points in tracks
@@ -54,11 +57,11 @@
// `true and false` or `false and true`
// means target passed the line in current frame
if (check1 ^ check2) {
- total_crossline++;
involve_targets.push_back(target->track_id);
-
// not empty need fill ba result back to frame meta
if (involve_targets.size() > 0) {
+ bool is_entering = p1.y > p2.y;
+ total_crossline += (is_entering ? 1 : -1);
// send record image and record video signal, recording actions would occur if record nodes exist in pipeline
std::string image_file_name_without_ext = ""; // empty means no recording image
std::string video_file_name_without_ext = ""; // empty means no recording video
@@ -82,7 +85,7 @@
meta->frame_index,
involve_targets,
involve_region,
- "cross_line", // meaningful label
+ is_entering ? "cross_line_in" : "cross_line_out", // meaningful label
image_file_name_without_ext,
video_file_name_without_ext);
// fill back to frame meta
--
Gitblit v1.9.1