o
    0j                     @   s<   d dl ZddlmZmZ edrd dlZeddd ZdS )    N   )function_requires_depsis_dep_availablezopencv-contrib-pythonc                 C   s   |dk s|dkrt d|dk r| S | jd d \}}|d |d f}d}t|||}t|d }t|d }t|| ||  }	t|| ||  }
|d	  |	| d 7  < |d
  |
| d 7  < |	|
f}tj| ||tjd}|S )Nr   ih  z#`angle` should be in range [0, 360)gHz>   g      ?)r   r   )r      )r   r   )r   r   )flags)	
ValueErrorshapecv2ZgetRotationMatrix2DnpabsintZ
warpAffineZINTER_CUBIC)imageZanglehwcenterscaleZmatcossinZnew_wZnew_hZdst_sizeZrotated r   y/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/paddlex/inference/pipelines/components/common/warp_image.pyrotate_image   s,   r   )numpyr   Z
utils.depsr   r   r
   r   r   r   r   r   <module>   s   