伙计
霍夫变换
Description
[[
计算二进制图像的标准霍夫变换(SHT)H
,,,,Theta
,,,,罗
] = hough(BW
)BW
。The伙计
function is designed to detect lines. The function uses the parametric representation of a line:rho = x*cos(theta) + y*sin(theta)
。The function returns罗
,,,,the distance from the origin to the line along a vector perpendicular to the line, andTheta
,在X- 轴和该向量。该功能还返回SHT,H
,,,,which is a parameter space matrix whose rows and columns correspond to罗andTheta值分别。有关更多信息,请参阅Algorithms。
Examples
输入参数
输出参数
Algorithms
The Standard Hough Transform (SHT) uses the parametric representation of a line:
rho = x*cos(theta) + y*sin(theta)
假定坐标系的原点位于左上角像素的中心。
The variable罗是the perpendicular distance from the origin to the line.
The variableTheta是从原点到线的垂直投影的角度,以顺时针式测量X-轴。范围Theta是–90°≤θ<90°。线本身的角度是θ + 90°,也相对于阳性进行顺时针测量X-轴。
SHT是一个参数空间矩阵,其行和列对应于罗andThetavalues, respectively. The elements in the SHT represent accumulator cells. Initially, the value in each cell is zero. Then, for every non-background point in the image,罗计算每个Theta。罗将四舍五入到SHT中最近的允许行。该累加器单元已增加。在此过程结束时,值问在SHT(R,C)意思是问点数xy- 平面位于指定的线上theta(c)andRho(R)。Peak values in the SHT represent potential lines in the input image.
The Hough transform matrix,H
,,,,是nrho-by-ntheta在哪里:
nrho = 2*(ceil(d/rhoresolution)) + 1
,,,,andd = sqrt((numrowsinbw -1)^2 +(numcolsinbw -1)^2)
。罗
值范围从-对角线
至diagonal
, 在哪里对角线= rhoresolution*ceil(d/rhoresolution)
。
ntheta =长度(theta)