python - Search image for color. Return X, Y -
python - Search image for color. Return X, Y -
i've been looking on way find specific color in image (screen capture), , homecoming the position of of color (x,y). i've had tries, not managed proper search. result should first pixel found color.
i tought maybe pil help. tried this, problem returns every position, found color:
fixed:
def findcolor(r,g,b): image = imagegrab.grab() x in range(1, 400): y in range(1,400): px = image.getpixel((x, y)) if px[0] == r , px[1] == g , px[2] == b: return(x,y)
and, need replace loops range, pictures width/height.
return
result @ first match, instead of continuing loop.
python image colors find python-imaging-library
Comments
Post a Comment