Python Forum
TypeError: 'tuple' object is not callable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: 'tuple' object is not callable
#1
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
I 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!
Reply
#2
It looks like you want to slice templete_props:

width  = templete_props[templete_class][2]*2+1
height = templete_props[templete_class][2]*2+1
Does that do what you intended?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: cannot pickle ‘_asyncio.Future’ object Abdul_Rafey 1 398 Mar-07-2024, 03:40 PM
Last Post: deanhystad
  error in class: TypeError: 'str' object is not callable akbarza 2 513 Dec-30-2023, 04:35 PM
Last Post: deanhystad
Bug TypeError: 'NoneType' object is not subscriptable TheLummen 4 749 Nov-27-2023, 11:34 AM
Last Post: TheLummen
  TypeError: 'NoneType' object is not callable akbarza 4 1,001 Aug-24-2023, 05:14 PM
Last Post: snippsat
  [NEW CODER] TypeError: Object is not callable iwantyoursec 5 1,363 Aug-23-2023, 06:21 PM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 841 Jul-23-2023, 02:25 PM
Last Post: Fare
  TypeError: 'float' object is not callable #1 isdito2001 1 1,086 Jan-21-2023, 12:43 AM
Last Post: Yoriz
  TypeError: a bytes-like object is required ZeroX 13 4,150 Jan-07-2023, 07:02 PM
Last Post: deanhystad
  'SSHClient' object is not callable 3lnyn0 1 1,173 Dec-15-2022, 03:40 AM
Last Post: deanhystad
  TypeError: 'float' object is not callable TimofeyKolpakov 3 1,457 Dec-04-2022, 04:58 PM
Last Post: TimofeyKolpakov

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020