§
    )Áôg@P  ã                   ó€   — d Z ddl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mZmZ dd
„Zdd„Zdd„Zd„ Z	 	 	 	 dd„ZdS )z)
Methods to characterize image textures.
é    Né   )Úcheck_nD)Úgray2rgb)Úimg_as_floaté   )Ú
_glcm_loopÚ_local_binary_patternÚ_multiblock_lbpFc                 ó0  — t          | d¦  «         t          |dd¦  «         t          |dd¦  «         t          j        | ¦  «        } |                      ¦   «         }t          j        | j        t          j        ¦  «        rt          d¦  «        ‚| j        t          j        t          j	        fvr|€t          d¦  «        ‚t          j        | j        t          j
        ¦  «        r't          j        | dk     ¦  «        rt          d	¦  «        ‚|€d
}||k    rt          d¦  «        ‚t          j        |t          j        ¬¦  «        }t          j        |t          j        ¬¦  «        }t          j        ||t          |¦  «        t          |¦  «        ft          j        d¬¦  «        }t!          | ||||¦  «         |rt          j        |d¦  «        }||z   }|rD|                     t          j        ¦  «        }t          j        |dd¬¦  «        }	d|	|	dk    <   ||	z  }|S )a  Calculate the gray-level co-occurrence matrix.

    A gray level co-occurrence matrix is a histogram of co-occurring
    grayscale values at a given offset over an image.

    .. versionchanged:: 0.19
               `greymatrix` was renamed to `graymatrix` in 0.19.

    Parameters
    ----------
    image : array_like
        Integer typed input image. Only positive valued images are supported.
        If type is other than uint8, the argument `levels` needs to be set.
    distances : array_like
        List of pixel pair distance offsets.
    angles : array_like
        List of pixel pair angles in radians.
    levels : int, optional
        The input image should contain integers in [0, `levels`-1],
        where levels indicate the number of gray-levels counted
        (typically 256 for an 8-bit image). This argument is required for
        16-bit images or higher and is typically the maximum of the image.
        As the output matrix is at least `levels` x `levels`, it might
        be preferable to use binning of the input image rather than
        large values for `levels`.
    symmetric : bool, optional
        If True, the output matrix `P[:, :, d, theta]` is symmetric. This
        is accomplished by ignoring the order of value pairs, so both
        (i, j) and (j, i) are accumulated when (i, j) is encountered
        for a given offset. The default is False.
    normed : bool, optional
        If True, normalize each matrix `P[:, :, d, theta]` by dividing
        by the total number of accumulated co-occurrences for the given
        offset. The elements of the resulting matrix sum to 1. The
        default is False.

    Returns
    -------
    P : 4-D ndarray
        The gray-level co-occurrence histogram. The value
        `P[i,j,d,theta]` is the number of times that gray-level `j`
        occurs at a distance `d` and at an angle `theta` from
        gray-level `i`. If `normed` is `False`, the output is of
        type uint32, otherwise it is float64. The dimensions are:
        levels x levels x number of distances x number of angles.

    References
    ----------
    .. [1] M. Hall-Beyer, 2007. GLCM Texture: A Tutorial
           https://prism.ucalgary.ca/handle/1880/51900
           DOI:`10.11575/PRISM/33280`
    .. [2] R.M. Haralick, K. Shanmugam, and I. Dinstein, "Textural features for
           image classification", IEEE Transactions on Systems, Man, and
           Cybernetics, vol. SMC-3, no. 6, pp. 610-621, Nov. 1973.
           :DOI:`10.1109/TSMC.1973.4309314`
    .. [3] M. Nadler and E.P. Smith, Pattern Recognition Engineering,
           Wiley-Interscience, 1993.
    .. [4] Wikipedia, https://en.wikipedia.org/wiki/Co-occurrence_matrix


    Examples
    --------
    Compute 4 GLCMs using 1-pixel distance and 4 different angles. For example,
    an angle of 0 radians refers to the neighboring pixel to the right;
    pi/4 radians to the top-right diagonal neighbor; pi/2 radians to the pixel
    above, and so forth.

    >>> image = np.array([[0, 0, 1, 1],
    ...                   [0, 0, 1, 1],
    ...                   [0, 2, 2, 2],
    ...                   [2, 2, 3, 3]], dtype=np.uint8)
    >>> result = graycomatrix(image, [1], [0, np.pi/4, np.pi/2, 3*np.pi/4],
    ...                       levels=4)
    >>> result[:, :, 0, 0]
    array([[2, 2, 1, 0],
           [0, 2, 0, 0],
           [0, 0, 3, 1],
           [0, 0, 0, 1]], dtype=uint32)
    >>> result[:, :, 0, 1]
    array([[1, 1, 3, 0],
           [0, 1, 1, 0],
           [0, 0, 0, 2],
           [0, 0, 0, 0]], dtype=uint32)
    >>> result[:, :, 0, 2]
    array([[3, 0, 2, 0],
           [0, 2, 2, 0],
           [0, 0, 1, 2],
           [0, 0, 0, 0]], dtype=uint32)
    >>> result[:, :, 0, 3]
    array([[2, 0, 0, 0],
           [1, 1, 2, 0],
           [0, 0, 2, 1],
           [0, 0, 0, 0]], dtype=uint32)

    r   r   Ú	distancesÚanglesz^Float images are not supported by graycomatrix. Convert the image to an unsigned integer type.Nz{The levels argument is required for data types other than uint8. The resulting matrix will be at least levels ** 2 in size.r   z)Negative-valued images are not supported.é   zUThe maximum grayscale value in the image should be smaller than the number of levels.©ÚdtypeÚC)r   Úorder)r   r   r   é   ©r   r   T©ÚaxisÚkeepdims)r   ÚnpÚascontiguousarrayÚmaxÚ
issubdtyper   ÚfloatingÚ
ValueErrorÚuint8Úint8ÚsignedintegerÚanyÚfloat64ÚzerosÚlenÚuint32r   Ú	transposeÚastypeÚsum)
Úimager   r   ÚlevelsÚ	symmetricÚnormedÚ	image_maxÚPÚPtÚ	glcm_sumss
             ú`/var/www/html/bac/bac_backend/python/env/lib/python3.11/site-packages/skimage/feature/texture.pyÚgraycomatrixr2      s  € õ@ ˆU�AÑÔÐÝˆY˜˜;Ñ'Ô'Ð'ÝˆV�Q˜Ñ!Ô!Ð!åÔ  Ñ'Ô'€Eà—	’	‘”€Iå	„}�U”[¥"¤+Ñ.Ô.ð 
Ýð=ñ
ô 
ð 	
ð „{�2œ8¥R¤WÐ-Ð-Ð-°&°.Ýð)ñ
ô 
ð 	
õ 
„}�U”[¥"Ô"2Ñ3Ô3ð F½¼¸uÀqºyÑ8IÔ8Ið FÝÐDÑEÔEÐEà€~Øˆà�FÒÐÝð1ñ
ô 
ð 	
õ
 Ô$ Yµb´jÐAÑAÔA€IÝÔ! &µ´
Ð;Ñ;Ô;€Få
ŒØ	��˜Y™œ­¨V©¬Ð5½R¼YÈcð	ñ 	ô 	€Aõ
 ˆu�i ¨°Ñ3Ô3Ð3ð ð ÝŒ\˜!˜\Ñ*Ô*ˆØ�‰Fˆð ð Ø�HŠH•R”ZÑ Ô ˆÝ”F˜1 6°DÐ9Ñ9Ô9ˆ	Ø$%ˆ	�)˜q’.Ñ!Ø	ˆY‰ˆà€Hó    Úcontrastc                 ó  ‡ ‡— ˆ ˆfd„}t          ‰ dd¦  «         ‰ j        \  Š}}}‰|k    rt          d¦  «        ‚|dk    rt          d¦  «        ‚|dk    rt          d¦  «        ‚‰                      t          j        ¦  «        Š t	          j        ‰ dd	¬
¦  «        }d||dk    <   ‰ |z  Š t          j        d‰…d‰…f         \  }}|dk    r	||z
  dz  }	nJ|dk    rt	          j        ||z
  ¦  «        }	n,|dk    rdd||z
  dz  z   z  }	n|dv rnt          |› d�¦  «        ‚|dk    r/t	          j        ‰ dz  d¬¦  «        }
t	          j	        |
¦  «        }�nµ|dk    rt	          j        ‰ dz  d¬¦  «        }�n”|dk    r |¦   «         \  }}�n|dk    r. |¦   «         \  }}t	          j        ‰ ||z
  dz  z  d¬¦  «        }�nK|dk    rB |¦   «         \  }}t	          j        ‰ ||z
  dz  z  d¬¦  «        }t	          j	        |¦  «        }�n|dk    rIt	          j
        ‰ ‰ dk    t	          j        ‰ ¦  «        ¬¦  «         }t	          j        ‰ |z  d¬¦  «        }�n´|dk    �rwt	          j        ||ft          j        ¬¦  «        }t	          j        t          ‰¦  «        ¦  «                             ‰dddf¦  «        }t	          j        t          ‰¦  «        ¦  «                             d‰ddf¦  «        }|t	          j        |‰ z  d¬¦  «        z
  }|t	          j        |‰ z  d¬¦  «        z
  }t	          j	        t	          j        ‰ |dz  z  d¬¦  «        ¦  «        }t	          j	        t	          j        ‰ |dz  z  d¬¦  «        ¦  «        }t	          j        ‰ ||z  z  d¬¦  «        }|dk     }d	||dk     <   d||<   | }||         ||         ||         z  z  ||<   n6|dv r2|	                     ‰‰ddf¦  «        }	t	          j        ‰ |	z  d¬¦  «        }|S )a
  Calculate texture properties of a GLCM.

    Compute a feature of a gray level co-occurrence matrix to serve as
    a compact summary of the matrix. The properties are computed as
    follows:

    - 'contrast': :math:`\sum_{i,j=0}^{levels-1} P_{i,j}(i-j)^2`
    - 'dissimilarity': :math:`\sum_{i,j=0}^{levels-1}P_{i,j}|i-j|`
    - 'homogeneity': :math:`\sum_{i,j=0}^{levels-1}\frac{P_{i,j}}{1+(i-j)^2}`
    - 'ASM': :math:`\sum_{i,j=0}^{levels-1} P_{i,j}^2`
    - 'energy': :math:`\sqrt{ASM}`
    - 'correlation':
        .. math:: \sum_{i,j=0}^{levels-1} P_{i,j}\left[\frac{(i-\mu_i) \
                  (j-\mu_j)}{\sqrt{(\sigma_i^2)(\sigma_j^2)}}\right]
    - 'mean': :math:`\sum_{i=0}^{levels-1} i*P_{i}`
    - 'variance': :math:`\sum_{i=0}^{levels-1} P_{i}*(i-mean)^2`
    - 'std': :math:`\sqrt{variance}`
    - 'entropy': :math:`\sum_{i,j=0}^{levels-1} -P_{i,j}*log(P_{i,j})`

    Each GLCM is normalized to have a sum of 1 before the computation of
    texture properties.

    .. versionchanged:: 0.19
           `greycoprops` was renamed to `graycoprops` in 0.19.

    Parameters
    ----------
    P : ndarray
        Input array. `P` is the gray-level co-occurrence histogram
        for which to compute the specified property. The value
        `P[i,j,d,theta]` is the number of times that gray-level j
        occurs at a distance d and at an angle theta from
        gray-level i.
    prop : {'contrast', 'dissimilarity', 'homogeneity', 'energy',             'correlation', 'ASM', 'mean', 'variance', 'std', 'entropy'}, optional
        The property of the GLCM to compute. The default is 'contrast'.

    Returns
    -------
    results : 2-D ndarray
        2-dimensional array. `results[d, a]` is the property 'prop' for
        the d'th distance and the a'th angle.

    References
    ----------
    .. [1] M. Hall-Beyer, 2007. GLCM Texture: A Tutorial v. 1.0 through 3.0.
           The GLCM Tutorial Home Page,
           https://prism.ucalgary.ca/handle/1880/51900
           DOI:`10.11575/PRISM/33280`

    Examples
    --------
    Compute the contrast for GLCMs with distances [1, 2] and angles
    [0 degrees, 90 degrees]

    >>> image = np.array([[0, 0, 1, 1],
    ...                   [0, 0, 1, 1],
    ...                   [0, 2, 2, 2],
    ...                   [2, 2, 3, 3]], dtype=np.uint8)
    >>> g = graycomatrix(image, [1, 2], [0, np.pi/2], levels=4,
    ...                  normed=True, symmetric=True)
    >>> contrast = graycoprops(g, 'contrast')
    >>> contrast
    array([[0.58333333, 1.        ],
           [1.25      , 2.75      ]])

    c                  ó”   •— t          j        ‰¦  «                             ‰dddf¦  «        } t          j        | ‰z  d¬¦  «        }| |fS )Nr   r   ©r   )r   ÚarangeÚreshaper(   )ÚIÚmeanr.   Ú	num_levels     €€r1   Ú	glcm_meanzgraycoprops.<locals>.glcm_meanï   sJ   ø€ ÝŒI�iÑ Ô ×(Ò(¨)°Q¸¸1Ð)=Ñ>Ô>ˆÝŒv�a˜!‘e &Ð)Ñ)Ô)ˆØ�$ˆwˆr3   é   r.   z'num_level and num_level2 must be equal.r   znum_dist must be positive.znum_angle must be positive.r   Tr   r   r4   r   ÚdissimilarityÚhomogeneityg      ð?)ÚASMÚenergyÚcorrelationÚentropyÚvariancer;   Ústdz is an invalid propertyrB   r7   rA   r;   rE   rF   rD   )ÚwhereÚoutrC   r   gVçž¯Ò<)r4   r?   r@   )r   Úshaper   r'   r   r"   r(   ÚogridÚabsÚsqrtÚlogÚ
zeros_liker#   ÚarrayÚranger9   )r.   Úpropr=   Ú
num_level2Únum_distÚ	num_angler0   r:   ÚJÚweightsÚasmÚresultsÚ_r;   ÚvarÚlnÚdiff_iÚdiff_jÚstd_iÚstd_jÚcovÚmask_0Úmask_1r<   s   `                      @r1   Úgraycopropsrc   ª   sl  øø€ ðJð ð ð ð ð õ
 ˆQ��3ÑÔÐà34´7Ñ0€Y�
˜H iØ�JÒÐÝÐBÑCÔCÐCØ�1‚}€}ÝÐ5Ñ6Ô6Ð6Ø�A‚~€~ÝÐ6Ñ7Ô7Ð7ð 	
�Š•”ÑÔ€AÝ”�q˜v°Ð5Ñ5Ô5€IØ !€Iˆi˜1ŠnÑØˆ�N€Aõ Œ8�A�i�K  9 Ð,Ô-�D€A€qØˆzÒÐØ�q‘5˜Q‘,ˆˆØ	�Ò	 Ð	 Ý”&˜˜Q™‘-”-ˆˆØ	�Ò	Ð	Ø˜  A¡¨!™|Ñ+Ñ,ˆˆØ	ÐWÐ	WÐ	WØå˜DÐ9Ð9Ð9Ñ:Ô:Ð:ð ˆxÒÐÝŒf�Q˜‘T Ð'Ñ'Ô'ˆÝ”'˜#‘,”,ˆ‰Ø	�ŠˆÝ”&˜˜A™ FÐ+Ñ+Ô+ˆ‰Ø	�ŠˆØ�Y‘[”[‰
ˆˆ7‰7Ø	�Ò	Ð	Ø�)‘+”+‰ˆˆ4Ý”&˜˜q 4™x¨A™oÑ.°VÐ<Ñ<Ô<ˆ‰Ø	�ŠˆØ�)‘+”+‰ˆˆ4ÝŒf�Q˜1˜t™8¨™/Ñ*°Ð8Ñ8Ô8ˆÝ”'˜#‘,”,ˆ‰Ø	�Ò	Ð	ÝŒf�Q˜q Ašv­B¬M¸!Ñ,<Ô,<Ð=Ñ=Ô=Ð=ˆÝ”&˜˜R™ fÐ-Ñ-Ô-ˆ‰à	�Ò	Ñ	Ý”(˜H iÐ0½¼
ÐCÑCÔCˆÝŒH•U˜9Ñ%Ô%Ñ&Ô&×.Ò.°	¸1¸aÀÐ/CÑDÔDˆÝŒH•U˜9Ñ%Ô%Ñ&Ô&×.Ò.°°9¸aÀÐ/CÑDÔDˆØ•R”V˜A ™E¨Ð/Ñ/Ô/Ñ/ˆØ•R”V˜A ™E¨Ð/Ñ/Ô/Ñ/ˆå”�œ˜q F¨q¡=Ñ0°vÐ>Ñ>Ô>Ñ?Ô?ˆÝ”�œ˜q F¨q¡=Ñ0°vÐ>Ñ>Ô>Ñ?Ô?ˆÝŒf�Q˜& 6™/Ñ*°Ð8Ñ8Ô8ˆð ˜’ˆØ $ˆˆu�uŠ}ÑØˆ�‰ð �ˆØ˜fœ+¨¨v¬¸¸v¼Ñ)FÑGˆ�‰ˆØ	Ð=Ð	=Ð	=Ø—/’/ 9¨i¸¸AÐ">Ñ?Ô?ˆÝ”&˜˜W™¨6Ð2Ñ2Ô2ˆà€Nr3   Údefaultc                 ó¼  — t          | d¦  «         t          d¦  «        t          d¦  «        t          d¦  «        t          d¦  «        t          d¦  «        dœ}t          j        | j        t          j        ¦  «        rt          j        d¦  «         t          j        | t          j	        ¬	¦  «        } t          | ||||                     ¦   «                  ¦  «        }|S )
aS	  Compute the local binary patterns (LBP) of an image.

    LBP is a visual descriptor often used in texture classification.

    Parameters
    ----------
    image : (M, N) array
        2D grayscale image.
    P : int
        Number of circularly symmetric neighbor set points (quantization of
        the angular space).
    R : float
        Radius of circle (spatial resolution of the operator).
    method : str {'default', 'ror', 'uniform', 'nri_uniform', 'var'}, optional
        Method to determine the pattern:

        ``default``
            Original local binary pattern which is grayscale invariant but not
            rotation invariant.
        ``ror``
            Extension of default pattern which is grayscale invariant and
            rotation invariant.
        ``uniform``
            Uniform pattern which is grayscale invariant and rotation
            invariant, offering finer quantization of the angular space.
            For details, see [1]_.
        ``nri_uniform``
            Variant of uniform pattern which is grayscale invariant but not
            rotation invariant. For details, see [2]_ and [3]_.
        ``var``
            Variance of local image texture (related to contrast)
            which is rotation invariant but not grayscale invariant.

    Returns
    -------
    output : (M, N) array
        LBP image.

    References
    ----------
    .. [1] T. Ojala, M. Pietikainen, T. Maenpaa, "Multiresolution gray-scale
           and rotation invariant texture classification with local binary
           patterns", IEEE Transactions on Pattern Analysis and Machine
           Intelligence, vol. 24, no. 7, pp. 971-987, July 2002
           :DOI:`10.1109/TPAMI.2002.1017623`
    .. [2] T. Ahonen, A. Hadid and M. Pietikainen. "Face recognition with
           local binary patterns", in Proc. Eighth European Conf. Computer
           Vision, Prague, Czech Republic, May 11-14, 2004, pp. 469-481, 2004.
           http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.214.6851
           :DOI:`10.1007/978-3-540-24670-1_36`
    .. [3] T. Ahonen, A. Hadid and M. Pietikainen, "Face Description with
           Local Binary Patterns: Application to Face Recognition",
           IEEE Transactions on Pattern Analysis and Machine Intelligence,
           vol. 28, no. 12, pp. 2037-2041, Dec. 2006
           :DOI:`10.1109/TPAMI.2006.244`
    r   ÚDÚRÚUÚNÚV)rd   ÚrorÚuniformÚnri_uniformrZ   zßApplying `local_binary_pattern` to floating-point images may give unexpected results when small numerical differences between adjacent pixels are present. It is recommended to use this function with images of integer dtype.r   )r   Úordr   r   r   r   ÚwarningsÚwarnr   r"   r	   Úlower)r)   r.   rg   ÚmethodÚmethodsÚoutputs         r1   Úlocal_binary_patternru   >  sÁ   € õr ˆU�AÑÔÐõ �s‘8”8Ý�3‰xŒxÝ�s‘8”8Ý˜3‘x”xÝ�3‰xŒxðð €Gõ 
„}�U”[¥"¤+Ñ.Ô.ð 
ÝŒð5ñ	
ô 	
ð 	
õ Ô  ­b¬jÐ9Ñ9Ô9€EÝ" 5¨!¨Q°¸¿º¹¼Ô0GÑHÔH€FØ€Mr3   c                 ól   — t          j        | t           j        ¬¦  «        } t          | ||||¦  «        }|S )a  Multi-block local binary pattern (MB-LBP).

    The features are calculated similarly to local binary patterns (LBPs),
    (See :py:meth:`local_binary_pattern`) except that summed blocks are
    used instead of individual pixel values.

    MB-LBP is an extension of LBP that can be computed on multiple scales
    in constant time using the integral image. Nine equally-sized rectangles
    are used to compute a feature. For each rectangle, the sum of the pixel
    intensities is computed. Comparisons of these sums to that of the central
    rectangle determine the feature, similarly to LBP.

    Parameters
    ----------
    int_image : (N, M) array
        Integral image.
    r : int
        Row-coordinate of top left corner of a rectangle containing feature.
    c : int
        Column-coordinate of top left corner of a rectangle containing feature.
    width : int
        Width of one of the 9 equal rectangles that will be used to compute
        a feature.
    height : int
        Height of one of the 9 equal rectangles that will be used to compute
        a feature.

    Returns
    -------
    output : int
        8-bit MB-LBP feature descriptor.

    References
    ----------
    .. [1] L. Zhang, R. Chu, S. Xiang, S. Liao, S.Z. Li. "Face Detection Based
           on Multi-Block LBP Representation", In Proceedings: Advances in
           Biometrics, International Conference, ICB 2007, Seoul, Korea.
           http://www.cbsr.ia.ac.cn/users/scliao/papers/Zhang-ICB07-MBLBP.pdf
           :DOI:`10.1007/978-3-540-74549-5_2`
    r   )r   r   Úfloat32r
   )Ú	int_imageÚrÚcÚwidthÚheightÚlbp_codes         r1   Úmultiblock_lbpr~   Œ  s6   € õT Ô$ Yµb´jÐAÑAÔA€IÝ˜y¨!¨Q°°vÑ>Ô>€HØ€Or3   ©r   r   r   ©r   g®Gázæ?g¸…ëQ¸î?ç      à?c	                 óÒ  — t          j        |t           j        ¬¦  «        }t          j        |t           j        ¬¦  «        }t          j        | ¦  «        }	t	          | j        ¦  «        dk     rt          | ¦  «        }	t          |	¦  «        }	d}
t          j        |
¦  «        }
|
dd…dfxx         |z  cc<   |
dd…dfxx         |z  cc<   ||z   }||z   }t          |
¦  «        D ]„\  }}|\  }}||z   }||z   }|dd|z
  z  z  }|r2d|z
  |	|||z   …|||z   …f         z  ||z  z   }||	|||z   …|||z   …f<   ŒSd|z
  |	|||z   …|||z   …f         z  ||z  z   }||	|||z   …|||z   …f<   Œ…|	S )aý  Multi-block local binary pattern visualization.

    Blocks with higher sums are colored with alpha-blended white rectangles,
    whereas blocks with lower sums are colored alpha-blended cyan. Colors
    and the `alpha` parameter can be changed.

    Parameters
    ----------
    image : ndarray of float or uint
        Image on which to visualize the pattern.
    r : int
        Row-coordinate of top left corner of a rectangle containing feature.
    c : int
        Column-coordinate of top left corner of a rectangle containing feature.
    width : int
        Width of one of 9 equal rectangles that will be used to compute
        a feature.
    height : int
        Height of one of 9 equal rectangles that will be used to compute
        a feature.
    lbp_code : int
        The descriptor of feature to visualize. If not provided, the
        descriptor with 0 value will be used.
    color_greater_block : tuple of 3 floats
        Floats specifying the color for the block that has greater
        intensity value. They should be in the range [0, 1].
        Corresponding values define (R, G, B) values. Default value
        is white (1, 1, 1).
    color_greater_block : tuple of 3 floats
        Floats specifying the color for the block that has greater intensity
        value. They should be in the range [0, 1]. Corresponding values define
        (R, G, B) values. Default value is cyan (0, 0.69, 0.96).
    alpha : float
        Value in the range [0, 1] that specifies opacity of visualization.
        1 - fully transparent, 0 - opaque.

    Returns
    -------
    output : ndarray of float
        Image with MB-LBP visualization.

    References
    ----------
    .. [1] L. Zhang, R. Chu, S. Xiang, S. Liao, S.Z. Li. "Face Detection Based
           on Multi-Block LBP Representation", In Proceedings: Advances in
           Biometrics, International Conference, ICB 2007, Seoul, Korea.
           http://www.cbsr.ia.ac.cn/users/scliao/papers/Zhang-ICB07-MBLBP.pdf
           :DOI:`10.1007/978-3-540-74549-5_2`
    r   r   ))éÿÿÿÿrƒ   )rƒ   r   )rƒ   r   r   )r   r   )r   r   )r   rƒ   )r   rƒ   Nr   r   é   )
r   Úasarrayr"   Úcopyr$   rI   r   r   rO   Ú	enumerate)r)   ry   rz   r{   r|   r}   Úcolor_greater_blockÚcolor_less_blockÚalphart   Úneighbor_rect_offsetsÚcentral_rect_rÚcentral_rect_cÚelement_numÚoffsetÚoffset_rÚoffset_cÚcurr_rÚcurr_cÚhas_greater_valueÚ	new_values                        r1   Údraw_multiblock_lbpr–   »  s  € õ@ œ*Ð%8ÅÄ
ÐKÑKÔKÐÝ”zÐ"2½"¼*ÐEÑEÔEÐõ ŒW�U‰^Œ^€Fõ ˆ5Œ;ÑÔ˜!ÒÐÝ˜%‘”ˆõ ˜&Ñ!Ô!€Fð	Ðõ œHÐ%:Ñ;Ô;ÐØ˜!˜!˜!˜Q˜$ÐÐÔ 6Ñ)ÐÐÑØ˜!˜!˜!˜Q˜$ÐÐÔ 5Ñ(ÐÐÑð ˜‘Z€NØ˜‘Y€Nå(Ð)>Ñ?Ô?ð Rð RÑˆ�VØ#Ñˆ�(à (Ñ*ˆØ (Ñ*ˆà$¨¨a°+©oÑ(>Ñ?Ðð ð 		RØ˜U™ fØ˜ &™Ð(¨&°6¸E±>Ð*AÐAô'ñ àÐ+Ñ+ñ,ˆIð IRˆF�6˜F V™OÐ+¨V°f¸u±nÐ-DÐDÑEÐEà˜U™ fØ˜ &™Ð(¨&°6¸E±>Ð*AÐAô'ñ àÐ(Ñ(ñ)ˆIð IRˆF�6˜F V™OÐ+¨V°f¸u±nÐ-DÐDÑEÐEà€Mr3   )NFF)r4   )rd   )r   r   r€   r�   )Ú__doc__ro   Únumpyr   Ú_shared.utilsr   Úcolorr   Úutilr   Ú_texturer   r	   r
   r2   rc   ru   r~   r–   © r3   r1   ú<module>rž      s  ððð ð €€€à Ð Ð Ð à $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HðXð Xð Xð XðvQð Qð Qð QðhKð Kð Kð Kð\,ð ,ð ,ðj Ø!Ø$Ø
ðwð wð wð wð wð wr3   