HSV color model
The standard way to store images is RGB, but it exitsts other color spaces like HSV that can be useful in some cases.
Segmentation
It is very easy to segment a given color if we select the range of Hue that we are interseted, for example, the pink:
First we need to convert to HSV color space, this can be done with openCV: cv2.cvtColor(image, cv2.COLOR_RGB2HSV)
Then we define our hue range, (note that openCV hue range goes from 0 to 180).
lower_hue = np.array([160,0,0])
upper_hue = np.array([180,255,255])
mask = cv2.inRange(hsv, lower_hue, upper_hue)
Classification
Other application, of the HSV color space can be the day/night classificaton depending on the average Value, (amount of light).
sum_brightness = np.sum(hsv[:,:,2])
area = 600*1100.0 # pixels
avg = sum_brightness/area
If the avergae is greater than 120 for example, is a day image, otherwise, a night image.