1 definition of hue, saturation, lightness

Source: Internet
Author: User

Color three-factor (Elementsof color) colors available hue (hue), saturation (purity) and lightness to describe. Any color light seen by the human eye is the combined effect of these three characteristics, which are the three elements of the color, which is directly related to the wavelength of the wave, brightness and saturation and the amplitude of the light wave.

1.1Hue Definition

  Color is the sensation caused by the physical light of the object reflecting on the optic nerve of the human eye. The difference in color is determined by the length of the wavelength of the light. As a hue, refers to the situation of these different wavelengths of color. The longest wavelength is red, and the shortest is purple. Red, orange, yellow, green, blue, purple and in their respective red orange, yellow orange, yellow-green, blue-green, blue-violet, red Violet, the 6 kinds of intermediate color- A total of a color as a hue ring. The color arranged on the hue ring is a high- purity color, known as a solid color. The positions of these colors on the rings are arranged according to the equal spacing of the visual and sensory. A similar method can be used to separate a variety of subtle colors. On the hue ring, the color that is symmetric with the center of the ring and at the position of the location of the dimension is called the complementary color .

1.2definition of saturation

The color is expressed as a color by means of a numerical value or a vivid or distinct degree. There are color of various colors have color value, no color color of the color value of 0, for color color ( purity ) of the high and low, the difference method is based on the degree of gray in this color calculation. Color due to different hues, and even the same hue, because of the difference in brightness, the color will also change.

1.3Definition of lightness

The Brightness and darkness of the expression color is called lightness. The benchmark for calculating lightness is the grayscale test Card. The black is 0, the white is ten, andthe interval between the 0-10 is arranged in 9 stages. Color can be divided into color and no color , but the latter still has a lightness. As a color, each color of the respective brightness, the degree of darkness on the gray Test card has a corresponding position value . The color of high color has a great influence on the lightness, and it is not easy to distinguish. It is easier to identify the lightness of color in a bright place, which is difficult to identify in dark places.

2hue, saturation, luminance adjustment

Often in the RGB color space to adjust the brightness and saturation is not very intuitive, and HSL color empty can be very intuitive to represent the saturation and brightness of each pixel. So first read the pixel RGB value of the image and then convert to the HSL space to get the saturation and luminance values, adjust and then convert from the HSL space to the RGB value of the RGB space , The brightness and saturation of the image is adjusted by completing this adjustment for each pixel.

3saturation Adjust the source of the implementation
1 #include"Highgui.h"2 #include"Cv.h"3 #include"Stdio.h"4 iplimage* src =0;5int g_switch_value =0;6int value=0;7int main ()//int argc,char**argv)8{9 src = cvloadimage ("11.bmp",1);Ten Cvsize cvsz =Cvgetsize (SRC);iplimage* H_plane = cvcreateimage (cvgetsize (SRC),8,1);iplimage* S_plane = cvcreateimage (cvgetsize (SRC),8,1);iplimage* V_plane = cvcreateimage (cvgetsize (SRC),8,1);Cvcvtcolor (SRC,SRC,CV_RGB2HSV);//RGB to HSV SpaceCvcvtpixtoplane (Src,h_plane, S_plane, V_plane,0);//HSV is divided into three components of h,s,vCvnamedwindow ("Src",1);Cvcreatetrackbar ("Bar","Src", &g_switch_value,200, NULL);Unsignedchar* pTest = (uchar*) s_plane->ImageData;19int m=src->Height20int n=src->Widthprintf ("%d\n", m);//The length and width of the output imageprintf ("%d\n", n);23While1)24{25if (Cvgettrackbarpos ("Bar","Src")!=Value26{27Forint y=0;y<m;y++)28{29Forint x=0; x<n; X + +)30{Ptest[y*n+x] +=cvgettrackbarpos ("Bar","Src")-value;//Ptest[y*n+x]+g_switch_value;32}33}Value=cvgettrackbarpos ("Bar","Src");35}Cvcvtplanetopix (H_plane, S_plane, V_plane,0, SRC);37Cvcvtcolor (SRC,SRC,CV_HSV2RGB);Cvshowimage ("src ",src); 39 if (Cvwaitkey (15) ==< Span style= "COLOR: #800080" >27) break; // press ESC to exit 40 }41 cvreleaseimage (&src); 42 Cvdestroywindow ( "src "); 43 return 0; 44}             

1 definition of hue, saturation, lightness

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.