Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interface to frame_publisher for direct access to frame information #547

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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