Browse Source

add screenshot tool

Richard Köhl 1 năm trước cách đây
mục cha
commit
caee9d452e
1 tập tin đã thay đổi với 17 bổ sung0 xóa
  1. 17 0
      extract.py

+ 17 - 0
extract.py

@@ -0,0 +1,17 @@
+import cv2
+
+file_path = "test/20240112_132814.jpg"
+
+topLeftX = 1029
+topLeftY = 480
+bottomRightX = 1252
+bottomRightY = 734
+
+image = cv2.imread(file_path)
+cropped = image  # [topLeftY:bottomRightY, topLeftX:bottomRightX]
+
+# cv2.imwrite("templates/dungeon/angus.png", cropped)
+
+cv2.imshow("preview", cropped)
+cv2.waitKey(0)
+cv2.destroyAllWindows()