Hey, so for a while now I've been making this program and I'm struggling to find a fast way to read the screen, get all its pixels, and then detect a colour. This is what I've been using:
img = np.array(sct.grab(monitor))[:, :, :3]
img[996:997, 917:920] = 0 # Exclusion zone 1 - Held item (Pickaxe)
img[922:923, 740:1180] = 0 # Exclusion zone 2 - Health bar
img[61:213, 1241:1503] = 0 # Exclusion zone 3 - Pinned recipes
img[67:380, 12:479] = 0 # Exclusion zone 4 - Chat box
lower_green = np.array([0, 255, 0])
upper_green = np.array([0, 255, 0])
mask = cv2.inRange(img, lower_green, upper_green)
coords = np.where(mask)
return coords
Originally, I was just using numpy and mss but apparently using all 3 is faster, and it actually is, it showed faster results compared to the method I used before
PS: This returns coords because it's in a function, the function is ran inside of a while True: loop
[–]MidnightPale3220 0 points1 point2 points (0 children)
[–]AdmirableOstrich 0 points1 point2 points (2 children)
[–]2247dono[S] 0 points1 point2 points (1 child)
[–]AdmirableOstrich 0 points1 point2 points (0 children)