Convert the imageFrame in BGR(RGB color space represented as three matrices of red, green and blue with integer values from 0 to 255) to HSV(hue-saturation-value) color space.
Hue
describes a color in terms of
saturation
, represents the amount of gray color in that color and
value
describes the brightness or intensity of the color. This can be represented as three matrices in the range of 0-179, 0-255 and 0-255 respectively.
Step 4:
Define the range of each color and create the corresponding mask.
Step 5:
Morphological Transform: Dilation, to remove noises from the images.
Step 6:
bitwise_and between the image frame and mask is performed to specifically detect that particular color and discrad others.
Step 7:
Create contour for the individual colors to display the detected colored region distinguishly.