图像螺旋像素搜索 [英] Image Spiral Pixel Search

查看:61
本文介绍了图像螺旋像素搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何从中心开始以螺旋形形状进行像素(彩色)搜索.与正常的从左到右像素搜索"不同.

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".

到目前为止,我已经进行了一些简单的x-y搜索.使用标准PIL.但这太慢了.因为在我的情况下,结果似乎总是更靠近(图像的)中心.事实是,它不是正方形图像,因此中心位置可以是2个或更多像素(不是 A 中心,而是两个" +像素居中),这就是我松动"的地方它."您能给我窥视一下吗?我总是使用屏幕截图PIL-> ImageGrab.grab(),使用 image.size 来获取图像大小,并使用 px = image.getpixel((x,y))获取当前像素位置

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

我正在使用R,G,B颜色:如果px [0] == r和px [1] == g和px [2] == b:

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

推荐答案

看到此答案一堆用python编写的不同算法,用于以螺旋形式遍历矩阵.

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

这篇关于图像螺旋像素搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆