How to create a thread ?
http://msdn.microsoft.com/en-us/library/ms682453(v=vs.85).aspx
http://stackoverflow.com/questions/2050369/display-image-in-second-thread-opencv
main() {
DispThreadHasFinished=FALSE;
MainThreadHasFinished=FALSE;
CreateThread(..,..,Thread,..);
while(IsTheUserDone()){
myImg=AcquireFrame();
DoProcessing();
TakeAction();
}
MainThreadHasFinished=TRUE;
while (!DisplayThreadHasFinished){
CvWaitKey(100);
}
return;
}
/** Thread that displays image at ~30fps **/
Thread(){
while (!MainThreadHasFinished) {
cvShowImage(myImage);
cvWaitKey(30);
}
DispThreadHasFinished=TRUE;
return;
}
No comments:
Post a Comment