On several occasions, we may be interested in working separately with the red, green, and blue channels. For example, we might want to build a histogram for every channel of an image.
We will work separately with the different channels in Chapter 8, Histograms, Contours, Morphological Transformations, and Performance Measurement.
cv2.split() is used to split an image into three different intensity arrays for each color channel, whereas
cv2.merge() is used to merge different arrays into a single multi-channel array, that is, a color image.
The following example demonstrates this:
import cv2 img = cv2.imread('/home/pi/book/test_set/4.2.03.tiff',1) b,g,r = cv2.split (img) cv2.imshow('Blue Channel',b) ...