Esempio n. 1
0
if __name__=='__main__':

    row = config['grid_num']
    column = config['grid_num']
    grid = config['grid_w']
    count=10

    clf = joblib.load('linear_model.pkl')
    m.click(104, 90, 1)
    sum_img_pre=0

    while True:
        print("********************%s****************************"%(count))
        t1=time.time()
        filename=r'Image/%s.png'%(count)
        img=util.shotByWinAPI(filename)
        t2=time.time()
        print("Screen spend time :%s s"%(t2-t1))
        print(img.shape)
        #Image.fromarray(img.astype('uint8')).show()

        '''
        sum_img=np.sum(np.array(img))
        print(sum_img_pre,sum_img)
        if sum_img_pre >= sum_img-2000 and sum_img_pre <= sum_img + 2000:
            print("********************************重复截图")
            continue
        sum_img_pre=sum_img
        '''
        for i in range(row):
            for j in range(column):
Esempio n. 2
0
    else:
        if shot_type == 0:
            adb_tool.tapScreen(config['adb_tap_false_x'], config['adb_tap_y'])
        else:
            util.tapScreenFromPC(config['pc_tap_false_x'], config['pc_tap_y'])


count = 0  #迭代轮数
while True:
    t1 = time.time()
    if shot_type == 0:
        img = adb_tool.getScreenshot()
    elif shot_type == 1:
        img = util.shotFromComputer()
    else:
        img = util.shotByWinAPI('ScreenShot/%d.png' % count)
    #t2= time.time()
    #print('截图耗时%f' %(t2 - t1))
    res = img_tool.get_result(lr, img, '%d.png' % count)
    #t3 = time.time()
    #print('获取结果耗时%f' % (t3 - t2))
    if res == preRes or res == '':
        '''如果表达式和之前的表达式相同,则代表截图重复,可能此时手机已经跳到了下一题,因此不进行点击'''
        count += 1
        #print('截图重复')
        continue
    else:
        print(res)
        preRes = res
        one_tap(res)
        count += 1