o
    1 i                  
   @   s   d dl Z d dlZd dlZd dlmZ eeZedd Z	zd dl
Z
e
jd ed W n eyM Z ze	drAede dZ
W Y dZ[ndZ[ww ed	ejd
ededejfddZed	ejdejfddZededejfddZdS )    N)DeveloperAPIc                 C   s,   z	t j|  W dS  t jjy   Y dS w )NTF)	importlibmetadataversionZPackageNotFoundError)package_name r   b/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/ray/rllib/utils/images.pyis_package_installed   s   r	   FzCV2 found for image processing.zopencv-pythonzOpenCV is installed, but we failed to import it. This may be because you need to install `opencv-python-headless` instead of `opencv-python`. Error message: imgheightwidthreturnc                 C   s"   t stdt j| ||ft jdS )N6`opencv` not installed! Do `pip install opencv-python`)interpolation)cv2ModuleNotFoundErrorresizeZ
INTER_AREA)r
   r   r   r   r   r   r   $   s
   r   c                 C   s   t stdt | t jS Nr   )r   r   ZcvtColorZCOLOR_RGB2GRAY)r
   r   r   r   rgb2gray-   s
   r   img_filec                 C   s   t stdt | tjS r   )r   r   imreadZastypenpZfloat32)r   r   r   r   r   6   s
   r   )r   loggingnumpyr   Zray.rllib.utils.annotationsr   	getLogger__name__loggerr	   r   ZoclZsetUseOpenCLdebugImportErroreZndarrayintr   r   strr   r   r   r   r   <module>   s6    


 