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.

image
mask
result

Where this lab comes from

Colour Spaces: Choosing Axes You Can Threshold

Lesson 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