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

Method draw_lzm

PATH/core/solvers/utils/detools/box.py:188–215  ·  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, colors_lzm, bold=False)

Source from the content-addressed store, hash-verified

186 """
187
188 def draw_lzm(self, img, colors_lzm, bold=False):
189 """
190 :meth: draw bounding box on the given image
191 :param img: the image to draw
192 :param bold: if bold the bounding box or not (default False)
193 :type img: numpy.array
194 :type bold: bool
195 """
196 if self.tag not in colors_lzm:
197 colors_lzm[self.tag] = (
198 random.random() * 255, random.random() * 255,
199 random.random() * 255)
200 color = colors_lzm[self.tag]
201 # line = self._getDrawLine(bold)
202 if "score" in self.__dict__:
203 text = "{}: {:.2f}".format(self.tag, self.score)
204 else:
205 text = str(self.tag)
206
207 cv2.rectangle(img, (int(self.x), int(self.y)), (int(self.x1), int(self.y1)), color, 3)
208 cx = self.x
209 cy = self.y - 12
210 #cv2.putText(img, text, (int(cx), int(cy)), cv2.FONT_HERSHEY_DUPLEX, 0.5, color)
211 cv2.putText(img, text, (int(cx), int(cy)), cv2.FONT_HERSHEY_DUPLEX, 0.5, color, 1)
212 """
213 cv2.putText(img, text, (int(self.x1)+5, int(self.y1)+5), cv2.FONT_HERSHEY_SIMPLEX,\
214 0.5, color, line)
215 """
216
217class DetBox(BoxBase):
218 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected