Image processing method and related equipment
By converting the image from RGB color space to LAB or LCH color space, adjusting the intensity of image enhancement in these spaces, and performing inverse color space transformation, the problem of uncontrollable multi-dimensional image enhancement effect in the prior art is solved, and better image enhancement effect and user experience are achieved.
Patent Information
- Application Number
- CN202311566552.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2025-05-30
AI Technical Summary
Existing image enhancement methods are difficult to achieve controllability of the effect in multiple dimensions, resulting in an increase in model learning tasks and a worse upper limit of the effect.
By converting the image from RGB color space to LAB or LCH color space, adjusting the image enhancement intensity in these spaces and performing inverse color space transformation, the adjusted image is output.
The intensity of the black box model image enhancement effect is controlled in one or more dimensions, improving the image enhancement effect and user's visual experience.
Smart Images

Figure CN120070295A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular, to an image processing method and related devices. Background Art
[0002] Currently, many image enhancement methods are end-to-end data-driven based on black-box models, and the controllability of the enhancement intensity of images is not strong.
[0003] However, in practical applications, users often need to control the enhancement effect of images in different dimensions (such as the contrast of brightness, the saturation of color, etc.). If the controllable ability of the enhancement intensity of multi-dimensional images is introduced into the model and the model is allowed to learn the enhancement effects of different dimensions, it may cause the number of learning tasks of the model to increase, further resulting in a worse upper limit of the model's effect.
[0004] Therefore, how to control the enhancement effect of images in one or more dimensions is an urgent problem to be solved. Summary of the Invention
[0005] This application provides an image processing method and related devices. The electronic device can control the intensity of the image enhancement effect based on the difference between the input and output of the black-box model, so as to achieve the purpose of controlling the intensity of the black-box model image enhancement effect in one or more dimensions.
[0006] In a first aspect, this application provides an image processing method, which includes: the electronic device performs image enhancement processing on a first image to obtain a second image; the electronic device converts the first image and the second image from a first color space to a second color space, the first color space includes the RGB color space, and the second color space includes any one of the following color spaces: the LAB color space, the LCH color space; in the second color space, the electronic device adjusts the intensity of the image enhancement in multiple regions of the first image to obtain a third image, where the intensity of the image enhancement is obtained by the electronic device based on the difference between the first image and the second image in the second color space; the electronic device converts the third image from the second color space to the first color space and outputs the third image.
[0007] By implementing the method provided in the first aspect, the electronic device can convert the input and output of the black-box model to a color space (such as the LAB space or the LCH space) that decouples image brightness and color for separate adjustment, then perform an inverse color space transformation, and finally output the adjusted image. In this way, the intensity of the black-box model image enhancement can be controlled, achieving a better image enhancement effect and providing a better visual experience for users.
[0008] In combination with the first aspect, in some embodiments, the differences include one or more of the following: brightness difference, color difference; if the difference includes a brightness difference, the multiple regions include multiple regions with different brightnesses; if the difference includes a color difference, the multiple regions include multiple regions with different colors.
[0009] In this way, when the difference between the first image and the second image is a brightness difference, the electronic device can adjust the intensity of contrast enhancement for one or more regions with different brightnesses of the first image; when the difference between the first image and the second image is a color difference, the electronic device can adjust the intensity of saturation enhancement for one or more regions with different colors of the first image;
[0010] In combination with the first aspect, in some embodiments, the electronic device adjusts the intensity of image enhancement for multiple regions of the first image to obtain a third image, which specifically includes: the electronic device performs a subtraction operation on the brightness value corresponding to the pixel point of the second image and the brightness value corresponding to the pixel point of the first image to obtain a first brightness change amount; the electronic device determines a first weight, and the first weight is used to indicate the contrast enhancement ratio corresponding to each pixel point of the first image; the electronic device performs a multiplication operation on the first brightness change amount and the first weight to obtain a second brightness change amount; the electronic device obtains the third image based on the first image and the second brightness change amount, where the brightness value corresponding to the pixel point of the third image is obtained by the electronic device performing an addition operation on the brightness value corresponding to the pixel point of the first image and the second brightness change amount.
[0011] In this way, the electronic device can adjust the intensity of contrast enhancement for one or more regions with different brightnesses of the first image, control the intensity of contrast enhancement of the black box model image, and achieve a better image enhancement effect.
[0012] In combination with the first aspect, in some embodiments, there is a preset correspondence between the contrast enhancement ratio corresponding to each pixel point and the brightness value of the pixel point.
[0013] In this way, the electronic device can obtain the above first weight based on the above preset correspondence.
[0014] In combination with the first aspect, in some embodiments, in the first luminance region of the first image, the higher the luminance value of a pixel, the lower the contrast enhancement ratio corresponding to the pixel; in the second luminance region of the first image, the higher the luminance value of a pixel, the higher the contrast enhancement ratio corresponding to the pixel; in the third luminance region of the first image, for a pixel within the first luminance range, the higher the luminance value of the pixel, the higher the contrast enhancement ratio corresponding to the pixel; for a pixel within the second luminance range, the higher the luminance value of the pixel, the lower the contrast enhancement ratio corresponding to the pixel; wherein, the luminance of the first luminance region is lower than that of the third luminance region, the luminance of the third luminance region is lower than that of the second luminance region, and the luminance values of the pixels within the first luminance range are lower than those of the pixels within the second luminance range.
[0015] In combination with the first aspect, in some embodiments, the preset correspondence is determined by a first preset function, and the first preset function includes a Gaussian function.
[0016] In combination with the first aspect, in some embodiments, the electronic device adjusts the intensity of image enhancement in multiple regions of the first image to obtain a third image, which specifically includes: the electronic device performs a subtraction operation on the saturation value corresponding to the pixel of the second image and the saturation value corresponding to the pixel of the first image to obtain a first saturation change amount; the electronic device determines a second weight, and the second weight is used to indicate the saturation enhancement ratio corresponding to each pixel of the first image; the electronic device performs a multiplication operation on the first saturation change amount and the second weight to obtain a second saturation change amount; the electronic device obtains the third image based on the first image and the second saturation change amount, wherein the saturation value corresponding to the pixel of the third image is obtained by the electronic device performing an addition operation on the saturation value corresponding to the pixel of the first image and the second saturation change amount.
[0017] In this way, the electronic device can adjust the intensity of saturation enhancement in one or more regions of different colors of the first image, control the intensity of saturation enhancement of the black box model image, and achieve a better image enhancement effect.
[0018] In combination with the first aspect, in some embodiments, there is a preset correspondence between the saturation enhancement ratio corresponding to each pixel and the hue value of the pixel.
[0019] In this way, the electronic device can obtain the second weight based on the above preset correspondence.
[0020] In combination with the first aspect, in some embodiments, in the first color region of the first image, the higher the hue value of a pixel point within the first hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the second hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue value of the pixel points within the first hue range is less than the hue value of the pixel points within the second hue range; in the second color region of the first image, the higher the hue value of a pixel point within the third hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the fourth hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue value of the pixel points within the third hue range is less than the hue value of the pixel points within the fourth hue range; in the third color region of the first image, the higher the hue value of a pixel point within the fifth hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the sixth hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue value of the pixel points within the fifth hue range is less than the hue value of the pixel points within the sixth hue range.
[0021] In combination with the first aspect, in some embodiments, the first color region is a red region, the second color region is a green region, and the third color region is a blue region.
[0022] In combination with the first aspect, in some embodiments, the preset correspondence is determined by a second preset function, and the second preset function includes a Gaussian function.
[0023] In a second aspect, the present application provides an electronic device, which includes one or more processors and one or more memories; wherein, the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device is caused to execute the method described in any one of the above first aspects.
[0024] In a third aspect, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program includes program instructions. When the program instructions run on an electronic device, the electronic device is caused to execute the method described in any one of the above first aspects.
[0025] In a fourth aspect, an embodiment of the present application provides a computer program product. When the computer program product is executed by a processor, the method described in any one of the above first aspects will be implemented.
[0026] Fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a memory. The memory is used to store computer programs or computer instructions, and the processor is used to execute the computer programs or computer instructions stored in the memory, so that the chip executes the method described in any item of the first aspect above.
[0027] The solutions provided in the above second aspect to fifth aspect are used to implement or cooperate with the implementation of the corresponding methods provided in the first aspect. Therefore, the same or corresponding beneficial effects can be achieved as those of the corresponding methods in the first aspect, and details are not described herein again. Description of the Drawings
[0028] Figure 1 is a schematic diagram of an image processing method provided by an embodiment of the present application;
[0029] Figures 2A - 2B is a schematic diagram of a set of images before and after image enhancement provided by an embodiment of the present application;
[0030] Figures 3A - 3B is a schematic diagram of a set of images before and after contrast adjustment of the bright region in an image provided by an embodiment of the present application;
[0031] Figure 4 is a schematic diagram of a set of images before and after saturation adjustment of the blue hue in an image provided by an embodiment of the present application;
[0032] Figure 5 is a schematic diagram of image processing through a blend model provided by an embodiment of the present application;
[0033] Figure 6 is a schematic diagram of determining a contrast enhancement ratio based on brightness provided by an embodiment of the present application;
[0034] Figures 7A - 7C is a weight mapping diagram of different brightness regions of a set of images provided by an embodiment of the present application;
[0035] Figures 8A - 8C is a schematic diagram of a set of RGB format images after contrast enhancement of the bright region in an image provided by an embodiment of the present application;
[0036] Figures 9A - 9C is a schematic diagram of a set of RGB format images after contrast enhancement of the highlight region in an image provided by an embodiment of the present application;
[0037] Figure 10 is a schematic diagram of determining a saturation enhancement ratio based on hue provided by an embodiment of the present application;
[0038] Figures 11A - 11CIt is a weight mapping diagram of different color regions of a set of images provided by an embodiment of the present application;
[0039] Figures 12A - 12C It is a schematic diagram of an RGB format image after enhancing the saturation of the blue region of the image provided by an embodiment of the present application;
[0040] Figure 13 It is a schematic diagram for calculating the color difference between an input image and an output image provided by an embodiment of the present application;
[0041] Figure 14 It is a schematic flowchart of an image processing method provided by an embodiment of the present application;
[0042] Figure 15 It is a schematic diagram of the software structure of an electronic device provided by an embodiment of the present application;
[0043] Figure 16 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0044] Next, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B may mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality of" means two or more than two.
[0045] It should be understood that the terms "first", "second", etc. in the specification, claims and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.
[0046] Referring to "embodiment" in the present application means that a specific feature, structure or characteristic described in combination with the embodiment may be included in at least one embodiment of the present application. The phrase appears in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments.
[0047] For ease of understanding, some related concepts involved in this application are described below first.
[0048] 1. RGB space (or RGB color / color space)
[0049] The RGB space is based on three primary colors: red (R), green (G), and blue (B). By superimposing them in different degrees, a rich and extensive range of colors is produced. Therefore, it is commonly known as the three-primary color model.
[0050] The RGB space is the most commonly used expression of color information. It quantitatively represents colors using the brightness of the three primary colors, red, green, and blue, and is a method of color mixing by superimposing the RGB three-color lights on each other. Different proportions of the three colors result in different colors. By changing the mixing proportions, various mixing effects can be obtained. The RGB color space can be regarded as a unit cube in a three-dimensional rectangular coordinate system. Any color can be represented by a point in the three-dimensional space in the RGB space. In the RGB space, any color light can be formed by adding and mixing different components of the RGB three colors.
[0051] 2. LAB space (or LAB color / color space)
[0052] The LAB space is obtained by mathematically modeling the human eye's perception of different spectral stimuli.
[0053] L represents lightness / luminance, with a value range of 0 - 100, indicating the brightness level from black to white.
[0054] A represents the position of the color on the red-green axis, with a value range of -128 to +127. Among them, negative values indicate green, and positive values indicate red.
[0055] B represents the position of the color on the yellow-blue axis, with a value range of -128 to +127. Among them, negative values indicate blue, and positive values indicate yellow.
[0056] 3. LCH space (or LCH color / color space)
[0057] The LCH space is used to describe the brightness, chroma, and hue of colors.
[0058] The LCH space is more intuitive than the LAB space. It represents color attributes in polar coordinate form and is more suitable for describing the appearance characteristics and perceptual attributes of colors.
[0059] L (lightness / luminance) represents the light and dark level or brightness level of a color. It represents the light and dark degree of a color relative to neutral gray, with a value range of 1 - 100. Lower brightness values are closer to black, and higher brightness values are closer to white.
[0060] C (chroma) represents the saturation of a color or the intensity of a color. It measures the purity or saturation of a color relative to neutral gray. Lower chroma values indicate that the color is darker or closer to gray, while higher chroma values indicate that the color is vivid and has a higher saturation.
[0061] H (hue) represents the hue, that is, the color appearance. Hue is the primary characteristic of a color and is the most accurate standard for distinguishing various different colors. The value range is 0 - 360 degrees, indicating the position of the color on the color wheel.
[0062] The embodiment of the present application provides an image processing method. The electronic device can control the enhancement effect and amplitude of an image based on the difference between the input and output of a black box model. The electronic device can first convert the input and output of the black box model to a color space (such as the LAB space or the LCH space) that decouples image brightness and color for separate adjustment, then perform an inverse color space transformation, and finally output an image with adjusted contrast, saturation, etc. respectively. By implementing this method, the purpose of controlling the intensity of the black box model image enhancement effect in one or more dimensions can be achieved.
[0063] It should be noted that the electronic device mentioned in the embodiment of the present application can be a portable electronic device (or handheld terminal device) equipped with or other operating systems, such as mobile phones, tablets, smart watches, smart bracelets, etc. It can also be a non - portable electronic device such as a laptop computer with a touch - sensitive surface or touch panel, a desktop computer with a touch - sensitive surface or touch panel, a vehicle - mounted device, a home liquid crystal display, etc. The embodiment of the present application does not limit the specific type of the electronic device.
[0064] Figure 1 is a schematic diagram of an image processing method provided by the embodiment of the present application.
[0065] In the embodiment of the present application, take the case where the format of the image to be processed is the RGB format as an example. It is easy to understand that the format of the image to be processed is not limited to the RGB format and can also be other formats. The embodiment of the present application does not limit this.
[0066] Refer to Figure 1, the RGB input (RGBin) can be an image in RGB format to be processed. This image is input into the black-box model for image enhancement. After the image enhancement is completed, the black-box model can output a processed image in RGB format, that is, RGB output 1 (RGBout1).
[0067] Refer to Figure 2A and Figure 2B , Figure 2A Exemplarily shows an image in RGB format to be processed, that is, the image before image enhancement by the above black-box model. Figure 2B Exemplarily shows Figure 2A the image after the image shown exemplarily is enhanced by the above black-box model. If you want to obtain an intermediate image between the image before image enhancement and the image after image enhancement, then it is necessary to adjust the contrast of the image brightness, the saturation of the color, etc. respectively.
[0068] The embodiment of the present application provides an image processing model, that is, Figure 1 the exemplarily shown blend model. This model can achieve the purpose of controlling the intensity of the image enhancement effect of the black-box model in one or more dimensions. Refer to Figure 1 , the input of this model can include RGB input, RGB output 1, and the weight in the xml file (xmlweight). The output of this model can be RGB output 2 (RGBout2). It is easy to understand that RGB output 2 is the image adjusted in one or more dimensions (such as contrast, saturation, etc.).
[0069] It should be noted that the embodiment of the present application does not limit the name of the above blend image processing model. In the embodiment of the present application, this model can be called the blend model. In some embodiments of the present application, this model can also be other names.
[0070] Refer to Figure 3A and Figure 3B , taking the dimension of contrast as an example, the blend model can adjust the contrast of different brightness regions of the image. It is easy to understand that the image can be divided into multiple different brightness regions. In the embodiment of the present application, taking the low-brightness region (that is, the region with lower brightness, which can also be called the medium-brightness region), the medium-brightness region (that is, the region with medium brightness, that is, the medium-brightness region), and the high-brightness region (that is, the region with higher brightness, that is, the high-brightness region) as examples of these three different brightness regions, refer to Figure 3A , Figure 3A the three different brightness regions of the low-brightness region, the medium-brightness region, and the high-brightness region corresponding to the image are marked in the shown image. Taking the adjustment of the contrast of the medium-brightness region of the image by the blend model as an example, Figure 3AThe contrast enhancement ratio of the medium-bright region of the shown image is 0. Figure 3B The contrast enhancement ratio of the medium-bright region of the shown image is 1.0. As can be seen from Figure 3A and Figure 3B , Figure 3B compared with Figure 3A , the contrast enhancement effect of the medium-bright region becomes higher. That is to say, as the contrast enhancement ratio of the region increases, the contrast enhancement effect (or enhancement amplitude) of this region will become higher. It is easy to understand that Figure 3A and Figure 3B only take the contrast enhancement ratios of 0 and 1.0 as examples, not limited to this. The contrast enhancement ratio can also be any value between 0 and 1.0, and can be reasonably adjusted according to the actual application scenario.
[0071] Referring to Figure 4 , taking the dimension of saturation as an example, the blend model can adjust the saturation of different color regions of the image. It is easy to understand that the image can be divided into multiple different color regions. In the embodiments of the present application, taking the three color regions of the red region, green region, and blue region as examples, referring to Figure 4 , taking the adjustment of the saturation of the blue region of the image by the blend model as an example, Figure 4 the saturation enhancement ratios of the blue phase (or blue hue) of the shown image from left to right are 0, 0.5, and 1.0 respectively. As can be seen from Figure 4 , as the saturation enhancement ratio of the blue phase increases, the saturation enhancement effect (or enhancement amplitude) of this blue phase will become higher. It is easy to understand that Figure 4 only take the saturation enhancement ratios of 0, 0.5, and 1.0 as examples, not limited to this. The saturation enhancement ratio can also be any value between 0 and 1.0, and can be reasonably adjusted according to the actual application scenario.
[0072] Next, the above blend model will be introduced in combination with Figure 5 .
[0073] Referring to Figure 5 , the blend model can convert the input and output of the black-box model to a color space that decouples image brightness and color. In the embodiments of the present application, taking the conversion from the RGB space to the LAB space as an example.
[0074] Exemplarily, the blend model can convert the RGB input (RGBin) into a standard RGB (standardRGB, sRGB) input. Further, the sRGB input can be converted into a Lab input (Lab in) through the relevant algorithm of sRGB to Lab (sRGB2Lab). It is easy to understand that the Lab input is the input of the sRGB input in the Lab space.
[0075] Similarly, the blend model can also convert the RGB output 1 (RGBout1) into the sRGB output 1. Further, the sRGB output 1 can be converted into the Lab output 1 (Labout1) through the relevant algorithm of sRGB to Lab (sRGB2Lab). It is easy to understand that the Lab output 1 is the output of the sRGB output 1 in the Lab space.
[0076] After obtaining the Lab input and the Lab output 1, the blend model can input the Lab input and the Lab output 1 into a subtractor to perform a subtraction operation on the Lab output 1 and the Lab input to obtain the Lab variation 1 (LabDelta1). Among them, performing a subtraction operation on the Lab output 1 and the Lab input can refer to performing a subtraction operation on the corresponding values (such as brightness values, saturation values, etc.) of the pixel points of the Lab output 1 and the pixel points of the Lab input in a certain dimension (such as dimensions of contrast, saturation, etc.). The Lab variation 1 is the difference between the corresponding values (such as brightness values, saturation values, etc.) of the pixel points of the Lab output 1 and the pixel points of the Lab input in a certain dimension (such as dimensions of contrast, saturation, etc.).
[0077] After obtaining the Lab variation 1, the blend model can input the Lab variation 1 and the weight map (weightmap) into a multiplier to perform a multiplication operation (or called a fusion operation) on the Lab variation 1 and the weight map to obtain the Lab variation 2 (LabDelta2). Among them, the above-mentioned weight map can be determined based on the Lab input and the weight values (weights). The weight values (which can also be called enhancement ratios or enhancement coefficients) can refer to the ratios or coefficients of enhancement of the pixel points of the Lab input in a certain dimension (such as dimensions of contrast, saturation, etc.) (such as contrast enhancement ratio / coefficient, saturation enhancement ratio / coefficient, etc.). Among them, the above-mentioned weight values can be the values corresponding to the weight attribute in an extensible markup language (xml) file, and this value can be set by developers. The embodiments of the present application do not limit its setting rules. Among them, performing a multiplication operation on the Lab variation 1 and the weight map can refer to performing a multiplication operation on the Lab variation 1 and the weight values corresponding to the same dimension (such as dimensions of contrast, saturation, etc.) of the pixel points in the weight map and the Lab variation 1. The Lab variation 2 is the product value of the Lab variation 1 and the weight values corresponding to the same dimension (such as dimensions of contrast, saturation, etc.) of the pixel points in the weight map and the Lab variation 1.
[0078] After obtaining the Lab variation 2, the blend model can input the Lab input and the Lab variation 2 into an adder to perform an addition operation on the Lab input and the Lab variation 2, obtaining the Lab output 2 (Labout2). Among them, performing an addition operation on the Lab input and the Lab variation 2 can refer to performing an addition operation on the Lab variation 2 and the corresponding values (such as brightness values, saturation values, etc.) of the pixels of the Lab input under the same dimension (such as dimensions like contrast, saturation, etc.) corresponding to the Lab variation 2. The Lab output 2 is the output in the LAB space obtained based on the sum of the Lab variation 2 and the corresponding values (such as brightness values, saturation values, etc.) of the pixels of the Lab input under the same dimension (such as dimensions like contrast, saturation, etc.) corresponding to the Lab variation 2.
[0079] After obtaining the Lab output 2, the blend model can convert the Lab output 2 into the RGB output 2 (RGBout2) through relevant algorithms of Lab to RGB (Lab2RGB). It is easy to understand that the RGB output 2 is the output of the Lab output 2 in the RGB space.
[0080] It should be noted that the above description of the blend model only takes the LAB space as an example, and is not limited to this. The blend model is also applicable to other color spaces, such as the LCH space. The image processing process in the LCH space is similar to the above image processing process in the LAB space, and will not be elaborated here.
[0081] The blend model provided by the embodiments of the present application has strong versatility and can adjust the enhancement effect of an image in one or more dimensions after multiple image enhancement models, with strong flexibility.
[0082] Continue to refer to Figure 5 , in some embodiments, the blend model can also input the Lab output 1 and the weight map into a multiplier to perform a multiplication operation on the Lab output 1 and the weight map, obtaining the Lab output 2.
[0083] Next, taking the dimension of contrast as an example, this paper introduces how the blend model adjusts the contrast of different brightness regions of an image.
[0084] Taking the LAB space as an example, the brightness regions of an image can be divided into low - brightness regions, medium - brightness regions, and high - brightness regions.
[0085] Refer to Figure 6 , Figure 6It is a schematic diagram for determining the contrast enhancement ratio based on brightness provided by an embodiment of the present application. Among them, the abscissa represents brightness, and the ordinate represents the contrast enhancement ratio. The abscissa can be represented by the brightness corresponding to the L dimension in the LAB color space, and its value range is 0 - 100. It can be seen that Figure 6 The value range of the abscissa shown is the value range after normalizing the value range of brightness. It is easy to understand that the brightness value corresponding to the abscissa can represent the brightness value of the pixel point input in Lab.
[0086] Continue to refer to Figure 6 In the embodiment of the present application, the relationship between brightness and the contrast enhancement ratio is represented by a Gaussian function. Three Gaussian curves can be used to represent the contrast enhancement strength (which can also be called the weight value / enhancement ratio / enhancement coefficient) of three different brightness regions, namely the low - brightness region, the medium - brightness region, and the high - brightness region, of the Lab input.
[0087] It should be noted that parameters such as the mean value, standard deviation, and amplitude of the above - mentioned Gaussian function can all be adjusted, and the adjustment rules can be determined according to the actual application scenario. The embodiment of the present application does not limit this.
[0088] Continue to refer to Figure 6 Curve 1 represents the relationship between the brightness value of the pixel point in the low - brightness region of the Lab input and the contrast enhancement ratio. Curve 2 represents the relationship between the brightness value of the pixel point in the medium - brightness region of the Lab input and the contrast enhancement ratio. Curve 3 represents the relationship between the brightness value of the pixel point in the high - brightness region of the Lab input and the contrast enhancement ratio. Curve 4 represents the relationship between the brightness value of the pixel points in the three brightness regions of the Lab input as a whole and the contrast enhancement ratio.
[0089] It can be seen from Curve 1 that in the low - brightness region, the higher the brightness value of the pixel point, the lower the contrast enhancement ratio corresponding to the pixel point.
[0090] It can be seen from Curve 2 that in the medium - brightness region, when the brightness value of the pixel point is less than 0.5, the higher the brightness value of the pixel point, the higher the contrast enhancement ratio corresponding to the pixel point; when the brightness value of the pixel point is greater than 0.5, the higher the brightness value of the pixel point, the lower the contrast enhancement ratio corresponding to the pixel point.
[0091] It can be seen from Curve 3 that in the high - brightness region, the higher the brightness value of the pixel point, the higher the contrast enhancement ratio corresponding to the pixel point.
[0092] It is easy to understand that, according to the above-mentioned Curve 1, Curve 2, and Curve 3, the contrast enhancement ratios corresponding to all the pixel points in the low-brightness region, the contrast enhancement ratios corresponding to all the pixel points in the medium-brightness region, and the contrast enhancement ratios corresponding to all the pixel points in the high-brightness region can be obtained respectively. That is to say, according to the above-mentioned Curve 1, Curve 2, and Curve 3, the weight values (i.e., contrast enhancement ratios) corresponding to all the pixel points of the Lab input in the contrast dimension can be obtained. Further, in combination with the Lab input, the Figure 7A weight mapping diagram of the low-brightness region shown in Figure 7B can be obtained respectively, Figure 7C weight mapping diagram of the medium-brightness region shown in
[0093] weight mapping diagram of the high-brightness region shown in Figure 5 After obtaining the weight mapping diagram, in combination with the
[0094] image processing process shown in Figure 5 Finally, an RGB-format image with enhanced contrast can be obtained. Figure 5 image processing process shown in
[0095] Figures 8A - 8C Exemplarily shows an RGB-format image with enhanced contrast in the medium-brightness region of the image.
[0096] Referring to Figures 8A - 8C , Figure 8A the image shown in Figure 8B is an image with a contrast enhancement ratio of 0 in the medium-brightness region, Figure 8C the image shown in Figures 8A - 8C is an image with a contrast enhancement ratio of 0.5 in the medium-brightness region,
[0097] Figures 9A - 9C the image shown in
[0098] Refer to Figures 9A - 9C , Figure 9A The image shown is an image with a contrast enhancement ratio of 0 in the highlighted area. Figure 9B The image shown is an image with a contrast enhancement ratio of 0.5 in the highlighted area. Figure 9C The image shown is an image with a contrast enhancement ratio of 1.0 in the highlighted area. It can be seen from Figures 9A - 9C that as the contrast enhancement ratio of the highlighted area increases, the contrast enhancement effect (or enhancement amplitude) of this area also becomes higher.
[0099] It is easy to understand that the contrast enhancement ratio (such as 0, 0.5, 1.0, etc.) of a certain area mentioned above (such as the low-brightness area, the medium-brightness area, the high-brightness area) can refer to the maximum value of the contrast enhancement ratio corresponding to the pixel points in this area.
[0100] In the LAB color space, the brightness difference (diff) between the input image and the output image can be expressed by the formula diff = Ldst - Lsrc, where Lsrc is the brightness of the input image and Ldst is the brightness of the output image.
[0101] It should be noted that the above only takes the brightness areas of the image being divided into three brightness areas: the low-brightness area, the medium-brightness area, and the high-brightness area as an example, and is not limited to this. The brightness areas of the image can also be divided into more or fewer brightness areas, and the embodiments of this application do not make any limitations in this regard.
[0102] It should be noted that the above only takes the LAB color space as an example to introduce how the blend model adjusts the contrast of different brightness areas of the image, and should not constitute a limitation to this application. In other color spaces, such as the LCH color space, the process of the blend model adjusting the contrast of different brightness areas of the image is similar, and will not be elaborated here.
[0103] It should be noted that the above only uses the Gaussian function to represent the relationship between brightness and the contrast enhancement ratio, and is not limited to this. Other functions can also be used to represent the relationship between brightness and the contrast enhancement ratio, and the embodiments of this application do not make any limitations in this regard.
[0104] Next, take the dimension of saturation as an example to introduce how the blend model adjusts the saturation of different color areas of the image.
[0105] Taking the LCH color space as an example, the color areas of the image can be divided into the red area, the green area, and the blue area.
[0106] Refer to Figure 10 , Figure 10It is a schematic diagram provided by an embodiment of the present application for determining the saturation enhancement ratio based on hue. Among them, the abscissa represents hue, and the ordinate represents the saturation enhancement ratio. The abscissa can be represented by the hue corresponding to the H dimension in the LCH space, and its value range is 0 - 360 degrees. It is easy to understand that the hue value corresponding to the abscissa can represent the hue value corresponding to the color of the pixel point input in Lab.
[0107] Continue to refer to Figure 10 , in the embodiment of the present application, the relationship between hue and saturation enhancement ratio is represented by a Gaussian function. Three Gaussian curves can be used to represent the saturation enhancement strength (which can also be called the weight value / enhancement ratio / enhancement coefficient) of the three different color regions of the red region, green region, and blue region of the Lab input.
[0108] It should be noted that parameters such as the mean, standard deviation, and amplitude of the above Gaussian function can all be adjusted, and the adjustment rules can be determined according to the actual application scenario. The embodiment of the present application does not limit this.
[0109] Continue to refer to Figure 10 , Curve 1 represents the relationship between the hue value corresponding to the color of the pixel points in the red region of the Lab input and the saturation enhancement ratio. Curve 2 represents the relationship between the hue value corresponding to the color of the pixel points in the green region of the Lab input and the saturation enhancement ratio. Curve 3 represents the relationship between the hue value corresponding to the color of the pixel points in the blue region of the Lab input and the saturation enhancement ratio. Curve 4 represents the relationship between the hue value corresponding to the color of the pixel points in the three color regions of the Lab input as a whole and the saturation enhancement ratio.
[0110] It is easy to understand that according to the above Curve 1, Curve 2, and Curve 3, the saturation enhancement ratios corresponding to the colors of all pixel points in the red region, the saturation enhancement ratios corresponding to the colors of all pixel points in the green region, and the saturation enhancement ratios corresponding to the colors of all pixel points in the blue region can be obtained respectively. That is to say, according to the above Curve 1, Curve 2, and Curve 3, the weight values (i.e., saturation enhancement ratios) corresponding to all pixel points of the Lab input in the saturation dimension can be obtained. Further, combined with the Lab input, the Figure 11A weight mapping diagram of the red region shown in Figure 11B weight mapping diagram of the green region shown in Figure 11C weight mapping diagram of the blue region shown in
[0111] After obtaining the weight mapping diagram, combined with the Figure 5 image processing process shown in
[0112] It is easy to understand that in the embodiments of the present application, according to the above weight mapping diagram, the saturation of only a certain color region of the image can be enhanced, or the saturation of multiple color regions of the image can be enhanced. For example, if only the blue region of the image is saturated enhanced, the RGB format image with enhanced saturation in the blue region can be finally obtained according to the above weight mapping diagram of the blue region and Figure 5 the image processing process shown. For another example, if the saturation of the blue region and the red region of the image is enhanced, the RGB format image with enhanced saturation in the blue region and the red region can be finally obtained according to the above weight mapping diagram of the blue region, the weight mapping diagram of the red region, Figure 5 and the image processing process shown.
[0113] Figures 12A - 12C Exemplarily shown is the RGB format image after enhancing the saturation of the blue region of the image.
[0114] Refer to Figures 12A - 12C , Figure 12A the image shown is an image with a saturation enhancement ratio of 0 in the blue region (e.g., the region where the sky is located), Figure 12B the image shown is an image with a saturation enhancement ratio of 0.5 in the blue region, Figure 12C the image shown is an image with a saturation enhancement ratio of 1.0 in the blue region. It can be seen from Figures 12A - 12C that as the saturation enhancement ratio of the blue region increases, the saturation enhancement effect (or enhancement amplitude) of this region also becomes higher.
[0115] It is easy to understand that the saturation enhancement ratio (e.g., 0, 0.5, 1.0, etc.) of a certain region (e.g., red region, green region, blue region) mentioned above can refer to the maximum value of the saturation enhancement ratio corresponding to the pixel points in this region.
[0116] Refer to Figure 13 , on the LAB space, the color difference between the input image and the output image can be expressed by the following formula:
[0117]
[0118] where, is the color difference between the input image and the output image, is the color of the input image, is the color of the output image.
[0119] On the LCH space, the color difference between the input image and the output image can be expressed by the following formula:
[0120]
[0121] Among them, diff C is the color difference between the input image and the output image, is the color of the input image, is the color of the output image.
[0122] It should be noted that the above only takes the color regions of the image being divided into three color regions: the red region, the green region, and the blue region as an example, and is not limited thereto. The color regions of the image can also be divided into more or fewer color regions, and the embodiments of the present application do not make any limitations in this regard.
[0123] It should be noted that the above only takes the LCH space as an example to introduce how the blend model adjusts the saturation of different color regions of the image, and should not constitute a limitation to the present application. In other color spaces, such as the LAB space, the process of the blend model adjusting the saturation of different color regions of the image is similar, and will not be elaborated here.
[0124] It should be noted that the above only uses the Gaussian function to represent the relationship between the hue and the saturation enhancement ratio, and is not limited thereto. Other functions can also be used to represent the relationship between the hue and the saturation enhancement ratio, and the embodiments of the present application do not make any limitations in this regard.
[0125] Figure 14 Exemplarily shows the specific process of an image processing method provided by the embodiments of the present application.
[0126] As Figure 14 shown, this method can be applied to an electronic device. The following details the specific steps of this method:
[0127] S1401. The electronic device performs image enhancement processing on the first image to obtain a second image.
[0128] Among them, the first image can be, for example, Figure 5 the RGB input shown, and the second image can be, for example, Figure 5 the RGB output 1 shown. Image enhancement can include but is not limited to contrast enhancement and saturation enhancement.
[0129] S1402. The electronic device converts the first image and the second image from the first color space to the second color space. The first color space includes the RGB color space, and the second color space includes any one of the following color spaces: the LAB color space, the LCH color space.
[0130] Exemplarily, referring to Figure 5, the conversion of the first image from the first color space to the second color space can be, for example, the conversion of RGB input to Lab input, and the conversion of the second image from the first color space to the second color space can be, for example, the conversion of RGB output 1 to Lab output 1.
[0131] Exemplarily, the conversion of the first image from the first color space to the second color space can also be, for example, the conversion of RGB input to Lch input, and the conversion of the second image from the first color space to the second color space can be, for example, the conversion of RGB output 1 to Lch output 1.
[0132] S1403. In the second color space, the electronic device adjusts the intensity of image enhancement in multiple regions of the first image to obtain a third image, where the intensity of image enhancement is obtained by the electronic device in the second color space based on the difference between the first image and the second image.
[0133] Where, when the second color space is the LAB color space, the third image can be, for example, Figure 5 the shown Lab output 2; when the second color space is the LCH color space, the third image can be, for example, Lch output 2.
[0134] Where, the difference between the first image and the second image may include one or more of the following: brightness difference, color difference; if the difference includes the brightness difference, the multiple regions include multiple regions with different brightnesses; if the difference includes the color difference, the multiple regions include multiple regions with different colors.
[0135] 1. When the image enhancement is contrast enhancement:
[0136] In a possible implementation, the electronic device adjusts the intensity of image enhancement in multiple regions of the first image to obtain a third image, specifically including: the electronic device performs a subtraction operation on the brightness value corresponding to the pixel point of the second image and the brightness value corresponding to the pixel point of the first image to obtain a first brightness change amount; the electronic device determines a first weight, and the first weight is used to indicate the contrast enhancement ratio corresponding to each pixel point of the first image; the electronic device performs a multiplication operation on the first brightness change amount and the first weight to obtain a second brightness change amount; the electronic device obtains the third image based on the first image and the second brightness change amount, where the brightness value corresponding to the pixel point of the third image is obtained by the electronic device performing an addition operation on the brightness value corresponding to the pixel point of the first image and the second brightness change amount.
[0137] In a possible implementation, there is a preset correspondence between the contrast enhancement ratio corresponding to each pixel point and the brightness value of the pixel point.
[0138] In a possible implementation, the above preset correspondence is determined by a first preset function, and the first preset function includes a Gaussian function. The Gaussian function can be, for example, Figure 6 the Gaussian function shown.
[0139] In a possible implementation, in the first brightness region of the first image, the higher the brightness value of a pixel point, the lower the contrast enhancement ratio corresponding to the pixel point; in the second brightness region of the first image, the higher the brightness value of a pixel point, the higher the contrast enhancement ratio corresponding to the pixel point; in the third brightness region of the first image, for a pixel point within the first brightness range, the higher the brightness value of the pixel point, the higher the contrast enhancement ratio corresponding to the pixel point; for a pixel point within the second brightness range, the higher the brightness value of the pixel point, the lower the contrast enhancement ratio corresponding to the pixel point; wherein, the brightness of the first brightness region is lower than the brightness of the third brightness region, the brightness of the third brightness region is lower than the brightness of the second brightness region, and the brightness value of the pixel points within the first brightness range is lower than the brightness value of the pixel points within the second brightness range.
[0140] In a possible implementation, the above first brightness region can be, for example, a low-brightness region, the above second brightness region can be, for example, a high-brightness region, the above third brightness region can be, for example, a medium-brightness region, and the above first brightness range can be, for example, Figure 6 the left half of the peak of curve 2 shown, and the above second brightness range can be, for example, Figure 6 the right half of the peak of curve 2 shown.
[0141] 2. The case where the image enhancement is saturation enhancement:
[0142] In a possible implementation, the electronic device adjusts the intensity of image enhancement in multiple regions of the first image to obtain a third image. Specifically, the electronic device performs a subtraction operation on the saturation value corresponding to the pixel point of the second image and the saturation value corresponding to the pixel point of the first image to obtain a first saturation change amount; the electronic device determines a second weight, and the second weight is used to indicate the saturation enhancement ratio corresponding to each pixel point of the first image; the electronic device performs a multiplication operation on the first saturation change amount and the second weight to obtain a second saturation change amount; the electronic device obtains the third image based on the first image and the second saturation change amount, where the saturation value corresponding to the pixel point of the third image is obtained by the electronic device performing an addition operation on the saturation value corresponding to the pixel point of the first image and the second saturation change amount.
[0143] In a possible implementation, there is a preset correspondence between the saturation enhancement ratio corresponding to each pixel point and the hue value of the pixel point.
[0144] In a possible implementation, the above-mentioned preset correspondence relationship is determined by a second preset function, and the second preset function includes a Gaussian function. The Gaussian function can be, for example, Figure 10 the Gaussian function shown.
[0145] In a possible implementation, in the first color region of the first image, the higher the hue value of a pixel point within the first hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the second hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue values of the pixel points within the first hue range are less than the hue values of the pixel points within the second hue range; in the second color region of the first image, the higher the hue value of a pixel point within the third hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the fourth hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue values of the pixel points within the third hue range are less than the hue values of the pixel points within the fourth hue range; in the third color region of the first image, the higher the hue value of a pixel point within the fifth hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the sixth hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue values of the pixel points within the fifth hue range are less than the hue values of the pixel points within the sixth hue range.
[0146] In a possible implementation, the above-mentioned first color region can be, for example, a red region, the above-mentioned second color region can be, for example, a green region, the above-mentioned third color region can be, for example, a blue region, and the above-mentioned first hue range can be, for example, Figure 10 the left half of the peak of curve 1 shown, the above-mentioned second hue range can be, for example, Figure 10 the right half of the peak of curve 1 shown, the above-mentioned third hue range can be, for example, Figure 10 the left half of the peak of curve 2 shown, the above-mentioned fourth hue range can be, for example, Figure 10 the right half of the peak of curve 2 shown, the above-mentioned fifth hue range can be, for example, Figure 10 the left half of the peak of curve 3 shown, the above-mentioned sixth hue range can be, for example, Figure 10 the right half of the peak of curve 3 shown.
[0147] S1404. The electronic device converts the third image from the second color space to the first color space and outputs the third image.
[0148] Among them, the output third image can be, for example, Figure 5 the RGB output 2 shown.
[0149] By implementing the image processing method provided in the embodiments of the present application, an electronic device can control the intensity of image enhancement in multiple regions of the image after image enhancement of the black-box model in different spaces (such as the LAB space and the LCH space) and different dimensions, achieving a better image enhancement effect and providing a better visual experience for users.
[0150] The following introduces the software structure of an electronic device provided in the embodiments of the present application.
[0151] Figure 15 Exemplarily shows the software structure of an electronic device provided in the embodiments of the present application.
[0152] Such as Figure 15 As shown, the software system of the electronic device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present application, taking the Android system with a layered architecture as an example, the software structure of the electronic device is exemplarily described.
[0153] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom are the application layer, the application framework layer, the system libraries, and the kernel layer.
[0154] The application layer may include a series of application packages.
[0155] Such as Figure 15 As shown, the application packages may include applications such as cameras, galleries, calendars, calls, maps, navigation, WLAN, Bluetooth, music, videos, and text messages.
[0156] The image processing method provided in the embodiments of the present application can be applied to various image-related application programs, such as camera application programs, gallery application programs, etc.
[0157] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the application programs in the application layer. The application framework layer includes some predefined functions.
[0158] Such as Figure 15 As shown, the application framework layer may include a window manager, a content provider, a view system, a telephone manager, a resource manager, a notification manager, etc.
[0159] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0160] The content provider is used to store and retrieve data, and make this data accessible to applications. The data can include videos, images, audio, incoming and outgoing calls, browsing history and bookmarks, phone books, etc.
[0161] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon can include a view for displaying text and a view for displaying pictures.
[0162] The phone manager is used to provide the communication functions of the electronic device. For example, the management of call status (including answering, hanging up, etc.).
[0163] The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc.
[0164] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages, which can automatically disappear after a short stay without user interaction. For example, the notification manager is used to inform that the download is completed, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as the notification of a background-running application, or a notification that appears in the form of a dialog window on the screen. For example, prompt text information in the status bar, emit a prompt tone, the electronic device vibrates, the indicator light flashes, etc.
[0165] The core library consists of two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core library of Android.
[0166] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0167] The system library can include multiple functional modules. For example: surface manager, Media Libraries, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc.
[0168] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
[0169] The media library supports the playback and recording of multiple common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0170] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.
[0171] The 2D graphics engine is a drawing engine for 2D drawing.
[0172] The kernel layer is the layer between hardware and software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0173] The following introduces a schematic structural diagram of an electronic device provided by an embodiment of the present application.
[0174] Figure 16 An exemplary structure of an electronic device provided by an embodiment of the present application is shown.
[0175] As Figure 16 shown, the electronic device may include: a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headphone interface 270D, a sensor module 280, a camera 293, a display screen 294, etc. Among them, the sensor module 280 may include a pressure sensor 280A, a touch sensor 280B, etc.
[0176] The processor 210 may include one or more processing units. For example: the processor 210 may include an application processor (AP), a modulation and demodulation processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0177] Among them, the controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0178] A memory can also be set in the processor 210 for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. This memory can save the instructions or data that the processor 210 has just used or recycled. If the processor 210 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.
[0179] The USB interface 230 is an interface that conforms to the USB standard specification. Specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 230 can be used to connect a charger to charge the electronic device, and can also be used for data transmission between the electronic device and peripheral devices. It can also be used to connect headphones to play audio through the headphones. This interface can also be used to connect other terminal devices.
[0180] It can be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only for illustrative purposes and does not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device can also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0181] The charging management module 240 is used to receive charging input from a charger. Among them, the charger can be a wireless charger or a wired charger.
[0182] The power management module 241 is used to connect the battery 242, the charging management module 240, and the processor 210. The power management module 241 receives the inputs from the battery 242 and / or the charging management module 240 and supplies power to the processor 210, the internal memory 221, the external memory 220, the display screen 294, the camera 293, etc.
[0183] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include one or N display screens 294, where N is a positive integer greater than 1.
[0184] The camera 293 is used to capture still images or videos. The electronic device may include one or N cameras 293, where N is a positive integer greater than 1.
[0185] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.
[0186] The video codec is used to compress or decompress digital videos. The electronic device can support one or more video codecs. In this way, the electronic device can play or record videos in multiple encoding formats.
[0187] The NPU is a neural-network (NN) computing processor. By learning from the structure of biological neural networks, such as the transmission mode between human brain neurons, it can quickly process input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device can be realized, such as: image recognition, face recognition, speech recognition, text understanding, etc.
[0188] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 210 through the external memory interface 220 to achieve the data storage function. For example, files such as music and videos are saved in the external memory card.
[0189] The internal memory 221 can be used to store computer-executable program codes, and the executable program codes include instructions. The processor 210 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 221. The internal memory 221 can include a program storage area and a data storage area. The program storage area can store an operating system, applications required for at least one function (such as face recognition function, fingerprint recognition function, mobile payment function, etc.). The data storage area can store data created during the use of the electronic device (such as face information template data, fingerprint information template, etc.). In addition, the internal memory 221 can include high-speed random access memory, and can also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0190] The electronic device can implement audio functions through the audio module 270, speaker 270A, receiver 270B, microphone 270C, headphone jack 270D, and application processor, etc. For example, music playback, recording, etc.
[0191] The audio module 270 is used to convert digital audio information into an analog audio signal for output, and is also used to convert analog audio input into a digital audio signal. The audio module 270 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 270 can be disposed in the processor 210, or some functional modules of the audio module 270 can be disposed in the processor 210.
[0192] The speaker 270A, also called a "loudspeaker", is used to convert an audio electrical signal into a sound signal. The electronic device can listen to music or hands-free calls through the speaker 270A.
[0193] The receiver 270B, also called a "handset", is used to convert an audio electrical signal into a sound signal. When the electronic device answers a call or a voice message, the voice can be listened to by placing the receiver 270B close to the human ear.
[0194] The microphone 270C, also called a "microphone" or "transmitter", is used to convert a sound signal into an electrical signal.
[0195] The headphone jack 270D is used to connect a wired headphone. The headphone jack 270D can be a USB interface 230, or a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0196] The pressure sensor 280A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 280A may be disposed on the display screen 294. There are many types of pressure sensors 280A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor may include at least two parallel plates having conductive materials. When a force acts on the pressure sensor 280A, the capacitance between the electrodes changes. The electronic device determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 294, the electronic device detects the intensity of the touch operation according to the pressure sensor 280A. The electronic device can also calculate the position of the touch according to the detection signal of the pressure sensor 280A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions.
[0197] The touch sensor 280B, also known as the "touch panel". The touch sensor 280B may be disposed on the display screen 294. The touch sensor 280B and the display screen 294 together form a touch screen, also known as the "touch display screen". The touch sensor 280B is used to detect touch operations acting on it or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 294. In some other embodiments, the touch sensor 280B may also be disposed on the surface of the electronic device, at a different position from that of the display screen 294.
[0198] It should be understood that Figure 16 the illustrated electronic device is only an example, and the electronic device may have more or fewer components than those Figure 16 shown, may combine two or more components, or may have different component configurations. Figure 16 The various components shown can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0199] As described above, the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
[0200] As used in the foregoing embodiments, depending on the context, the term "when" may be construed to mean "if" or "after" or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "when determining" or "if detecting (the stated condition or event)" may be construed to mean "if determining" or "in response to determining" or "when detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)".
[0201] An embodiment of the present application provides a chip system, including: a processor, the processor is coupled to a memory, and the memory is used to store programs or instructions. When the programs or instructions are executed by the processor, the chip system implements the method in any of the foregoing method embodiments.
[0202] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor that implements by reading software code stored in the memory.
[0203] Optionally, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately provided from the processor, which is not limited in the embodiments of the present application. Exemplarily, the memory may be a non-transitory processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be separately provided on different chips. The embodiments of the present application do not specifically limit the type of the memory and the setting manner of the memory and the processor.
[0204] Exemplarily, the chip system may be a field programmable gate array (FPGA), may be an application specific integrated circuit (ASIC), may also be a system on chip (SoC), may also be a central processor unit (CPU), may also be a network processor (NP), may also be a digital signal processing circuit (DSP), may also be a microcontroller unit (MCU), may also be a programmable logic device (PLD) or other integrated chips.
[0205] It should be understood that each step in the above method embodiments can be completed by the integrated logic circuit of the hardware in the processor or the instructions in the form of software. The method steps disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware processor, or executed and completed by the combination of the hardware and software modules in the processor.
[0206] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access, or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state drive), etc.
[0207] Those of ordinary skill in the art can understand all or part of the processes in the above method embodiments. The processes can be completed by the relevant hardware instructed by a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The foregoing storage medium includes: various media such as ROM or random access memory RAM, magnetic disk, or optical disc that can store program codes.
Claims
1. An image processing method, characterized in that, the method includes: The electronic device performs image enhancement processing on the first image to obtain a second image; The electronic device converts the first image and the second image from a first color space to a second color space, the first color space includes the RGB color space, and the second color space includes any one of the following color spaces: LAB color space, LCH color space; In the second color space, the electronic device adjusts the intensity of the image enhancement in multiple regions of the first image to obtain a third image, wherein the intensity of the image enhancement is obtained by the electronic device based on the difference between the first image and the second image in the second color space; The electronic device converts the third image from the second color space to the first color space and outputs the third image.
2. The method according to claim 1, characterized in that, the difference includes one or more of the following: brightness difference, color difference; If the difference includes the brightness difference, the multiple regions include multiple regions with different brightnesses; If the difference includes the color difference, the multiple regions include multiple regions with different colors.
3. The method according to claim 1 or 2, characterized in that, The electronic device adjusts the intensity of the image enhancement in multiple regions of the first image to obtain a third image, specifically including: The electronic device performs a subtraction operation on the brightness value corresponding to the pixel point of the second image and the brightness value corresponding to the pixel point of the first image to obtain a first brightness change amount; The electronic device determines a first weight, and the first weight is used to indicate the contrast enhancement ratio corresponding to each pixel point of the first image; The electronic device performs a multiplication operation on the first brightness change amount and the first weight to obtain a second brightness change amount; The electronic device obtains the third image based on the first image and the second brightness change amount, wherein the brightness value corresponding to the pixel point of the third image is obtained by the electronic device performing an addition operation on the brightness value corresponding to the pixel point of the first image and the second brightness change amount.
4. The method according to claim 3, characterized in that, There is a preset correspondence between the contrast enhancement ratio corresponding to each pixel point and the brightness value of the pixel point.
5. The method according to claim 3 or 4, characterized in that, In the first brightness region of the first image, the higher the brightness value of a pixel point, the lower the contrast enhancement ratio corresponding to the pixel point; In the second brightness region of the first image, the higher the brightness value of a pixel point, the higher the contrast enhancement ratio corresponding to the pixel point; In the third brightness region of the first image, the higher the brightness value of a pixel point within the first brightness range, the higher the contrast enhancement ratio corresponding to the pixel point; The higher the brightness value of a pixel point within the second brightness range, the lower the contrast enhancement ratio corresponding to the pixel point; Among them, the brightness of the first brightness region is lower than that of the third brightness region, the brightness of the third brightness region is lower than that of the second brightness region, and the brightness value of the pixel points within the first brightness range is lower than that of the pixel points within the second brightness range.
6. The method according to claim 4 or 5, characterized in that the preset correspondence is determined by a first preset function, and the first preset function includes a Gaussian function.
7. The method according to claim 1 or 2, characterized in that the electronic device adjusts the intensity of image enhancement in multiple regions of the first image to obtain a third image, specifically including: the electronic device performs a subtraction operation on the saturation value corresponding to the pixel point of the second image and the saturation value corresponding to the pixel point of the first image to obtain a first saturation change amount; the electronic device determines a second weight, and the second weight is used to indicate the saturation enhancement ratio corresponding to each pixel point of the first image; the electronic device performs a multiplication operation on the first saturation change amount and the second weight to obtain a second saturation change amount; the electronic device obtains the third image based on the first image and the second saturation change amount, wherein the saturation value corresponding to the pixel point of the third image is obtained by the electronic device performing an addition operation on the saturation value corresponding to the pixel point of the first image and the second saturation change amount.
8. The method according to claim 7, characterized in that there is a preset correspondence between the saturation enhancement ratio corresponding to each pixel point and the hue value of the pixel point.
9. The method according to claim 7 or 8, characterized in that in the first color region of the first image, the higher the hue value of a pixel point within the first hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the second hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue value of the pixel points within the first hue range is less than the hue value of the pixel points within the second hue range; in the second color region of the first image, the higher the hue value of a pixel point within the third hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the fourth hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue value of the pixel points within the third hue range is less than the hue value of the pixel points within the fourth hue range; in the third color region of the first image, the higher the hue value of a pixel point within the fifth hue range, the higher the saturation enhancement ratio corresponding to the pixel point; the higher the hue value of a pixel point within the sixth hue range, the lower the saturation enhancement ratio corresponding to the pixel point; wherein, the hue value of the pixel points within the fifth hue range is less than the hue value of the pixel points within the sixth hue range.
10. The method according to claim 9, characterized in that the first color region is a red region, the second color region is a green region, and the third color region is a blue region.
11. The method according to any one of claims 8-10, wherein, the preset correspondence relationship is determined by a second preset function, and the second preset function includes a Gaussian function.
12. An electronic device, wherein, the electronic device includes one or more processors and one or more memories; wherein, the one or more memories are coupled to the one or more processors, and the one or more memories are configured to store computer program code, the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the electronic device is caused to execute the method according to any one of claims 1-11.
13. A computer-readable storage medium, comprising computer instructions, wherein, the computer storage medium stores a computer program, the computer program includes program instructions, and when the program instructions run on an electronic device, the electronic device is caused to execute the method according to any one of claims 1-11.
Citation Information
Patent Citations
Dynamic contrast enhancement device and method
CN102231264A
Color enhancement method and device
CN111899182A
Image enhancement method and device
CN114511479A
Image processing method and device, electronic equipment and storage medium
CN114676360A
Image processing method and related equipment
CN116993619A