Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I wrote code for mousecallback function.
C++
while(1)  
{  
    myShowImageScroll("Image", image, width, height);  
    int KEY = cvWaitKey(10);  
    if( (char) KEY == 27 ) 
    {
        cvWaitKey();
        break;
    }
}

Here how can I stop the program without using virtual keys.
Posted
Updated 10-Jul-11 23:35pm
v2

I'm not familiar with OpenCV, but wouldn't cvWaitKey() only react to events from your keyboard? If this is mouse callback code, why then do you query the keyboard?

Not to mention that you never should call functions that rely on events inside an event handler (if this is one) - you'd be provoking deadlocks! I'd expect that any information required to resolve event handling would be passed as parameters to the event handler function. Is this not the case for your mouse callback? If so, what are you missing?
 
Share this answer
 
Actually, I need to stop the program without using ESC key.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900