Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Sam authored and Matt Sam committed Jul 11, 2021
1 parent d5a2d66 commit f174a46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions AImbot_opencv_yolo/AI_M_BOT_X1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import pywintypes
import statistics
import nvidia_smi
import mss


# 截图类
Expand All @@ -56,6 +55,7 @@ def __init__(self, window_class):
raise Exception(f'\033[1;31;40m窗口类名未找到: {window_class}')
self.update_window_info()
if platform != 'win32':
import mss
self.sct = mss.mss() # 初始化mss截图

def update_window_info(self):
Expand Down Expand Up @@ -559,6 +559,7 @@ def detection2(que, array):
test_win = [False]
move_record_x = []
move_record_y = []
run_platform = platform

# 如果文件不存在则退出
check_file('yolov4-tiny-vvv')
Expand Down Expand Up @@ -634,7 +635,7 @@ def detection2(que, array):

while True:
# 选择截图方式
screenshot = (win_cap.get_screenshot() if platform == 'win32' else win_cap.grab_screenshot())
screenshot = (win_cap.get_screenshot() if run_platform == 'win32' else win_cap.grab_screenshot())

try:
screenshot.any()
Expand Down
5 changes: 3 additions & 2 deletions AImbot_opencv_yolo/AI_M_BOT_X2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import pywintypes
import statistics
import nvidia_smi
import mss


# 截图类
Expand All @@ -56,6 +55,7 @@ def __init__(self, window_class):
raise Exception(f'\033[1;31;40m窗口类名未找到: {window_class}')
self.update_window_info()
if platform != 'win32':
import mss
self.sct = mss.mss() # 初始化mss截图

def update_window_info(self):
Expand Down Expand Up @@ -559,6 +559,7 @@ def detection2(que, array):
test_win = [False]
move_record_x = []
move_record_y = []
run_platform = platform

# 如果文件不存在则退出
check_file('yolov4-tiny-vvv')
Expand Down Expand Up @@ -634,7 +635,7 @@ def detection2(que, array):

while True:
# 选择截图方式
screenshot = (win_cap.get_screenshot() if platform == 'win32' else win_cap.grab_screenshot())
screenshot = (win_cap.get_screenshot() if run_platform == 'win32' else win_cap.grab_screenshot())

try:
screenshot.any()
Expand Down

0 comments on commit f174a46

Please sign in to comment.