Scheaven
2021-09-18 291deeb1fcf45dbf39a24aa72a213ff3fd6b3405
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
U
#’—_Áã@s6dZddlZddlmZmZddlmZddd„ZdS)z9
@author:  liaoxingyu
@contact: sherlockliao01@gmail.com
éN)ÚImageÚImageOps)Ú PathManagerc
CsÄt |d¡®}t |¡}zt |¡}Wntk
r:YnX|dk    r^|}|dkrTd}| |¡}t |¡}|dkrŒ|dd…dd…ddd…f}|dkr t     |d¡}t 
|¡}|W5QR£SQRXdS)a,
    Read an image into the given format.
    Will apply rotation and flipping if the image has such exif information.
    Args:
        file_name (str): image file path
        format (str): one of the supported image modes in PIL, or "BGR"
    Returns:
        image (np.ndarray): an HWC image
    ÚrbNZBGRZRGBéÿÿÿÿÚL) rÚopenrrZexif_transposeÚ    ExceptionÚconvertÚnpÚasarrayÚ expand_dimsZ    fromarray)Ú    file_nameÚformatÚfZimageZconversion_format©rú./data/data_utils.pyÚ
read_image s$
 
 
 
 
r)N)    Ú__doc__Únumpyr ZPILrrZ utils.file_iorrrrrrÚ<module>s