在图像中找到参考点的最快方法 [英] Fastest way to find reference point in image

查看:105
本文介绍了在图像中找到参考点的最快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找找到一个或多个参考点的最快方法,(可能是+或矩形)。

i'm searching for the fastest way to find one or more reference points, (could be +, or a rectangle).

我的第一个想法是,到从图像的中点开始,在所有4个方向上迭代看彩色像素。但在这种情况下,我不清楚如何处理像+这样的符号。

My first idea is, to go from the mid point of the image and look iterative in all 4 directions for the coloured pixels. But in this case it is not clear for me how to handle a symbol like + .

希望我的描述清楚。
问候

Hopefully my description is clear. Greetings

更新

就像在这张图片中一样,矩形通常应该在中期。对于检测,如果最初找到的位置需要更长时间并且检查必须非常快,那就没问题。

Like in this image, the rectangle should normally in the mid. For the detection it would be ok, if the initial finding of the positions would take longer and a "check" must be really fast.:

推荐答案

我不知道所有方面的相对表现OpenCV代码,但我认为它非常适用于整行图像的矢量类型操作,而不是标量操作,例如当你建议从中心辐射增加圆圈以找到交叉时。这是一种可行的方法。

I don't know the relative performance of all the aspects of the OpenCV code, but I assume it is pretty good at vector type operations across whole rows of an image rather than scalar operations such as you suggest when you propose doing ever increasing circles radiating from the centre to find the cross. Here is one approach that may work.

首先, squidge (TM)将所有像素组合在一起,使列与原始图像一样高但只有一个像素宽。我在图中用红色着色了。此列中最暗的像素为您提供参考点的y坐标。

First, squidge (TM) all the pixels together to make a column as tall as the original image but just a single pixel wide. I have coloured this in red in the diagram. The darkest pixel in this column gives you the y-coordinate of your reference points.

然后, squidge (TM)所有像素一起到制作与原始图像一样宽的行,但只有一个像素高。我在图中用蓝色着色了。然后中间黑条的最暗处给出了中心参考点的x坐标。

Then, squidge (TM) all the pixels together to make a row as wide as the original image but just a single pixel high. I have coloured this in blue in the diagram. The darkest of the middle black bar then gives you the x-coordinate of your central reference point.

这也将处理小旋转和翻译 - 如果旋转较大,您将右边有3个黑条。

This will also handle small rotations as well as translations - and if the rotations are larger, you will get 3 black bars on the right.

你也可以决定,一般而言,为了节省时间,你只需要将图像从1/3处理到垂直方向为2/3点,水平方向为1/4至3/4点,因为这最有可能包括参考点。

You may also decide that, in general, and to save time, you only need process the image from the 1/3 to the 2/3 point in the vertical direction and the 1/4 to the 3/4 point in the horizontal direction since that is most likely to include the reference points.

这篇关于在图像中找到参考点的最快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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