diff --git a/src/df_tools/dfwindow.py b/src/df_tools/dfwindow.py index 0806b49..f5964ea 100644 --- a/src/df_tools/dfwindow.py +++ b/src/df_tools/dfwindow.py @@ -107,22 +107,22 @@ class DFWINDOW: @staticmethod def firstNotBlackX(img) -> int: - first_x = np.where(np.max(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=0) > 5)[0][0] + first_x = np.where(np.mean(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=0) > 10)[0][0] return int(first_x) @staticmethod def lastNotBlackX(img) -> int: - first_x = np.where(np.max(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=0) > 5)[0][-1] + first_x = np.where(np.mean(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=0) > 10)[0][-1] return int(first_x) @staticmethod def firstNotBlackY(img) -> int: - first_y = np.where(np.max(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=1) > 5)[0][0] + first_y = np.where(np.mean(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=1) > 10)[0][0] return int(first_y) @staticmethod def lastNotBlackY(img) -> int: - first_y = np.where(np.max(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=1) > 5)[0][-1] + first_y = np.where(np.mean(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=1) > 10)[0][-1] return int(first_y) bottom_to_ignore = 160