1 | initial version |
First read in the image:
>>> import cv2 >>> img = cv2.imread("/path/to/your/image.jpg")
Then using cv2.split
is as easy as doing:
>>> (channel_b, channel_g, channel_r) = cv2.split(img)
Which is equivalent to saying:
>>> (channel_b, channel_g, channel_r) = (img[:,:,0], img[:,:,1], img[:,:,2])
2 | No.2 Revision |
First read in the image:
>>>import cv2
>>>img = cv2.imread("/path/to/your/image.jpg")
Then using cv2.split
is as easy as doing:
>>>(channel_b, channel_g, channel_r) = cv2.split(img)
Which is equivalent to saying:
>>>(channel_b, channel_g, channel_r) = (img[:,:,0], img[:,:,1], img[:,:,2])