Mar-13-2019, 07:35 AM
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)+1I would like to detect corner of chessboard patterns. However, i faced this kind of error at line 38:
Error:width = templete_props(templete_class,3)*2+1
TypeError: 'tuple' object is not callable
Anyone have any idea? thanks in advanced!