extract.py 345 B

1234567891011121314151617
  1. import cv2
  2. file_path = "test/20240112_132814.jpg"
  3. topLeftX = 1029
  4. topLeftY = 480
  5. bottomRightX = 1252
  6. bottomRightY = 734
  7. image = cv2.imread(file_path)
  8. cropped = image # [topLeftY:bottomRightY, topLeftX:bottomRightX]
  9. # cv2.imwrite("templates/dungeon/angus.png", cropped)
  10. cv2.imshow("preview", cropped)
  11. cv2.waitKey(0)
  12. cv2.destroyAllWindows()