OpenCV namedWindow hangs when ROS ImageTransport is included
Hi everybody,
I have a problem with cv::namedWindow never returning when specific files are included in a project. I'm using OpenCV 2.4.10.
Minimal example that compiles and opens a window correctly:
main.cpp
#include <opencv/highgui.h>
int main( int argc, char** argv )
{
cv::namedWindow( "window", CV_WINDOW_NORMAL|CV_GUI_NORMAL );
cv::waitKey(0);
return 0;
}
Additional files that causes the program to hang at cv::namedWindow:
grapper.h
#include <image_transport/subscriber_filter.h>
class Grabber {
public:
Grabber(ros::NodeHandle n);
image_transport::ImageTransport it_;
};
grapper.cpp
#include "grapper.hpp"
Grabber(ros::NodeHandle n)
: it_(n)
{
}
The program hangs at namedWindow when grapper.cpp is compiled into the project, even though it is not used or referenced from main.cpp.
Does anyone have any idea on what's wrong and/or how to debug it? I would apreciate any help.
I'm having the exact same problem. I don't suppose you solved it? It is so odd that the problem occurs even if the files aren't included and used. I did notice, at least with my program, that if you run it several times, occasionally it will work and the window pops up. It only works like that maybe 1 out of 10 though.