ImageMagick 霍夫变换的解释
Explanation of hough transform for ImageMagick
预览:
我已经使用下面提到的代码进行了霍夫线检测:
convert image.jpg -threshold 90% -canny 0x1+10%+30% \
\( +clone -background none \
-fill red -stroke red -strokewidth 2 \
-hough-lines 5x5+80 -write lines.mvg \
\) -composite hough.png
然后我在 .mvg 文件中写了该行的详细信息。 .mvg文件内容如下:
# Hough line transform: 5x5+80
viewbox 0 0 640 360
line 448.256,0 473.43,360 # 104
line 0,74.5652 640,29.8121 # 158
line 0,289.088 640,244.335 # 156
line 0,292.095 640,247.342 # 133
line 154.541,0 179.714,360 # 125
line 151.533,0 176.707,360 # 145
并在此处检查输出 hough.png 文件。
问题:
#104、#158、#156...代表什么,我猜它们是行号。如果是这样,为什么它们被编号在这样的方式?
另外我想知道坐标是如何分配的。
如果我能得到 .mvg 文件中内容的解释,那将非常有帮助。
# <number>
是 maxima
值。它默认为 count
,由 line_count
设置,返回时受您指定的 threshold
影响。如果矩阵元素计数大于先前的 height/width 迭代,则该数字将减少。所以...如果你给它一个 -hough-lines 5x5+80
的阈值,那么 line 448.256,0 473.43,360 # 104
被发现超过阈值大约 24 个像素(或线?)。下一次迭代会将 maxima
降至 80
阈值以下,因此我们停止比较矩阵元素。
Also I would like to know how the co-ordinates has been assigned.
我只能通过伪引用源代码来回答这个问题,但这是基本的三角函数。
if ((x >= 45) %% (x <= 135)) {
y = (r-x cos(t))/sin(t)
else {
x = (r-y cos(t))/sin(t)
}
where r is defined as y - midpoint element matrix height
where t is defined as x + midpoint rows
在 feature.c
中的 HoughLineImage
方法中了解更多信息
预览:
我已经使用下面提到的代码进行了霍夫线检测:
convert image.jpg -threshold 90% -canny 0x1+10%+30% \
\( +clone -background none \
-fill red -stroke red -strokewidth 2 \
-hough-lines 5x5+80 -write lines.mvg \
\) -composite hough.png
然后我在 .mvg 文件中写了该行的详细信息。 .mvg文件内容如下:
# Hough line transform: 5x5+80
viewbox 0 0 640 360
line 448.256,0 473.43,360 # 104
line 0,74.5652 640,29.8121 # 158
line 0,289.088 640,244.335 # 156
line 0,292.095 640,247.342 # 133
line 154.541,0 179.714,360 # 125
line 151.533,0 176.707,360 # 145
并在此处检查输出 hough.png 文件。
问题:
#104、#158、#156...代表什么,我猜它们是行号。如果是这样,为什么它们被编号在这样的方式?
另外我想知道坐标是如何分配的。
如果我能得到 .mvg 文件中内容的解释,那将非常有帮助。
# <number>
是 maxima
值。它默认为 count
,由 line_count
设置,返回时受您指定的 threshold
影响。如果矩阵元素计数大于先前的 height/width 迭代,则该数字将减少。所以...如果你给它一个 -hough-lines 5x5+80
的阈值,那么 line 448.256,0 473.43,360 # 104
被发现超过阈值大约 24 个像素(或线?)。下一次迭代会将 maxima
降至 80
阈值以下,因此我们停止比较矩阵元素。
Also I would like to know how the co-ordinates has been assigned.
我只能通过伪引用源代码来回答这个问题,但这是基本的三角函数。
if ((x >= 45) %% (x <= 135)) {
y = (r-x cos(t))/sin(t)
else {
x = (r-y cos(t))/sin(t)
}
where r is defined as y - midpoint element matrix height
where t is defined as x + midpoint rows
在 feature.c
HoughLineImage
方法中了解更多信息