Color IV in the computer-solid color and hue

Source: Internet
Author: User

Previous ArticleArticleThis section describes the HSV representation of the color. h indicates the color phase, that is, the position on the color palette. S indicates the color purity. When S = 1, it indicates that the color is the purest. When S = 0, it indicates that the color has no purity. At this time, it indicates that it is a gray color. V indicates the brightness of the color. When v = 1, the color is the brightest. When V = 0, the brightness is the lowest, and the color is black.

To sum up, when S = 1, V = 1 in a color (H, S, V), the color indicates a color on the color palette. We define the color as solid color or hue.

Because each color has h components, any color corresponds to a solid color. The difference between them is that S and v values are different, while H values are the same. At the same time, this correspondence is a many-to-one relationship, that is, as long as the H values of several colors are the same, they correspond to the same solid color.

What are the characteristics of solid colors? The solid color is also a color, so it can also be expressed in RGB and HSV. According to the previous definition, S = 1, V = 1 in hsv format. Let's take a look at the conversion publicity in the previous article:

S = 1-min/MAX

V = max/255

Note: In the preceding formula, the RGB component is represented by [0,255]. This article has been converted to [], so there is a difference.

If v = 1, max = 255

If S = 1, min = 0

It can be seen that whether a color is a solid color must be filled with three color components, the maximum component is 255, and the minimum component is 0.

As mentioned above, each color corresponds to a solid color. There must be a fast computing process between them. In fact, the computing process in the previous article is clear but complex.

Known solid color (R, G, B) and component s, V, how to calculate the color (R', G', B ')

The following formula is provided through derivation:

R' = (r × S + 255 × (1-s) × V

G' = (g × S + 255 × (1-s) × V

B '= (B × S + 255 × (1-s) × V

 

Known colors (R', G', B '): How to calculate solid colors (R, G, B)

The following formula is used for derivation:

Max is the maximum value of the three components, and Min is the minimum value of the three components.

If max = min, the three components are the same. In this case, the grayscale value is defined. Solid color (, 0), S = 0, V = max are defined.

If Max =min,

R = 255 × (R'-min)/(max-min)

G = 255 × (G'-min)/(max-min)

B = 255 × (B '-min)/(max-min)

At this time, the three components calculated must be 255 and 0.

 

The color of the same color phase has a certain correlation, and the color is calculated by solid color, which can speed up the calculation and simplify the calculation process.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.