# filter image
img_corners = np.zeros((np.size(img,0),np.size(img,1)))
for templete_class in range (1,np.size(templete_props,0)):
# create correlation templete
# width and height
width = (templete_props[templete_class][2])*2+1
height = (templete_props[templete_class][2])*2+1
# initialize templete
templete_a1 = np.zeros((height,width),np.float)
templete_a2 = np.zeros((height,width),np.float)
templete_b1 = np.zeros((height,width),np.float)
templete_b2 = np.zeros((height,width),np.float)
# midpoint
mu = (templete_props[templete_class][2])+1
mv = (templete_props[templete_class][2])+1
# compute normals from angles
n1 = np.array([-math.sin(templete_props[templete_class][0]), math.cos(templete_props[templete_class][0])])
n2 = np.array([-math.sin(templete_props[templete_class][1]), math.cos(templete_props[templete_class][1])])
# compute normals from angles do
for u in range (1, width):
for v in range (1, height):
# vector
vec = np.array([u-mu+1, v-mv+1])
dist = np.linalg.norm(vec)
# check on which side of the normals we are
n1_t = n1.reshape(-1,1)
s1 = vec@n1_t
n2_t = n2.reshape(-1,1)
s2 = vec@n2_t
if s1<=-0.1 and s2<=-0.1:
templete_a1(v,u) = stats.norm.pdf(dist,0,(templete_props[templete_class][2])/2)
elif s1>=0.1 and s2>=0.1:
templete_a2(v,u) = stats.norm.pdf(dist,0,(templete_props[templete_class][2])/2)
elif s1<=-0.1 and s2>=0.1:
templete_b1(v,u) = stats.norm.pdf(dist,0,(templete_props[templete_class][2])/2)
elif s1>=0.1 and s2<=-0.1:
templete_b2(v,u) = stats.norm.pdf(dist,0,(templete_props[templete_class][2])/2)
此编码用于将s1和s2的某个值/范围归类为特定模板(编码的最后一部分)。但是,有些错误我无法解决。错误如下:
“无法分配给函数调用”
任何人,您对此有任何想法吗?我是python的新手。谢谢你。