if( showsamples )
{
cvShowImage( "Sample", &sample );
- if( cvWaitKey( 0 ) == 27 )
+ if( (cvWaitKey( 0 ) & 0xFF) == 27 )
{
showsamples = 0;
}
if( showsamples )
{
cvShowImage( "Image", &cvbgreader->src );
- if( cvWaitKey( 0 ) == 27 )
+ if( (cvWaitKey( 0 ) & 0xFF) == 27 )
{
showsamples = 0;
}
if( showsamples )
{
cvShowImage( "Sample", sample );
- if( cvWaitKey( 0 ) == 27 )
+ if( (cvWaitKey( 0 ) & 0xFF) == 27 )
{
showsamples = 0;
}
icvGetTraininDataFromVec( sample, &file );
if( scale != 1.0 ) cvResize( sample, scaled_sample, CV_INTER_LINEAR);
cvShowImage( "Sample", scaled_sample );
- if( cvWaitKey( 0 ) == 27 ) break;
+ if( (cvWaitKey( 0 ) & 0xFF) == 27 ) break;
}
if( scaled_sample && scaled_sample != sample ) cvReleaseMat( &scaled_sample );
cvReleaseMat( &sample );
}
fclose( file.input );
}
-}
\ No newline at end of file
+}
for (std::vector<cv::Ptr<FrameProcessor> >::iterator it = processors.begin(); it != processors.end(); ++it)
processedFrame = (*it)->processFrame(processedFrame);
cv::imshow(mainWindowName, processedFrame);
- int key = cv::waitKey(CAP_DELAY);
+ char key = (char)cv::waitKey(CAP_DELAY);
if(key == 27) // esc
return Finished;
while( true )
{
/// 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
- Perform an infinite loop waiting for user input.
@snippet cpp/tutorial_code/ImgProc/Pyramids.cpp infinite_loop
+
Our program exits if the user presses *ESC*. Besides, it has two options:
- **Perform upsampling (after pressing 'u')**
img = render.getNextFrame()
cv2.imshow('img', img)
- ch = 0xFF & cv2.waitKey(3)
- if ch == 27:
+ ch = cv2.waitKey(3)
+ if ch == 27:
break
- cv2.destroyAllWindows()
\ No newline at end of file
+ cv2.destroyAllWindows()
for( k = 0; k < small_canvas.rows; k += 16 )
line(small_canvas, Point(0, k), Point(small_canvas.cols, k), Scalar(0,255,0), 1);
imshow("rectified", small_canvas);
- int c = waitKey(0);
+ char c = (char)waitKey(0);
if( c == 27 || c == 'q' || c == 'Q' )
break;
}
}
imshow("Image View", view);
- int key = 0xff & waitKey(capture.isOpened() ? 50 : 500);
+ char key = (char)waitKey(capture.isOpened() ? 50 : 500);
- if( (key & 255) == 27 )
+ if( key == 27 )
break;
if( key == 'u' && mode == CALIBRATED )
//undistort( view, rview, cameraMatrix, distCoeffs, cameraMatrix );
remap(view, rview, map1, map2, INTER_LINEAR);
imshow("Image View", rview);
- int c = 0xff & waitKey();
- if( (c & 255) == 27 || c == 'q' || c == 'Q' )
+ char c = (char)waitKey();
+ if( c == 27 || c == 'q' || c == 'Q' )
break;
}
}
for(;;)
{
- char key = (char) waitKey(0);
+ char key = (char)waitKey(0);
if(key == 'd' && flag3 == 0)
{
for(;;)
{
- char key;
int i, count = (unsigned)rng%100 + 1;
vector<Point> points;
imshow("hull", img);
- key = (char)waitKey();
+ char key = (char)waitKey();
if( key == 27 || key == 'q' || key == 'Q' ) // 'ESC'
break;
}
for (;;)
{
updateWindow("OpenGL");
- int key = waitKey(40);
- if ((key & 0xff) == 27)
+ char key = (char)waitKey(40);
+ if (key == 27)
break;
if (key == 0x20)
rotateEnable = !rotateEnable;
// Call to update the view
onTrackbar(0, 0);
- int c = waitKey(0) & 255;
+ char c = (char)waitKey(0);
if( c == 27 )
break;
}
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() )
{
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;
}
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';
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;
}
{
imshow("image", isColor ? image : gray);
- int c = waitKey(0);
- if( (c & 255) == 27 )
+ char c = (char)waitKey(0);
+ if( c == 27 )
{
cout << "Exiting ...\n";
break;
}
- switch( (char)c )
+ switch( c )
{
case 'c':
if( isColor )
for(;;)
{
- int c = waitKey(0);
- switch( (char) c )
+ char c = (char)waitKey(0);
+ switch( c )
{
case '\x1b':
cout << "Exiting ..." << endl;
convertScaleAbs(laplace, result, (sigma+1)*0.25);
imshow("Laplacian", result);
- int c = waitKey(30);
+ char c = (char)waitKey(30);
if( c == ' ' )
smoothType = smoothType == GAUSSIAN ? BLUR : smoothType == BLUR ? MEDIAN : GAUSSIAN;
- if( c == 'q' || c == 'Q' || (c & 255) == 27 )
+ if( c == 'q' || c == 'Q' || c == 27 )
break;
}
for(;;)
{
- int c;
-
OpenClose(open_close_pos, 0);
ErodeDilate(erode_dilate_pos, 0);
- c = waitKey(0);
+ char c = (char)waitKey(0);
- if( (char)c == 27 )
+ if( c == 27 )
break;
- if( (char)c == 'e' )
+ if( c == 'e' )
element_shape = MORPH_ELLIPSE;
- else if( (char)c == 'r' )
+ else if( c == 'r' )
element_shape = MORPH_RECT;
- else if( (char)c == 'c' )
+ else if( c == 'c' )
element_shape = MORPH_CROSS;
- else if( (char)c == ' ' )
+ else if( c == ' ' )
element_shape = (element_shape + 1) % 3;
}
// display until user presses q
imshow(winName, reconstruction);
- int key = 0;
+ char key = 0;
while(key != 'q')
- key = waitKey();
+ key = (char)waitKey();
return 0;
}
{
VideoCapture video(0);
Mat frame, curr, prev, curr64f, prev64f, hann;
- int key = 0;
+ char key;
do
{
}
imshow("phase shift", frame);
- key = waitKey(2);
+ key = (char)waitKey(2);
prev = curr.clone();
- } while((char)key != 27); // Esc to exit...
+ } while(key != 27); // Esc to exit...
return 0;
}
for(;;)
{
- uchar key = (uchar)waitKey();
+ char key = (char)waitKey();
if( key == 27 ) break;
refineSegments(tmp_frame, bgmask, out_frame);
imshow("video", tmp_frame);
imshow("segmented", out_frame);
- int keycode = waitKey(30);
+ char keycode = (char)waitKey(30);
if( keycode == 27 )
break;
if( keycode == ' ' )
imshow(windowname, shownFrame);
imshow(selWinName, selectedObjFrame);
- int c = waitKey(30);
- if( (c & 255) == 27 )
+ char c = (char)waitKey(30);
+ if( c == 27 )
{
nobjpt = 0;
}
imshow("View", shownFrame);
imshow("Selected Object", selectedObjFrame);
- int c = waitKey(imageList.empty() && !box.empty() ? 30 : 300);
+ char c = (char)waitKey(imageList.empty() && !box.empty() ? 30 : 300);
if( c == 'q' || c == 'Q' )
break;
if( c == '\r' || c == '\n' )
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;
}
findSquares(image, squares);
drawSquares(image, squares);
- int c = waitKey();
- if( (char)c == 27 )
+ char c = (char)waitKey();
+ if( c == 27 )
break;
}
//![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]
/// Wait until user finishes program
for(;;)
{
- int c;
- c = waitKey( 20 );
- if( (char)c == 27 )
+ char c = (char)waitKey( 20 );
+ if( c == 27 )
{ break; }
}
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())
// 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
HoughDetection(src_gray, src, cannyThreshold, accumulatorThreshold);
// get user key
- key = waitKey(10);
+ key = (char)waitKey(10);
}
return 0;
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
*/
int main( int, char** argv )
{
-
- int c;
-
//![load]
src = imread( argv[1], IMREAD_COLOR ); // Load an image
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]
int kernel_size;
const char* window_name = "filter2D Demo";
- int c;
-
//![load]
src = imread( argv[1], IMREAD_COLOR ); // Load an image
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]
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
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;
//-- 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;
}
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;
}
for(;;)
{
- char key = (char) waitKey(0);
+ char key = (char)waitKey(0);
if(key == 'd' && flag3 == 0)
{
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();
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;
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();
//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
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);
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);
imshow(WIN_RF, frameReference);
imshow(WIN_UT, frameUnderTest);
- c = (char)waitKey(delay);
+ char c = (char)waitKey(delay);
if (c == 27) break;
}
for(;;)
{
- int c = waitKey(0);
+ char c = (char)waitKey(0);
- if( (char)c == 27 )
+ if( c == 27 )
break;
- if( (char)c == 'r' )
+ if( c == 'r' )
{
markerMask = Scalar::all(0);
img0.copyTo(img);
imshow( "image", img );
}
- if( (char)c == 'w' || (char)c == ' ' )
+ if( c == 'w' || c == ' ' )
{
int i, j, compCount = 0;
vector<vector<Point> > contours;
if (!bgimg.empty())
imshow("mean background image", bgimg);
- int key = waitKey(30);
+ char key = (char)waitKey(30);
if (key == 27)
break;
}
for (;;)
{
updateWindow("OpenGL");
- int key = waitKey(40);
- if ((key & 0xff) == 27)
+ char key = (char)waitKey(40);
+ if (key == 27)
break;
}
cv2.imshow('camshift', vis)
- ch = 0xFF & cv2.waitKey(5)
+ ch = cv2.waitKey(5)
if ch == 27:
break
if ch == ord('b'):
cv2.imshow('src', src)
update()
while True:
- ch = 0xFF & cv2.waitKey()
+ ch = cv2.waitKey()
if ch == ord(' '):
update()
if ch == 27:
vis = hsv_map*h[:,:,np.newaxis] / 255.0
cv2.imshow('hist', vis)
- ch = 0xFF & cv2.waitKey(1)
+ ch = cv2.waitKey(1)
if ch == 27:
break
cv2.destroyAllWindows()
update(3)
cv2.createTrackbar( "levels+3", "contours", 3, 7, update )
cv2.imshow('image', img)
- 0xFF & cv2.waitKey()
+ cv2.waitKey()
cv2.destroyAllWindows()
update(None)
while True:
- ch = cv2.waitKey() & 0xFF
+ ch = cv2.waitKey()
if ch == 27:
break
if ch == ord(' '):
cv2.imshow('frame', frame)
cv2.imshow('bin', bin)
- ch = cv2.waitKey(1) & 0xFF
+ ch = cv2.waitKey(1)
if ch == 27:
break
while True:
- ch = 0xFF & cv2.waitKey(50)
+ ch = cv2.waitKey(50)
if ch == 27:
break
if ch == ord('v'):
vis = np.uint8(vis/2.)
vis[edge != 0] = (0, 255, 0)
cv2.imshow('edge', vis)
- ch = cv2.waitKey(5) & 0xFF
+ ch = cv2.waitKey(5)
if ch == 27:
break
cv2.destroyAllWindows()
draw_str(vis, (20, 20), 'time: %.1f ms' % (dt*1000))
cv2.imshow('facedetect', vis)
- if 0xFF & cv2.waitKey(5) == 27:
+ if cv2.waitKey(5) == 27:
break
cv2.destroyAllWindows()
cv2.createTrackbar('outlier %', 'fit line', 30, 100, update)
while True:
update()
- ch = cv2.waitKey(0) & 0xFF
+ ch = cv2.waitKey(0)
if ch == ord('f'):
if PY3:
cur_func_name = next(dist_func_names)
cv2.createTrackbar('hi', 'floodfill', 20, 255, update)
while True:
- ch = 0xFF & cv2.waitKey()
+ ch = cv2.waitKey()
if ch == 27:
break
if ch == ord('f'):
draw_gaussain(img, m, cov, (0, 0, 255))
cv2.imshow('gaussian mixture', img)
- ch = 0xFF & cv2.waitKey(0)
+ ch = cv2.waitKey(0)
if ch == 27:
break
cv2.destroyAllWindows()
cv2.imshow('output',output)
cv2.imshow('input',img)
- k = 0xFF & cv2.waitKey(1)
+ k = cv2.waitKey(1)
# key bindings
if k == 27: # esc to exit
cv2.imshow('image',im)
while True:
- k = cv2.waitKey(0)&0xFF
+ k = cv2.waitKey(0)
if k == ord('a'):
curve = hist_curve(im)
cv2.imshow('histogram',curve)
sketch = Sketcher('img', [img_mark, mark], lambda : ((255, 255, 255), 255))
while True:
- ch = 0xFF & cv2.waitKey()
+ ch = cv2.waitKey()
if ch == 27:
break
if ch == ord(' '):
if code != -1:
break
- if (code % 0x100) in [27, ord('q'), ord('Q')]:
+ if code in [27, ord('q'), ord('Q')]:
break
cv2.destroyWindow("Kalman")
cv2.circle(img, (x, y), 1, c, -1)
cv2.imshow('gaussian mixture', img)
- ch = 0xFF & cv2.waitKey(0)
+ ch = cv2.waitKey(0)
if ch == 27:
break
cv2.destroyAllWindows()
cv2.imshow('laplacian pyramid filter', res)
- if cv2.waitKey(1) & 0xFF == 27:
+ if cv2.waitKey(1) == 27:
break
cv2.imshow('lk_homography', vis)
- ch = 0xFF & cv2.waitKey(1)
+ ch = cv2.waitKey(1)
if ch == 27:
break
if ch == ord(' '):
self.prev_gray = frame_gray
cv2.imshow('lk_track', vis)
- ch = 0xFF & cv2.waitKey(1)
+ ch = cv2.waitKey(1)
if ch == 27:
break
cv2.createTrackbar('iters', 'morphology', 1, 10, update)
update()
while True:
- ch = 0xFF & cv2.waitKey()
+ ch = cv2.waitKey()
if ch == 27:
break
if ch == ord('1'):
self.rect_sel.draw(vis)
cv2.imshow('frame', vis)
- ch = cv2.waitKey(10) & 0xFF
+ ch = cv2.waitKey(10)
if ch == 27:
break
if ch == ord(' '):
drag_start = None
gray=cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imshow("gray",gray)
- if (cv2.waitKey() & 255) == 27:
+ if cv2.waitKey() == 27:
break
cv2.destroyAllWindows()
cv2.polylines(vis, hulls, 1, (0, 255, 0))
cv2.imshow('img', vis)
- if 0xFF & cv2.waitKey(5) == 27:
+ if cv2.waitKey(5) == 27:
break
cv2.destroyAllWindows()
cur_glitch = warp_flow(cur_glitch, flow)
cv2.imshow('glitch', cur_glitch)
- ch = 0xFF & cv2.waitKey(5)
+ ch = cv2.waitKey(5)
if ch == 27:
break
if ch == ord('1'):
draw_detections(img, found_filtered, 3)
print('%d (%d) found' % (len(found_filtered), len(found)))
cv2.imshow('img', img)
- ch = 0xFF & cv2.waitKey()
+ ch = cv2.waitKey()
if ch == 27:
break
cv2.destroyAllWindows()
self.rect_sel.draw(vis)
cv2.imshow('plane', vis)
- ch = cv2.waitKey(1) & 0xFF
+ ch = cv2.waitKey(1)
if ch == ord(' '):
self.paused = not self.paused
if ch == ord('c'):
self.rect_sel.draw(vis)
cv2.imshow('plane', vis)
- ch = cv2.waitKey(1) & 0xFF
+ ch = cv2.waitKey(1)
if ch == ord(' '):
self.paused = not self.paused
if ch == ord('c'):
squares = find_squares(img)
cv2.drawContours( img, squares, -1, (0, 255, 0), 3 )
cv2.imshow('squares', img)
- ch = 0xFF & cv2.waitKey()
+ ch = cv2.waitKey()
if ch == 27:
break
cv2.destroyAllWindows()
img = render.getNextFrame()
cv2.imshow('img', img)
- ch = 0xFF & cv2.waitKey(3)
+ ch = cv2.waitKey(3)
if ch == 27:
break
#import os
#print (os.environ['PYTHONPATH'])
- cv2.destroyAllWindows()
\ No newline at end of file
+ cv2.destroyAllWindows()
vis = a.copy()
draw_str(vis, (20, 20), 'frame %d' % frame_i)
cv2.imshow('a', vis)
- if 0xFF & cv2.waitKey(5) == 27:
+ if cv2.waitKey(5) == 27:
break
cv2.destroyAllWindows()
ret, img = cap.read()
imgs.append(img)
cv2.imshow('capture %d' % i, img)
- ch = 0xFF & cv2.waitKey(1)
+ ch = cv2.waitKey(1)
if ch == 27:
break
if ch == ord(' '):
else:
task = DummyTask(process_frame(frame, t))
pending.append(task)
- ch = 0xFF & cv2.waitKey(1)
+ ch = cv2.waitKey(1)
if ch == ord(' '):
threaded_mode = not threaded_mode
if ch == 27:
cv2.putText(img, "FPS: {}".format(fps), (15, 80), font, 1.0, color)
cv2.imshow("Video", img)
- k = 0xFF & cv2.waitKey(1)
+ k = cv2.waitKey(1)
if k == 27:
break
- elif k == ord("g"):
+ elif k == ord('g'):
convert_rgb = not convert_rgb
cap.set(cv2.CAP_PROP_CONVERT_RGB, convert_rgb)
def run(self):
while cv2.getWindowProperty('img', 0) != -1 or cv2.getWindowProperty('watershed', 0) != -1:
- ch = 0xFF & cv2.waitKey(50)
+ ch = cv2.waitKey(50)
if ch == 27:
break
if ch >= ord('1') and ch <= ord('7'):
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
{
detectAndDraw( frame, canvas, cascade, nestedCascade, scale, tryflip );
- int c = waitKey(10);
+ char c = (char)waitKey(10);
if( c == 27 || c == 'q' || c == 'Q' )
break;
}
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';
if( !image.empty() )
{
detectAndDraw( image, canvas, cascade, nestedCascade, scale, tryflip );
- c = waitKey(0);
+ char c = (char)waitKey(0);
if( c == 27 || c == 'q' || c == 'Q' )
break;
}