§
    (Áôg½  ã                   ó4   — d dl ZddlmZ dej        d dfd„ZdS )é    Né   )Úview_as_blocksc           
      ó²  — t          j        |¦  «        r|f| j        z  }n't          |¦  «        | j        k    rt	          d¦  «        ‚|€i }g }t          t          |¦  «        ¦  «        D ]p}||         dk     rt	          d¦  «        ‚| j        |         ||         z  dk    r ||         | j        |         ||         z  z
  }nd}|                     d|f¦  «         Œqt          j        t          j	        |¦  «        ¦  «        rt          j
        | |d|¬¦  «        } t          | |¦  «        } ||fdt          t          | j        |j        ¦  «        ¦  «        i|¤ŽS )	aÿ  Downsample image by applying function `func` to local blocks.

    This function is useful for max and mean pooling, for example.

    Parameters
    ----------
    image : (M[, ...]) ndarray
        N-dimensional input image.
    block_size : array_like or int
        Array containing down-sampling integer factor along each axis.
        Default block_size is 2.
    func : callable
        Function object which is used to calculate the return value for each
        local block. This function must implement an ``axis`` parameter.
        Primary functions are ``numpy.sum``, ``numpy.min``, ``numpy.max``,
        ``numpy.mean`` and ``numpy.median``.  See also `func_kwargs`.
    cval : float
        Constant padding value if image is not perfectly divisible by the
        block size.
    func_kwargs : dict
        Keyword arguments passed to `func`. Notably useful for passing dtype
        argument to ``np.mean``. Takes dictionary of inputs, e.g.:
        ``func_kwargs={'dtype': np.float16})``.

    Returns
    -------
    image : ndarray
        Down-sampled image with same number of dimensions as input image.

    Examples
    --------
    >>> from skimage.measure import block_reduce
    >>> image = np.arange(3*3*4).reshape(3, 3, 4)
    >>> image # doctest: +NORMALIZE_WHITESPACE
    array([[[ 0,  1,  2,  3],
            [ 4,  5,  6,  7],
            [ 8,  9, 10, 11]],
           [[12, 13, 14, 15],
            [16, 17, 18, 19],
            [20, 21, 22, 23]],
           [[24, 25, 26, 27],
            [28, 29, 30, 31],
            [32, 33, 34, 35]]])
    >>> block_reduce(image, block_size=(3, 3, 1), func=np.mean)
    array([[[16., 17., 18., 19.]]])
    >>> image_max1 = block_reduce(image, block_size=(1, 3, 4), func=np.max)
    >>> image_max1 # doctest: +NORMALIZE_WHITESPACE
    array([[[11]],
           [[23]],
           [[35]]])
    >>> image_max2 = block_reduce(image, block_size=(3, 1, 4), func=np.max)
    >>> image_max2 # doctest: +NORMALIZE_WHITESPACE
    array([[[27],
            [31],
            [35]]])
    zF`block_size` must be a scalar or have the same length as `image.shape`Né   zYDown-sampling factors must be >= 1. Use `skimage.transform.resize` to up-sample an image.r   Úconstant)Ú	pad_widthÚmodeÚconstant_valuesÚaxis)ÚnpÚisscalarÚndimÚlenÚ
ValueErrorÚrangeÚshapeÚappendÚanyÚasarrayÚpadr   Útuple)	ÚimageÚ
block_sizeÚfuncÚcvalÚfunc_kwargsr   ÚiÚafter_widthÚblockeds	            ú^/var/www/html/bac/bac_backend/python/env/lib/python3.11/site-packages/skimage/measure/block.pyÚblock_reducer!      s  € õt 
„{�:ÑÔð 
Ø �] U¤ZÑ/ˆ
ˆ
Ý	ˆZ‰Œ˜EœJÒ	&Ð	&ÝØWñ
ô 
ð 	
ð ÐØˆà€IÝ•3�z‘?”?Ñ#Ô#ð +ð +ˆØ�aŒ=˜1ÒÐÝðñô ð ð
 Œ;�qŒ>˜J qœMÑ)¨QÒ.Ð.Ø$ Qœ-¨5¬;°q¬>¸JÀq¼MÑ+IÑJˆKˆKàˆKØ×Ò˜!˜[Ð)Ñ*Ô*Ð*Ð*å	„v�bŒj˜Ñ#Ô#Ñ$Ô$ð 
Ý”Ø˜Y¨ZÈð
ñ 
ô 
ˆõ ˜U JÑ/Ô/€Gàˆ4�ÐTÐT�e¥E¨%¬*°g´lÑ$CÔ$CÑDÔDÐTÈÐTÐTÐTó    )Únumpyr   Úutilr   Úsumr!   © r"   r    ú<module>r'      sZ   ðØ Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !ð $%¨2¬6¸Àtð YUð YUð YUð YUð YUð YUr"   