From 30850bb7648576a5d032988bc14dcf87536c55b5 Mon Sep 17 00:00:00 2001 From: ymd-stella <7959916+ymd-stella@users.noreply.github.com> Date: Sun, 17 Dec 2023 08:29:50 +0900 Subject: [PATCH] Add interface to frame_publisher for direct access to frame information (#547) --- src/stella_vslam/publish/frame_publisher.cc | 26 +++++++++++++++++++++ src/stella_vslam/publish/frame_publisher.h | 10 ++++++++ 2 files changed, 36 insertions(+) diff --git a/src/stella_vslam/publish/frame_publisher.cc b/src/stella_vslam/publish/frame_publisher.cc index 0e9e37336..ed081ac67 100644 --- a/src/stella_vslam/publish/frame_publisher.cc +++ b/src/stella_vslam/publish/frame_publisher.cc @@ -73,6 +73,32 @@ cv::Mat frame_publisher::draw_frame() { return img; } +tracker_state_t frame_publisher::get_tracking_state() { + std::lock_guard lock(mtx_); + return tracking_state_; +} + +std::vector frame_publisher::get_keypoints() { + std::lock_guard lock(mtx_); + return curr_keypts_; +} + +bool frame_publisher::get_mapping_is_enabled() { + std::lock_guard lock(mtx_); + return mapping_is_enabled_; +} + +std::vector> frame_publisher::get_landmarks() { + std::lock_guard lock(mtx_); + return curr_lms_; +} + +cv::Mat frame_publisher::get_image() { + cv::Mat img; + img_.copyTo(img); + return img; +} + unsigned int frame_publisher::draw_tracked_points(cv::Mat& img, const std::vector& curr_keypts, const std::vector>& curr_lms, const bool mapping_is_enabled, diff --git a/src/stella_vslam/publish/frame_publisher.h b/src/stella_vslam/publish/frame_publisher.h index 9ab8c103d..429323d6e 100644 --- a/src/stella_vslam/publish/frame_publisher.h +++ b/src/stella_vslam/publish/frame_publisher.h @@ -51,6 +51,16 @@ class frame_publisher { */ cv::Mat draw_frame(); + tracker_state_t get_tracking_state(); + + std::vector get_keypoints(); + + bool get_mapping_is_enabled(); + + std::vector> get_landmarks(); + + cv::Mat get_image(); + protected: unsigned int draw_tracked_points(cv::Mat& img, const std::vector& curr_keypts, const std::vector>& curr_lms,