update samples: waitKey() usage
Original commit is a5f19f7dd6ae5bc93f73e0417a9e0bfd34c01672
This commit is contained in:
committed by
Alexander Alekhin
parent
4e7b521438
commit
6d34d6b47e
@@ -45,26 +45,22 @@ int main( void )
|
||||
//![infinite_loop]
|
||||
for(;;)
|
||||
{
|
||||
int c;
|
||||
c = waitKey(0);
|
||||
char c = (char)waitKey(0);
|
||||
|
||||
if( (char)c == 27 )
|
||||
if( c == 27 )
|
||||
{ break; }
|
||||
if( (char)c == 'u' )
|
||||
{
|
||||
//![pyrup]
|
||||
pyrUp( tmp, dst, Size( tmp.cols*2, tmp.rows*2 ) );
|
||||
//![pyrup]
|
||||
//![pyrup]
|
||||
if( c == 'u' )
|
||||
{ pyrUp( tmp, dst, Size( tmp.cols*2, tmp.rows*2 ) );
|
||||
printf( "** Zoom In: Image x 2 \n" );
|
||||
}
|
||||
else if( (char)c == 'd' )
|
||||
{
|
||||
//![pyrdown]
|
||||
pyrDown( tmp, dst, Size( tmp.cols/2, tmp.rows/2 ) );
|
||||
//![pyrdown]
|
||||
//![pyrup]
|
||||
//![pyrdown]
|
||||
else if( c == 'd' )
|
||||
{ pyrDown( tmp, dst, Size( tmp.cols/2, tmp.rows/2 ) );
|
||||
printf( "** Zoom Out: Image / 2 \n" );
|
||||
}
|
||||
|
||||
//![pyrdown]
|
||||
imshow( window_name, dst );
|
||||
|
||||
//![update_tmp]
|
||||
|
||||
@@ -60,9 +60,8 @@ int main( int, char** argv )
|
||||
/// Wait until user finishes program
|
||||
for(;;)
|
||||
{
|
||||
int c;
|
||||
c = waitKey( 20 );
|
||||
if( (char)c == 27 )
|
||||
char c = (char)waitKey( 20 );
|
||||
if( c == 27 )
|
||||
{ break; }
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ int main()
|
||||
createTrackbar("Low B","Object Detection", &low_b, 255, on_low_b_thresh_trackbar);
|
||||
createTrackbar("High B","Object Detection", &high_b, 255, on_high_b_thresh_trackbar);
|
||||
//! [trackbar]
|
||||
while(char(waitKey(1))!='q'){
|
||||
while((char)waitKey(1)!='q'){
|
||||
//! [while]
|
||||
cap>>frame;
|
||||
if(frame.empty())
|
||||
|
||||
Reference in New Issue
Block a user