Python分别保存图片多个光谱,分别保存图像各个通道
import cv2
import numpy as np
import time
#图片地址+名称
img = cv2.imread('./WV3_beijing_LRGB_warp_R12C5.tif',1)
#此处用图片为RGB三通道
row,col,plane = img.shape
temp = np.zeros((row,col,plane),np.uint8)
temp[:,:,0] = img[:,:,0]
cv2.imwrite('Blue.png',temp)
temp = np.zeros((row,col,plane),np.uint8)
temp[:,:,1] = img[:,:,1]
cv2.imwrite('Green.png',temp)
temp = np.zeros((row,col,plane),np.uint8)
temp[:,:,2] = img[:,:,2]
cv2.imwrite('Red.png',temp)