Spaces:
Running
Running
File size: 1,053 Bytes
d015578 |
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 |
class ObjectAnalyzed:
def __init__(self):
# Processor addons
self.attributes = []
self.drawers = []
def has_processor(self):
if len(self.attributes) > 0:
return True
else:
return False
def plot_features(self, image, plotter, show_attributes):
for drawer in self.drawers:
image = drawer(image, self, plotter, show_attributes)
return image
def get_attributes(self, names=None):
# Initialization by input type
single_name = False
if names is None:
names = self.attributes
elif isinstance(names, str):
names = [names]
single_name = True
attributes = {}
attribute = []
for name in names:
if name in self.attributes and name in self.__dict__.keys():
attribute = getattr(self, name)
attributes[name] = attribute
if single_name:
return attribute
else:
return attributes |