I faced a nececssity to add atribute to one of classes from cv2 library (simply id of the object). But when I try
setattr(keypoint, 'id', 1)
I get the error 'cv2.KeyPoint' object has no attribute 'id'
Whereas object of semi defined class:
class testclass:
def __init__(self, a):
self.a = 1
test = testclass(2)
setattr(test, 'id', 3)
works and now test.id
returns 3. Why setattr
does not work for cv2.KeyPoint
object? Is there a way to make it work?