File size: 338 Bytes
22b8701 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import cv2
import numpy as np
from pathlib import Path
from typing import Union
def imread_rgb(img_path: Union[str, Path]) -> np.ndarray:
return cv2.cvtColor(cv2.imread(str(img_path)), cv2.COLOR_BGR2RGB)
def imwrite_rgb(img_path: Union[str, Path], img):
return cv2.imwrite(str(img_path), cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
|