识别图像中的图案 [英] Recognize pattern in images
问题描述
我正在寻找一种快速的构想/算法,以便让我在图像文件中找到正方形(作为标记点).但是,挑战不应该这么多...
I am looking for a fast idea/algorithm letting me to find squares (as mark points) in the image file. It shouldn't be so much challenge, however...
我开始通过将源图像的颜色更改为灰度图像并扫描图像的每一行以寻找两,三条最长的行(逐像素)来进行此操作.
I started doing this by changing the color of the source image to a grey scale image and scanning each line of the image looking for two, three longest lines (pixel by pixel).
然后,我发现有一系列线",它们可能会创建期望的正方形.
Then having an array of "lines" I am finding elements which may create the desire square.
更好的主意是找到具有已知特征的图案,例如:它是正方形,在正方形之外没有失真(只有空白)等.
The better idea would be to find the pattern with known traits, like: it is square, beyond of the square there are no distortion (there is just white space) etc.
目标是在不到1-2s的时间内分析图像5000 X 5000 px.
The goal is to analyze the image 5000 X 5000 px in less than 1-2s.
有可能吗?
推荐答案
其中一个OpenCV示例squares.cpp
就是这样做的,请参见
One of the OpenCV samples squares.cpp
does just this, see here for code, . Alternatively you could look up the Hough transform to detect all lines in your image, and then test for two lines intersecting at right angles.
此网站上也有许多资源可以为您提供帮助:
There are also a number of resources on this site which may help you:
- OpenCV C++/Obj-C: Detecting a sheet of paper / Square Detection
- Are there any opencv function like "cvHoughCircles()" for square detection?
- square detection, image processing
我确定还有其他人,这些只是我遇到的头几个人.
I'm sure there are others, these are just the first few I came across.
这篇关于识别图像中的图案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!