Color spaces are a way to represent the color channels present in the image that gives the image that particular hue. There are several different color spaces and each has its own significance. Some of the popular color spaces are RGB (Red, Green, Blue), CMYK (Cyan, Magenta, Yellow, Black), HSV (Hue, Saturation, Value), etc. BGR color space: OpenCV’s default color space is RGB. However, it actually stores color in the BGR format. It is an additive color model where the different intensities of Blue, Green and Red give different shades of color.
import cv2
B, G, R = cv2.split(image)
# Corresponding channels are separated cv2.imshow( "original" , image)
cv2.waitKey( 0 )
cv2.imshow( "blue" , B)
cv2.waitKey( 0 )
cv2.imshow( "Green" , G)
cv2.waitKey( 0 )
cv2.imshow( "red" , R)
cv2.waitKey( 0 )
cv2.destroyAllWindows() |
Output: