| | |
| | | // 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
|
| | |
| | | // `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
|
| | |
| | | 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
|