
    Wpf                        d Z ddlmZ ddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddl	mZ dd	l	mZ dd
l	mZ ddl	mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddlm%Z% ddlm&Z& dd lm'Z' d!Z(d"Z)d#Z* G d$ d%e          Z+dS )&zMediaPipe Face Mesh.    )
NamedTupleN)#constant_side_packet_calculator_pb2)gate_calculator_pb2)split_vector_calculator_pb2)image_to_tensor_calculator_pb2)inference_calculator_pb2)(tensors_to_classification_calculator_pb2)$tensors_to_detections_calculator_pb2)#tensors_to_landmarks_calculator_pb2)ssd_anchors_calculator_pb2)association_calculator_pb2)"detections_to_rects_calculator_pb2)#landmarks_refinement_calculator_pb2)logic_calculator_pb2)"non_max_suppression_calculator_pb2)"rect_transformation_calculator_pb2)thresholding_calculator_pb2)SolutionBase)FACEMESH_CONTOURS)FACEMESH_FACE_OVAL)FACEMESH_IRISES)FACEMESH_LEFT_EYE)FACEMESH_LEFT_EYEBROW)FACEMESH_LEFT_IRIS)FACEMESH_LIPS)FACEMESH_NOSE)FACEMESH_RIGHT_EYE)FACEMESH_RIGHT_EYEBROW)FACEMESH_RIGHT_IRIS)FACEMESH_TESSELATIONi  i  z@mediapipe/modules/face_landmark/face_landmark_front_cpu.binarypbc                   L     e Zd ZdZ	 	 	 	 	 d	 fd	Zdej        def fdZ xZ	S )
FaceMeshzMediaPipe Face Mesh.

  MediaPipe Face Mesh processes an RGB image and returns the face landmarks on
  each detected face.

  Please refer to https://solutions.mediapipe.dev/face_mesh#python-solution-api
  for usage examples.
  F         ?c                 n    t                                          t          ||| d||ddg           dS )aj  Initializes a MediaPipe Face Mesh object.

    Args:
      static_image_mode: Whether to treat the input images as a batch of static
        and possibly unrelated images, or a video stream. See details in
        https://solutions.mediapipe.dev/face_mesh#static_image_mode.
      max_num_faces: Maximum number of faces to detect. See details in
        https://solutions.mediapipe.dev/face_mesh#max_num_faces.
      refine_landmarks: Whether to further refine the landmark coordinates
        around the eyes and lips, and output additional landmarks around the
        irises. Default to False. See details in
        https://solutions.mediapipe.dev/face_mesh#refine_landmarks.
      min_detection_confidence: Minimum confidence value ([0.0, 1.0]) for face
        detection to be considered successful. See details in
        https://solutions.mediapipe.dev/face_mesh#min_detection_confidence.
      min_tracking_confidence: Minimum confidence value ([0.0, 1.0]) for the
        face landmarks to be considered tracked successfully. See details in
        https://solutions.mediapipe.dev/face_mesh#min_tracking_confidence.
    )	num_faceswith_attentionuse_prev_landmarks)zrfacedetectionshortrangecpu__facedetectionshortrange__facedetection__TensorsToDetectionsCalculator.min_score_threshz1facelandmarkcpu__ThresholdingCalculator.thresholdmulti_face_landmarks)binary_graph_pathside_inputscalculator_paramsoutputsN)super__init___BINARYPB_FILE_PATH)selfstatic_image_modemax_num_facesrefine_landmarksmin_detection_confidencemin_tracking_confidence	__class__s         d/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/mediapipe/python/solutions/face_mesh.pyr/   zFaceMesh.__init__F   sc    2 
GG-&.&7"7
 
 )'	
 
 ((  * * * * *    imagereturnc                 L    t                                          d|i          S )a  Processes an RGB image and returns the face landmarks on each detected face.

    Args:
      image: An RGB image represented as a numpy ndarray.

    Raises:
      RuntimeError: If the underlying graph throws any error.
      ValueError: If the input image is not three channel RGB.

    Returns:
      A NamedTuple object with a "multi_face_landmarks" field that contains the
      face landmarks on each detected face.
    r:   )
input_data)r.   process)r1   r:   r7   s     r8   r>   zFaceMesh.processn   s"     77??w&6?777r9   )Fr#   Fr$   r$   )
__name__
__module____qualname____doc__r/   npndarrayr   r>   __classcell__)r7   s   @r8   r"   r"   <   s          "' %(+'*&* &* &* &* &* &*P82: 8* 8 8 8 8 8 8 8 8 8 8r9   r"   ),rB   typingr   numpyrC   mediapipe.calculators.corer   r   r   mediapipe.calculators.tensorr   r   r	   r
   r   mediapipe.calculators.tfliter   mediapipe.calculators.utilr   r   r   r   r   r   r   mediapipe.python.solution_baser   0mediapipe.python.solutions.face_mesh_connectionsr   r   r   r   r   r   r   r   r   r   r   r    FACEMESH_NUM_LANDMARKS"FACEMESH_NUM_LANDMARKS_WITH_IRISESr0   r"    r9   r8   <module>rQ      s               K J J J J J : : : : : : B B B B B B G G G G G G A A A A A A Q Q Q Q Q Q M M M M M M L L L L L L C C C C C C A A A A A A I I I I I I J J J J J J ; ; ; ; ; ; I I I I I I I I I I I I B B B B B B 7 7 7 7 7 7 N N N N N N O O O O O O L L L L L L N N N N N N R R R R R R O O O O O O J J J J J J J J J J J J O O O O O O S S S S S S P P P P P P Q Q Q Q Q Q  %( "X A8 A8 A8 A8 A8| A8 A8 A8 A8 A8r9   