CN-115375555-B - Image processing method and device
Abstract
The disclosure relates to an image processing method and device for avoiding the problem of hyperchromatic gamut when adjusting the saturation of an image. The method comprises the steps of determining a corresponding saturation upper limit value according to first color information of a pixel point in an image to be processed when an input value of a received saturation adjustment proportion coefficient is larger than 1, determining a saturation adjustment control curve according to the saturation upper limit value and the input value of the saturation adjustment proportion coefficient, wherein the saturation upper limit value is used for representing the relation between a saturation value and the saturation adjustment proportion coefficient value, the saturation upper limit value is the maximum value of the saturation on the saturation adjustment control curve, determining a first target value of the saturation adjustment proportion coefficient according to the saturation of the pixel point and the saturation adjustment control curve, and adjusting the saturation of the pixel point according to the first target value of the saturation adjustment proportion coefficient. According to the technical scheme, the problem of generating the super-color gamut can be avoided when the saturation of the image is adjusted.
Inventors
- LIU YUELEI
Assignees
- 北京小米移动软件有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20210519
Claims (10)
- 1. An image processing method, the method comprising: when the input value of the received saturation adjustment scaling factor is larger than 1, determining a corresponding saturation upper limit value according to first color information of a pixel point aiming at the pixel point in an image to be processed; Determining a saturation adjustment control curve according to the saturation upper limit value and the input value of the saturation adjustment proportionality coefficient, wherein the saturation adjustment control curve is used for representing the relation between the value of the saturation and the value of the saturation adjustment proportionality coefficient, and the saturation upper limit value is the maximum value of the saturation on the saturation adjustment control curve; Determining a first target value of a saturation adjustment scaling factor according to the saturation of the pixel point and the saturation adjustment control curve; Adjusting the saturation of the pixel point according to the first target value of the saturation adjustment scaling factor; the adjusting the saturation of the pixel point according to the first target value of the saturation adjustment scaling factor includes: determining a second brightness value according to the first color information and a calculation formula of converting the RGB color space into the YUV color space aiming at pixel points in the image to be processed, wherein the first color information comprises an R color value, a B color value and a G color value; Determining a second target value of the saturation adjustment scaling factor according to the second brightness value, the first target value of the saturation adjustment scaling factor and the first color information; Adjusting the saturation of the pixel point according to the second target value of the saturation adjustment scaling factor to obtain second color information of the pixel point; The calculation formula for converting the RGB color space into the YUV color space is as follows Wherein R is an R color value, G is a G color value, B is a B color value, C1 is a weight coefficient of the R color value, C2 is a weight coefficient of the G color value, C3 is a weight coefficient of the B color value, For the second luminance value; The determining the second target value of the saturation adjustment scaling factor according to the second luminance value, the first target value of the saturation adjustment scaling factor, and the first color information includes: substituting the second brightness value, the first target value of the saturation adjustment scaling factor and the first color information into the following calculation formula to calculate the second target value of the saturation adjustment scaling factor: Wherein, the For the value of the second luminance value, And R is an R color value, G is a G color value, B is a B color value, and t is a second target value of the saturation adjustment scaling factor.
- 2. The method of claim 1, wherein determining a saturation adjustment control curve from the saturation upper limit and an input value of a saturation adjustment scaling factor comprises: Acquiring coordinate data of at least one control point, wherein the coordinate data comprises a saturation value and a corresponding saturation adjustment scaling factor value; And determining a saturation adjustment control curve according to the saturation upper limit value, the coordinate data of the at least one control point and the input value of the saturation adjustment scaling factor, wherein the control point is positioned on the saturation adjustment control curve.
- 3. The method of claim 2, wherein the at least one control point comprises a first control point and a second control point, wherein the first control point has a saturation value that is less than the second control point, wherein the second control point has a saturation value that is less than or equal to the upper saturation limit, and wherein the saturation adjustment control curve has a functional expression: Wherein, the Adjusting the value of the scaling factor for the saturation, S for the value of the saturation, For the value of the saturation of the first control point, For the value of the saturation of the second control point, And k is the input value of the saturation adjustment scaling factor for the saturation upper limit value.
- 4. The method of claim 1, wherein determining the corresponding saturation upper limit value according to the first color information of the pixel point comprises: determining a corresponding saturation value according to first color information of a pixel point in an image to be processed, wherein the first color information comprises an R color value, a B color value and a G color value; Calculating the values of the first saturation scale coefficients corresponding to the color values aiming at the color values in the first color information to obtain three values of the first saturation scale coefficients; obtaining the minimum value in the three values of the first saturation proportion coefficient to obtain the value of the second saturation proportion coefficient; And determining the saturation upper limit value according to the value of the second saturation proportionality coefficient and the value of the saturation of the pixel point.
- 5. The method according to claim 4, wherein calculating the values of the first saturation scaling coefficients corresponding to the color values for the color values in the first color information, to obtain the three values of the first saturation scaling coefficients, includes: Determining a first brightness value according to the first color information aiming at a pixel point in an image to be processed, wherein the first brightness value is an average value of an R color value, a B color value and a G color value; For the color value in the first color information, calculating the value of a first saturation scaling factor corresponding to the color value by adopting the following calculation formula: wherein I is the first brightness value, C is an R color value, a B color value or a G color value, MAX () is a function that takes the maximum value from a given parameter, which is the value of the first saturation scaling factor corresponding to C.
- 6. The method as recited in claim 1, further comprising: And when the input value of the saturation adjustment scaling factor is smaller than or equal to 1, determining the input value of the saturation adjustment scaling factor as a first target value of the saturation adjustment scaling factor.
- 7. The method according to claim 1, wherein adjusting the saturation of the pixel according to the second target value of the saturation adjustment scaling factor to obtain the second color information of the pixel includes: Substituting the first color information, the second target value of the saturation adjustment scaling factor and the second brightness value into the following calculation formula for pixel points in an image to be processed to obtain the second color information: The second color information comprises an R ' color value, a G ' color value and a B ' color value, R ' is the R ' color value, G ' is the G ' color value and B ' is the B ' color value.
- 8. An image processing apparatus for performing the image processing method according to any one of claims 1 to 7, characterized in that the apparatus comprises: the first determining module is configured to determine, for a pixel point in an image to be processed, a corresponding saturation upper limit value according to first color information of the pixel point when the input value of the received saturation adjustment scaling factor is greater than 1; A second determining module configured to determine a saturation adjustment control curve according to the saturation upper limit value and the input value of the saturation adjustment scaling factor, the saturation adjustment control curve being used for representing the relationship between the value of saturation and the value of the saturation adjustment scaling factor, the saturation upper limit value being the maximum value of the saturation on the saturation adjustment control curve; A third determining module configured to determine a first target value of a saturation adjustment scaling factor according to the saturation of the pixel point and the saturation adjustment control curve; And the adjusting module is configured to adjust the saturation of the pixel point according to the first target value of the saturation adjustment scaling factor.
- 9. A terminal device comprising a processor and a memory, the memory for storing a computer program, the processor for executing the computer program stored on the memory for implementing the method according to any of claims 1-7.
- 10. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the method of any of claims 1-7.
Description
Image processing method and device Technical Field The present disclosure relates to the field of image processing technologies, and in particular, to an image processing method and apparatus. Background In the related art, an Image Signal Processing (ISP) unit of a camera is used for Processing an image signal collected by an image sensor, and the image signal Processing unit may include a plurality of modules, such as a Raw domain denoising module, a black level Processing module, a lens shading correction module, a demosaicing module, a color restoration module, a dynamic range adjustment module, a photoelectric conversion function module, a preferential color adjustment module, and a color space conversion module. The color processing is an important link in the whole image signal processing process, and the modules participating in the color processing comprise a color restoration module, a photoelectric conversion function module and a favorites adjustment module. Adjusting saturation is an essential step in the preference color adjustment module adjusting the preference color. However, when adjusting saturation, the hyperchromatic problem is easily caused. Disclosure of Invention To overcome the problems in the related art, embodiments of the present disclosure provide an image processing method and apparatus for avoiding the problem of hyperchromatic gamut when adjusting the saturation of an image. According to a first aspect of an embodiment of the present disclosure, there is provided an image processing method including: when the input value of the received saturation adjustment scaling factor is larger than 1, determining a corresponding saturation upper limit value according to first color information of a pixel point aiming at the pixel point in an image to be processed; Determining a saturation adjustment control curve according to the saturation upper limit value and the input value of the saturation adjustment proportionality coefficient, wherein the saturation adjustment control curve is used for representing the relation between the value of the saturation and the value of the saturation adjustment proportionality coefficient, and the saturation upper limit value is the maximum value of the saturation on the saturation adjustment control curve; Determining a first target value of a saturation adjustment scaling factor according to the saturation of the pixel point and the saturation adjustment control curve; And adjusting the saturation of the pixel point according to the first target value of the saturation adjustment scaling factor. In one embodiment, the determining the saturation adjustment control curve according to the saturation upper limit value and the input value of the saturation adjustment scaling factor includes: Acquiring coordinate data of at least one control point, wherein the coordinate data comprises a saturation value and a corresponding saturation adjustment scaling factor value; And determining a saturation adjustment control curve according to the saturation upper limit value, the coordinate data of the at least one control point and the input value of the saturation adjustment scaling factor, wherein the control point is positioned on the saturation adjustment control curve. In one embodiment, the at least one control point includes a first control point and a second control point, the saturation value of the first control point is smaller than the saturation value of the second control point, the saturation value of the second control point is smaller than or equal to the saturation upper limit value, and the function expression of the saturation adjustment control curve is: Wherein k' is the value of the saturation adjustment scaling factor, S is the value of the saturation, k 1 is the value of the saturation of the first control point, k 2 is the value of the saturation of the second control point, maxS is the saturation upper limit value, and k is the input value of the saturation adjustment scaling factor. In one embodiment, the determining the corresponding saturation upper limit according to the first color information of the pixel point includes: determining a corresponding saturation value according to first color information of a pixel point in an image to be processed, wherein the first color information comprises an R color value, a B color value and a G color value; Calculating the values of the first saturation scale coefficients corresponding to the color values aiming at the color values in the first color information to obtain three values of the first saturation scale coefficients; obtaining the minimum value in the three values of the first saturation proportion coefficient to obtain the value of the second saturation proportion coefficient; And determining the saturation upper limit value according to the value of the second saturation proportionality coefficient and the value of the saturation of the pixel point. In one embodiment, the calculat