mp.tasks.vision.drawing_utils.draw_landmarks
Stay organized with collections
Save and categorize content based on your preferences.
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-11-05 UTC.
[null,null,["Last updated 2026-11-05 UTC."],[],[]]