imagemagick - ImageMagick 的霍夫变换说明

标签 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 文件。

enter image description here

问题:

  1. #104、#158、#156... 代表什么,我猜它们是行号。如果是这样,为什么要以这种方式编号?

  2. 我还想知道坐标是如何分配的。

如果我能得到 .mvg 文件中内容的解释,这将非常有帮助。

最佳答案

# <number>maxima值(value)。默认为count ,由 line_count 设置,并返回受 threshold 影响你指定的。如果矩阵元素计数大于先前的高度/宽度迭代,则该数字将会减少。所以...如果你给它一个阈值 -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

了解更多信息 HoughLineImage方法位于 feature.c

关于imagemagick - ImageMagick 的霍夫变换说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30995349/

相关文章:

imagemagick - 使用 ImageMagick 裁剪 40/60

linux - 如何在 Perl 中使用 Image::Magic 增加特定像素的 RGB 值?

php - 将 PDF 转换为 PNG Imagemagick 时出错 : unable to create temporary file

imagemagick - 图像魔术: resize and fill doesn't work

ruby-on-rails - libMagickCore.so.4 : cannot open shared object file: No such file or directory

r - 如何在 R 中使用 magick 保存高分辨率图像?

ruby - RMagick - 如何将网格图像裁剪成图像数组?

php - 如何在 tcpdf 中使用 imagemagick

c# - 叠加两个图像所需的 ASP.net 服务器端图像处理库

windows - 如何使用 ImageMagick 批量转换 pdf 并对流程进行基准测试?