From 98781a780a73f40e774d28ac3afbd3c615925b10 Mon Sep 17 00:00:00 2001 From: rez-spb Date: Tue, 8 Jun 2021 18:12:29 +0300 Subject: [PATCH 1/2] Fix exception in gaze tracking by casting np.int64 to int. --- tracker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracker.py b/tracker.py index e41681a..dc7b7f4 100644 --- a/tracker.py +++ b/tracker.py @@ -50,7 +50,7 @@ def compensate(p1, p2): def rotate_image(image, a, center): (h, w) = image.shape[:2] a = np.rad2deg(a) - M = cv2.getRotationMatrix2D((center[0], center[1]), a, 1.0) + M = cv2.getRotationMatrix2D((int(center[0]), int(center[1])), a, 1.0) rotated = cv2.warpAffine(image, M, (w, h)) return rotated From 323d707849dd2c45923d1fc552d9c142890156e0 Mon Sep 17 00:00:00 2001 From: rez-spb Date: Tue, 8 Jun 2021 21:43:38 +0300 Subject: [PATCH 2/2] Move from int cast to float. --- tracker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracker.py b/tracker.py index dc7b7f4..a22190b 100644 --- a/tracker.py +++ b/tracker.py @@ -50,7 +50,7 @@ def compensate(p1, p2): def rotate_image(image, a, center): (h, w) = image.shape[:2] a = np.rad2deg(a) - M = cv2.getRotationMatrix2D((int(center[0]), int(center[1])), a, 1.0) + M = cv2.getRotationMatrix2D((float(center[0]), float(center[1])), a, 1.0) rotated = cv2.warpAffine(image, M, (w, h)) return rotated