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

[backport iron] enable autosize parameter in disparity view (#875) #898

Merged
merged 1 commit into from
Jan 19, 2024
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
1 change: 1 addition & 0 deletions image_view/include/image_view/disparity_view_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class DisparityViewNode
static unsigned char colormap[];

std::string window_name_;
bool autosize_;
rclcpp::Subscription<stereo_msgs::msg::DisparityImage>::SharedPtr sub_;
cv::Mat_<cv::Vec3b> disparity_color_;
bool initialized;
Expand Down
6 changes: 2 additions & 4 deletions image_view/src/disparity_view_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ DisparityViewNode::DisparityViewNode(const rclcpp::NodeOptions & options)

// Default window name is the resolved topic name
window_name_ = this->declare_parameter("window_name", topic);
// bool autosize = this->declare_parameter("autosize", false);

// cv::namedWindow(window_name_, autosize ? cv::WND_PROP_AUTOSIZE : 0);
autosize_ = this->declare_parameter("autosize", false);

sub_ = this->create_subscription<stereo_msgs::msg::DisparityImage>(
topic, rclcpp::QoS(10), std::bind(&DisparityViewNode::imageCb, this, std::placeholders::_1));
Expand Down Expand Up @@ -110,7 +108,7 @@ void DisparityViewNode::imageCb(const stereo_msgs::msg::DisparityImage::SharedPt
}

if (!initialized) {
cv::namedWindow(window_name_, false ? cv::WND_PROP_AUTOSIZE : 0);
cv::namedWindow(window_name_, autosize_ ? cv::WND_PROP_AUTOSIZE : 0);
initialized = true;
}

Expand Down
Loading