diff --git a/mediapipe/python/solutions/drawing_utils.py b/mediapipe/python/solutions/drawing_utils.py index a1acc0be2..78e931264 100644 --- a/mediapipe/python/solutions/drawing_utils.py +++ b/mediapipe/python/solutions/drawing_utils.py @@ -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