Revision as of 05:15, 29 June 2009 editDatumizer (talk | contribs)Extended confirmed users, Pending changes reviewers42,788 edits color>strength← Previous edit | Revision as of 05:16, 29 June 2009 edit undoDicklyon (talk | contribs)Autopatrolled, Extended confirmed users, Rollbackers477,051 edits Reverted to revision 299250299 by SharkD; restore intend meaning; see talk page. (TW)Next edit → | ||
Line 9: | Line 9: | ||
The two representations are similar in purpose, but differ somewhat in approach. Both are mathematically cylindrical, but while HSV (hue, saturation, value) can be thought of conceptually as an inverted ] of colors (with a black point at the bottom, and fully-saturated colors around a circle at the top), HSL conceptually represents a double-cone or sphere (with white at the top, black at the bottom, and the fully-saturated colors around the edge of a horizontal cross-section with middle gray at its center). Note that while “hue” in HSL and HSV refers to the same attribute, their definitions of “saturation” differ dramatically. | The two representations are similar in purpose, but differ somewhat in approach. Both are mathematically cylindrical, but while HSV (hue, saturation, value) can be thought of conceptually as an inverted ] of colors (with a black point at the bottom, and fully-saturated colors around a circle at the top), HSL conceptually represents a double-cone or sphere (with white at the top, black at the bottom, and the fully-saturated colors around the edge of a horizontal cross-section with middle gray at its center). Note that while “hue” in HSL and HSV refers to the same attribute, their definitions of “saturation” differ dramatically. | ||
Because HSL and HSV are simple transformations of device-dependent RGB, the color defined by a (''h'', ''s'', ''l'') or (''h'', ''s'', ''v'') ] depends on the |
Because HSL and HSV are simple transformations of device-dependent RGB, the color defined by a (''h'', ''s'', ''l'') or (''h'', ''s'', ''v'') ] depends on the colors of the ], ], and ] ], and on the ] used to represent the amounts of those primaries. Each unique RGB device therefore has unique HSL and HSV spaces to accompany it. An (''h'', ''s'', ''l'') or (''h'', ''s'', ''v'') triplet can however become definite when it is tied to a particular RGB color space, such as ]. | ||
Both models were first formally described in 1978 by ], though the concept of describing colors in three dimensions dates to the 18th century (see section below).<ref>{{cite journal | author = Alvy Ray Smith | title = Color Gamut Transform Pairs | journal = Computer Graphics | volume = 12 | issue = 3 | date = August 1978 | doi = 10.1145/965139.807361 | pages = 12 | curly = true }}</ref><ref>{{cite journal | last = Kuehni | first = Rolf G. | title = The early development of the Munsell system | journal = Color Research and Application | volume = 27 | issue = 1 | pages = 20–27 | date = February 2002 | year = 2002 | doi = 10.1002/col.10002 | curly = true}}.</ref> | Both models were first formally described in 1978 by ], though the concept of describing colors in three dimensions dates to the 18th century (see section below).<ref>{{cite journal | author = Alvy Ray Smith | title = Color Gamut Transform Pairs | journal = Computer Graphics | volume = 12 | issue = 3 | date = August 1978 | doi = 10.1145/965139.807361 | pages = 12 | curly = true }}</ref><ref>{{cite journal | last = Kuehni | first = Rolf G. | title = The early development of the Munsell system | journal = Color Research and Application | volume = 27 | issue = 1 | pages = 20–27 | date = February 2002 | year = 2002 | doi = 10.1002/col.10002 | curly = true}}.</ref> |
Revision as of 05:16, 29 June 2009
HSL and HSV are two related representations of points in an RGB color space that attempt to describe perceptual color relationships more accurately than RGB, while remaining computationally simple. HSL stands for hue, saturation and lightness, while HSV stands for hue, saturation and value.
HSI and HSB are alternative names for these concepts, substituting intensity and brightness for lightness and/or value; their definitions are less standardized, but they are typically interpreted to be synonymous with HSL and HSV.
Both HSL and HSV can be thought of as describing colors as points in a cylinder whose central axis ranges from black at the bottom to white at the top with neutral colors between them, where angle around the axis corresponds to “hue”, distance from the axis corresponds to “saturation”, and distance along the axis corresponds to “lightness”, “value”, or “brightness”.
The two representations are similar in purpose, but differ somewhat in approach. Both are mathematically cylindrical, but while HSV (hue, saturation, value) can be thought of conceptually as an inverted cone of colors (with a black point at the bottom, and fully-saturated colors around a circle at the top), HSL conceptually represents a double-cone or sphere (with white at the top, black at the bottom, and the fully-saturated colors around the edge of a horizontal cross-section with middle gray at its center). Note that while “hue” in HSL and HSV refers to the same attribute, their definitions of “saturation” differ dramatically.
Because HSL and HSV are simple transformations of device-dependent RGB, the color defined by a (h, s, l) or (h, s, v) triplet depends on the colors of the red, green, and blue primaries, and on the gamma compression used to represent the amounts of those primaries. Each unique RGB device therefore has unique HSL and HSV spaces to accompany it. An (h, s, l) or (h, s, v) triplet can however become definite when it is tied to a particular RGB color space, such as sRGB.
Both models were first formally described in 1978 by Alvy Ray Smith, though the concept of describing colors in three dimensions dates to the 18th century (see section below).
Usage
It is sometimes preferable in working with art materials, digitized images, or other media, to use the HSV or HSL color model over alternative models such as RGB or CMYK, because of differences in the ways the models emulate how humans perceive color. RGB and CMYK are additive and subtractive models, respectively, modelling the way that primary color lights or pigments (respectively) combine to form new colors when mixed.
The HSV model is commonly used in computer graphics applications. In various application contexts, a user must choose a color to be applied to a particular graphical element. When used in this way, the HSV color wheel is often used. In it, the hue is represented by a circular region; a separate triangular region may be used to represent saturation and value. Typically, the vertical axis of the triangle indicates saturation, while the horizontal axis corresponds to value. In this way, a color can be chosen by first picking the hue from the circular region, then selecting the desired saturation and value from the triangular region.
Another visualization method of the HSV model is the cone. In this representation, the hue is depicted as a three-dimensional conical formation of the color wheel. The saturation is represented by the distance from the center of a circular cross-section of the cone, and the value is the distance from the pointed end of the cone. Some representations use a hexagonal cone, or hexcone, instead of a circular cone. This method is well-suited to visualizing the entire HSV color space in a single object; however, due to its three-dimensional nature, it is not well-suited to color selection in two-dimensional computer interfaces.
The HSV color space could also be visualized as a cylindrical object; similar to the cone above, the hue varies along the outer circumference of a cylinder, with saturation again varying with distance from the center of a circular cross-section. Value again varies from top to bottom. Such a representation might be considered the most mathematically accurate model of the HSV color space; however, in practice the number of visually distinct saturation levels and hues decreases as the value approaches black. Additionally, computers typically store RGB values with a limited range of precision; the constraints of precision, coupled with the limitations of human color perception, make the cone visualization more practical in most cases.
Comparison of HSL and HSV
HSL is similar to HSV. For some people, HSL better reflects the intuitive notion of "saturation" and "lightness" as two independent parameters, but for others its definition of saturation is wrong, as for example a very pastel, almost white color can be defined as fully saturated in HSL. It might be controversial, though, whether HSV or HSL is more suitable for use in human user interfaces.
The CSS3 specification from the W3C states, "Advantages of HSL are that it is symmetrical to lightness and darkness (which is not the case with HSV for example)…" This means that:
- In HSL, the Saturation component always goes from fully saturated color to the equivalent gray (in HSV, with V at maximum, it goes from saturated color to white, which may be considered counterintuitive).
- The Lightness in HSL always spans the entire range from black through the chosen hue to white (in HSV, the V component only goes half that way, from black to the chosen hue).
Comparison with other color models
This section needs expansion. You can help by adding to it. (May 2008) |
The HSV tristimulus space does not technically support a one-to-one mapping to physical power spectra as measured in radiometry. Thus it is not generally advisable to try to make direct comparisons between HSV coordinates and physical light properties such as wavelength or amplitude.
Comparison with color science
The terms attributed to the "L" or "V" component of HSL or HSV color space may be misleading since they have little to do with color science definitions of the terms. In photometry, concepts such as lightness and luminance relate to a weighted spectrum, in which green is much more luminous than blue, and red is between; but in HSL and HSV, the "L" and "V" dimensions treat the three color channels equally.
- Lightness or value refers to the perceived reflectance of a surface, or to relative luminous reflectance of a colored surface patch.
- Luminance typically refers to relative luminance, which is based on the photometric definition of luminance but normalized with respect to a reference white.
- Luminosity typically (and incorrectly) refers to relative luminance. This usage was popularized by Adobe Photoshop; in the documentation of the CS3 version, the luminosity blending mode is still present, but is described in terms of luminance: "Luminosity: Creates a result color with the hue and saturation of the base color and the luminance of the blend color."
Spherical and other 3D mappings
HSL and HSV are related to older, three-dimensional color-order systems such as Philipp Otto Runge's color sphere (Farbenkugel) and the Munsell color system, both of which are structured around a neutral black-to-white axis, with extending lightness along the polar axis, hue as longitude, and saturation a fraction of the radius of the disk at a constant lightness or latitude. Munsell refers to the colorfulness dimension as chroma rather than saturation, but uses hue and lightness in the same way as HSL. Modern works also sometimes use this spherical model.
Since the entire top and bottom surfaces of the HSL cylinder are white and black, respectively, no information is lost when collapsing them to points at the sphere's poles. The same is true for the HSL bi-cone, another popular way to shrink the white and black surfaces to points. The bi-cone fits the same description as the sphere given above, but with a different profile of radius versus lightness. For HSV, on the other hand, the top surface of the cylinder is not white, so only the bottom surface can be collapsed to a point, resulting in the popular mapping to a cone.
Formal specifications
HSL and HSV are defined mathematically by transformations between the r, g, and b coordinates of colors in RGB space and the h, s, l, and v coordinates of the HSL and HSV spaces.
Conversion from RGB to HSL overview
The logic of the conversion is as follows.
Luminance : In RGB, the closer we are to the MAX RGB value for each r,g,b the closer we are getting to white thus the closer we are getting to full brightness. So Luminance is dependent on how close our average RGB values are to white.
Saturation : . There are two factors that determine the "strength" of the saturation. The first is the distances between the different RGB values (the closer they are together, the RGBs neutralize each other and the hue is less emphasized, thus lowering the saturation. R = G = B means no saturation at all). The Second factor is the distance the RGB values are from mid point. This is because the closer they are to 0 , means the darker they are until total darkness and thus no saturation, and the closer they get to MAX value, the brighter they are until total white and once again there will be no saturation.
Hue : The logic here is to map the RGB values to different hues on a circle circumference.
Conversion from RGB to HSL or HSV
Let r, g, b ∈ be the red, green, and blue coordinates, respectively, of a color in RGB space.
Let max be the greatest of r, g, and b, and min the least.
To find the hue angle h ∈ for either HSL or HSV space, compute:
To find saturation and lightness s, l ∈ for HSL space, compute:
The value of h is generally normalized to lie between 0 and 360°, and h = 0 is used when max = min (that is, for grays) though the hue has no geometric meaning there, where the saturation s = 0. Similarly, the choice of 0 as the value for s when l is equal to 0 or 1 is arbitrary.
HSL and HSV have the same definition of hue, but the other components differ. The values for s and v of an HSV color are defined as follows:
The range of HSV and HSL vectors is a cube in the cartesian coordinate system; but since hue is really a cyclic property, it is not so necessary or appropriate to unwrap it, with a cut at 0 (red), into a linear coordinate. Therefore, visualizations of these spaces usually involve hue circles; cylindrical and conical (bi-conical for HSL) depictions are most popular; spherical depictions and other color solids are also possible.
Conversion from HSL to RGB
Given a color defined by (h, s, l) values in HSL space, with h in the semi-open interval , representing the saturation and lightness, respectively, a corresponding (r, g, b) triplet in RGB space, with r, g, and b also in range , and corresponding to red, green, and blue, respectively, can be computed as follows:
First, if s = 0, then the resulting color is achromatic, or gray. In this special case, r, g, and b all equal l. Note that the value of h is ignored, and may be undefined in this situation.
The following procedure can be used, even when s is zero:
- (h normalized to be in the range [0,1))
Compute each color component ColorC of the vector (ColorR, ColorG, ColorB) = (r, g, b),
Conversion from HSV to RGB
Similarly, given a color defined by (h, s, v) values in HSV space, with h as above, and with s and v varying between 0 and 1, representing the saturation and value, respectively, a corresponding (r, g, b) triplet in RGB space can be computed:
Compute color vector (r, g, b),
Examples
The R, G, B, S and L values shown below are in the range of 0.0 to 1.0. The H values are in the range of 0° to 360°.
RGB | HSL | HSV | Result |
---|---|---|---|
(1, 0, 0) | (0°, 1, 0.5) | (0°, 1, 1) | |
(0.5, 1, 0.5) | (120°, 1, 0.75) | (120°, 0.5, 1) | |
(0, 0, 0.5) | (240°, 1, 0.25) | (240°, 1, 0.5) |
Software support
In software, a hue-based color model (HSV or HSL) is usually presented to the user in the form of a linear or circular hue chooser and a two-dimensional area (usually a square or a triangle) where the user can choose saturation and value/lightness for the selected hue. With this representation, the difference between HSV and HSL is irrelevant. However, many programs also let the user select a color via linear sliders or numeric entry fields, and for those controls, usually either HSL or HSV (not both) are used. HSV is traditionally more common. Here are some examples:
Applications that support HSV:
- Apple Mac OS X system color picker (has a color disk for H/S and a slider for V)
- Xara Xtreme
- Blender
- Microsoft Windows Aero color picker (uses three horizontal bars; Hue, Saturation, and Brightness.)
- PB MapInfo Pro
Applications that support HSL:
- The W3C CSS3 specification
- Macromedia Studio
- Microsoft Windows system color picker (including Microsoft Paint)
- Paint Shop Pro
Applications that support both HSV and HSL:
- Bryce
- ImageMagick (refers to HSV as 'HSB')
- Inkscape (HSV color selection is on the 'Wheel' tab)
- Pixel image editor (starting from Beta5)
- Pixia
Applications that support HSV for color selection and HSL for image color adjustment:
- The GIMP
- Paint.NET
- Adobe graphic applications (Illustrator, Photoshop, and others)
References
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "HSL and HSV" – news · newspapers · books · scholar · JSTOR (June 2007) (Learn how and when to remove this message) |
- Gonzalez, Rafael C. (2007). Digital Image Processing. Prentice Hall. p. 954. ISBN 013168728X, 9780131687288.
{{cite book}}
: Check|isbn=
value: invalid character (help); Unknown parameter|coauthors=
ignored (|author=
suggested) (help) - "The HSB/HLS Color Model - Color Models - Technical Guides". Adobe. Retrieved 2009-06-29.
- Jewett, Tom (1997–2009). "Colors: HSB". Retrieved 2009-06-29.
{{cite web}}
: CS1 maint: date format (link) - Alvy Ray Smith (August 1978). "Color Gamut Transform Pairs". Computer Graphics. 12 (3): 12. doi:10.1145/965139.807361.
{{cite journal}}
: Unknown parameter|curly=
ignored (help) - Kuehni, Rolf G. (February 2002). "The early development of the Munsell system". Color Research and Application. 27 (1): 20–27. doi:10.1002/col.10002.
{{cite journal}}
: Unknown parameter|curly=
ignored (help)CS1 maint: date and year (link). - Edward H. Adelson (2000). "Lightness Perception and Lightness Illusions – Some terminology". Massachusetts Institute of Technology. Retrieved 2007-07-17.
{{cite web}}
: Unknown parameter|curly=
ignored (help) - "List of Blending Modes". Adobe Help Resource Center. Retrieved 2007-11-10.
{{cite web}}
: Unknown parameter|curly=
ignored (help) - Phil Nelson (2007). The Photographer's Guide to Color Management: Professional Techniques for Consistent Results. Amherst Media, Inc. ISBN 1584282045.
- Abhay Sharma (2003). Understanding Color Management. Thomson Delmar Learning. ISBN 1401814476.
- John C. Russ (2005). Image Analysis Of Food Microstructure. CRC Press. ISBN 0849322413.
- Richard Prikryl (2004). Dimension Stone 2004 - New Perspectives for a Traditional Building Material. Taylor & Francis. ISBN 9058096750.
- Max K. Agoston (2005). Computer Graphics and Geometric Modeling: Implementation and Algorithms. Springer. ISBN 1852338180.
- John C. Russ (2005). Image Analysis Of Food Microstructure. CRC Press. ISBN 0849322413.
This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. Please help improve this article by introducing more precise citations. (June 2009) (Learn how and when to remove this message) |
- Raphael Gonzalez, Richard E. Woods (2002) Digital Image Processing, 2nd ed. Prentice Hall Press, ISBN 0-201-18075-8, p. 295.
- Charles Poynton. “What are HSB and HLS?” Color FAQ. 28 November 2006.
- Donald Hearn, M. Pauline Baker (1986) Computer Graphics. Prentice Hall International, ISBN 0-13-165598-1, pp. 302–205.
External links
- An explanation of HSL and how it differs from RGB can be found in the W3C's CSS3 Color Module.
- Formulas for converting to and from RGB can be found on EasyRGB.com.
- C++ code for RGB and HSV conversion
- Demonstrative color conversion applet
- HSV Colors by Hector Zenil, The Wolfram Demonstrations Project.
- HSL at CSS3 . Info very good and simple explanation of HSL
- An algorithm and code for performing HSV transformations directly on RGB colors
- jQuery Color Picker - jQCP
Color space | |
---|---|
CAM | |
CIE | |
RGB | |
Y′UV | |
Other | |
Color systems and standards | |
For the vision capacities of organisms or machines, see Color vision. |