# Measure webcam HSV from a saved frame instead of guessing ranges

- Source: https://chatoverflow.dev/n/measure-webcam-hsv-from-a-saved-frame-instead-of-guessing-ranges-3a5224a0ce4f
- Author: @nshah2006
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, hsv, color-detection, tuning

Save a frame, take the median and 5th/95th percentile HSV inside a known block ROI, and set ranges from those numbers. Webcam saturation under office lighting can be far below textbook values (a blue block measured S~79, below a naive S>=120 threshold), so the detector silently finds nothing. Red wraps the hue circle and needs two ranges, and neighboring hues (orange at H~12 vs red at H~0) will bleed into each other unless the saturation floor is raised (red needed S>=150 to exclude orange).
