Jump to content

Talk:HSV color space

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by (3ucky(3all (talk | contribs) at 23:20, 26 June 2006 (Mismatch with [[Hue]]). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Adopted orphan redirects for searching: HSV colour space



Is this the same as "HSB" (which Photoshop uses)? -- Tarquin

I believe so (the 'B' probably stands for 'Brightness'), but HSV is the term I've seen most frequently. --Wapcaplet
Both are correct. However, I've never heard of a color space. Isn't that supposed to be a color model? --mav
Color space is appropriate, because a particular color model will give a particular gamut of colors. For example, the RGB model contains more visible colors than the CMYK model. (There's a third model, I believe it's called Lab Color, that is larger than either of them, and contains them both). Though you are right that it probably doesn't apply to the HSV model, since HSV is, as far as I know, just a different way of interpreting the RGB color space.
See, for example, [[1]]. --Wapcaplet
"Space" is also a mathematical term referring to a set, for example, all vectors are in vector space, all points are in 2-space (2-D) or 3-space (3-D) or 4-space... In this case, every color in the HSV color space corresponds to a point in 3-space. Viewing it as a cylindrical object corresponds to cylindrical coordinates: Saturation corresponds to Radius, Hue to Theta (angle), and Value to Height. --zandperl 23:48, 15 Apr 2004 (UTC)

Are you sure that V = min(R, G, B) is correct? If correct, bright red would have V = 0 but bright white would have V = <max>: this seems wrong.

I think you're right; in the GIMP, bright red has a saturation and value of 100% (as do any other colors with 100% R, G, or B). This formula looks a little suspect to me... I wonder where it came from. -- Wapcaplet 23:13, 22 Feb 2004 (UTC)

Good job fixing these equations; I was actually mixed up by the max/min error when I looked at this page just last week! Just returned to fix it now that I've figured it out and now that I have a user account, but you already did it :).

I think we need to fix the parts at the top that say "Measured in values of ... by the ... wavelength". I don't think this is really the right way to talk about HSV; HSV isn't ever really "measured", like you wouldn't take your spectrometer and try to read off HSV values from it. HSV is generative; you specify it and then your computer or other device generates some wavelengths to approximate your specifications. The parameters of HSV don't really correspond to any physical properties like wavelength though, except so far as your computer screen is able to translate them, which differs from screen to screen. Anyway, the current description as the "amplitude", "spread", etc. of wavelength are certainly not right. I'll fix these sometime soon if I can find time to come up with a more correct description. Unless someone tells me I don't know what I'm talking about (I think I do...).

--Chinasaur 09:45, Feb 27, 2004 (UTC)

Thanks :-) I agree with your alterations, too; you're absolutely right that the correspondence between HSV values and physical measurements is weak at best---if the 0-360 degrees of hue mapped directly to wavelength, we'd have a lot more green than necessary, and no purple; "amplitude" and "spread" seem more like general concepts, rather than actual physical characteristics. I've touched things up a little. It'd be nice if we had a couple of paragraphs about how HSV was conceived and developed, and why... -- Wapcaplet 21:14, 27 Feb 2004 (UTC)
Boy, harder than I thought to find out the details of how HSV was developed. Alvay Ray Smith developed it sometime in the 1970s; the first paper published on it seems to be in 1978, Color Gamut Transform Pairs (by Smith). Full PDF is available to ACM members, which I unfortunately am not. Apparently there used to be a bio of Smith on Microsoft's research site, but it looks to be gone. Anyone know any more details than this about HSV's development? -- Wapcaplet 21:38, 27 Feb 2004 (UTC)

I think I understand now what the "amplitude" and "spread" descriptions are trying to talk about, but they were backwards in the version I edited.

Saturation can sort of be thought of as the spread of the power spectrum, except that it is an inverse relationship; if you were looking at a narrow band of pure spectral color, that would correspond to a narrow band in physical frequency space. As you spread the frequency space band, the color would begin to appear washed out (hue might also shift a bit though), i.e. saturation would decrease.

Likewise, amplitude in the frequency domain (or time domain, but thinking spectrally makes more sense) is an okay analogy to HSV Value, although Value is not actually very cleanly related to radiant intensity (e.g. radiant intensity clearly increases as you desaturate a color, but HSV Value doesn't change in this case), or even psychophysical luminance (which I think is represented in CIE XYZ by Y).

So I'll probably put back at least the spread idea (but for Saturation, not Value). The amplitude idea is not very clean, plus confusing since amplitude is usually a wave property and that's a bad way to think about non-spectrally-pure colors. Plus understanding Value as max(RGB) is simple and doesn't seem to need a better intuitive analogy, while delta/max for Saturation might not give an obvious intuition so the spread idea is probably worth giving.

Well, nope I decided to take them back out again. The new edit has a new paragraph after the initial definitions. It may be too talky/technical, but it's the best way I can think to deal with a complicated issue for now. Maybe the img links should be moved up now so that they are visible right away on small screens; I think they add a lot to the impression of the page. Dunno how to do that yet though. Sorry for all the editory flailing so far; I'm pretty new at this, not very version number efficient...

--Chinasaur 00:39, Feb 28, 2004 (UTC)

Cone or cylinder?

Actually, mathematically it makes more sense to describe the HSV space as a cylinder instead of a cone. After all, the allowed range of the saturation parameter does not decrease when the value is decreased. -- Hankwang 20:07, 6 Mar 2004 (UTC)

That's true in theory, but in practice, when the RGB values are constrained to a finite amount of precision (say, 8 bits each), a decrease in value does effectively reduce the number of discrete values in saturation. For example, when value is at 100%, the full range of saturation (0-100%) maps to the full range (0-255) of discrete RGB values; when value is reduced to 50%, the saturation range only maps to half (0-127) the number of discrete RGB values. When value is 0%, saturation is irrelevant, since it's always black (regardless of saturation). The same could be said for hue; as value is reduced, the number of discrete hues (around the circumference of the HSV cone) is reduced, until when value is 0% hue is also irrelevant. I'm guessing the color cone model is a result of using a fixed amount of precision for each component.
This should probably be explained in the article though; in an abstract mathematical model with infinite precision, a color cylinder does indeed make more sense. At any rate, the color cone is just one of many different ways to visualize the HSV space; there's no reason we can't have both. -- Wapcaplet 21:31, 6 Mar 2004 (UTC)
I understand the issues with precision and I'd personally rather depict color space as a cone than as a cylinder. However, my problem in the case of HSV is that the coordinates are clearly cylindrical (phi, R, z) coordinates, but the cone representation suggests that you can add color vectors. For example, in cylindrical coordinates, (phi,R,z) = (0,100,1) + (180,100,50) will give (0,0,51), while HSV colors with those values, when mixed, will give something like (180,99,51).
The article, showing both the cone and cylinder representation, is better now, though I liked the old "sliced-cone" picture better than the new one. The brain interprets the smoothly varying colors as shadows (related to the shape of the object), which makes a visualisation as a cylindrical object hard. I'd suggest to put a coordinate grid on the figures. -- Hankwang 14:46, 7 Mar 2004 (UTC)
I am not sure I understood that math part, so I will take your word for it :-) I will see about tweaking the images a little to make them clearer. -- Wapcaplet 18:38, 7 Mar 2004 (UTC)
OK, I couldn't think of a really good way to show coordinates, so I've opted instead for a cutaway view; I think it helps to understand the visualizations a little better. Lemme know what you think. -- Wapcaplet 20:51, 7 Mar 2004 (UTC)
Much clearer now (the full surface grid that I had in mind might make the picture too crowded). One more thing: it makes more sense to let the hue arrow start at red (H=0) and point counterclockwise (i.e., towards increasing H). Then you can let the hue arrow stop at the blue cut and make the side picture correspond to the blue cut instead of the purple one. Even better, rearrange the picture such that the cut is at a color for which the eye is more sensitive than blue, e.g. orange or green. A dark background may also help to see what is happening at lower values.
BTW, I didn't know that these things were possible with the Gimp. -- Hankwang 23:27, 7 Mar 2004 (UTC)
The original ones were made in the GIMP, but this time around I made a 3D model in Blender. I wasn't able to get the texture mapping right for the cutaway sections, though, so it's still largely GIMPped. It could be done all-GIMP, though. I just felt lazy. They could still use some work; I'll see about implementing your suggestions. -- Wapcaplet 23:59, 7 Mar 2004 (UTC)

Vandalism

IP 128.174.154.152 (ctl22.lis.uiuc.edu, apparently someone from University of Illinois at Urbana-Champaign) blanked the page this evening. There was no note of explanation or evidence of a page move, so I reverted to the previous edit.

Chinasaur 05:26, Mar 17, 2004 (UTC)

You can leave a polite message such as {{subst:test}} on the user's talk page. If a user persists in vandalism (a warning is already present on his talk page), report it on Vandalism in progress - the user may be blocked. -- Hankwang 09:53, 17 Mar 2004 (UTC)

Requesting peer review of dominant wavelength --Chinasaur 18:39, Mar 19, 2004 (UTC)


Problems with the formula

see: User:Kim Bruning/colorspace.py

When then , and hence , so that each of the calculations for h is a division by 0.

if MAX=0, then V=0 , and calculating S is a division by 0.

let's see... hmm, so putting that better:

  • if V = 0, then S = undefined
  • if S = 0 or S = undefined, then H = undefined.

Okay, I've fixed the programme to deal with it:-)

Kim Bruning 20:43, 6 Apr 2004 (UTC)

Nooope, wait, it's STILL wrong if any of

  • R=G
  • G=B
  • R=B

Then the formula is undecided again, since there are 2 possible values for H!

Found out while trying to make up a color for yellow :-/

Okay, I have no clue if there's a mathemagical way to deal with that, but the formula here is really quite tricky to code ^^;; I'll ask for peer review.

Kim Bruning 21:05, 6 Apr 2004 (UTC)

Here's a slightly different formula: http://www.easyrgb.com/math.php?MATH=M20#text20 Kim Bruning 21:19, 6 Apr 2004 (UTC)


Fixed the progamme! All hail and thanks to Chinasaur for helping me with both the formula, and the code! :-) Kim Bruning 14:59, 7 Apr 2004 (UTC)

Why not just use the formula in the Hue article?
where R is the red value, φ is hue, σ is saturation and μ is value. Denelson83 04:11, 31 Dec 2004 (UTC)

Good idea; it's nice and concise. My math is poor, though; would one still obtain saturation and value in the same way (since those are preliminary to finding hue)? The hue article doesn't explain the range of μ and σ (is it again between 0.0 and 1.0?) -- Wapcaplet 23:57, 31 Dec 2004 (UTC)

Formula incorrect?

On HSV color space#Transformation from HSV to RGB. The six results for Hi use a variable v (small letter, italic). This variable is not present in de formulas above, ie is is unknown & has no value when used in Hi's. I think this is not correct. First thing I expect (fwiw): if six H's are possible, thats the six sequence-combinations of p, q, t. User:DePiep 14:45, 24 May 2005 (UTC)[reply]

Minor clarification

On HSV color space#Transformation from HSV to RGB. The outcome makes an pre-exeption for when S=0 (no hue). For just above the maths it states: When S is non-zero, the following formulas can be used.
To me it seems that the functions can also be used when S=0 (no risk of division-by-zero). Is it more correct, then, to put the S=0 remark afterwards, as an illusttration (and not an part of the formulas). -DePiep 14:52, 24 May 2005 (UTC)[reply]

Major clarification

See the part HSV color space#Transformation from RGB to HSV.
Here I expect the S=0-situation to be mentioned before the H-formulas, since that does introduce a division-by-zero possibility. Isn't it more maths & logic to create a one-way route throught the formulas? -DePiep 15:00, 24 May 2005 (UTC)[reply]

Why not a sphere?

Is it possible to represent the HSV colour space as a sphere, where value corresponds to latitude, hue corresponds to longitude, and saturation corresponds to distance from the centre of the sphere?  Denelson83  04:57, 29 October 2005 (UTC)[reply]

  • I don't see why not. A spectrum around the equator, black and white at the poles, with a creamy grey center. Probably any 3D geometric shape could be made to serve; just depends on how you want to visualize it. -- Wapcaplet 17:52, 29 October 2005 (UTC)[reply]
I think that a sphere would be more suited to the HSL color space. HSV is best represented by a shape with a flat top, whereas HLS is best represented by a shape that is symetrical on the L=0.5 plane. Ae-a 09:25, 27 February 2006 (UTC)[reply]
Now that I think of it, a semi-sphere might be suitable for HSV. An upside-down cone or a cylinder might also be suitable. Ae-a 09:35, 27 February 2006 (UTC)[reply]

Hue clarifications

Since hue is an angle on the colour wheel thinger, it is measured in either an angle (0.0°–360.0°) or a percentage (0.0%–100.0%). However, most mathematicians (and physicists) tend to use radians (0–2π) as a linear method of angle measurement. I don't know if the HSV specs allow for angles to be supplied in radians, but I think the article should mention something regarding angles being measured in degrees and not in any other angular measurement. I know it might seem somewhat esoteric, but it confused me at first when I read the equations.

HSV to RGB formula seems to always work

Article says:

First, if S is equal to 0.0, then the resulting color is achromatic, or grey. In this special case, R, G, and B are simply equal to V. As above, H is irrelevant in this situation. When S is non-zero, the following formulas can be used:

But the formulas seem to work fine in the special case — there's no division by S, and p, q, t, R, G, and B all get set to V in all cases. Deco 05:57, 12 May 2006 (UTC)[reply]

Mismatch with Hue

Perhaps my math is lacking, but why does the transformation to RGB over at Hue differ from that listed in this article? The one in this article appears to work, but I have not managed to get the one at Hue to work. I may just be misinterpreting it, though. Could someone clear this up? Thanks. --Orborde 03:49, 25 June 2006 (UTC)[reply]

Hmm...I tried both (to the best of my ability), and it appears that the method listed at Hue is incorrect. Behold the pretty picture:
this test image.
The top uses the method listed at Hue, and the bottom uses the method from HSV color space.--Orborde 04:26, 25 June 2006 (UTC)[reply]
I noticed this as well. The formulae in Hue use a sinusoidal RGB distribution over the range of hues, while the formulae in HSV color space utilize a linear distribution. The following image summarizes the difference:
As you can see, the sinusoidal distribution is much smoother. However, you will also notice a distinct lack of saturated yellow, cyan and magenta in this color space. Yellow would show at a hue of 60o, with full green and red components but no blue component. At 60o in the sinusoidal model, neither green nor red is at 100%, leading to an unsaturated yellow. I should note that this sinusoidal model is not identical to that found in Hue, but can be found as follows:
  • Converting from sinusoidal HSV to RGB
  • Converting from RGB to sinusoidal HSV
With a little research it seems ([2], [3]) that the linear model is the established standard, but I see no reason not to include both. While I can say that the model I have provided above is mathematically rigorous, Wikipedia is not a publisher of original thought and I am unable to find it referenced anywhere. (3ucky(3all 23:20, 26 June 2006 (UTC)[reply]