Question

I'm trying to figure out how to do a pixel (color) search from the center and out, in a spiral shape.. Not like the normal "left to right pixel search".

So far i've made some simple x-y searches. Using standard PIL. But it was to slow. as the result always seems to be closer to the center (of the image) in my case. The thing is that it's not a square image, so the center position(s) can be 2 or more pixels (not A center, but "two"+ pixels centerd), this is where I "loose it".. Can you peeps give me some hints? Im always working from a screenshot PIL-> ImageGrab.grab(), using image.size to get the image size, and px=image.getpixel((x, y)) to get the current pixel-location

I'm working with R,G,B-colours: if px[0] == r and px[1] == g and px[2] == b:

Était-ce utile?

La solution

See this answer for a bunch of different algorithms written in python for iterating over a matrix in a spiral fashion.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top