cv::imshow黑窗口不显示图片

cv::imshow(“view”, cv_bridge::toCvShare(msg, “bgr8”)->image);
cv::waitKey(30);

原因是需要给时间 去显示图片

官方说明如下:

A common mistake for opencv newcomers is to call cv::imshow() in a loop through video frames, without following up each draw with cv::waitKey(30). In this case, nothing appears on screen, because highgui is never given time to process the draw requests from cv::imshow().

你可能感兴趣的:(Opencv)