U
    !?h                     @   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 )ar  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   npZonesr   )imageZradiusheightwidthZwindow_sizeW r   W/var/www/html/venv/lib/python3.8/site-packages/pymatting/laplacian/uniform_laplacian.pyuniform_laplacian	   s    r   )r   )Zpymatting.util.utilr   r   r   numpyr   r   r   r   r   r   <module>   s   