mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
added 0xFF & in front of every waitKey so that it works on linux
This commit is contained in:
parent
ade7394e77
commit
9164ccbaaf
@ -101,7 +101,7 @@ class App(object):
|
||||
|
||||
cv2.imshow('camshift', vis)
|
||||
|
||||
ch = cv2.waitKey(5)
|
||||
ch = 0xFF & cv2.waitKey(5)
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord('b'):
|
||||
|
@ -65,7 +65,7 @@ if __name__ == '__main__':
|
||||
cv2.imshow('src', src)
|
||||
update()
|
||||
while True:
|
||||
ch = cv2.waitKey()
|
||||
ch = 0xFF & cv2.waitKey()
|
||||
if ch == ord(' '):
|
||||
update()
|
||||
if ch == 27:
|
||||
|
@ -42,6 +42,6 @@ if __name__ == '__main__':
|
||||
vis = hsv_map*h[:,:,np.newaxis] / 255.0
|
||||
cv2.imshow('hist', vis)
|
||||
|
||||
ch = cv2.waitKey(1)
|
||||
ch = 0xFF & cv2.waitKey(1)
|
||||
if ch == 27:
|
||||
break
|
||||
|
@ -45,4 +45,4 @@ if __name__ == '__main__':
|
||||
update(3)
|
||||
cv2.createTrackbar( "levels+3", "contours", 3, 7, update )
|
||||
cv2.imshow('image', img)
|
||||
cv2.waitKey()
|
||||
0xFF & cv2.waitKey()
|
||||
|
@ -44,7 +44,7 @@ if __name__ == '__main__':
|
||||
|
||||
|
||||
while True:
|
||||
ch = cv2.waitKey(50)
|
||||
ch = 0xFF & cv2.waitKey(50)
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord('v'):
|
||||
|
@ -54,6 +54,6 @@ if __name__ == '__main__':
|
||||
draw_str(vis, (20, 20), 'time: %.1f ms' % (dt*1000))
|
||||
cv2.imshow('facedetect', vis)
|
||||
|
||||
if cv2.waitKey(5) == 27:
|
||||
if 0xFF & cv2.waitKey(5) == 27:
|
||||
break
|
||||
|
||||
|
@ -85,7 +85,7 @@ if __name__ == '__main__':
|
||||
draw_str(vis, (20, 40), 'matched: %d ( %d outliers )' % (match_n, match_n-inlier_n))
|
||||
|
||||
cv2.imshow('img', vis)
|
||||
ch = cv2.waitKey(1)
|
||||
ch = 0xFF & cv2.waitKey(1)
|
||||
if ch == ord(' '):
|
||||
matcher.clear()
|
||||
matcher.add([desc])
|
||||
|
@ -99,4 +99,4 @@ if __name__ == '__main__':
|
||||
# neighbours, so r_threshold is decreased
|
||||
cv2.imshow('find_obj SURF', vis_brute)
|
||||
cv2.imshow('find_obj SURF flann', vis_flann)
|
||||
cv2.waitKey()
|
||||
0xFF & cv2.waitKey()
|
||||
|
@ -51,7 +51,7 @@ if __name__ == '__main__':
|
||||
cv2.createTrackbar('hi', 'floodfill', 20, 255, update)
|
||||
|
||||
while True:
|
||||
ch = cv2.waitKey()
|
||||
ch = 0xFF & cv2.waitKey()
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord('f'):
|
||||
|
@ -51,6 +51,6 @@ if __name__ == '__main__':
|
||||
draw_gaussain(img, m, cov, (0, 0, 255))
|
||||
|
||||
cv2.imshow('gaussian mixture', img)
|
||||
ch = cv2.waitKey(0)
|
||||
ch = 0xFF & cv2.waitKey(0)
|
||||
if ch == 27:
|
||||
break
|
||||
|
@ -22,7 +22,7 @@ if __name__ == '__main__':
|
||||
sketch = Sketcher('img', [img_mark, mark], lambda : ((255, 255, 255), 255))
|
||||
|
||||
while True:
|
||||
ch = cv2.waitKey()
|
||||
ch = 0xFF & cv2.waitKey()
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord(' '):
|
||||
|
@ -85,7 +85,7 @@ class App:
|
||||
|
||||
cv2.imshow('lk_homography', vis)
|
||||
|
||||
ch = cv2.waitKey(1)
|
||||
ch = 0xFF & cv2.waitKey(1)
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord(' '):
|
||||
|
@ -81,7 +81,7 @@ class App:
|
||||
self.prev_gray = frame_gray
|
||||
cv2.imshow('lk_track', vis)
|
||||
|
||||
ch = cv2.waitKey(1)
|
||||
ch = 0xFF & cv2.waitKey(1)
|
||||
if ch == 27:
|
||||
break
|
||||
|
||||
|
@ -48,7 +48,7 @@ if __name__ == '__main__':
|
||||
print " 2 - change structure element shape"
|
||||
print
|
||||
while True:
|
||||
ch = cv2.waitKey()
|
||||
ch = 0xFF & cv2.waitKey()
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord('1'):
|
||||
|
@ -76,5 +76,5 @@ if __name__ == '__main__':
|
||||
cv2.imshow('motempl', vis)
|
||||
|
||||
prev_frame = frame.copy()
|
||||
if cv2.waitKey(5) == 27:
|
||||
break
|
||||
if 0xFF & cv2.waitKey(5) == 27:
|
||||
break
|
||||
|
@ -33,5 +33,5 @@ if __name__ == '__main__':
|
||||
cv2.polylines(vis, hulls, 1, (0, 255, 0))
|
||||
|
||||
cv2.imshow('img', vis)
|
||||
if cv2.waitKey(5) == 27:
|
||||
break
|
||||
if 0xFF & cv2.waitKey(5) == 27:
|
||||
break
|
||||
|
@ -69,7 +69,7 @@ if __name__ == '__main__':
|
||||
cur_glitch = warp_flow(cur_glitch, flow)
|
||||
cv2.imshow('glitch', cur_glitch)
|
||||
|
||||
ch = cv2.waitKey(5)
|
||||
ch = 0xFF & cv2.waitKey(5)
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord('1'):
|
||||
|
@ -50,6 +50,6 @@ if __name__ == '__main__':
|
||||
draw_detections(img, found_filtered, 3)
|
||||
print '%d (%d) found' % (len(found_filtered), len(found))
|
||||
cv2.imshow('img', img)
|
||||
ch = cv2.waitKey()
|
||||
ch = 0xFF & cv2.waitKey()
|
||||
if ch == 27:
|
||||
break
|
||||
|
@ -34,6 +34,6 @@ if __name__ == '__main__':
|
||||
squares = find_squares(img)
|
||||
cv2.drawContours( img, squares, -1, (0, 255, 0), 3 )
|
||||
cv2.imshow('squares', img)
|
||||
ch = cv2.waitKey()
|
||||
ch = 0xFF & cv2.waitKey()
|
||||
if ch == 27:
|
||||
break
|
||||
break
|
||||
|
@ -60,5 +60,5 @@ if __name__ == '__main__':
|
||||
vis = a.copy()
|
||||
draw_str(vis, (20, 20), 'frame %d' % frame_i)
|
||||
cv2.imshow('a', vis)
|
||||
if cv2.waitKey(5) == 27:
|
||||
if 0xFF & cv2.waitKey(5) == 27:
|
||||
break
|
||||
|
@ -156,7 +156,7 @@ if __name__ == '__main__':
|
||||
ret, img = cap.read()
|
||||
imgs.append(img)
|
||||
cv2.imshow('capture %d' % i, img)
|
||||
ch = cv2.waitKey(1)
|
||||
ch = 0xFF & cv2.waitKey(1)
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord(' '):
|
||||
|
@ -37,7 +37,7 @@ class App:
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
ch = cv2.waitKey(50)
|
||||
ch = 0xFF & cv2.waitKey(50)
|
||||
if ch == 27:
|
||||
break
|
||||
if ch >= ord('1') and ch <= ord('7'):
|
||||
|
Loading…
Reference in New Issue
Block a user