Images as Arrays and Color Spaces
To a computer, an image is a grid of numbers. A color image stores three numbers per pixel: red, green, and blue. Other color spaces describe the same colors differently. HSV splits color into hue, saturation, and value, which makes "find the red ball" much easier when the lighting changes.
Move the pointer over the image.
Two ways to describe a color
RGB stores how much red, green, and blue light each pixel has, each from 0 to 255 in an 8-bit image. HSV turns that into hue, the kind of color as an angle around a color wheel, saturation, how pure it is, and value, how bright it is:
What to notice
Dim the lighting and every RGB number on the red ball drops, so a rule like "R above 200" stops working. Its hue stays near 0°, red, and only its value changes. That is why simple color tracking usually works in HSV. A whole camera image is just a grid like the zoomed view, here 160 by 100 pixels, while a typical robot camera has about 2 million pixels, each with three numbers, many times per second.