Mar-13-2019, 07:35 AM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
img = rgb2gray(image) # 3 scales radius1 = 4 radius2 = 8 radius3 = 12 # sobel mask sobel_dx = ([ - 1 , 0 , 1 ],[ - 1 , 0 , 1 ],[ - 1 , 0 , 1 ]) sobel_dy = ([ - 1 , - 1 , - 1 ],[ 0 , 0 , 0 ], [ 1 , 1 , 1 ]) # compute image derivatives img_dx = convolve2d(img, sobel_dx) img_dy = convolve2d(img, sobel_dy) img_angle = np.arctan2(img_dx, img_dy) img_weight = np.sqrt(img_dx * * 2 + img_dy * * 2 ) # correct angle to lie in between [0,pi] img_angle[img_angle< 0 ] = img_angle[img_angle< 0 ] + math.pi img_angle[img_angle>math.pi] = img_angle[img_angle>math.pi] - math.pi # scale input image img_min = img. min () img_max = img. max () img = (img - img_min) / (img_max - img_min) # templete properties templete_props = ([ 0 , math.pi / 2 , radius1], [math.pi / 4 , - math.pi / 4 , radius1], [ 0 , math.pi / 2 , radius2], [math.pi / 4 , - math.pi / 4 , radius2], [ 0 , math.pi / 2 , radius3], [math.pi / 4 , - math.pi / 4 , radius3]) print ( "Filtering ..." ) # 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, 3 ) * 2 + 1 height = templete_props(templete_class, 3 ) * 2 + 1 # initialize templete templete.a1 = np.zeros(height,width) templete.a2 = np.zeros(height,width) templete.b1 = np.zeros(height,width) templete.b2 = np.zeros(height,width) # midpoint mu = templete_props(templete_class, 3 ) + 1 mv = templete_props(templete_class, 3 ) + 1 |
Error:width = templete_props(templete_class,3)*2+1
TypeError: 'tuple' object is not callable
Anyone have any idea? thanks in advanced!