§
    1-Ph¶	  ã                   ób   — d dl ZddlmZ ddlmZ  ej        d¬¦  «        dd
dœd„¦   «         ZdS )é    Né   )Ú_felzenszwalb_cythoné   )ÚutilsF)Úmultichannel_outputçš™™™™™é?é   éÿÿÿÿ)Úchannel_axisc                óˆ   — |€| j         dk    rt          d¦  «        ‚t          j        | ¦  «        } t	          | |||¬¦  «        S )a¥  Computes Felsenszwalb's efficient graph based image segmentation.

    Produces an oversegmentation of a multichannel (i.e. RGB) image
    using a fast, minimum spanning tree based clustering on the image grid.
    The parameter ``scale`` sets an observation level. Higher scale means
    less and larger segments. ``sigma`` is the diameter of a Gaussian kernel,
    used for smoothing the image prior to segmentation.

    The number of produced segments as well as their size can only be
    controlled indirectly through ``scale``. Segment size within an image can
    vary greatly depending on local contrast.

    For RGB images, the algorithm uses the euclidean distance between pixels in
    color space.

    Parameters
    ----------
    image : (M, N[, 3]) ndarray
        Input image.
    scale : float
        Free parameter. Higher means larger clusters.
    sigma : float
        Width (standard deviation) of Gaussian kernel used in preprocessing.
    min_size : int
        Minimum component size. Enforced using postprocessing.
    channel_axis : int or None, optional
        If None, the image is assumed to be a grayscale (single channel) image.
        Otherwise, this parameter indicates which axis of the array corresponds
        to channels.

        .. versionadded:: 0.19
           ``channel_axis`` was added in 0.19.

    Returns
    -------
    segment_mask : (M, N) ndarray
        Integer mask indicating segment labels.

    References
    ----------
    .. [1] Efficient graph-based image segmentation, Felzenszwalb, P.F. and
           Huttenlocher, D.P.  International Journal of Computer Vision, 2004

    Notes
    -----
        The `k` parameter used in the original paper renamed to `scale` here.

    Examples
    --------
    >>> from skimage.segmentation import felzenszwalb
    >>> from skimage.data import coffee
    >>> img = coffee()
    >>> segments = felzenszwalb(img, scale=3.0, sigma=0.95, min_size=5)
    Nr   z@This algorithm works only on single or multi-channel 2d images. )ÚscaleÚsigmaÚmin_size)ÚndimÚ
ValueErrorÚnpÚ
atleast_3dr   )Úimager   r   r   r   s        úb/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/skimage/segmentation/_felzenszwalb.pyÚfelzenszwalbr      sR   € ðp Ð ¤
¨Q¢ ÝØQñ
ô 
ð 	
õ ŒM˜%Ñ Ô €EÝ ¨U¸%È(ÐSÑSÔSÐSó    )r   r   r	   )Únumpyr   Ú_felzenszwalb_cyr   Ú_sharedr   Úchannel_as_last_axisr   © r   r   ú<module>r      s„   ðØ Ð Ð Ð à 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø Ð Ð Ð Ð Ð ð €Ô°Ð6Ñ6Ô6ð=TÈð =Tð =Tð =Tð =Tñ 7Ô6ð=Tð =Tð =Tr   