January 2018
Intermediate to advanced
268 pages
6h 20m
English
Now we are going to read an image, split it into separate channels, and merge them to see how different effects can be obtained out of different combinations:
img = cv2.imread('./images/input.jpg', cv2.IMREAD_COLOR)g,b,r = cv2.split(img)gbr_img = cv2.merge((g,b,r))rbr_img = cv2.merge((r,b,r))cv2.imshow('Original', img)cv2.imshow('GRB', gbr_img)cv2.imshow('RBR', rbr_img)cv2.waitKey()
Here we can see how channels can be recombined to obtain different color intensities:

In this one, the red channel is used twice so the reds are more intense:
This should give you a basic idea of how to convert between color spaces. You ...
Read now
Unlock full access