[python] Remove one color channel & Save
import cv2
import numpy as np
# read image into matrix.
m = cv2.imread("python.png")
# get image properties.
h,w,bpp = np.shape(m)
# iterate over the entire image.
for py in range(0,h):
for px in range(0,w):
m[py][px][0] = 0
# display image
cv2.imshow('matrix', m)
cv2.waitKey(0)
cv2.imwrite('filename.png',m)
댓글
댓글 쓰기