you need to call waitKey(some_millis); somewhere after imshow(), else your window won't get updated.
imshow window freeze in opencv
-
15-06-2023 - |
题
I'm doing opencv with leap motion. when I try to create a window with black screen but the window freezes and not respond. anyone have this problem? this is my code.
Mat PaintShow( 480,640,CV_8UC3);
int main(int argc, char* argv[])
{
rectangle( PaintShow,Point( 0, 0),Point( 2000, 2000),Scalar( 0, 0, 0 ),-1,8 );
// Create a sample listener and controller
SampleListener listener;
Leap::Controller controller;
.
.
.
}
the following is the leap motion method which update every few ms. so I put imshow here
void SampleListener::onFrame(const Leap::Controller& controller)
{
const Leap::Frame frame = controller.frame();
imshow("PaintShow",PaintShow);
.
.
.
}
解决方案
不隶属于 StackOverflow