Vinnie Garcia

Camera color sampler

How it worksBack to the demo

Nine color samples from your camera

Press Start Camera, allow access, and hold something with a broad patch of color in view. The page requests the rear camera where available. After an initial five-second delay, nine boxes mark sample locations across the image.

Move the camera so one box samples the lit part of an object, then its shadow, and watch the label change. Each box reads one pixel, not an average of the area inside it. Near an edge, a tiny movement can give you a very different result. The grid stays in place; it doesn't follow objects.

The labels look like Munsell notation, but they aren't measured Munsell colors. This is a rough RGB calculation dressed in that notation, useful for seeing how the calculation responds to a camera image.

Where the numbers come from

The code draws a video frame into a canvas and reads pixels at one-quarter, one-half, and three-quarters of its width and height. It scales the RGB channels to 0 through 1, then uses the largest channel times ten as value. The difference between the largest and smallest channels, also times ten, becomes chroma.

A hue angle calculated from RGB is divided into approximate families. Very low chroma gets an N label for neutral. The other samples get a hue followed by value/chroma.

Those shortcuts have limits. The largest RGB channel isn't perceptual lightness. The channel range isn't Munsell chroma. There's no Munsell lookup table, reference chart, or camera calibration behind the labels.

Light and camera processing matter before the calculation even starts. Exposure, white balance, shadows, and reflections all change the sampled RGB values. Single-pixel sampling adds noise. The same object can get different labels without its surface changing, so these readings aren't suitable for paint matching or recording an object's true color.

The Munsell notation guide explains the real system. The site's hue wheel shows its family names, and MDN explains how a canvas reads pixels.