From 07eb11ebe39e6eb5a59459b6c1b11e643a52b567 Mon Sep 17 00:00:00 2001 From: DeltaNeverUsed Date: Sun, 25 May 2025 23:04:53 +0200 Subject: [PATCH] fix: serious performance issue with numpy linalg.inv on linux --- EyeTrackApp/eye_processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EyeTrackApp/eye_processor.py b/EyeTrackApp/eye_processor.py index ddc2eb1..f9a1cbf 100644 --- a/EyeTrackApp/eye_processor.py +++ b/EyeTrackApp/eye_processor.py @@ -238,7 +238,7 @@ class EyeProcessor: borderValue=(255, 255, 255), ) - inv_matrix = np.linalg.inv(np.vstack((matrix, [0, 0, 1])))[:-1] + inv_matrix = cv2.invertAffineTransform(matrix) # calculate crop corner locations in original image space corners = np.matmul([[0, 0, 1], [roi_w, 0, 1], [0, roi_h, 1], [roi_w, roi_h, 1]], np.transpose(inv_matrix)) fits_in_bounds = all(0 <= x <= img_w and 0 <= y <= img_h for (x, y) in corners)