Merge pull request #7866 from alalek:update_waitKey
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -90,7 +90,7 @@ int main(int argc, char** argv)
|
||||
// infinite loop to display
|
||||
// and refresh the content of the output image
|
||||
// until the user presses q or Q
|
||||
int key = 0;
|
||||
char key = 0;
|
||||
while(key != 'q' && key != 'Q')
|
||||
{
|
||||
// those paramaters cannot be =0
|
||||
@@ -102,7 +102,7 @@ int main(int argc, char** argv)
|
||||
HoughDetection(src_gray, src, cannyThreshold, accumulatorThreshold);
|
||||
|
||||
// get user key
|
||||
key = waitKey(10);
|
||||
key = (char)waitKey(10);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -40,9 +40,9 @@ int main( int, char** argv )
|
||||
for(;;)
|
||||
{
|
||||
/// Each 1 sec. Press ESC to exit the program
|
||||
int c = waitKey( 1000 );
|
||||
char c = (char)waitKey( 1000 );
|
||||
|
||||
if( (char)c == 27 )
|
||||
if( c == 27 )
|
||||
{ break; }
|
||||
|
||||
/// Update map_x & map_y. Then apply remap
|
||||
|
||||
@@ -23,9 +23,6 @@ RNG rng(12345);
|
||||
*/
|
||||
int main( int, char** argv )
|
||||
{
|
||||
|
||||
int c;
|
||||
|
||||
//![load]
|
||||
src = imread( argv[1], IMREAD_COLOR ); // Load an image
|
||||
|
||||
@@ -59,13 +56,12 @@ int main( int, char** argv )
|
||||
for(;;)
|
||||
{
|
||||
//![check_keypress]
|
||||
c = waitKey(500);
|
||||
|
||||
if( (char)c == 27 )
|
||||
char c = (char)waitKey(500);
|
||||
if( c == 27 )
|
||||
{ break; }
|
||||
else if( (char)c == 'c' )
|
||||
else if( c == 'c' )
|
||||
{ borderType = BORDER_CONSTANT; }
|
||||
else if( (char)c == 'r' )
|
||||
else if( c == 'r' )
|
||||
{ borderType = BORDER_REPLICATE; }
|
||||
//![check_keypress]
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ int main ( int, char** argv )
|
||||
int kernel_size;
|
||||
const char* window_name = "filter2D Demo";
|
||||
|
||||
int c;
|
||||
|
||||
//![load]
|
||||
src = imread( argv[1], IMREAD_COLOR ); // Load an image
|
||||
|
||||
@@ -45,9 +43,9 @@ int main ( int, char** argv )
|
||||
int ind = 0;
|
||||
for(;;)
|
||||
{
|
||||
c = waitKey(500);
|
||||
char c = (char)waitKey(500);
|
||||
/// Press 'ESC' to exit the program
|
||||
if( (char)c == 27 )
|
||||
if( c == 27 )
|
||||
{ break; }
|
||||
|
||||
//![update_kernel]
|
||||
|
||||
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Mat frame, frame_vis;
|
||||
|
||||
while(cap.read(frame) && waitKey(30) != 27) // capture frame until ESC is pressed
|
||||
while(cap.read(frame) && (char)waitKey(30) != 27) // capture frame until ESC is pressed
|
||||
{
|
||||
|
||||
frame_vis = frame.clone(); // refresh visualisation frame
|
||||
|
||||
@@ -195,7 +195,7 @@ int main(int argc, char **argv)
|
||||
drawStatistics(orb_res, orb_draw_stats);
|
||||
vconcat(akaze_res, orb_res, res_frame);
|
||||
cv::imshow(video_name, res_frame);
|
||||
if(cv::waitKey(1)==27) break; //quit on ESC button
|
||||
if(waitKey(1)==27) break; //quit on ESC button
|
||||
}
|
||||
akaze_stats /= i - 1;
|
||||
orb_stats /= i - 1;
|
||||
|
||||
@@ -44,8 +44,8 @@ int main( void )
|
||||
//-- 3. Apply the classifier to the frame
|
||||
detectAndDisplay( frame );
|
||||
|
||||
int c = waitKey(10);
|
||||
if( (char)c == 27 ) { break; } // escape
|
||||
char c = (char)waitKey(10);
|
||||
if( c == 27 ) { break; } // escape
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ int main( void )
|
||||
detectAndDisplay( frame );
|
||||
|
||||
//-- bail out if escape was pressed
|
||||
int c = waitKey(10);
|
||||
if( (char)c == 27 ) { break; }
|
||||
char c = (char)waitKey(10);
|
||||
if( c == 27 ) { break; }
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ int main()
|
||||
|
||||
for(;;)
|
||||
{
|
||||
char key = (char) waitKey(0);
|
||||
char key = (char)waitKey(0);
|
||||
|
||||
if(key == 'd' && flag3 == 0)
|
||||
{
|
||||
|
||||
@@ -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 = (char)waitKey( 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 = (char)waitKey( 30 );
|
||||
//search for the next image in the sequence
|
||||
ostringstream oss;
|
||||
oss << (frameNumber + 1);
|
||||
|
||||
@@ -44,7 +44,6 @@ int main(int argc, char *argv[])
|
||||
conv << argv[3] << endl << argv[4]; // put in the strings
|
||||
conv >> psnrTriggerValue >> delay; // take out the numbers
|
||||
|
||||
char c;
|
||||
int frameNum = -1; // Frame counter
|
||||
|
||||
VideoCapture captRefrnc(sourceReference), captUndTst(sourceCompareWith);
|
||||
@@ -126,7 +125,7 @@ int main(int argc, char *argv[])
|
||||
imshow(WIN_RF, frameReference);
|
||||
imshow(WIN_UT, frameUnderTest);
|
||||
|
||||
c = (char)waitKey(delay);
|
||||
char c = (char)waitKey(delay);
|
||||
if (c == 27) break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user