diff --git a/get_points.py b/get_points.py index a825d44..be5ed4f 100644 --- a/get_points.py +++ b/get_points.py @@ -49,7 +49,7 @@ def callback(event, x, y, flags, param): # Display the cropped images cv2.namedWindow(window_name_2, cv2.WINDOW_NORMAL) cv2.imshow(window_name_2, im_disp) - key = cv2.waitKey(30) + key = (0xFF & cv2.waitKey(30)) if key == ord('p'): # Press key `s` to return the selected points cv2.destroyAllWindows() diff --git a/object-tracker-multiple.py b/object-tracker-multiple.py index f86bd03..1854cd3 100644 --- a/object-tracker-multiple.py +++ b/object-tracker-multiple.py @@ -20,7 +20,7 @@ def run(source=0, dispLoc=False): if not retval: print "Cannot capture frame device" exit() - if(cv2.waitKey(10)==ord('p')): + if(0xFF & cv2.waitKey(10))==ord('p'): break cv2.namedWindow("Image", cv2.WINDOW_NORMAL) cv2.imshow("Image", img) @@ -66,7 +66,7 @@ def run(source=0, dispLoc=False): cv2.namedWindow("Image", cv2.WINDOW_NORMAL) cv2.imshow("Image", img) # Continue until the user presses ESC key - if cv2.waitKey(1) == 27: + if (0xFF & cv2.waitKey(1)) == 27: break # Relase the VideoCapture object diff --git a/object-tracker-single.py b/object-tracker-single.py index c29d7aa..3824611 100644 --- a/object-tracker-single.py +++ b/object-tracker-single.py @@ -20,7 +20,7 @@ def run(source=0, dispLoc=False): if not retval: print "Cannot capture frame device" exit() - if(cv2.waitKey(10)==ord('p')): + if(0xFF & cv2.waitKey(10))==ord('p'): break cv2.namedWindow("Image", cv2.WINDOW_NORMAL) cv2.imshow("Image", img) @@ -65,7 +65,7 @@ def run(source=0, dispLoc=False): cv2.namedWindow("Image", cv2.WINDOW_NORMAL) cv2.imshow("Image", img) # Continue until the user presses ESC key - if cv2.waitKey(1) == 27: + if (0xFF & cv2.waitKey(1)) == 27: break # Relase the VideoCapture object