
    Wpf                     8   d Z ddl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  G d dej                  ZdZ G d de          Z dS )zMediaPipe Hands.    N)
NamedTuple)#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)logic_calculator_pb2)"non_max_suppression_calculator_pb2)"rect_transformation_calculator_pb2)thresholding_calculator_pb2)SolutionBase)HAND_CONNECTIONSc                   f    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdS )HandLandmarkzThe 21 hand landmarks.r                           	   
                                 N)__name__
__module____qualname____doc__WRIST	THUMB_CMC	THUMB_MCPTHUMB_IP	THUMB_TIPINDEX_FINGER_MCPINDEX_FINGER_PIPINDEX_FINGER_DIPINDEX_FINGER_TIPMIDDLE_FINGER_MCPMIDDLE_FINGER_PIPMIDDLE_FINGER_DIPMIDDLE_FINGER_TIPRING_FINGER_MCPRING_FINGER_PIPRING_FINGER_DIPRING_FINGER_TIP	PINKY_MCP	PINKY_PIP	PINKY_DIP	PINKY_TIP     `/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/mediapipe/python/solutions/hands.pyr   r   -   s        
%))()////))))))rE   r   zCmediapipe/modules/hand_landmark/hand_landmark_tracking_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 )HandsaO  MediaPipe Hands.

  MediaPipe Hands processes an RGB image and returns the hand landmarks and
  handedness (left v.s. right hand) of each detected hand.

  Note that it determines handedness assuming the input image is mirrored,
  i.e., taken with a front-facing/selfie camera (
  https://en.wikipedia.org/wiki/Front-facing_camera) with images flipped
  horizontally. If that is not the case, use, for instance, cv2.flip(image, 1)
  to flip the image first for a correct handedness output.

  Please refer to https://solutions.mediapipe.dev/hands#python-solution-api for
  usage examples.
  Fr   r         ?c                 p    t                                          t          ||| d||dg d           dS )aH  Initializes a MediaPipe Hand 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/hands#static_image_mode.
      max_num_hands: Maximum number of hands to detect. See details in
        https://solutions.mediapipe.dev/hands#max_num_hands.
      model_complexity: Complexity of the hand landmark model: 0 or 1.
        Landmark accuracy as well as inference latency generally go up with the
        model complexity. See details in
        https://solutions.mediapipe.dev/hands#model_complexity.
      min_detection_confidence: Minimum confidence value ([0.0, 1.0]) for hand
        detection to be considered successful. See details in
        https://solutions.mediapipe.dev/hands#min_detection_confidence.
      min_tracking_confidence: Minimum confidence value ([0.0, 1.0]) for the
        hand landmarks to be considered tracked successfully. See details in
        https://solutions.mediapipe.dev/hands#min_tracking_confidence.
    )model_complexity	num_handsuse_prev_landmarks)z@palmdetectioncpu__TensorsToDetectionsCalculator.min_score_threshz1handlandmarkcpu__ThresholdingCalculator.threshold)multi_hand_landmarksmulti_hand_world_landmarksmulti_handedness)binary_graph_pathside_inputscalculator_paramsoutputsN)super__init___BINARYPB_FILE_PATH)selfstatic_image_modemax_num_handsrK   min_detection_confidencemin_tracking_confidence	__class__s         rF   rV   zHands.__init__Y   sj    2 
GG- 0&&7"7
 
 )'	
 

 
 
      rE   imagereturnc                 L    t                                          d|i          S )aC  Processes an RGB image and returns the hand landmarks and handedness of each detected hand.

    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 the following fields:
        1) a "multi_hand_landmarks" field that contains the hand landmarks on
           each detected hand.
        2) a "multi_hand_world_landmarks" field that contains the hand landmarks
           on each detected hand in real-world 3D coordinates that are in meters
           with the origin at the hand's approximate geometric center.
        3) a "multi_handedness" field that contains the handedness (left v.s.
           right hand) of the detected hand.
    r^   )
input_data)rU   process)rX   r^   r]   s     rF   rb   zHands.process   s"    * 77??w&6?777rE   )Fr   r   rI   rI   )
r+   r,   r-   r.   rV   npndarrayr   rb   __classcell__)r]   s   @rF   rH   rH   I   s           "' !(+'*) ) ) ) ) )V82: 8* 8 8 8 8 8 8 8 8 8 8rE   rH   )!r.   enum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   mediapipe.python.solution_baser   ,mediapipe.python.solutions.hands_connectionsr   IntEnumr   rW   rH   rD   rE   rF   <module>rp      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 ; ; ; ; ; ; I I I I I I I I I I I I B B B B B B 7 7 7 7 7 7 I I I I I I    4<   2 \ P8 P8 P8 P8 P8L P8 P8 P8 P8 P8rE   