Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temp1是'NoneType' object has no attribute 'shape' #5

Open
PEPSIYANG opened this issue Jan 3, 2018 · 7 comments
Open

temp1是'NoneType' object has no attribute 'shape' #5

PEPSIYANG opened this issue Jan 3, 2018 · 7 comments

Comments

@PEPSIYANG
Copy link

image

@moneyDboat
Copy link
Owner

模板图片没读取出来

@PEPSIYANG
Copy link
Author

@moneyDboat 这个问题是我没把模板图片拷到play.py同级目录下,解决了。
但是现在问题是每次程序执行就跳一下,接着就game over ?

@PEPSIYANG
Copy link
Author

@moneyDboat

循环直到游戏失败结束

for i in range(10000):
get_screenshot(0)
img_rgb = cv2.imread('%s.png' % 0, 0)
最后一句什么意思?没看懂

@moneyDboat
Copy link
Owner

cv2.imread()就是opencv加载图片的函数

@ShiningRuby
Copy link

你这个还是截屏没有获取到,我也出现过这个问题。这个程序是把截屏保存到手机SD卡然后传到电脑,如果手机没有SD卡就会这样。你可以直接把截屏保存到电脑,即把get_screenshot函数改成这样:
os.system('adb shell screencap -p | sed 's/\r$//'>%s.png'%str(id))

@PEPSIYANG
Copy link
Author

@ShiningRuby 代码能解释一下吗?
image

@ShiningRuby
Copy link

就是用adb获取截屏保存到某个路径,命名为%s.png ,保存时这里的%s用字符串id代替

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants