+
    œ°³jÒ  ã                   óº   € ^ RI t ^ RIHu Ht ^RIHt ^RIHt ^RI	H
t
Ht ^RIHtHt ^RIHt ^RIHt ^RIHt ]]! RR	7       ! R
 R]4      4       4       tR.tR# )é    N)ÚBatchFeature)ÚTorchvisionBackend)Úgroup_images_by_shapeÚreorder_images)ÚPILImageResamplingÚSizeDict)Úauto_docstring)Ú
TensorType)Úrequires)Úbackendsc                   ót   a € ] tR t^"t o RtRtRRRR/t]P                  t	V 3R lR lt
RV 3R lR	 lltR
tV tR# )ÚUVDocImageProcessorTÚheightiÈ  Úwidthiè  c                óò   <€ V ^8„  d   QhRS[ R,          RS[RS[RS[RS[RS[RS[S[ S[,          ,          R	,          R
S[S[ S[,          ,          R	,          RS[R	,          RS[S[,          R	,          RS[/# )é   Úimagesztorch.TensorÚ	do_resizeÚsizeÚ
do_rescaleÚrescale_factorÚdo_normalizeÚ
image_meanNÚ	image_stdÚdisable_groupingÚreturn_tensorsÚreturn)ÚlistÚboolr   ÚfloatÚstrr
   r   )ÚformatÚ__classdict__s   "€Úq/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/uvdoc/image_processing_uvdoc.pyÚ__annotate__Ú UVDocImageProcessor.__annotate__*   s¨   ø€ ÷ /
ñ /
á�^Õ$ð/
ñ ð/
ñ ð	/
ñ
 ð/
ñ ð/
ñ ð/
ñ ™D¡�KÕ'¨$Õ.ð/
ñ ™4¡�;Õ&¨Õ-ð/
ñ  �+ð/
ñ ™jÕ(¨4Õ/ð/
ñ 
ñ/
ó    c           	     óè  € \        WR 7      w  rÍ/ pVP                  4        F-  w  ppV P                  VWEWgV4      pVR. RORR3,          pVWï&   K/  	  \        Wí4      pVP	                  4       p\        VV	R 7      w  rÍ/ pVP                  4        FC  w  ppV'       d1   \
        P                  ! VVP                  VP                  3RRR7      pVVV&   KE  	  \        VV4      p\        RVRV/V
R.R7      # )	)r   :NNNÚbilinearT©r   ÚmodeÚalign_cornersÚpixel_valuesÚoriginal_images)ÚdataÚtensor_typeÚskip_tensor_conversion)r   é   r   )
r   ÚitemsÚrescale_and_normalizer   ÚcopyÚFÚinterpolater   r   r   )Úselfr   r   r   r   r   r   r   r   r   r   ÚkwargsÚgrouped_imagesÚgrouped_images_indexÚprocessed_images_groupedÚshapeÚstacked_imagesÚrescale_and_normalize_imagesr.   Úinterpolated_images_groupedr-   s   &&&&&&&&&&&,         r$   Ú_preprocessÚUVDocImageProcessor._preprocess*   s   € ô 0EÀVÔ/oÑ,ˆØ#%Ð Ø%3×%9Ñ%9Ö%;Ñ!ˆE�>Ø!×7Ñ7Ø 
¸LÐV_óˆNð ,¨Aªy¸!¸QÐ,>Õ?ˆNØ.<Ð$Ó+ñ &<ô (6Ð6NÓ'eÐ$à6×;Ñ;Ó=ˆä/DØ(Ð;Kô0
Ñ,ˆð ')Ð#à%3×%9Ñ%9Ö%;Ñ!ˆE�>çÜ!"§¢Ø"¨$¯+©+°t·z±zÐ)BÈÐcgô"�ð 2@Ð'¨Ó.ñ &<ô &Ð&AÐCWÓXˆäØ  ,Ð0AÀ?ÐSØ&Ø$5Ð#6ô
ð 	
r'   c                ó¤   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[RS[S[S[S[ P                  3,          ,          /# )r   Ú
predictionr.   Úscaler   )ÚtorchÚTensorr   r    Údictr!   )r"   r#   s   "€r$   r%   r&   [   sS   ø€ ÷ 5ñ 5á—L‘Lð5ñ ™eŸl™lÕ+ð5ñ ð	5ñ
 
‰d‘3™Ÿ™Ð$Õ%Õ	&ñ5r'   c                óÈ  € \        V4      p\        P                  ! R\        V4      VP                  R7      p. p\        V4       EF  w  rgVP                  ^8X  d   VP                  ^ 4      pVP                  VP                  4      pVP                  R,          w  r‰\        P                  ! WV^,            W‰3RRR7      p
V
P                  ^ ^^^4      p\        P                  ! W{RR7      pVP                  ^ 4      P                  ^^^ 4      pWÓ,          pVP                  R.R7      P                  \        P                   RRR	7      pVP#                  R
V/4       EK  	  V# )aN  
Post-process document rectification predictions to convert them into rectified images.

Args:
    prediction: Predicted 2D Bezier mesh coordinates, shape (B, 2, H, W)
    original_images: List of original input tensors, each of shape (C, H_i, W_i). Images may have different sizes.
    scale: Scaling factor for output images (default: 255.0)

Returns:
    List of dictionaries containing rectified images. Each dictionary has:
        - "images": Rectified image tensor of shape (H, W, 3) with dtype torch.uint8
                  and BGR channel order (suitable for OpenCV visualization)
)Údevice:r   NNr)   Tr*   )r,   )ÚdimsF)ÚdtypeÚnon_blockingr5   r   © éÿÿÿÿ)r   rF   Úfullr    rJ   Ú	enumerateÚndimÚ	unsqueezeÚtor=   r6   r7   ÚpermuteÚgrid_sampleÚsqueezeÚflipÚuint8Úappend)r8   rD   r.   rE   Ú
image_listÚresultsÚiÚoriginal_imageÚoriginal_heightÚoriginal_widthÚupsampled_meshÚrearranged_meshÚ	rectifiedÚimages   &&&&          r$   Ú#post_process_document_rectificationÚ7UVDocImageProcessor.post_process_document_rectification[   sF  € ô& ˜/Ó*ˆ
Ü—
’
˜2œu U›|°J×4EÑ4EÔFˆØˆä!*¨:×!6ÑˆAà×"Ñ" aÔ'Ø!/×!9Ñ!9¸!Ó!<�Ø+×.Ñ.¨z×/@Ñ/@ÓAˆNØ.<×.BÑ.BÀ2Õ.FÑ+ˆOô Ÿ]š]Ø˜q 1�uÐ%Ø%Ð6ØØ"ô	ˆNð -×4Ñ4°Q¸¸1¸aÓ@ˆOô Ÿš nÐUYÔZˆIð ×%Ñ% aÓ(×0Ñ0°°A°qÓ9ˆEð •MˆEà—J‘J R D�JÓ)×,Ñ,´5·;±;ÈTÐX]Ð,Ó^ˆEà�N‰N˜H eÐ,×-ñ9 "7ð< ˆr'   rN   N)g     ào@)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r   r   ÚBILINEARÚresamplerA   re   Ú__static_attributes__Ú__classdictcell__)r#   s   @r$   r   r   "   sD   ø‡ € ð €JØ€IØ�c˜7 CÐ(€DØ!×*Ñ*€H÷/
ð /
÷b5÷ 5ð 5r'   r   )rF   )rF   Útorch.nn.functionalÚnnÚ
functionalr6   Úfeature_extraction_utilsr   Úimage_processing_backendsr   Úimage_transformsr   r   Úimage_utilsr   r   Úutilsr	   Úutils.genericr
   Úutils.import_utilsr   r   Ú__all__rN   r'   r$   Ú<module>rz      s\   ðó, ß Ð å 4Ý ;ß Eß 7Ý #Ý 'Ý *ð Ù	�:ÔôlÐ,ó ló ó ðlð^ !Ð
!‚r'   