
    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Z G d de          ZdS )zMediaPipe Selfie Segmentation.    )
NamedTupleN)#constant_side_packet_calculator_pb2)image_to_tensor_calculator_pb2)inference_calculator_pb2)&tensors_to_segmentation_calculator_pb2)"local_file_contents_calculator_pb2)switch_container_pb2)SolutionBasezFmediapipe/modules/selfie_segmentation/selfie_segmentation_cpu.binarypbc                   B     e Zd ZdZd fd	Zdej        def fdZ xZ	S )SelfieSegmentationzMediaPipe Selfie Segmentation.

  MediaPipe Selfie Segmentation processes an RGB image and returns a
  segmentation mask.

  Please refer to
  https://solutions.mediapipe.dev/selfie_segmentation#python-solution-api for
  usage examples.
  r   c                 `    t                                          t          d|idg           dS )a(  Initializes a MediaPipe Selfie Segmentation object.

    Args:
      model_selection: 0 or 1. 0 to select a general-purpose model, and 1 to
        select a model more optimized for landscape images. See details in
        https://solutions.mediapipe.dev/selfie_segmentation#model_selection.
    model_selectionsegmentation_mask)binary_graph_pathside_inputsoutputsN)super__init___BINARYPB_FILE_PATH)selfr   	__class__s     n/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/mediapipe/python/solutions/selfie_segmentation.pyr   zSelfieSegmentation.__init__.   sE     
GG-
 %%  ' ' ' ' '    imagereturnc                 L    t                                          d|i          S )a  Processes an RGB image and returns a segmentation mask.

    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 "segmentation_mask" field that contains a float
      type 2d np array representing the mask.
    r   )
input_data)r   process)r   r   r   s     r   r   zSelfieSegmentation.process=   s"     77??w&6?777r   )r   )
__name__
__module____qualname____doc__r   npndarrayr   r   __classcell__)r   s   @r   r   r   #   su         ' ' ' ' ' '82: 8* 8 8 8 8 8 8 8 8 8 8r   r   )r"   typingr   numpyr#   mediapipe.calculators.corer   mediapipe.calculators.tensorr   r   r   mediapipe.calculators.utilr   mediapipe.framework.toolr	   mediapipe.python.solution_baser
   r   r    r   r   <module>r.      s    % $           K J J J J J G G G G G G A A A A A A O O O O O O I I I I I I 9 9 9 9 9 9 8 7 7 7 7 7^ )8 )8 )8 )8 )8 )8 )8 )8 )8 )8r   