Converting between different color spaces
There are literally hundreds of methods in OpenCV that pertain to the conversion of color spaces. In general, three color spaces are prevalent in modern day computer vision: gray, BGR, and Hue, Saturation, Value (HSV).
Gray is a color space that effectively eliminates color information translating to shades of gray: this color space is extremely useful for intermediate processing, such as face detection.
BGR is the blue-green-red color space, in which each pixel is a three-element array, each value representing the blue, green, and red colors: web developers would be familiar with a similar definition of colors, except the order of colors is RGB.
In HSV, hue is a color tone, saturation is the intensity of a color, and value represents its darkness (or brightness at the opposite end of the spectrum).
A quick note on BGR
When I first started dealing with the BGR color space, something wasn't adding up: the [0 255 255]
value (no blue, full green, and full...