From 3992dda41cbeb110ad225abc77f30a2ea38ac1f5 Mon Sep 17 00:00:00 2001 From: Viraj Mavani Date: Tue, 17 Apr 2018 14:45:32 +0530 Subject: [PATCH 1/3] solved "can not work by 'p' and 'esc' key #4" --- object-tracker-multiple.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From c3f6ba32b8e982e3797750054cb86e571381e922 Mon Sep 17 00:00:00 2001 From: Viraj Mavani Date: Tue, 17 Apr 2018 14:47:05 +0530 Subject: [PATCH 2/3] solved "can not work by 'p' and 'esc' key #4" --- object-tracker-single.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 4965d707457ffe6eb202964ae4309e5326315ad4 Mon Sep 17 00:00:00 2001 From: Viraj Mavani Date: Tue, 17 Apr 2018 14:48:00 +0530 Subject: [PATCH 3/3] solved "can not work by 'p' and 'esc' key #4" --- get_points.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()