def isInvEmpty():
bag, bagx,bagy = get_bag('bag and coords', 'hsv')
# looks for color of empty inv
low = np.array([10,46,58])
high= np.array([21,92,82])
# applies mask
mask = cv2.inRange(bag, low, high)
# removes any noise
kernel = np.ones((5,5), np.uint8)
closing = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel)
# looks to see if the inv is all white pixels
# returns true, else False
if (closing.view() == 255).all():
return True
return False
评论列表
文章目录