o
    :Î®cã  ã                   @   s*   d dl mZmZmZ d dlZddd„ZdS )é    )Úgrid_coordinatesÚsparse_conv_matrixÚweights_to_laplacianNé   c                 C   s<   | j dd… \}}d| d }t||t ||f¡ƒ}t|ƒS )at  This function returns a Laplacian matrix with all weights equal to one.

    Parameters
    ------------
    image: numpy.ndarray
        Image with shape :math:`h\times w \times 3`
    radius: int
        Radius of local window size, defaults to 1, i.e. only adjacent pixels are considered.
       The size of the local window is given as :math:`(2 r + 1)^2`, where :math:`r` denotes         the radius. A larger radius might lead to violated color line constraints, but also
       favors further propagation of information within the image.

    Returns
    -------
    L: scipy.sparse.spmatrix
        Matting Laplacian
    Né   r   )Úshaper   ÚnpÚonesr   )ÚimageÚradiusÚheightÚwidthÚwindow_sizeÚW© r   úL/tmp/pip-target-vg8gfxp4/lib/python/pymatting/laplacian/uniform_laplacian.pyÚuniform_laplacian	   s   r   )r   )Úpymatting.util.utilr   r   r   Únumpyr   r   r   r   r   r   Ú<module>   s    