+
    Ai                      L    ^ RI Ht ^ RIHt ^ RI Ht ^ RIHt ^ RIt/ / 3R lt	R# )    )sanity_check_image)lkm_laplacian)trimap_split)cgNc                8  aaa \        V 4       \        V 3/ VB w  op\        V4      w  rVrxRp	W,          oW,          p
RVS,           ,          oVV3R lpV3R lp\        W3RV/VB p\        P
                  ! V^ ^4      P                  VP                  4      pV# )a  
Estimate alpha from an input image and an input trimap as described in Fast Matting Using Large Kernel Matting Laplacian Matrices by :cite:`he2010fast`.

Parameters
----------
image: numpy.ndarray
    Image with shape :math:`h \times  w \times d` for which the alpha matte should be estimated
trimap: numpy.ndarray
    Trimap with shape :math:`h \times  w` of the image
laplacian_kwargs: dictionary
    Arguments passed to the :code:`lkm_laplacian` function
cg_kwargs: dictionary
    Arguments passed to the :code:`cg` solver

Returns
-------
alpha: numpy.ndarray
    Estimated alpha matte

Example
-------
>>> from pymatting import *
>>> image = load_image("data/lemur/lemur.png", "RGB")
>>> trimap = load_image("data/lemur/lemur_trimap.png", "GRAY")
>>> alpha = estimate_alpha_lkm(
...     image,
...     trimap,
...     laplacian_kwargs={"epsilon": 1e-6, "radius": 15},
...     cg_kwargs={"maxiter":2000})

g      Y@g      ?c                 0   < S! V 4      SV ,          ,           # N )xL_matveccs   &`/var/www/html/photoedit/myenv/lib/python3.14/site-packages/pymatting/alpha/estimate_alpha_lkm.pyA_matvec$estimate_alpha_lkm.<locals>.A_matvec6   s    {QU""    c                    < SV ,          # r	   r
   )r   
inv_diag_As   &r   jacobi"estimate_alpha_lkm.<locals>.jacobi9   s    A~r   M)r   r   r   r   npclipreshapeshape)imagetrimaplaplacian_kwargs	cg_kwargsdiag_Lis_fgis_bgis_known
is_unknownlambda_valuebr   r   r   alphar   r   r   s   &&&&           @@@r   estimate_alpha_lkmr'      s    B u$U?.>?Hf)5f)=&E(LAA
#J# 	8.&.I.AGGAq!$$V\\2ELr   )
pymatting.util.utilr   !pymatting.laplacian.lkm_laplacianr   r   pymatting.solver.cgr   numpyr   r'   r
   r   r   <module>r,      s     2 ; , "  8:R 8r   