hough 变换和噪声

hough 变换和噪声_第1张图片

#!/usr/bin/python
#
# A demo for hough transformation
#
import numpy as np
import matplotlib.pyplot as plt
import math

lt = np.arange(0,10,0.5)
lx = (2.4-0.6*lt)/0.4
t=np.arange(0,np.pi,np.pi/20)
fig = plt.figure(1)
ax=fig.add_subplot(211)
for i in lt:
    x=np.sin(t)*(2.4-0.6*i/10.0)/0.4+np.cos(t)*i
    ax.plot(t,x)
    
ax=fig.add_subplot(212)
for i in lt:
    x=np.sin(t)*(2.4-0.6*i/10.0+np.random.randint(0,10)/10.0)/0.4+np.cos(t)*i
    ax.plot(t,x)
    
plt.show()

你可能感兴趣的:(hough 变换和噪声)