Current location - Health Preservation Learning Network - Slimming men and women - Gray scale method
Gray scale method
Generally speaking, there are four methods for graying color images.

1. Composition method

Taking the brightness of three components in a color image as the gray values of three gray images, one gray image can be selected according to the application needs.

f 1(i,j)=R(i,j)f2(i,j)=G(i,j)f3(i,j)=B(i,j)

Where fk(i, j)(k= 1, 2,3) is the gray value of the converted gray image at (i, j). As shown in Figure 4- 1, the color image is converted into a 4-2 gray image.

Figure 4- 1 color image

(a)R-component gray map (b)G-component gray map (c)B-component gray map

Figure 4-2 Three-component Gray Image of Color Image

2. Maximum method

The maximum brightness of the three components in the color image is taken as the gray value of the gray map.

f(i,j)=max(R(i,j),G(i,j),B(i,j))

3. Average method

Average the brightness of the three components in the color image to obtain the gray value.

f(i,j)=(R(i,j)+G(i,j)+B(i,j)) /3

4. Weighted average method

According to the importance and other indicators, the three components are weighted and averaged with different weights. Because the human eye is the most sensitive to green and the least sensitive to blue, a reasonable gray image can be obtained by weighted average of the three components of RGB according to the following formula.

f(i,j)=0.30R(i,j)+0.59G(i,j)+0. 1 1B(i,j))