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 Aug 17, 2021
1 parent 6754d25 commit e9fde8c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions AI_M_BOT(opencv+yolo)/AI_M_BOT_X0.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ def control_mouse(a, b, fps_var, ranges, rate, go_fire, win_class, move_rx, move
if move_range > 6 * ranges:
a = uniform(0.9 * a, 1.1 * a)
b = uniform(0.9 * b, 1.1 * b)
a /= DPI_Var
b /= DPI_Var
a = a / DPI_Var * move_factor[0]
b = b / DPI_Var * move_factor[1]
fps_factor = pow(fps_var/3, 1/3)
x0 = {
'CrossFire': a / 2.719 * (client_ratio / (4/3)) / fps_factor, # 32
Expand Down Expand Up @@ -716,6 +716,7 @@ def detection(que, array, frame_in):
move_record_x = []
move_record_y = []
shoot_times = [0]
move_factor = [1, 1]

# 如果文件不存在则退出
check_file('yolox_nano')
Expand Down Expand Up @@ -795,12 +796,15 @@ def detection(que, array, frame_in):
screenshot = win_cap.grab_screenshot()

try:
screenshot.any()
if screenshot.any():
resized_screenshot = cv2.resize(screenshot, (224, 192))
arr[5] = (150 if win_cap.get_window_left() - 10 < 150 else win_cap.get_window_left() - 10)
except (AttributeError, pywintypes.error):
break

queue.put_nowait(screenshot)
move_factor[0] = screenshot.shape[0] / resized_screenshot.shape[0]
move_factor[1] = screenshot.shape[1] / resized_screenshot.shape[1]
queue.put_nowait(resized_screenshot)
queue.join()

exit_program, arr[4] = check_status(exit_program, arr[4])
Expand Down

0 comments on commit e9fde8c

Please sign in to comment.