StrataQuest Home › StrataQuest Glossary › Color space conversions
BOM Operation

Color space conversions

Same colors, different coordinates

Definition
RGB / BGR is the camera's raw red, green and blue intensities; BGR is the same numbers in the byte order some imaging libraries prefer. HLS and HSV split hue (which color) from saturation (how pure) and lightness or value (how bright). Lab is perceptually uniform. Optical Density (OD) is the Beer-LambertLoading... representation, linear with chromogen concentration. Grayscale keeps only brightness: a weighted sum of the channels, equal weights by default.
Supporting
Pre processing - Basic - Virtual Channel
Video · Supporting
H&EDSPTCH
Video · Supporting
User Interface - Dimensions (8bit FL)
Video · Supporting
User Interface - Image Viewer + Toolbar
Video · Supporting
Dynamic range - 16bit to 8bit normalization
Video · Supporting
Same image, different coordinate systems
The pixel values change; the colors don't
HSV separates hue from brightness
Hue stays roughly constant as illumination changes
Lab is perceptually uniform
Equal distance ≈ equal perceived difference
OD is linear with concentration
Beer-Lambert in coordinate form

Choosing the right space for the question

The choice of color space depends on which axis lines up with the property you are measuring, and rarely on display. A few cases:

Segmenting one chromogen against another in IHC. DAB brown and hematoxylin blue absorb at different wavelengths, but their RGB values interact: a darker DAB region can look, in R, G and B, like a lighter hematoxylin region. Color SeparationLoading... is the dedicated engine for this. Conceptually, the move is to convert into a space where the chromogens separate cleanly: HSV by hue, or per-stain optical-density channels.

Quantifying stain intensity for measurement. RGB values aren't linear with stain concentration, because the Beer-Lambert relationshipLoading... is exponential. Convert RGB to OD linearizes it. Measurements on the OD image, such as mean or integrated density per cell, then quantify stain concentration directly, which is the quantity of interest.

Color-based classification with variable lighting. A ClassifierLoading... trained on RGB features performs poorly when the test images are lit differently from the training images, because the same biology shows up as different RGB values. Convert to HSV first, then train and predict on hue and saturation and leave out value, which carries the lighting variation. The classifier becomes lighting-invariant.

Computing color difference for distinguishing populations. To measure how different in color one region is from another, compute the distance in Lab, where distance corresponds to perceived difference.

Reducing to grayscale for shape analysis. When only structure matters and color carries nothing the analysis needs, Convert RGB to Grayscale drops the extra dimension. The result is the input to most filteringLoading... and labelingLoading... engines, which are designed for one-channel data.

Share This Term
Term Connections