MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / _annotate_faces

Method _annotate_faces

IntelOSINT.py:10717–10730  ·  view source on GitHub ↗
(self, bgr, faces)

Source from the content-addressed store, hash-verified

10715 return cv2.imdecode(arr, cv2.IMREAD_COLOR)
10716
10717 def _annotate_faces(self, bgr, faces):
10718 import cv2
10719 draw = bgr.copy()
10720 for i, f in enumerate(faces, start=1):
10721 bb = getattr(f, "bbox", None)
10722 if bb is None:
10723 continue
10724 x1, y1, x2, y2 = [int(v) for v in bb]
10725 cv2.rectangle(draw, (x1, y1), (x2, y2), (0, 229, 255), 2)
10726 cv2.putText(draw, f"Face {i}", (x1, max(18, y1 - 8)), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 229, 255), 2, lineType=cv2.LINE_AA)
10727 ok, enc = cv2.imencode(".png", draw)
10728 if not ok:
10729 return ""
10730 return "data:image/png;base64," + base64.b64encode(enc.tobytes()).decode("utf-8")
10731
10732 def _encode_bgr_png(self, bgr):
10733 import cv2

Callers 1

extract_from_imageMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected