Question

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);
    .
    .
    .
}

enter image description here

Était-ce utile?

La solution

you need to call waitKey(some_millis); somewhere after imshow(), else your window won't get updated.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top