update samples: waitKey() usage
Original commit is a5f19f7dd6ae5bc93f73e0417a9e0bfd34c01672
This commit is contained in:
committed by
Alexander Alekhin
parent
4e7b521438
commit
6d34d6b47e
@@ -72,9 +72,9 @@ int main( int argc, const char** argv )
|
||||
}
|
||||
if( inputName.empty() || (isdigit(inputName[0]) && inputName.size() == 1) )
|
||||
{
|
||||
int c = inputName.empty() ? 0 : inputName[0] - '0';
|
||||
if(!capture.open(c))
|
||||
cout << "Capture from camera #" << c << " didn't work" << endl;
|
||||
int camera = inputName.empty() ? 0 : inputName[0] - '0';
|
||||
if(!capture.open(camera))
|
||||
cout << "Capture from camera #" << camera << " didn't work" << endl;
|
||||
}
|
||||
else if( inputName.size() )
|
||||
{
|
||||
@@ -104,7 +104,7 @@ int main( int argc, const char** argv )
|
||||
Mat frame1 = frame.clone();
|
||||
detectAndDraw( frame1, cascade, nestedCascade, scale, tryflip );
|
||||
|
||||
int c = waitKey(10);
|
||||
char c = (char)waitKey(10);
|
||||
if( c == 27 || c == 'q' || c == 'Q' )
|
||||
break;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ int main( int argc, const char** argv )
|
||||
char buf[1000+1];
|
||||
while( fgets( buf, 1000, f ) )
|
||||
{
|
||||
int len = (int)strlen(buf), c;
|
||||
int len = (int)strlen(buf);
|
||||
while( len > 0 && isspace(buf[len-1]) )
|
||||
len--;
|
||||
buf[len] = '\0';
|
||||
@@ -136,7 +136,7 @@ int main( int argc, const char** argv )
|
||||
if( !image.empty() )
|
||||
{
|
||||
detectAndDraw( image, cascade, nestedCascade, scale, tryflip );
|
||||
c = waitKey(0);
|
||||
char c = (char)waitKey(0);
|
||||
if( c == 27 || c == 'q' || c == 'Q' )
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user