RGB or HSV
3 views (last 30 days)
Show older comments
which one is the best for color correction of an image? I am learning RGB color correction and is HSV color correction on matlab possible or not? Beside, does HSV represent brightness, contrast, and gamma? i mean huge saturation and value are equal to brightness, contrast, and gamma? Can you help me about these. thank you.
0 Comments
Answers (2)
Jan
on 27 Jun 2012
Please take the time to read the corresponding documentation, e.g. wiki:HSL and HSV and doc rgb2hsv.
Some color corrections can be easier in the HSV color space. But this depends on how you want to modify the colors.
0 Comments
DGM
on 6 Apr 2024
Edited: DGM
on 6 Apr 2024
I keep seeing this thread and every time I wish I could ask what the question meant. It's conflating a bunch of terms which themselves have different contextual meanings, and it's doing so with such confusion that it makes me struggle to explain them in any way that actually decreases the confusion. I can't believe it took me this long to realize that "huge" is probably supposed to mean "hue". I guess it's worth some more wiki links.
What is brightness? It's perception of luminance. It's a general concept, and there are many different related and more specific metrics related to what's either measurable or perceived.
What is contrast? It's the perceived range or difference in brightness. There are a bunch of more specific definitions within that. It's also a fairly generic word that is often applied to aspects of visual perception other than strictly brightness, and it also applies outside the realm of visual perception.
What is gamma? Depends what you mean when you say it, but in the end, it's some nonlinear transformation of image values that either shifts the distribution toward either black or white while preserving both. This may be something done for display or transport of the image, or this may be a transformation done to effect an arbitrary shift in the (e.g.) brightness distribution of the image. It's this latter definition that I suspect is what's relevant here.
What is saturation? Wikipedia cites: "colorfulness of an area judged in proportion to its brightness". I've seen similar explanations, but it doesn't make sense to me, specifically "in proportion". The cited source seems to immediately contradict that specific part, and the other cases where I've read similar definitions were referring to HSV, where V is the proportional relationship between chroma and saturation. Other models exist where that relationship is not proportional, so I tend to just say that the concept is a normalized representation of chroma information. That holds true for HSV, HSL, HSI, and other normalized models I know of.
The problem is that saturation also has other meanings. Images are typically transported in integer formats, and even when represented in floating-point, they're still handled with respect to some expected interval within which the values are expected to be. Transformations which would push values outside this interval will result in said values being "clamped", "truncated" or "saturated" at the maximal (or minimal) allowed value. This interpretation is relevant to the topic of image adjustment, since it's often the result of brightness adjustment, and it can influence different aspects of contrast.
What is value? With words like this, we're stepping on our own feet. Value can obviously mean "any particular quantitative determination" (Webster's 1913). It's just a number representing something. Value can also mean something of particular relevance to the HSV model, where it's the representation of brightness -- specifically, it's the maximum of R,G, and B components.
Okay, so now does HSV represent brightness, contrast, and gamma? Depends what you mean by "represent". If you mean to ask if the two pairs of three terms are synonymous, we can now be clear that the answer is no.
On the other hand, HSV is just a convenient remapping of RGB. If you move points in RGB by adjusting brightness, contrast, and gamma (for whatever definitions you choose), then they obviously also move in HSV.
Does that mean that you can apply identical transformations in HSV and RGB and get the same result? Of course not. Like @Jan suggests, we use polar and rectangular coordinate systems because usually one is more convenient than the other for some operation. Are there operations that you could perform in HSV which are at least analogous, even if results aren't identical? Sure. You can perform these three operations on V alone to alter the brightness distribution. It's probably not going to be the best way to approach it, but you could. Similarly, you can apply adjustments to things other than the brightness metric of the model for different purposes. Likewise, the effect would be difficult to achieve with the same tools in RGB.
I have no idea if this was helpful, and I doubt that it was warranted, but at least I can finally ignore this thread.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!