首页 > 代码库 > wechat
#!/bin/bash adb shell screencap -p /sdcard/a.png adb pull /sdcard/a.png ./ adb shell rm /sdcard/a.png echo "screencap [done]"
#!/usr/bin/env python from PIL import Image from PIL import ImageDraw img = Image.open("./a.png") print img.size sx = 990 #970 sy = 1395 #1375 dx = 51 #86 dy = 36 #66 rL = [] draw = ImageDraw.Draw(img) for i in range(sx,sx+dx): row = ‘‘ for j in range(sy,sy+dy): col = img.getpixel((i,j)) draw.point((i-sx,j-sy),col) row += str(col[0])+‘,‘+str(col[1])+‘,‘+str(col[2])+‘,‘+str(col[3])+‘-‘ rL.append(row[:-1]+‘\n‘) img.save("./r.png") f = open(‘./g.txt‘, ‘w‘) f.writelines(rL) f.close()
#!/usr/bin/env python from PIL import Image #################################################################### dx = 51 dy = 36 g_block = [[] for i in range(dx)] #################################################################### def init(): global g_block f = open(‘./g.txt‘, ‘r‘) t = f.readlines() f.close() for index,i in enumerate(t): #print index e = i[:-1].split(‘-‘) for index2, j in enumerate(e): w = j.split(‘,‘) g_block[index].append((int(w[0]),int(w[1]),int(w[2]),int(w[3]))) pass def check(): global g_block rslt = [] img = Image.open("./a.png") imgw, imgh = img.size for x in range(imgw): for y in range(imgh): if x + dx >= imgw or y + dy >= imgh: continue fg = True #print x,y, for xx in range(dx): if fg == False: break for yy in range(dy): col1 = img.getpixel((x+xx,y+yy)) if col1 != g_block[xx][yy]: #print xx, yy, col1, g_block[xx][yy] fg = False break if fg == True: rslt.append((x,y)) print rslt #################################################################### if __name__ == ‘__main__‘: init() print ‘[finished]‘ check()
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。