def find_prayer_pot():
rs_bag, bagx, bagy = RS.get_bag('bag coords', 'hsv')
# prayer potion color ranges
low = np.array([78,140,0])
high= np.array([81,225,211])
mask = cv2.inRange(rs_bag, low, high)
kernel = np.ones((5,5), np.uint8)
dilation = cv2.dilate(mask, kernel, iterations = 1)
_,contours, _ = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for con in contours:
x, y, w, h = cv2.boundingRect(con)
cv2.rectangle(mask,(x,y), (x+w, y+h), (255,255,255),-1)
_,contours, _ = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for con in contours[::-1]:
M = cv2.moments(con)
mx, my = int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"])
mx += RSX + bagx
my += RSY + bagy
mx += random.randint(-7,7)
my += random.randint(-12,5)
Mouse.moveClick(mx,my,1)
#Mouse.moveTo(mx,my)
break
评论列表
文章目录