【问题标题】:line detection within a plain geometry figure平面几何图形内的线检测
【发布时间】:2013-04-15 03:07:10
【问题描述】:

我想从给定的以下图片中实现什么

  1. 以 A 点为原点的 A、B、C 和 D 点坐标。
  2. 事实上存在 lineAB、AC、BC 和 AD。
  3. 事实点 D 在 lineAB 上

点 id 并不重要,只要它可以检测到这些位置有点并且它们之间有线即可。 OpenCV 会帮助我实现这一目标吗?如果是这样,请您说得更具体一点吗?

非常感谢。

【问题讨论】:

  • 我现在没有时间给出完整的答案(我相信其他人很快就会发布一个),但是做你正在寻找的“标准”方式是 Hough变换:docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/…
  • 你总是知道你的线条应该有多粗吗?我问是因为如果您不必担心不同的线条粗细,可以使用更简单的扫描算法来检测这样的点

标签: image-processing computer-vision object-detection


【解决方案1】:

正如乔所说的霍夫变换会帮助你,我知道 openCV 会帮助你,但我以前从未使用过它,这是我编写的一个简单的 Matlab 代码,用于提取线和点的坐标。

f=imread("your image without piont ID"); 
f=rgb2gray(f);              
fb=im2bw(f,graythresh(f));  

[H,T,R] = hough(not(fb),'RhoResolution',0.5,'Theta',-90:0.5:89.5); 
peaks=houghpeaks(H,4,'threshold',ceil(0.3*max(H(:))));      


lines = houghlines(not(fb),T,R,peaks); %this will give u start and end point of lines, Rho and tetha (x*cos(tetha)+y*sin(tetha)=Rho) now you can answer to all of your questions 

http://en.wikipedia.org/wiki/Hough_transform

【讨论】:

    猜你喜欢
    • 2020-09-26
    • 2016-09-02
    • 1970-01-01
    • 2021-12-09
    • 2020-09-05
    • 2010-10-11
    • 1970-01-01
    • 1970-01-01
    • 2014-05-22
    相关资源
    最近更新 更多