Skip to content

Commit

Permalink
参数调优
Browse files Browse the repository at this point in the history
  • Loading branch information
JYlsc committed Jan 4, 2018
1 parent 6e40ad7 commit bff58ea
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ __pycache__/
*.so

# Distribution / packaging
*.DS_Store
.idea
.Python
build/
develop-eggs/
Expand Down
Binary file added img/n.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/people_1440.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/temp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# 指令集
cut_command = "adb shell screencap -p /sdcard/n.png "
get_command = "adb pull /sdcard/n.png ."
get_command = "adb pull /sdcard/n.png ./img/"
click_command = "adb shell input swipe "

""" 720 分辨率参数 """
Expand Down Expand Up @@ -43,13 +43,13 @@
people_img = cv2.imread('./img/people_1440.jpg')

# 读取小人中心偏移像素
x_offset = 43
y_offset = 226
x_offset = 46
y_offset = 228

# 读取时间与距离计算参数
# time = (distance + b) * w
# w = 1440 / 分辨率
b = 22
b = 21
w = 1

# 小人宽度
Expand Down Expand Up @@ -145,6 +145,6 @@ def get_time(distance):
while True:
run(cut_command)
run(get_command)
img = cv2.imread('./n.png')[cut_size:, :]
img = cv2.imread('./img/n.png')[cut_size:, :]
distance = get_distance(img)
jump(distance)

0 comments on commit bff58ea

Please sign in to comment.