Beispiel #1
0
def _read_img(x: str):
    img = cv2.imread(x)
    if img is None:
        logger.warning(
            f'Can not read image {x} with OpenCV, switching to scikit-image')
        img = imread(x)
    return img
Beispiel #2
0
def read_mask(x: str):
    mask = cv2.imread(x, cv2.IMREAD_GRAYSCALE)
    if mask is None:
        logger.warning(
            f"Can not read image {x} with OpenCV, switching to scikit-image")
        mask = imread(x, as_gray=True)
    return np.expand_dims(mask, axis=-1)
Beispiel #3
0
def read_img(x: str):
    img = cv2.cvtColor(cv2.imread(x), cv2.COLOR_BGR2RGB)
    if img is None:
        logger.warning(
            f"Can not read image {x} with OpenCV, switching to scikit-image")
        img = imread(x)
    return img
Beispiel #4
0
def _read_img(x: str):
    img = cv2.imread(x)
    if img is None:
        logger.warning(f'Can not read image {x} with OpenCV')
        raise IOError('')
    return img