Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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