kornia/tutorials

Update tutorials with Kornia.io

Closed this issue · 0 comments

Update in tutorials and examples to showcase Kornia.io

Include the following python function pattern

def load_img(img_path: Union[str, Path]) -> Tensor:
    img: Tensor
    try:
        # not ready on Windows machine
        img = K.io.load_image(img_path, K.io.ImageLoadType.RGB32)
    except:
        import cv2
        img = cv2.imread(img_path, cv2.IMREAD_COLOR)
        img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
        img = K.image_to_tensor(img).float() / 255.
    return img