Cutting an object out by colour
An HSV window applied to a real scene, with the controls being literally the six bounds of an OpenCV inRange call. Selecting "red" in RGB means reasoning about three correlated channels; in HSV it is a window on one.
Try this
Get a clean mask, then drop the lower value bound and watch the shadows join the object.
Where this lab comes from
Colour Spaces: Choosing Axes You Can ThresholdLesson 4 of The Image as Data. A colour space is a choice of axes for the same three numbers, and the choice is what makes a question easy or impossible. Worked on one measured chart patch: RGB (149.8, 58.3, 34.0) becomes luma 82.8, hue 12 degrees stored as 6, and a Lab triple — plus the five-line red detector that is brittle in RGB and robust in HSV.
More in the image itself
- One colour per photosite — Throw away two thirds of the colour, then guess it back.
- Hitting the colour a meter measured — Drag the gains and watch ΔE against 22 metered patches.
- Sixteen by twelve real pixels — Hover a pixel, read its index and its three numbers.