Ë
    {Dìj‹  ã                   ó:   — d Z ddlZddlmZmZmZmZ ddlm	Z	 d„ Z
y)zÔ
"warp" engine: works on any CPU, no downloads, ~0.3 s per photo.
Same pipeline as the live mode: MediaPipe finds the body, the old clothes are
painted over, and the garment is perspective-warped onto the torso.
é    Né   )Úblend_warpedÚcover_clothesÚ	fit_quadsÚ
warp_dress)Údetect_bodyc                 ó‚  — t        | «      }|€y| j                  dd \  }}|d   t        j                  ||gt        j                  ¬«      z  }t        |dd |j                  ||«      }	t        | j                  ||	«      }
|d   |d   d	œ}|
€| |fS t        | ||	d
   |d   |||
dd…dd…df   ¬«      }t        ||
«      |fS )zMReturn (edited photo BGR, info dict), or (None, None) if no person was found.N)NNé   Úpoints)Údtypeé   Úhips_okÚlegs_ok)r   r   r   Úmaské   )Údress_alpha)	r   ÚshapeÚnpÚarrayÚfloat32r   r   r   r   )Ú	frame_bgrÚ
dress_bgraÚdress_colorÚanchorsÚsleevesÚ	detectionÚhÚwÚ	points_pxÚfitÚwarpedÚinfoÚresults                úUC:\Users\Stabi\Downloads\virtual-tryon(1)\virtual-tryon\tryon\services\engine_warp.pyÚrenderr%      sÝ   € ä˜IÓ&€IØÐØà�?‰?˜2˜AÐ�D€A€qØ˜(Ñ#¤b§h¡h°°1¨v¼R¿Z¹ZÔ&HÑH€IÜ
�I˜b˜q�M :×#3Ñ#3°W¸jÓ
I€CÜ˜	Ÿ™¨°SÓ9€FØ  Ñ+¸	À)Ñ8LÑM€DØ€~Ø˜$ˆÐäØ�9˜c !™f i°Ñ&7¸ÀgØš1ša ˜7‘Oô€Fô ˜ Ó'¨Ð-Ð-ó    )Ú__doc__Únumpyr   Úoverlayr   r   r   r   Úpose_detectorr   r%   © r&   r$   Ú<module>r,      s   ðñó
 ç GÓ GÝ &ó.r&   