ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

mtbrobotanist's profile - activity

2021-09-28 09:55:16 -0500 received badge  Great Answer (source)
2020-01-10 03:24:54 -0500 received badge  Good Answer (source)
2018-04-19 03:54:16 -0500 received badge  Nice Answer (source)
2017-04-06 22:24:57 -0500 received badge  Necromancer (source)
2017-04-06 22:24:57 -0500 received badge  Teacher (source)
2016-09-29 15:23:46 -0500 received badge  Enthusiast
2016-09-27 19:01:42 -0500 answered a question cmake error, poco was not found, Raspberry Pi, ROS Indigo

sudo apt-get install libpoco-dev

2016-03-20 20:52:30 -0500 commented answer image_view stereo_view do not show image or disparity
2016-03-20 20:02:16 -0500 answered a question image_view stereo_view do not show image or disparity

I'm running the same setup.

The problem is inside imageCB() method in stereo_view.cpp.

image_mutex_.unlock() was being called before imshow() for the left, right and disparity images.

image_mutex_.unlock();
if (!last_left_image_.empty())
  cv::imshow("left", last_left_image_);
if (!last_right_image_.empty())
  cv::imshow("right", last_right_image_);
cv::imshow("disparity", disparity_color_);

the location of image_mutex_.unlock(); is causing the window threads to lock up.

change the above to this:

if (!last_left_image_.empty())){
  cv::imshow("left", last_left_image_);
  cv::waitKey(1);
}
if (!last_right_image_.empty()){
  cv::imshow("right", last_right_image_);
  cv::waitKey(1);
}
cv::imshow("disparity", disparity_color_);
cv::waitKey(1);   

image_mutex_.unlock();

moving the unlock() command below the Mat checks and adding cv::waitKey(1) for each cv::imshow() solved it for me.

You'll have to download the source code from https://github.com/ros-perception/image_pipeline.git and compile it yourself. look in image_view/src/stereo_view.cpp for the image call back.

Hope this helps