internal change.

PiperOrigin-RevId: 586156439
This commit is contained in:
MediaPipe Team 2023-11-28 18:05:07 -08:00 committed by Copybara-Service
parent 62bafd39bb
commit 91589b10d3

View File

@ -125,7 +125,8 @@ def draw_landmarks(
color=RED_COLOR),
connection_drawing_spec: Union[DrawingSpec,
Mapping[Tuple[int, int],
DrawingSpec]] = DrawingSpec()):
DrawingSpec]] = DrawingSpec(),
is_drawing_landmarks: bool = True):
"""Draws the landmarks and the connections on the image.
Args:
@ -142,6 +143,8 @@ def draw_landmarks(
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:
@ -181,7 +184,7 @@ def draw_landmarks(
drawing_spec.thickness)
# Draws landmark points after finishing the connection lines, which is
# aesthetically better.
if landmark_drawing_spec:
if is_drawing_landmarks and landmark_drawing_spec:
for idx, landmark_px in idx_to_coordinates.items():
drawing_spec = landmark_drawing_spec[idx] if isinstance(
landmark_drawing_spec, Mapping) else landmark_drawing_spec