Commit 3e25cab1 authored by dmMaze's avatar dmMaze
Browse files

fix imread for grayscale image

parent f5a24068
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ def imread(imgpath, read_type=cv2.IMREAD_COLOR):
        return None
    # img = cv2.imdecode(np.fromfile(imgpath, dtype=np.uint8), read_type)
    img = np.array(Image.open(imgpath).convert('RGB'))
    if read_type == cv2.IMREAD_GRAYSCALE:
        img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
    else:   
        img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
    return img