已经创建了Hough变换的c ++实现来检测图像中的线条.使用rho,theta表示找到的行,如维基百科所述:
"参数r表示直线与原点之间的距离,而θ是从原点到该最近点的矢量角度"
如何使用r,θ描述两条线的x,y空间中的交点?
这里参考我目前用于转换进出霍夫空间的函数:
//get 'r' (length of a line from pole (corner, 0,0, distance from center) perpendicular to a line intersecting point x,y at a given angle) given the point and the angle (in radians)
inline float point2Hough(int x, int y, float theta) {
return((((float)x)*cosf(theta))+((float)y)*sinf(theta));
}
//get point y for a line at angle theta with a distance from the pole of r intersecting x? bad explanation! >_<
inline float hough2Point(int x, int r, float theta) {
float …Run Code Online (Sandbox Code Playgroud)