Ë
    ½Gìj<  ã                   ól   — d dl Zd dlZd dlmZ  eddd¬«      d„ «       Z eddd¬«      d„ «       Zd
d	„Zy)é    N)Únjitzf8[:, :](f8[:, :], f8)T)ÚcacheÚnogilc                 óR  — | j                   \  }}t        j                  ||f«      }t        |«      D ]r  }t        |«      D ]b  }t        j                  t        j
                  |«       t        j                  t        j                  | |   | |   z
  «      «      z  «      |||f<   Œd Œt |S )N)ÚshapeÚnpÚzerosÚrangeÚexpÚsqrtÚsumÚsquare)ÚXÚvÚnÚmÚKÚiÚjs          úfC:\Users\Stabi\Downloads\virtual-tryon(1)\venv\Lib\site-packages\pymatting/laplacian/lbdm_laplacian.pyÚcalculate_kernel_matrixr      s‡   € à�7‰7�D€A€qÜ
�‰�!�Q�Ó€AÜ�1ŽXˆÜ�q–ˆAÜ—f‘fœbŸg™g a›j˜[¬2¯6©6´"·)±)¸A¸a¹DÀ1ÀQÁ4¹KÓ2HÓ+IÑIÓJˆAˆa�ˆdŠGñ ð ð €Hó    z1Tuple((f8[:], i4[:], i4[:]))(f8[:, :, :], f8, i4)c           	      ó  — | j                   d d \  }}||z  }d|z  dz   dz  }t        j                  |«      j                  ||«      }t        j                  ||dz  f«      }t        j                  ||dz  ft        j
                  ¬«      }	t        j                  ||dz  ft        j
                  ¬«      }
t        |||z
  «      D �]“  }t        |||z
  «      D �]}  }|||z  z   }t        j                  |df«      }d}t        ||z
  ||z   dz   «      D ]>  }t        ||z
  ||z   dz   «      D ]$  }t        d«      D ]  }| |||f   |||f<   Œ |dz  }Œ& Œ@ |||z
  ||z   dz   …||z
  ||z   dz   …f   j                  «       }t        j                  ||j                  «      }t        j                  j                  ||t        j                  |«      z  z   |«      }t        j                  |j                   d   «      |z
  }|j                  |j                  «      }t        |«      D ]  }||	||d |…f<   ||
|||z  ||z  |z   …f<   Œ  |j                  «       ||<   �Œ€ �Œ– |j                  «       |	j                  «       |
j                  «       fS )Né   é   )Údtypeé   r   é   )r   r   ÚarangeÚreshaper	   Úint32r
   ÚonesÚflattenÚdotÚTÚlinalgÚsolveÚeyeÚravel)ÚimageÚepsilonÚrÚhÚwr   ÚareaÚindicesÚvaluesÚi_indsÚj_indsÚyÚxr   r   ÚkÚy2Úx2ÚcÚwindow_indicesr   ÚfÚtmp2Útmp3s                           r   Ú_lbdm_laplacianr>      sg  € à�;‰;�r˜ˆ?�D€A€qØ	ˆA‰€Aà�‰E�A‰I˜!Ñ€Dä�i‰i˜‹l×"Ñ" 1 aÓ(€Gä�X‰X�q˜$ !™)�nÓ%€FÜ�X‰X�q˜$ !™)�n¬B¯H©HÔ5€FÜ�X‰X�q˜$ !™)�n¬B¯H©HÔ5€Fô
 �1�a˜!‘e�_ˆÜ�q˜!˜a™%—ˆAØ�A˜‘E‘	ˆAä—‘˜˜u˜Ó&ˆAàˆAÜ˜A ™E 1 q¡5¨1¡9Ö-�Ü  A¡ q¨1¡u¨q¡yÖ1�BÜ" 1žX˜Ø"'¨¨B°¨	Ñ"2˜˜!˜Q˜$šð &à˜‘F‘Añ 2ð .ð % Q¨¡U¨Q°©U°Q©YÐ%6¸¸A¹ÀÀAÁÈÁ	Ð8IÐ%IÑJ×RÑRÓTˆNô
 —‘�q˜!Ÿ#™#“ˆAä—	‘	—‘  G¬b¯f©f°T«lÑ$:Ñ :¸AÓ>ˆAä—6‘6˜!Ÿ'™' !™*Ó%¨Ñ)ˆDØ—8‘8˜DŸF™FÓ#ˆDä˜4–[�Ø%3��q˜!˜'˜T˜'�zÑ"Ø8F��q˜!˜d™( Q¨¡X°¡_Ð4Ð4Ò5ð !ð Ÿ
™
›ˆF�1‹Iò7 !ð ð< �<‰<‹>˜6Ÿ<™<›>¨6¯<©<«>Ð9Ð9r   c                 ó¤   — | j                   dd \  }}||z  }t        | ||«      \  }}}t        j                  j	                  |||ff||f¬«      }	|	S )a&  
    Calculate a Laplacian matrix based on :cite:`zheng2009learning`.

    Parameters
    ----------
    image: numpy.ndarray
       Image with shape :math:`h\times w \times 3`
    epsilon: float
       Regularization strength, defaults to :math:`10^{-7}`. Strong
       regularization improves convergence but results in smoother alpha mattes.
    radius: int
       Radius of local window size, defaults to :math:`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.csr_matrix
        Matting Laplacian
    Nr   )r   )r   r>   ÚscipyÚsparseÚ
csr_matrix)
r*   r+   Úradiusr-   r.   r   r1   r2   r3   ÚLs
             r   Úlbdm_laplacianrE   @   sa   € ð. �;‰;�r˜ˆ?�D€A€qØ	ˆA‰€Aä,¨U°G¸VÓDÑ€FˆF�Fä�‰×Ñ ¨&°&Ð)9Ð :À1ÀaÀ&ÐÓI€Aà€Hr   )gH¯¼šò×z>r   )	Únumpyr   Úscipy.sparser@   Únumbar   r   r>   rE   © r   r   Ú<module>rJ      sO   ðÛ Û Ý áÐ d°$Ô7ñó 8ðñ Ð9ÀÈTÔRñ-:ó Sð-:ô`r   