Python 关于Hough变换及其打印(要打印3个点)

Python 关于Hough变换及其打印(要打印3个点),python,hough-transform,Python,Hough Transform,我有三点意见: (1,3)(2,4)(3,5) 哪个方程是: y=x+2 及其 slope = 1 intercept = 2 在霍夫变换和绘图之后 # Hough Transformin in my code r_axis[i] = x_point * math.cos(th) + y_point * math.sin(th) 我得到: 这个情节告诉我: r = 1 theta = 135 deg (???) 但是我的方程告诉我 theta = arctan(slope) ( -pi

我有三点意见:

(1,3)(2,4)(3,5)

哪个方程是:

y=x+2

及其

slope = 1
intercept = 2
霍夫变换和绘图之后

# Hough Transformin in my code
r_axis[i] = x_point * math.cos(th) + y_point * math.sin(th)
我得到:

这个情节告诉我:

r = 1
theta = 135 deg (???)
但是我的方程告诉我

theta = 
arctan(slope) ( -pi < tan < +pi ) = 
45 deg
theta=
弧长(斜率)(-pi
答案应该是45度,而不是135度

我很困惑

以下是我的源代码:


好吧,在我努力思考之后

绘图的交点为
theta=135度,r=1.414
theta=135度,r=1

我们将
y=x+2
修改为
y-x=2

答案是:

r = 1.414
theta = 135 deg
我们代替

1.414 = y*sin (135 deg) - x*cos(135 deg)
=> 2 = y - x
=> y = x + 2
所以,代码和绘图都不是问题