Skip to content

Commit

Permalink
Reuse function colors to label
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoDCC committed May 24, 2024
1 parent 2b065fd commit a2bb487
Showing 1 changed file with 7 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,28 +209,15 @@ def _face_properties_to_label(face_properties):
face_properties.age)

@staticmethod
def _shirt_colors_to_label(shirt_colors):
def _object_colors_to_label(object_colors, object_name):
"""
Convert shirt colors array to label string
Convert object colors array to label string
:param: shirt_colors: Array to colors
:param: object_colors: Array to colors
:return: string label
"""
label = " shirt colors:"
for color in shirt_colors:
label += " {}".format(color)
return label

@staticmethod
def _hair_colors_to_label(hair_colors):
"""
Convert shirt colors array to label string
:param: shirt_colors: Array to colors
:return: string label
"""
label = " hair colors:"
for color in hair_colors:
label = f" {object_name} colors:"
for color in object_colors:
label += " {}".format(color)
return label

Expand Down Expand Up @@ -347,8 +334,8 @@ def recognize(self, image_msg):
face_recognitions):

temp_label = PeopleRecognizer2D._face_properties_to_label(face_properties) + \
PeopleRecognizer2D._shirt_colors_to_label(shirt_colors) + \
PeopleRecognizer2D._hair_colors_to_label(hair_colors)
PeopleRecognizer2D._object_colors_to_label(shirt_colors, "shirt") + \
PeopleRecognizer2D._object_colors_to_label(hair_colors, "hair")

if face_label:
image_annotations.append(face_label + " " + temp_label)
Expand Down

0 comments on commit a2bb487

Please sign in to comment.