Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed 0.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added DataSet/error.png
Binary file added DataSet/error10.png
Binary file added DataSet/error11.png
Binary file added DataSet/error2.png
Binary file added DataSet/error3.png
Binary file added DataSet/error5.png
Binary file added DataSet/error8.png
Binary file added DataSet/error9.png
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# JumpMaster
# JumpMaster

来自渣渣视觉小新的小试牛刀,写的不好,见笑了。

From the slag visual first test knife, writing is not good, laughed. --来自于百度翻译
main.py 是入口文件 jump.process 是主要的处理文件
jumpmaster 是主要的类 adb是和安卓手机通信的类
24 changes: 0 additions & 24 deletions check.py

This file was deleted.

6 changes: 0 additions & 6 deletions check1.py

This file was deleted.

Binary file added error1.png
Binary file added error10.png
Binary file added error11.png
Binary file added error2.png
Binary file added error8.png
Binary file modified jump/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified jump/__pycache__/adb.cpython-36.pyc
Binary file not shown.
Binary file modified jump/__pycache__/process.cpython-36.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions jump/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def __init__(self):
def screenshot(self):
''' get an image from android phone'''
sub.call("adb shell screencap -p | sed 's/\r$//' > liang.png",shell = True)
img = cv.imread("liang.png",-1)
img = cv.imread("liang.png",1)
#cv.imshow("img",img)
resize = cv.resize(img,(700,900))
self.img = resize
return self.img
Expand All @@ -28,7 +29,7 @@ def againtencent(self):
def touch(self,che_x,che_y,x,y):
x1 = np.random.randint(550,600)
y1 = np.random.randint(350,550)
time = math.sqrt(abs(che_x - y)**2 + abs(che_y - (x+40))**2)
time = math.sqrt(abs(che_x - x)**2 + abs(che_y - y)**2)
cal_time = int(time*2.2)
sub.call("adb shell input touchscreen swipe {} {} {} {} {}".format(x1,y1,x1+20,y1+20,cal_time),shell = True)

Expand Down
6 changes: 6 additions & 0 deletions jump/check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import numpy as np

a = [1,2,3,4,5,6]

for i,j in enumerate(a[::-1]):
print(i,j)
52 changes: 52 additions & 0 deletions jump/hist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt


a = 0

def cal_mask(img,channel):

hist_img = cv.calcHist([img],[channel],None,[256],[0,255])
hist_img = np.array(hist_img)
shang_data = 0
right_data = 0
for index,value in enumerate(hist_img):
right_data = value
if(shang_data == 0 and right_data != 0):
down = index
if(right_data == 0 and shang_data != 0):
up = index
shang_data = right_data

return down,up


if __name__ == "__main__":

while True:

img = cv.imread("../test_data/"+str(a)+".png",1)
#img_roi = img[200:540,695:700] # 截取的roi 用作分析直方图
#cv.imshow("img_ro2",img_ro2)
(b_down,b_up) = cal_mask(img_roi,0)
(g_down,g_up) = cal_mask(img_roi,1)
(r_down,r_up) = cal_mask(img_roi,2)
upper = np.array([b_up,g_up,r_up])
downer = np.array([b_down-5,g_down-5,r_down-5])
img_bin = cv.inRange(img,downer,upper)
img_bin = cv.bitwise_not(img_bin)
img_bin = cv.cvtColor(img_bin,cv.COLOR_GRAY2BGR)
img = cv.bitwise_and(img,img_bin)
cv.imshow("img",img)
key_num = cv.waitKey(0)
if key_num == ord("n"):
a += 1
continue
if key_num == ord("m"):
a -= 1
continue
if key_num == ord("s"):
break

cv.waitKey(0)
Binary file modified jump/liang.png
Loading