@ -23,7 +23,7 @@ using namespace std;
Mat frame ; //current frame
Mat fgMaskMOG2 ; //fg mask fg mask generated by MOG2 method
Ptr < BackgroundSubtractor > pMOG2 ; //MOG2 Background subtractor
int keyboard ; //input from keyboard
char keyboard ; //input from keyboard
/** Function Headers */
void help ( ) ;
@ -98,7 +98,8 @@ void processVideo(char* videoFilename) {
exit ( EXIT_FAILURE ) ;
}
//read input data. ESC or 'q' for quitting
while ( ( char ) keyboard ! = ' q ' & & ( char ) keyboard ! = 27 ) {
keyboard = 0 ;
while ( keyboard ! = ' q ' & & keyboard ! = 27 ) {
//read the current frame
if ( ! capture . read ( frame ) ) {
cerr < < " Unable to read next frame. " < < endl ;
@ -119,7 +120,7 @@ void processVideo(char* videoFilename) {
imshow ( " Frame " , frame ) ;
imshow ( " FG Mask MOG 2 " , fgMaskMOG2 ) ;
//get the input from the keyboard
keyboard = waitKey ( 30 ) ;
keyboard = waitChar ( 30 ) ;
}
//delete capture object
capture . release ( ) ;
@ -139,7 +140,8 @@ void processImages(char* fistFrameFilename) {
//current image filename
string fn ( fistFrameFilename ) ;
//read input data. ESC or 'q' for quitting
while ( ( char ) keyboard ! = ' q ' & & ( char ) keyboard ! = 27 ) {
keyboard = 0 ;
while ( keyboard ! = ' q ' & & keyboard ! = 27 ) {
//update the background model
pMOG2 - > apply ( frame , fgMaskMOG2 ) ;
//get the frame number and write it on the current frame
@ -162,7 +164,7 @@ void processImages(char* fistFrameFilename) {
imshow ( " Frame " , frame ) ;
imshow ( " FG Mask MOG 2 " , fgMaskMOG2 ) ;
//get the input from the keyboard
keyboard = waitKey ( 30 ) ;
keyboard = waitChar ( 30 ) ;
//search for the next image in the sequence
ostringstream oss ;
oss < < ( frameNumber + 1 ) ;