MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / draw

Method draw

PATH/core/solvers/utils/detools/box.py:164–186  ·  view source on GitHub ↗

:meth: draw bounding box on the given image :param img: the image to draw :param bold: if bold the bounding box or not (default False) :type img: numpy.array :type bold: bool

(self, img, bold=False)

Source from the content-addressed store, hash-verified

162 return 2 if bold else 1
163
164 def draw(self, img, bold=False):
165 """
166 :meth: draw bounding box on the given image
167 :param img: the image to draw
168 :param bold: if bold the bounding box or not (default False)
169 :type img: numpy.array
170 :type bold: bool
171 """
172 color = self._getDrawColor()
173 line = self._getDrawLine(bold)
174 if "score" in self.__dict__:
175 text = "{}: {:.4f}".format(self.tag, self.score)
176 else:
177 text = str(self.tag)
178
179 cv2.rectangle(img, (int(self.x), int(self.y)), (int(self.x1), int(self.y1)), color, line)
180 cx = self.x + (self.x1 - self.x) / 2 - 5
181 cy = self.y + 12
182 cv2.putText(img, text, (int(cx), int(cy)), cv2.FONT_HERSHEY_DUPLEX, 0.5, color)
183 """
184 cv2.putText(img, text, (int(self.x1)+5, int(self.y1)+5), cv2.FONT_HERSHEY_SIMPLEX,\
185 0.5, color, line)
186 """
187
188 def draw_lzm(self, img, colors_lzm, bold=False):
189 """

Callers 3

fig2npMethod · 0.80
fig2dataMethod · 0.80
draw_img_boxesMethod · 0.80

Calls 2

_getDrawColorMethod · 0.95
_getDrawLineMethod · 0.95

Tested by

no test coverage detected