python展示图片的RGB三通道

import cv2
import numpy as np
img = cv2.imread(r'C:\Users\lw\Desktop\ppt\chengliuxiang.jpg')
cv2.imshow('original image', img)
row, col, plane = img.shape
temp = np.zeros((row, col, plane), np.uint8)
temp[:, :, 0] = img[:, :, 0]
cv2.imshow('Blue plane image', temp)
cv2.waitKey(0)
temp = np.zeros((row, col, plane), np.uint8)
temp[:, :, 1] = img[:, :, 1]
cv2.imshow('Green plane image', temp)
cv2.waitKey(0)
temp = np.zeros((row, col, plane), np.uint8)
temp[:, :, 2] = img[:, :, 2]
cv2.imshow('Red plane image', temp)
cv2.waitKey(0)

你可能感兴趣的:(python,计算机视觉,opencv)