mp.tasks.vision.drawing_utils.draw_detection
Draws the detction bounding box and keypoints on the image.
mp.tasks.vision.drawing_utils.draw_detection(
image: np.ndarray,
detection: mp.tasks.components.containers.Detection,
keypoint_drawing_spec: mp.tasks.vision.drawing_utils.DrawingSpec = DrawingSpec(color=RED_COLOR),
bbox_drawing_spec: mp.tasks.vision.drawing_utils.DrawingSpec = DrawingSpec()
)
Args |
image
|
A three channel BGR image represented as numpy ndarray.
|
detection
|
A detection object with a bounding box.
|
keypoint_drawing_spec
|
A DrawingSpec object that specifies the keypoints'
drawing settings such as color, line thickness, and circle radius.
|
bbox_drawing_spec
|
A DrawingSpec object that specifies the bounding box's
drawing settings such as color and line thickness.
|
Raises |
ValueError
|
If the input image is not three channel BGR.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-06-05 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-05 UTC."],[],[]]