From 1c95d9b5534f5c711a155236a55668962b85ac4e Mon Sep 17 00:00:00 2001 From: jcasals <jcasals@iri.upc.edu> Date: Thu, 18 Jul 2019 08:43:22 +0200 Subject: [PATCH] Added storeKeyFrame() storeCapture() --- include/core/processor/processor_base.h | 12 ++++++++++++ src/processor/processor_base.cpp | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h index 3e555eb2e..19a5709d3 100644 --- a/include/core/processor/processor_base.h +++ b/include/core/processor/processor_base.h @@ -249,6 +249,18 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce */ virtual bool triggerInKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance) = 0; + /** \brief store key frame + * + * Returns true if the key frame should be stored + */ + virtual bool storeKeyFrame(FrameBasePtr) = 0; + + /** \brief store capture + * + * Returns true if the capture should be stored + */ + virtual bool storeCapture(CaptureBasePtr) = 0; + /** \brief Vote for KeyFrame generation * * If a KeyFrame criterion is validated, this function returns true, diff --git a/src/processor/processor_base.cpp b/src/processor/processor_base.cpp index 4d9e93702..3276f3335 100644 --- a/src/processor/processor_base.cpp +++ b/src/processor/processor_base.cpp @@ -36,8 +36,10 @@ void ProcessorBase::keyFrameCallback(FrameBasePtr _keyframe_ptr, const Scalar& _ WOLF_DEBUG("P", isMotion() ? "M " : "T ", getName(), ": KF", _keyframe_ptr->id(), " callback received with ts = ", _keyframe_ptr->getTimeStamp()); assert(_keyframe_ptr != nullptr && "keyFrameCallback with a nullptr frame"); - // buffering anyway - buffer_pack_kf_.add(_keyframe_ptr, _time_tol_other); + + // asking if key frame should be stored + if (storeKeyFrame(_keyframe_ptr)) + buffer_pack_kf_.add(_keyframe_ptr, _time_tol_other); // if trigger true -> processKeyFrame if (triggerInKeyFrame(_keyframe_ptr, _time_tol_other)) @@ -53,7 +55,8 @@ void ProcessorBase::captureCallback(CaptureBasePtr _capture_ptr) // if trigger, process directly without buffering if (triggerInCapture(_capture_ptr)) processCapture(_capture_ptr); - else + // asking if capture should be stored + if (storeCapture(_capture_ptr)) buffer_capture_.add(_capture_ptr->getTimeStamp(), _capture_ptr); } -- GitLab