Image Spiral Pixel Search

六眼飞鱼酱① 提交于 2021-01-28 02:42:06

问题


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:


回答1:


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



来源:https://stackoverflow.com/questions/8980601/image-spiral-pixel-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!