cv::imshow runtime error: "QObject::startTimer: Timers cannot be started from another thread"
I am using set of nodelets, and running them from one launch file. When I load them as standalone nodelets, I don't see any issue. but when I load them by one manager, I encountered an issue with cv::imshow function. my launch file:
<launch>
<node pkg="nodelet" type="nodelet" name="manager_nodelet" args="manager"/>
<node pkg="nodelet" type="nodelet" name="my_camera" args="standalone my_camera/NodeletCamera" output="screen"/>
<node pkg="nodelet" type="nodelet" name="my_nodelet1" args="load my_proj/SNodelet1 manager_nodelet" output="screen"/>
<node pkg="nodelet" type="nodelet" name="my_nodelet2" args="load my_proj/SNodelet2 manager_nodelet" output="screen" />
<node pkg="nodelet" type="nodelet" name="my_viewer" args="load my_proj/SNodeletViewer manager_nodelet"/>
<node pkg="nodelet" type="nodelet" name="my_sample" args="load my_proj/SNodeletSample manager_nodelet"/>
</launch>
The error I get is: "QObject::startTimer: Timers cannot be started from another thread"
I have a call to cv::imshow in a function gui.cpp file:
void GUI::showResult()
{
cv::namedWindow(m_name,cv::WINDOW_AUTOSIZE);
cv::imshow(m_window_name, m_img);
}
SNodeletViewer calls this function. I get the error after several calls to this function. when I get the error - the cpu usage is over then 100%. If I remove the calling to cv::namedWindow and cv::imshow - all works well.
any idea what can be the issue with calling cv::imshow from nodelet that loaded by nodelet manager? and what is the solution?
Thanks!