You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
451 B

3 years ago
import sys
import cv2
import numpy as np
import matplotlib.pyplot as plt
def three_channel(img_path):
img = cv2.imread(img_path, 1) # 读取图片
b = img[:, :, 0]
g = img[:, :, 1]
r = img[:, :, 2]
cv2.imwrite('./output/b.jpg', b)
cv2.imwrite('./output/g.jpg', g)
cv2.imwrite('./output/r.jpg', r)
'''
输入:img_path
输出b,g,r三通道共三张图片
'''
if __name__ == '__main__':
three_channel(sys.argv[1])