BGR图像转RGB

OpenCV默认把图像读成BGR格式,因此需要转化。
def readImage(path):
    # OpenCV reads the image in bgr format by default
    bgr_img = cv2.imread(path)
    # We flip it to rgb for visualization purposes
    b,g,r = cv2.split(bgr_img)
    rgb_img = cv2.merge([r,g,b])
    return rgb_img

猜你喜欢

转载自blog.csdn.net/y1556368418/article/details/88293265
今日推荐