Histogram-color toning

1. How does a computer represent colors

Computers specifically design a model to help them understand, this is the RGB color model.
The three primary colors of light are red, green and blue, and a variety of other colors can be obtained by mixing these three colors in different proportions and different intensities.
If we need the monitor to display the corresponding color, we only need to tell them the corresponding R (red), G (green), and B (blue) content.
For example, if we need to make the computer display pure green, we tell it: the luminous intensity of green reaches the maximum (255), red and blue do not emit light, which means RGB (0,255,0), and this color means pure green.

In the same way, we can also use RGB (255,0,0) to represent pure red, and RGB (0,0,255) to represent pure blue. Computers just like to understand the precise digital language, and don't like the blurry nature. Language.

Now the computer can display the three colors of pure red, green and blue. How can it display the three colors of black, white and gray?

Black: If red, green, and blue are not illuminated, it is black, so we use RGB (0,0,0) to represent black.

White: Let red, green, and blue emit the strongest light at the same time. At this time, the three cones are stimulated at the same time, giving people the impression of white RGB (255,255,255).

Gray: Let R value = G value = B value, that is, when red, green, and blue emit the same light light, it will be gray. At this time, we can find R and G in the three colors of black, white and gray. , B values ​​are all the same, but the intensity is different, the lowest intensity is black, the highest intensity is white, and the middle is gray RGB (128, 128, 128).

At this time we have mastered the representation methods of black, white, and gray. What if we want to express other mixed colors? This involves some basic color change principles, namely:

We know that the three primary colors of light are red, green, and blue. When these three colors are mixed in equal proportions, the final result is white (neutral color), and any two of the three primary colors are added to get another three primary colors. Complementary color, namely:

Red + green + blue = white,

Red + green = yellow, which is the complementary color of blue

Red + blue = magenta, the complementary color of green

Green + blue = cyan, which is the complementary color of red

Color mixing law

Therefore, if a pixel value is RGB (255,255,0), its color is yellow (complementary color of blue); if a pixel value is RGB (255,0,255), its color is magenta (complementary color of green) ); if a pixel value is RGB (0,255,255), its color is cyan (red complement color).

What if a pixel is RGB (255,255,100)? At this time, the pixel is still yellow. Because the luminous intensity of red and green is greater, the mixed color of these two lights is still the main color, but because blue also emits 100-intensity light, yellow is no longer So pure, so the color of this pixel is yellow with lower saturation.

What if a pixel is RGB (50, 100, 200)?

At this time, the color of the pixel is between the color of the maximum luminous intensity and the mixed color of the color of the maximum luminous intensity and the color of the sub-luminous intensity. For example, the color of the maximum luminous intensity of this pixel is blue, and the color of the maximum luminous intensity is the second largest luminous The mixed color of the intensity color is a mixed color of blue and green, that is, cyan, so this color lies between blue and cyan, and is a cool color.

2. What is a histogram

In the daily routine, the square chart in Excel is a histogram. The horizontal axis represents the type, and the vertical axis represents measurement data such as quantity or proportion.

In the histogram in ps, the leftmost horizontal axis represents the dark area, the rightmost represents the bright area, the middle part represents the midtone, and the vertical axis represents the number of pixels.
It’s not easy to understand the definition at first glance. Remember that the horizontal axis represents the darkest to brightest color in the image from left to right, that is, the origin of the coordinates is black, and the rightmost is white. Let’s look at an example:

Create a new grayscale file with 5 pixels in width and height. The total number of pixels in this file is 25.
In the figure, 5 blacks (255 levels of brightness), 7 dark grays (110 levels of brightness), 8 grays (160 levels), and 5 whites (level 0 brightness) are
5*5 pixel graphics
used in the first section. The three primary colors of RGB are equal to represent gray scale. When all are equal to 0, it is black, and when both are equal to 2555, it is white. That is, the larger the value, the higher the brightness of gray and the lighter the color. So the above figure gives the specific value, you can draw it yourself.

The total number of pixels=5+7+8+5=25.
Pixel histogram
The information distribution is shown in the figure above. The vertical axis (Y) represents the number, and the horizontal axis (X) represents the gray level. The term in Ps is called color level . Displayed in the PS histogram: the
ps histogramhorizontal axis indicates the brightness value (0~255), a total of 256 gray levels, where 0 means the darkest (black) and 255 means the brightest (white), and the vertical axis indicates the number of each pixel.

Three, understand the histogram through data

Through the above description, we have basically understood the histogram, but this is far from enough. You can see that there are average values, standard deviations, median values, pixels, color levels, quantities, percentiles, and high speeds below the histogram. Data items such as the cache level.

  1. Average value. Through the previous example, we can know that the average value of 25 pixels is (5 0+7 75+8 128+5 255)/25=112.96. Note that the number of pixels used in the average calculation is multiplied by the color scale value. Instead of the color value, the color scale value can be displayed in the statistical information below the histogram by clicking on each color scale with the mouse.
  2. Median. 128 is the middle value of the color scale in the 0-255 interval. The average value of 112.96 in the above figure is smaller than the middle value of 128, so the overall image brightness is dark.
  3. Standard deviation refers to the magnitude of the deviation between the brightness value of all pixels of the image and the average value. It is a measure of the degree of dispersion of the data distribution, which is used to measure the degree of deviation of the data value from the arithmetic average. The smaller the standard deviation in the PS histogram, the smaller the contrast of the image, and vice versa. Standard deviation formula: S = Sqr(∑(xn-x dial)^2 /(n-1)) In the
    formula, ∑ represents the sum, x represents the average, ^2 represents the square, and Sqr represents the square root.
    The specific meaning is not great, so it is not calculated in detail.
  4. Pixels: Indicates the total number of pixels used to calculate the histogram. Note that the data displayed by the pixels here is the histogram to calculate the number of images, not necessarily the total number of pixels in the image. Why is this? This is related to the cache level.
  5. Cache level: The cache level shows the image cache currently used to create the histogram. When the cache level is greater than 1, the histogram will be displayed faster, and the cache level of the original image is 1. When using the original image cache, just click the refresh button in the upper left corner of the histogram.
  6. Percentile: the number of all pixels from the leftmost to the mouse pointer position ÷ the total number of image pixels. When you drag the mouse to select a range of the histogram, the color scale, quantity, and percentile will display the statistical data of the selected range.

Okay, so far the histogram has been understood almost, let's start the actual combat.

Fourth, the scope of application of histogram in ps

By observing the histogram, we can confirm that the histogram shows the distribution of shadows, midtones, and highlights. And according to the actual situation of the picture and the details of each channel histogram, we can judge a certain image to redistribute the pixel brightness according to our requirements.

While making adjustments to the photo, a histogram must be used to check the quality and tonal range of the image. Therefore, the preview histogram adjustment is very necessary and important. We can preview the effect of any color and tone adjustment on the histogram through "Preview Histogram Adjustment". Know in advance the impact of the adjustment on the histogram, and try to keep enough details on the premise of ensuring the effect of the picture.

Select the "Preview" option in the dialog of any color or tone adjustment command.

When "Preview" is selected, the "Histogram" panel will show how the adjustment will affect the histogram.
The reasonable redistribution of the histogram is actually to adjust the brightness of the pixels of the photo itself. In this process, the common and effective tools for adjusting the overall or partial pixel brightness of the image are 1, brightness contrast 2, color scale 3, curve 4, and shadow. Highlight 5, tone homogenization

1. Brightness and contrast

Use the "Brightness/Contrast" adjustment to make simple adjustments to the tonal range of the image. Moving the brightness slider to the right increases the tonal value and expands the image highlights, while moving the brightness slider to the left decreases the value and expands the shadows. The contrast slider can expand or contract the overall range of tonal values ​​in the image.

In the normal mode, "Brightness/Contrast" will be the same as the adjustment of "Level" and "Curve", adjusting the image layer proportionally. When "Use old version" is selected, "Brightness/Contrast" simply increases or decreases all pixel values ​​when adjusting brightness. Since this will cause the highlights or shadows to be trimmed or lose the image details, it is not recommended to use brightness/contrast for photographic images in the old mode.

2. Color scale

Use "Level" to adjust the intensity level of the shadows, midtones, and highlights of the image to correct the tonal range and color balance of the image. The "Level" histogram is used as a visual reference for adjusting the basic tone of the image.

If you move the black field input slider, the pixel value will be mapped to level 0, while moving the white field slider will map the pixel value to level 255. The remaining color levels will be redistributed between color levels 0 and 255. This redistribution will increase the tonal range of the image and actually enhance the overall contrast of the image. The middle input slider is used to adjust the gamma in the image. It moves the midtones (level 128) and changes the intensity value of the mid-range of gray tones, but does not significantly change the highlights and shadows.

To adjust the hue of a specific color channel, choose an option from the Channel menu. To edit a group of color channels at the same time, before selecting the "Levels" command, hold down the Shift key and select the corresponding channels in the "Channels" panel. (This method does not work in the "Level" adjustment layer.) Then, the "Channel" menu will display the abbreviation of the target channel, and the selected channel can be adjusted at the same time.

3. Curve

"Level" has only three adjustment sliders (white point, black point, gamma), but "curve" can adjust the points in the entire tonal range of the image (from shadows to highlights), and can adjust individual colors in the image Channels are adjusted precisely. By changing the shape of the curve in the "Curve" adjustment, you can adjust the tone and color of the image. Moving the point down or to the right will map the “input” value to a smaller “output” value and darken the image. To brighten the shadows, move the point near the bottom of the curve upward. Moving the point up or to the left will map a smaller "input" value to a larger "output" value and brighten the image. Use the black point slider and white point slider to quickly set the black point and white point. The steeper part of the curve represents the area with higher contrast; the flatter part represents the area with lower contrast. Move the point at the top of the curve to adjust the highlight. Move the point at the center of the curve to adjust the midtone, and move the point at the bottom of the curve to adjust the shadow.

4. Shadow highlights

The "shadow/highlight" command does not simply lighten or darken the image, it brightens or darkens the surrounding pixels (locally adjacent pixels) in the shadow or highlight. Because of this, shadows and highlights have their own control options. The default value is set to repair images with backlight problems. The "Shadows/Highlights" command also has a "Midtone Contrast" slider to adjust the overall contrast of the image, a "Trim Black" option and a "Trim White" option, and a Color Correction slider to adjust the saturation.

Choose Image> Adjustments> Shadows/Highlights. Adjust the amount of light correction by moving the "Amount" slider or entering a value in the percentage box of "Shadow" or "Highlight". The larger the value, the greater the degree of brightening provided for shadows or the degree of darkening provided for highlights. You can adjust the shadows in the image and the highlights in the image. For finer control, you can select "Show other options" to make other adjustments.

5. Tone homogenization

The "Hue Equalization" command redistributes the brightness values ​​of the pixels in an image so that they present all ranges of brightness levels more evenly. "Hue equalization" will remap the pixel values ​​in the image so that the brightest value appears as white, the darkest value appears as black, and the middle value is evenly distributed throughout the grayscale.

Through the "Histogram" panel, you can see the before and after brightness comparison.

This method is usually used to adjust the overall or partial contrast of the image, especially when the contrast of the useful data of the image is quite close or the difference is large. In this way, the brightness can be better distributed on the histogram. This can be used to adjust the local contrast without affecting the overall contrast. This method is very useful for images where the background and foreground are too bright or too dark, and can make overexposed or underexposed photos better highlight details. The disadvantage of this method is that it does not choose the processed data, so the gray level of the image is reduced after some photos are transformed, and some details disappear; or some images, such as the histogram, have peaks, and the contrast after processing is unnatural. Excessive enhancement, so it is often used with masks.

Five, histogram actual combat

![Image with insufficient exposure](https://img-blog.csdnimg.cn/20191004114750618.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0FF,color_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UFF_center=120FF_70FF_NT120L The picture is an underexposed picture
. There is too much red in the picture , so in the level adjustment, move the value of the red dark area in the red channel to the right, which is the bright area, to reduce the red color, and adjust the blue channel Move the value of the bright blue area to the dark area on the right to increase the blue color to increase the brightness. The adjusted photo effect is as follows:
![Insert the picture description here](https://img-blog.csdnimg.cn/20191004115330819.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9UwmN0L# pic_center =240x240,color_FFFFFF,t_70) The middle part of the picture is the adjusted image, and the contrast is better.

Guess you like

Origin blog.csdn.net/u011930054/article/details/102055187