mp.tasks.vision.drawing_utils.draw_landmarks
Draws the landmarks and the connections on the image.
mp.tasks.vision.drawing_utils.draw_landmarks(
image: np.ndarray,
landmark_list: list[landmark_module.NormalizedLandmark],
connections: Optional[list[_CONNECTION]] = None,
landmark_drawing_spec: Optional[Union[DrawingSpec, Mapping[int, DrawingSpec]]] = DrawingSpec(color=RED_COLOR),
connection_drawing_spec: Union[DrawingSpec, Mapping[tuple[int, int], DrawingSpec]] = DrawingSpec(),
is_drawing_landmarks: bool = True
)
Args |
image
|
A three channel BGR image represented as numpy ndarray.
|
landmark_list
|
A list of normalized landmarks to be annotated on the image.
|
connections
|
A list of landmark index tuples that specifies how landmarks to
be connected in the drawing.
|
landmark_drawing_spec
|
Either a DrawingSpec object or a mapping from hand
landmarks to the DrawingSpecs that specifies the landmarks' drawing
settings such as color, line thickness, and circle radius. If this
argument is explicitly set to None, no landmarks will be drawn.
|
connection_drawing_spec
|
Either a DrawingSpec object or a mapping from hand
connections to the DrawingSpecs that specifies the connections' drawing
settings such as color and line thickness. If this argument is explicitly
set to None, no landmark connections will be drawn.
|
is_drawing_landmarks
|
Whether to draw landmarks. If set false, skip drawing
landmarks, only contours will be drawed.
|
Raises |
ValueError
|
If one of the followings:
a) If the input image is not three channel BGR.
b) If any connetions contain invalid landmark index.
|
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."],[],[]]