Skip to content

Commit

Permalink
Update motion_detect_stage.cpp to allow specification of optional reg…
Browse files Browse the repository at this point in the history
…ion name for output logging.
  • Loading branch information
NicHoza authored Jan 5, 2025
1 parent b78871e commit 20d6b31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion post_processing_stages/motion_detect_stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MotionDetectStage : public PostProcessingStage
float region_threshold;
int frame_period;
bool verbose;
std::string region_name;
} config_;
Stream *stream_;
unsigned lores_stride_;
Expand Down Expand Up @@ -87,6 +88,7 @@ void MotionDetectStage::Read(boost::property_tree::ptree const &params)
config_.region_threshold = params.get<float>("region_threshold", 0.005);
config_.frame_period = params.get<int>("frame_period", 5);
config_.verbose = params.get<int>("verbose", 0);
config_.region_name = params.get<std::string>("region_name", "");
}

void MotionDetectStage::Configure()
Expand Down Expand Up @@ -176,7 +178,7 @@ bool MotionDetectStage::Process(CompletedRequestPtr &completed_request)
}

if (config_.verbose && motion_detected != motion_detected_)
LOG(1, "Motion " << (motion_detected ? "detected" : "stopped"));
LOG(1, "Motion " << (motion_detected ? "detected" : "stopped") << (config_.region_name.empty() ? "" : " in region " + config_.region_name));

motion_detected_ = motion_detected;
completed_request->post_process_metadata.Set("motion_detect.result", motion_detected);
Expand Down

0 comments on commit 20d6b31

Please sign in to comment.