作者你好,很抱歉打扰你。就是我在学习你的代码的时候遇到了几个问题。

def get_img_frame(self):
'''
get_img_frame
'''
# Get window game raw frame
self.frame = self.capture.get_frame()
if self.frame is None:
logger.warning("Failed to capture game frame.")
return
# Cut the title bar and resize raw frame to (1296, 759)
frame_no_title = self.frame[self.cfg["game_window"]["title_bar_height"]:, :]
# Make sure the window ratio is as expected
if self.args.test_image != "":
pass # Disable size check if using test image for debugging
elif self.cfg["bot"]["mode"] == "aux":
if not is_img_16_to_9(frame_no_title, self.cfg): # Aux mode allow 16:9 resolution
text = f"Unexpeted window size: {frame_no_title.shape[:2]} (expect window ratio 16:9)\n"
text += "Please use windowed mode & smallest resolution."
logger.error(text)
return
else:
# Other mode only allow specific resolution
if self.cfg["game_window"]["size"] != frame_no_title.shape[:2]:
text = f"Unexpeted window size: {frame_no_title.shape[:2]} "\
f"(expect {self.cfg['game_window']['size']})\n"
text += "Please use windowed mode & smallest resolution."
logger.error(text)
return
return cv2.resize(frame_no_title, WINDOW_WORKING_SIZE,
interpolation=cv2.INTER_NEAREST)
因为你的图片捕获实在另外的一个capture线程中进行的,并且设置了窗口大小为1296759,但是在 else:
# Other mode only allow specific resolution
if self.cfg["game_window"]["size"] != frame_no_title.shape[:2]:
text = f"Unexpeted window size: {frame_no_title.shape[:2]} "
f"(expect {self.cfg['game_window']['size']})\n"
text += "Please use windowed mode & smallest resolution."
logger.error(text)
return
如果窗口大小为1296759返回的是一个空图像。那么在后面的run_once()函数不就得不到这个图像吗?
作者你好,很抱歉打扰你。就是我在学习你的代码的时候遇到了几个问题。
因为你的图片捕获实在另外的一个capture线程中进行的,并且设置了窗口大小为1296759,但是在 else:
# Other mode only allow specific resolution
if self.cfg["game_window"]["size"] != frame_no_title.shape[:2]:
text = f"Unexpeted window size: {frame_no_title.shape[:2]} "
f"(expect {self.cfg['game_window']['size']})\n"
text += "Please use windowed mode & smallest resolution."
logger.error(text)
return
如果窗口大小为1296759返回的是一个空图像。那么在后面的run_once()函数不就得不到这个图像吗?