o
    `۷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versionPackageNotFoundError)package_name r   L/home/ubuntu/vllm_env/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resize
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   cvtColorCOLOR_RGB2GRAY)r   r   r   r	   rgb2gray-   s
   r   img_filec                 C   s   t stdt | tjS r   )r   r   imreadastypenpfloat32)r   r   r   r	   r   6   s
   r   )r   loggingnumpyr   ray.rllib.utils.annotationsr   	getLogger__name__loggerr
   r   oclsetUseOpenCLdebugImportErrorendarrayintr   r   strr   r   r   r   r	   <module>   s6    


 