From 1fbe467ee778612bffa042ff367296be66c58ae6 Mon Sep 17 00:00:00 2001 From: Michael Ferguson Date: Fri, 19 Jan 2024 10:05:48 -0500 Subject: [PATCH] enable autosize parameter in disparity view (#875) appears to be bug left over from ROS 2 port --- image_view/include/image_view/disparity_view_node.hpp | 1 + image_view/src/disparity_view_node.cpp | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/image_view/include/image_view/disparity_view_node.hpp b/image_view/include/image_view/disparity_view_node.hpp index 6fb23cf91..d8ab8bc34 100644 --- a/image_view/include/image_view/disparity_view_node.hpp +++ b/image_view/include/image_view/disparity_view_node.hpp @@ -41,6 +41,7 @@ class DisparityViewNode static unsigned char colormap[]; std::string window_name_; + bool autosize_; rclcpp::Subscription::SharedPtr sub_; cv::Mat_ disparity_color_; bool initialized; diff --git a/image_view/src/disparity_view_node.cpp b/image_view/src/disparity_view_node.cpp index 440b91869..5c02b7e62 100644 --- a/image_view/src/disparity_view_node.cpp +++ b/image_view/src/disparity_view_node.cpp @@ -82,9 +82,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( topic, rclcpp::QoS(10), std::bind(&DisparityViewNode::imageCb, this, std::placeholders::_1)); @@ -114,7 +112,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; }