Skip to content

Commit

Permalink
Add interface to frame_publisher for direct access to frame informati…
Browse files Browse the repository at this point in the history
…on (#547)
  • Loading branch information
ymd-stella authored Dec 16, 2023
1 parent 30087cf commit 30850bb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/stella_vslam/publish/frame_publisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,32 @@ cv::Mat frame_publisher::draw_frame() {
return img;
}

tracker_state_t frame_publisher::get_tracking_state() {
std::lock_guard<std::mutex> lock(mtx_);
return tracking_state_;
}

std::vector<cv::KeyPoint> frame_publisher::get_keypoints() {
std::lock_guard<std::mutex> lock(mtx_);
return curr_keypts_;
}

bool frame_publisher::get_mapping_is_enabled() {
std::lock_guard<std::mutex> lock(mtx_);
return mapping_is_enabled_;
}

std::vector<std::shared_ptr<data::landmark>> frame_publisher::get_landmarks() {
std::lock_guard<std::mutex> 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<cv::KeyPoint>& curr_keypts,
const std::vector<std::shared_ptr<data::landmark>>& curr_lms,
const bool mapping_is_enabled,
Expand Down
10 changes: 10 additions & 0 deletions src/stella_vslam/publish/frame_publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ class frame_publisher {
*/
cv::Mat draw_frame();

tracker_state_t get_tracking_state();

std::vector<cv::KeyPoint> get_keypoints();

bool get_mapping_is_enabled();

std::vector<std::shared_ptr<data::landmark>> get_landmarks();

cv::Mat get_image();

protected:
unsigned int draw_tracked_points(cv::Mat& img, const std::vector<cv::KeyPoint>& curr_keypts,
const std::vector<std::shared_ptr<data::landmark>>& curr_lms,
Expand Down

0 comments on commit 30850bb

Please sign in to comment.