工具箱提供了 3 个与霍夫变换函数有关的函数。
函数 hough实现前一节概念
函数 houghpeaks 寻找霍夫变换中的峰值(高计数累加器单元)
函数 houghlines 则基于前两个函数的结果,提取原始图像中的线段
一、函数 hough
默认语法:[H,theta,rho] = hough(f)
完整的语法形式:[H,theta,rho] = hough(f,'ThetaRes',val1,'RhoRes',val2)
其中,H 是霍夫变换矩阵,theta(单位为度)和 rho 是 ρ 和 θ 值的向量,霍夫变换矩阵是在这些值上生成的。输入 f 是一幅二值图像;vall 是值在 0 到 90 之间的一个标量,它指定了沿 θ 轴的霍夫变换容器(默认为1),
val2 是范围 0<val2<hypot(size(I,1),size(I,2))
内的一个实标量,它指定了沿ρ轴的霍夫变换容器的间隔(默认为1)