在 Hough 变换之后/wiki/MATLAB" rel="nofollow noreferrer">MATLAB,如何选择线条以便可以在两个或更多图像之间进行比较?
我按照 Amro 给出的示例进行操作,实际上我想要检测的是第一张图片中的两行。然而,我得到的是第二张图片中的那个。我该怎么做?
After doing the Hough transform in MATLAB, how do I pick the lines so that I can compare between two or more images?
I followed the example given by Amro and actually what I wanted to detect is the two lines in the first picture. However, what I got is the one in the second picture. How can I do this?
发布评论
评论(1)
我认为您的目标是检测图像中的线条,而不是比较两个图像(?)。
无论如何,要找到由 霍夫变换 矩阵中的最大强度href="http://www.mathworks.com/help/images/ref/hough.html" rel="nofollow noreferrer">
hough
函数,我们使用houghpeaks
函数,并向其传递要检测的所需峰值数量。EDIT1:
我想我会添加一个示例来展示该过程:
EDIT2:
根据您最近的更新,我仅通过对相同的内容进行一些更改就成功地检测到了这些线条上面的代码:
[200 70 160 140]
注意:您必须添加偏移量才能获取线条中的位置未裁剪的原始图像。另外,如果您想要更准确的结果,您可能需要检测四行并获取中间的行,如下所示:
I think you meant the goal to be to detect lines in an image, not comparing two images (?).
Anyway, to find the maximum intensities in the Hough transform matrix generated by the
hough
function, we use thehoughpeaks
function, and pass it the desired number of peaks to detect.EDIT1:
I figured I would add an example to show the procedure:
EDIT2:
Following your recent update, I managed to detect the lines by only making a few changes to the same above code:
[200 70 160 140]
Note: You will have to add the offset to get the position of the lines in the original image uncropped. Also, if you want more accurate results, you might want to detect four lines and get the lines in the middle as shown below: