Image processing method and related device
Patent Information
- Application Number
- CN202311566552.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-11-22
AI Technical Summary
[0002]目前,很多图像增强方法是基于黑盒模型的端到端数据驱动,对图像的增强强度的可控性不强
[0026] The solutions provided in the second to fifth aspects above are used to implement or cooperate with the methods provided in the first aspect above, and therefore can achieve the same or corresponding beneficial effects as the methods in the first aspect, which will not be elaborated here.
Smart Images

Figure CN120070295B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to image processing methods and related equipment. Background Technology
[0002] Currently, many image enhancement methods are based on end-to-end data-driven black-box models, which do not provide strong control over the enhancement intensity.
[0003] However, in practical applications, users often need to control the image enhancement effect in different dimensions (such as brightness contrast, color saturation, etc.). If the controllability of multi-dimensional image enhancement intensity is introduced into the model, and the model learns the image enhancement effect in different dimensions, it may cause the model to have more learning tasks, thereby further reducing the upper limit of the model's performance.
[0004] Therefore, how to control the effect of image enhancement 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 equipment. 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, thereby achieving the goal of controllable 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, the method comprising: an electronic device performing image enhancement processing on a first image to obtain a second image; the electronic device converting the first image and the second image from a first color space to a second color space, the first color space including the RGB color space, and the second color space including any one of the following color spaces: LAB color space and LCH color space; in the second color space, the electronic device adjusting the intensity of image enhancement in multiple regions of the first image to obtain a third image, wherein 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; the electronic device converting the third image from the second color space back to the first color space and outputting 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, for example, a color space that decouples image brightness and color (such as LAB or LCH space), adjust them separately, then perform an inverse color space transformation, and finally output the adjusted image. This allows control over the intensity of image enhancement in the black-box model, achieving better image enhancement results and providing users with a better visual experience.
[0008] In conjunction with the first aspect, in some embodiments, the differences include one or more of the following: brightness differences, color differences; if the differences include brightness differences, then the multiple regions include multiple regions with different brightness; if the differences include color differences, then the multiple regions include multiple regions with different colors.
[0009] Thus, 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 in one or more regions of different brightness in 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 in one or more regions of different colors in the first image. In conjunction 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. Specifically, this includes: the electronic device subtracting the brightness value corresponding to a pixel in the second image from the brightness value corresponding to a pixel in the first image to obtain a first brightness change; the electronic device determining a first weight, which indicates the contrast enhancement ratio corresponding to each pixel in the first image; the electronic device multiplying the first brightness change by the first weight to obtain a second brightness change; and the electronic device obtaining a third image based on the first image and the second brightness change, wherein the brightness value corresponding to a pixel in the third image is obtained by adding the brightness value corresponding to a pixel in the first image to the second brightness change.
[0010] In this way, the electronic device can adjust the intensity of contrast enhancement in one or more regions of different brightness in the first image, control the intensity of contrast enhancement in the black box model image, and achieve a better image enhancement effect.
[0011] In conjunction with the first aspect, in some embodiments, the contrast enhancement ratio corresponding to each pixel has a preset correspondence with the brightness value of the pixel.
[0012] In this way, the electronic device can obtain the first weight based on the aforementioned preset correspondence.
[0013] In conjunction with the first aspect, in some embodiments, in a first brightness region of the first image, the higher the brightness value of a pixel, the lower the contrast enhancement ratio corresponding to the pixel; in a second brightness region of the first image, the higher the brightness value of a pixel, the higher the contrast enhancement ratio corresponding to the pixel; in a third brightness region of the first image, the higher the brightness value of a pixel within the first brightness range, the higher the contrast enhancement ratio corresponding to the pixel; and the higher the brightness value of a pixel within the second brightness range, the lower the contrast enhancement ratio corresponding to the pixel; 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 a pixel within the first brightness range is lower than the brightness value of a pixel within the second brightness range.
[0014] In conjunction with the first aspect, in some embodiments, the preset correspondence is determined by a first preset function, which includes a Gaussian function.
[0015] In conjunction 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. Specifically, this includes: the electronic device subtracting the saturation value corresponding to a pixel in the second image from the saturation value corresponding to a pixel in the first image to obtain a first saturation change; the electronic device determining a second weight, which indicates the saturation enhancement ratio corresponding to each pixel in the first image; the electronic device multiplying the first saturation change by the second weight to obtain a second saturation change; and the electronic device obtaining a third image based on the first image and the second saturation change, wherein the saturation value corresponding to a pixel in the third image is obtained by adding the saturation value corresponding to a pixel in the first image to the second saturation change.
[0016] In this way, the electronic device can adjust the intensity of saturation enhancement in one or more regions of different colors in the first image, control the intensity of saturation enhancement in the black-box model image, and achieve a better image enhancement effect.
[0017] In conjunction with the first aspect, in some embodiments, the saturation enhancement ratio corresponding to each pixel has a preset correspondence with the hue value of the pixel.
[0018] In this way, the electronic device can obtain the second weight based on the aforementioned preset correspondence.
[0019] In conjunction with the first aspect, in some embodiments, in the first color region of the first image, the higher the hue value of a pixel within the first hue range, the higher the saturation enhancement ratio of the corresponding pixel; the higher the hue value of a pixel within the second hue range, the lower the saturation enhancement ratio of the corresponding pixel; wherein the hue value of a pixel within the first hue range is less than the hue value of a pixel within the second hue range; in the second color region of the first image, the higher the hue value of a pixel within the third hue range, the higher the saturation enhancement ratio of the corresponding pixel; the higher the hue value of a pixel within the fourth hue range, the lower the saturation enhancement ratio of the corresponding pixel; wherein the hue value of a pixel within the third hue range is less than the hue value of a pixel within the fourth hue range; in the third color region of the first image, the higher the hue value of a pixel within the fifth hue range, the higher the saturation enhancement ratio of the corresponding pixel; the higher the hue value of a pixel within the sixth hue range, the lower the saturation enhancement ratio of the corresponding pixel; wherein the hue value of a pixel within the fifth hue range is less than the hue value of a pixel within the sixth hue range.
[0020] In conjunction 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.
[0021] In conjunction with the first aspect, in some embodiments, the preset correspondence is determined by a second preset function, which includes a Gaussian function.
[0022] In a second aspect, this 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 one or more processors, and the one or more memories are used to store computer program code, the computer program code including computer instructions, which, when the one or more processors execute the computer instructions, cause the electronic device to perform the method described in any one of the first aspects above.
[0023] Thirdly, this application provides a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed on an electronic device, cause the electronic device to perform the method described in any of the first aspects above.
[0024] Fourthly, embodiments of this application provide a computer program product, which, when executed by a processor, implements the method described in any of the first aspects above.
[0025] Fifthly, embodiments of this application provide a chip including a processor and a memory, wherein 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, causing the chip to perform the method described in any of the first aspects above.
[0026] The solutions provided in the second to fifth aspects above are used to implement or cooperate with the methods provided in the first aspect above, and therefore can achieve the same or corresponding beneficial effects as the methods in the first aspect, which will not be elaborated here. Attached Figure Description
[0027] Figure 1 This is a schematic diagram of an image processing method provided in an embodiment of this application; Figures 2A-2B These are schematic diagrams of images before and after image enhancement provided in the embodiments of this application; Figures 3A-3B These are schematic diagrams of images before and after contrast adjustment of the mid-bright areas of an image, provided in an embodiment of this application. Figure 4 This is a schematic diagram of an image before and after adjusting the saturation of the blue hue of an image, as provided in an embodiment of this application. Figure 5 This application provides a schematic diagram of image processing using a blend model. Figure 6 This is a schematic diagram illustrating how to determine the contrast enhancement ratio based on brightness, as provided in an embodiment of this application. Figures 7A-7C This is a set of weighted mapping maps of different brightness regions of an image provided in the embodiments of this application; Figures 8A-8C This is a set of RGB format image diagrams provided in the embodiments of this application after contrast enhancement of the mid-bright areas of the image; Figures 9A-9C This is a set of RGB format image diagrams provided in the embodiments of this application after contrast enhancement of the highlight areas of the image; Figure 10 This is a schematic diagram illustrating how to determine the saturation enhancement ratio based on hue, as provided in an embodiment of this application. Figures 11A-11C This is a set of weighted mapping maps of different color regions of an image provided in the embodiments of this application; Figures 12A-12C This is a set of RGB format image diagrams provided in the embodiments of this application after saturation enhancement of the blue area of the image; Figure 13 This is a schematic diagram illustrating the calculation of the color difference between an input image and an output image, provided in an embodiment of this application. Figure 14 This is a schematic flowchart of an image processing method provided in an embodiment of this application; Figure 15 This is a schematic diagram of the software structure of an electronic device provided in an embodiment of this application; Figure 16 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0029] It should be understood that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0030] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application can be combined with other embodiments.
[0031] To facilitate understanding, some relevant concepts involved in this application will be explained below.
[0032] 1. RGB space (or RGB color space) The RGB color space is based on three primary colors: red (R), green (G), and blue (B). Different degrees of superposition are used to produce a rich and wide range of colors, hence it is commonly known as the three-primary-color model.
[0033] The RGB color space is the most commonly used method for representing color information. It uses the brightness of the three primary colors—red, green, and blue—to quantitatively represent color. Color mixing is achieved by superimposing the three RGB colors. Different proportions of the three colors result in different colors. Changing the mixing proportions produces a variety of mixing effects. The RGB color space can be viewed as a unit cube in a three-dimensional Cartesian coordinate system. Any color in the RGB space can be represented by a point in three-dimensional space. In the RGB space, any color of light can be created by adding the different components of the three RGB colors.
[0034] 2. LAB space (or LAB color space) LAB space is obtained by mathematically modeling the human eye's perception of different spectral stimuli.
[0035] L represents brightness (lightness / luminance), with a value range of 0-100, representing brightness levels from black to white.
[0036] A represents the position of the color on the red-green axis, with a value range from -128 to +127, where negative values represent green and positive values represent red.
[0037] B represents the position of the color on the yellow-blue axis, with a value range of -128 to +127. Negative values represent blue, and positive values represent yellow.
[0038] 3. LCH color space (or LCH color space) The LCH color space is used to describe the lightness, chromaticity, and hue of colors.
[0039] The LCH space is more intuitive than the LAB space. It represents color attributes in polar coordinates and is more suitable for describing the appearance and perceptual properties of color.
[0040] L (lightness / luminance) represents the brightness or luminance level of a color. It indicates how light or dark a color is relative to neutral gray, with a value ranging from 1 to 100. Lower brightness values are closer to black, and higher brightness values are closer to white.
[0041] C (chroma) represents the saturation or intensity of a color. It measures the purity or saturation of a color relative to neutral gray. Lower chroma values indicate a darker color or one that is close to gray, while higher chroma values indicate a vibrant color with high saturation.
[0042] H (hue) represents hue, that is, the appearance of a color. Hue is the primary characteristic of color and the most accurate standard for distinguishing different colors. Its value ranges from 0 to 360 degrees, indicating the position of the color on the color wheel.
[0043] This application provides an image processing method that allows an electronic device to control the enhancement effect and magnitude of an image based on the differences 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 that decouples image brightness and color (e.g., LAB or LCH space), adjust them separately, then perform an inverse color space transformation, and finally output an image with contrast, saturation, etc., adjusted accordingly. By implementing this method, the intensity of the image enhancement effect of the black-box model can be controlled in one or more dimensions.
[0044] It should be noted that the electronic devices mentioned in the embodiments of this application can be portable electronic devices (or handheld terminal devices) running Harmony®, iOS®, Android®, Microsoft®, or other operating systems, such as mobile phones, tablets, smartwatches, smart bracelets, etc. They can also be non-portable electronic devices such as laptops, desktop computers, in-vehicle devices, and home LCD displays with touch-sensitive surfaces or touch panels. The embodiments of this application do not limit the specific type of electronic device.
[0045] Figure 1 This is a schematic diagram of an image processing method provided in an embodiment of this application.
[0046] In this embodiment, the image to be processed is in RGB format as an example. It is easy to understand that the format is not limited to RGB; the image to be processed can also be in other formats, and this embodiment does not limit this.
[0047] See Figure 1 The RGB input (RGBin) can be an RGB format image 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 RGB format image, i.e., RGB output 1 (RGBout1).
[0048] See Figure 2A and Figure 2B , Figure 2A An example is shown of an RGB format image to be processed, that is, the image before image enhancement using the black-box model described above. Figure 2B An example is shown Figure 2A The example image shown is the result of image enhancement using the black-box model described above. To obtain an intermediate image between the original and enhanced versions, adjustments need to be made to dimensions such as brightness contrast and color saturation.
[0049] This application provides an image processing model, namely... Figure 1 The exemplary blend model allows for controllable enhancement of black-box model images in one or more dimensions. See also... Figure 1 The model's input can include RGB input, RGB output 1, and weights (xmlweight) from an XML file. The model's output can be RGB output 2 (RGBout2). It's easy to understand that RGB output 2 is the image adjusted in one or more dimensions (such as contrast, saturation, etc.).
[0050] It should be noted that the name of the image processing model "blend" described above is not limited in the embodiments of this application. In the embodiments of this application, this model may be called the "blend model," and in some embodiments of this application, this model may also have other names.
[0051] See Figure 3A and Figure 3B Taking contrast as an example, the blend model can adjust the contrast of different brightness areas of an image. It's easy to understand that an image can be divided into multiple different brightness areas. In this embodiment, we take three different brightness areas as examples: low-brightness area (i.e., area with lower brightness, also called low-level brightness area), medium-brightness area (i.e., area with moderate brightness, also called medium-level brightness area), and high-brightness area (i.e., area with higher brightness, also called high-level brightness area). See [reference needed]. Figure 3A , Figure 3A The image shown is marked with three different brightness regions: low-brightness, medium-brightness, and high-brightness. Taking the adjustment of contrast in the medium-brightness region of the image using the blend model as an example... Figure 3A The contrast enhancement ratio in the mid-bright areas of the image shown is 0. Figure 3B The contrast enhancement ratio for the mid-bright areas of the image shown is 1.0. Figure 3A and Figure 3B It can be seen from this that Figure 3B Compared to Figure 3A In other words, the contrast enhancement effect in the mid-brightness area is higher; that is, as the contrast enhancement ratio in a region increases, the contrast enhancement effect (or enhancement magnitude) in that region will increase. This is easy to understand. Figure 3A and Figure 3B Taking contrast enhancement ratios of 0 and 1.0 as examples only, but not limited to these, the contrast enhancement ratio can also be any value between 0 and 1.0, which can be reasonably adjusted according to the actual application scenario.
[0052] See Figure 4Taking saturation as an example, the blend model can adjust the saturation of different color regions in an image. It's easy to understand that an image can be divided into multiple different color regions. In this embodiment, we take the red, green, and blue regions as examples. (See reference...) Figure 4 Taking the adjustment of saturation in the blue region of an image using the blend model as an example, Figure 4 The images shown have blue hue (or blue color) saturation enhancement ratios of 0, 0.5, and 1.0 from left to right. Figure 4 It can be seen that as the proportion of saturation enhancement in the blue hue increases, the saturation enhancement effect (or enhancement magnitude) of that blue hue also increases. This is easy to understand. Figure 4 Taking saturation enhancement ratios of 0, 0.5, and 1.0 as examples, but not limited to these, 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.
[0053] The following is combined Figure 5 The above blend model will be introduced.
[0054] See Figure 5 The blend model can convert the input and output of the black box model to a color space that decouples the brightness and color of the image. In this embodiment, the conversion from RGB space to LAB space is taken as an example.
[0055] For example, the blend model can convert RGB input (RGBin) into standard RGB (standardRGB, sRGB) input. Furthermore, it can convert sRGB input into Lab input (Labin) through related algorithms for sRGB to Lab conversion (sRGB2Lab). It is easy to understand that Lab input is the sRGB input in Lab space.
[0056] Similarly, the blend model can also convert RGB output 1 (RGBout1) into sRGB output 1. Furthermore, it can convert sRGB output 1 into Lab output 1 (Labout1) through the relevant algorithm of sRGB to Lab (sRGB2Lab). It is easy to understand that Lab output 1 is the output of sRGB output 1 in Lab space.
[0057] After obtaining the Lab input and Lab output 1, the blend model can input the Lab input and Lab output 1 into the subtractor, and perform a subtraction operation between the Lab output 1 and the Lab input to obtain the Lab change amount 1 (LabDelta1). The subtraction operation between the Lab output 1 and the Lab input refers to subtracting the corresponding value (e.g., brightness value, saturation value) of the pixel at the Lab output 1 and the corresponding value (e.g., brightness value, saturation value) of the pixel at the Lab input in a certain dimension (e.g., contrast, saturation value). The Lab change amount 1 is the difference between the corresponding value (e.g., brightness value, saturation value) of the pixel at the Lab output 1 and the corresponding value (e.g., brightness value, saturation value) of the pixel at the Lab input in a certain dimension (e.g., contrast, saturation value).
[0058] After obtaining Lab change 1, the blend model can input Lab change 1 and the weight map into the multiplier, and perform a multiplication operation (or fusion operation) on Lab change 1 and the weight map to obtain Lab change 2 (LabDelta2). The weight map can be determined based on the Lab input and weight values. The weight value (also called the enhancement ratio or enhancement coefficient) refers to the proportion or coefficient of enhancement of the pixels in the Lab input in a certain dimension (e.g., contrast enhancement ratio / coefficient, saturation enhancement ratio / coefficient, etc.). The weight value can be the numerical value corresponding to the weight attribute in an Extensible Markup Language (XML) file, which can be set by the developer; the rules for setting this value are not limited in this embodiment. The multiplication operation between Lab change 1 and the weight map can refer to the multiplication operation between Lab change 1 and the weight value of the pixel in the weight map and the corresponding weight value in the same dimension (such as contrast, saturation, etc.) of Lab change 1. Lab change 2 is the product of Lab change 1 and the weight value of the pixel in the weight map and the corresponding weight value in the same dimension (such as contrast, saturation, etc.) of Lab change 1.
[0059] After obtaining the Lab change factor 2, the blend model can input the Lab input and the Lab change factor 2 into the adder, performing an addition operation on the Lab input and the Lab change factor 2 to obtain the Lab output 2 (Labout2). The addition operation between the Lab input and the Lab change factor 2 can refer to the addition of the Lab change factor 2 and the corresponding values (e.g., brightness, saturation values) of the pixels in the Lab input within the same dimension (e.g., contrast, saturation). The Lab output 2 is the output in the LAB space obtained by summing the Lab change factor 2 and the corresponding values (e.g., brightness, saturation values) of the pixels in the Lab input within the same dimension (e.g., contrast, saturation).
[0060] After obtaining Lab output 2, the blend model can convert Lab output 2 into RGB output 2 (RGBout2) using the relevant algorithm for Lab to RGB (Lab2RGB). It is easy to understand that RGB output 2 is the output of Lab output 2 in RGB space.
[0061] It should be noted that the above explanation of the blend model only uses the LAB color space as an example. It is not limited to this. The blend model is also applicable to other color spaces, such as the LCH color space. The image processing process in the LCH color space is similar to the image processing process in the LAB color space, and will not be repeated here.
[0062] The blend model provided in this application has strong versatility and can adjust the enhancement effect of an image in one or more dimensions after multiple image enhancement models, thus offering high flexibility.
[0063] Continue reading Figure 5 In some embodiments, the blend model can also input Lab output 1 and the weight map into the multiplier, and perform a multiplication operation between Lab output 1 and the weight map to obtain Lab output 2.
[0064] The following example uses contrast to illustrate how the blend model adjusts the contrast of different brightness areas in an image.
[0065] Taking the LAB color space as an example, the brightness areas of an image can be divided into low-brightness areas, medium-brightness areas, and high-brightness areas.
[0066] See Figure 6 , Figure 6This is a schematic diagram illustrating how to determine the contrast enhancement ratio based on brightness, as provided in an embodiment of this application. The horizontal axis represents brightness, and the vertical axis represents the contrast enhancement ratio. The horizontal axis can be represented by the brightness corresponding to the L dimension in the LAB space, with a value range of 0-100. It can be seen that... Figure 6 The range of values on the horizontal axis shown is the normalized range of brightness values. It's easy to understand that the brightness value corresponding to the horizontal axis represents the brightness value of the pixel input in Lab mode.
[0067] Continue reading Figure 6 In this embodiment, a Gaussian function is used to represent the relationship between brightness and contrast enhancement ratio. Three Gaussian curves can be used to represent the contrast enhancement strength (also called weight value / enhancement ratio / enhancement coefficient) of the three different brightness areas of Lab input: low brightness area, medium brightness area, and high brightness area.
[0068] It should be noted that the mean, standard deviation, amplitude, and other parameters of the Gaussian function mentioned above can all be adjusted. The adjustment rules can be determined according to the actual application scenario, and this application embodiment does not limit this.
[0069] Continue reading Figure 6 Curve 1 represents the relationship between the brightness value of the pixel in the low-brightness area of Lab input and the contrast enhancement ratio; Curve 2 represents the relationship between the brightness value of the pixel in the medium-brightness area of Lab input and the contrast enhancement ratio; Curve 3 represents the relationship between the brightness value of the pixel in the high-brightness area of Lab input and the contrast enhancement ratio; and Curve 4 represents the relationship between the brightness value of the pixel in the three brightness areas of Lab input as a whole and the contrast enhancement ratio.
[0070] As can be seen from curve 1, in the low-brightness area, the higher the brightness value of a pixel, the lower the contrast enhancement ratio corresponding to that pixel.
[0071] As can be seen from curve 2, in the mid-brightness region, when the brightness value of a pixel is less than 0.5, the higher the brightness value of the pixel, the higher the contrast enhancement ratio of the corresponding pixel. When the brightness value of a pixel is greater than 0.5, the higher the brightness value of the pixel, the lower the contrast enhancement ratio of the corresponding pixel.
[0072] As can be seen from curve 3, in the bright area, the higher the brightness value of a pixel, the higher the contrast enhancement ratio of that pixel.
[0073] It's easy to understand that, based on curves 1, 2, and 3 above, we can obtain the contrast enhancement ratios for all pixels in the low-brightness region, the mid-brightness region, and the high-brightness region, respectively. In other words, based on curves 1, 2, and 3, we can obtain the weight values (i.e., contrast enhancement ratios) of all pixels in the Lab input under the contrast dimension. Furthermore, by combining this with the Lab input, we can obtain... Figure 7A The weight mapping diagram of the low-brightness region shown. Figure 7B The weight mapping diagram of the bright area shown. Figure 7C The weight mapping diagram of the highlighted area is shown.
[0074] After obtaining the weight mapping graph, then combine it with Figure 5 The image processing shown ultimately yields an RGB image with enhanced contrast.
[0075] It is readily understood that, in this embodiment of the application, based on the aforementioned weight mapping map, contrast enhancement can be performed on only a single brightness region of the image, or on multiple brightness regions of the image. For example, to enhance contrast only on the mid-bright regions of the image, the weight mapping map of the mid-bright regions described above can be used. Figure 5 The image processing steps shown are used to ultimately obtain an RGB format image with enhanced contrast in the mid-bright areas. For example, to enhance the contrast of the mid-bright and bright areas of an image, the weight mapping maps for the mid-bright and bright areas described above can be used. Figure 5 The image processing steps shown are used to obtain an RGB format image with enhanced contrast in the mid-bright and bright areas.
[0076] Figures 8A-8C An RGB format image is shown as an example, with contrast enhancement applied to the mid-bright areas of the image.
[0077] See Figures 8A-8C , Figure 8A The image shown is one where the contrast enhancement ratio in the mid-bright area is 0. Figure 8B The image shown is an image with a contrast enhancement ratio of 0.5 in the mid-bright area. Figure 8C The image shown is an image with a contrast enhancement ratio of 1.0 in the mid-bright areas. From Figures 8A-8C As can be seen, as the contrast enhancement ratio in the mid-bright area increases, the contrast enhancement effect (or enhancement magnitude) in that area also increases.
[0078] Figures 9A-9C An RGB format image is shown as an example, with contrast enhancement applied to the highlight areas of the image.
[0079] See Figures 9A-9C , Figure 9A The image shown is one where the contrast enhancement ratio for the highlight areas is 0. Figure 9B The image shown is one where the contrast enhancement ratio for the highlight areas is 0.5. Figure 9C The image shown is one where the contrast enhancement ratio for the highlight areas is 1.0. From Figures 9A-9C As can be seen, as the contrast enhancement ratio of the bright area increases, the contrast enhancement effect (or enhancement magnitude) of that area also increases.
[0080] It is easy to understand that the contrast enhancement ratio (e.g., 0, 0.5, 1.0, etc.) of a certain area (e.g., low brightness area, medium brightness area, high brightness area) mentioned above can refer to the maximum value of the contrast enhancement ratio corresponding to the pixel in that area.
[0081] In the LAB space, the brightness difference (diff) between the input image and the output image can be represented by the formula diff=Ldst –Lsrc, where Lsrc is the brightness of the input image and Ldst is the brightness of the output image.
[0082] It should be noted that the above example only uses the division of the image brightness area into three brightness areas: low brightness area, medium brightness area, and high brightness area. It is not limited to this. The brightness area of the image can also be divided into more or fewer brightness areas. This application embodiment does not limit this.
[0083] It should be noted that the above example of using the LAB color space to illustrate how the blend model adjusts the contrast of different brightness areas of an image should not be construed as limiting 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 an image is similar, and will not be elaborated here.
[0084] It should be noted that the above uses a Gaussian function to represent the relationship between brightness and contrast enhancement ratio, but it is not limited to this. Other functions can also be used to represent the relationship between brightness and contrast enhancement ratio, and the embodiments of this application do not limit this.
[0085] The following example uses saturation to illustrate how the blend model adjusts the saturation of different color regions in an image.
[0086] Taking the LCH color space as an example, the color regions of an image can be divided into red, green, and blue regions.
[0087] See Figure 10 , Figure 10This is a schematic diagram illustrating the determination of saturation enhancement ratio based on hue, provided in an embodiment of this application. The horizontal axis represents hue, and the vertical axis represents the saturation enhancement ratio. The horizontal axis can be represented by the hue corresponding to the H dimension of the LCH space, with a value range of 0-360 degrees. It is easy to understand that the hue value corresponding to the horizontal axis can represent the hue value corresponding to the color of the pixel input in Lab mode.
[0088] Continue reading Figure 10 In this embodiment, a Gaussian function is used to represent the relationship between hue and saturation enhancement ratio. Three Gaussian curves can be used to represent the saturation enhancement strength (also called weight value / enhancement ratio / enhancement coefficient) of the three different color regions of the Lab input: red region, green region, and blue region.
[0089] It should be noted that the mean, standard deviation, amplitude, and other parameters of the Gaussian function mentioned above can all be adjusted. The adjustment rules can be determined according to the actual application scenario, and this application embodiment does not limit this.
[0090] Continue reading Figure 10 Curve 1 represents the relationship between the hue value and saturation enhancement ratio of the pixels in the red region of Lab input; Curve 2 represents the relationship between the hue value and saturation enhancement ratio of the pixels in the green region of Lab input; Curve 3 represents the relationship between the hue value and saturation enhancement ratio of the pixels in the blue region of Lab input; and Curve 4 represents the relationship between the hue value and saturation enhancement ratio of the pixels in all three color regions of Lab input.
[0091] It's easy to understand that, based on curves 1, 2, and 3 above, we can obtain the saturation enhancement ratios for all pixels in the red region, the green region, and the blue region, respectively. In other words, based on curves 1, 2, and 3, we can obtain the weight values (i.e., saturation enhancement ratios) for all pixels in the Lab input dimension. Furthermore, by combining this with the Lab input, we can obtain... Figure 11A The weight mapping diagram of the red area shown. Figure 11B The weight mapping diagram of the green area shown. Figure 11C The weight mapping diagram for the blue area shown.
[0092] After obtaining the weight mapping graph, then combine it with Figure 5 The image processing shown can ultimately produce an RGB image with enhanced saturation.
[0093] It is readily understood that, in this embodiment of the application, based on the aforementioned weight mapping map, saturation enhancement can be applied to only one color region of the image, or it can be applied to multiple color regions of the image. For example, to enhance the saturation of only the blue region of the image, the weight mapping map of the blue region can be used as described above. Figure 5 The image processing steps shown are used to ultimately obtain an RGB image with enhanced saturation in the blue region. For example, to enhance the saturation of both the blue and red regions of an image, the weight mapping maps for the blue and red regions described above can be used. Figure 5 The image processing steps shown are used to ultimately obtain an RGB format image with enhanced saturation in the blue and red areas.
[0094] Figures 12A-12C An RGB format image is shown as an example, with the blue areas of the image enhanced for saturation.
[0095] See Figures 12A-12C , Figure 12A The image shown is an image where the saturation enhancement ratio of the blue area (such as the sky area) is 0. Figure 12B The image shown is an image where the saturation enhancement ratio of the blue area is 0.5. Figure 12C The image shown is an image where the saturation enhancement ratio for the blue area is 1.0. From Figures 12A-12C As can be seen, as the saturation enhancement ratio of the blue area increases, the saturation enhancement effect (or enhancement magnitude) of that area also increases.
[0096] 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 in that region.
[0097] See Figure 13 In the LAB color space, the color difference between the input and output images can be expressed by the following formula:
[0098] in, The color difference between the input and output images. For the color of the input image, To output the color of the image.
[0099] In the LCH color space, the color difference between the input and output images can be expressed by the following formula:
[0100] in, The color difference between the input and output images. For the color of the input image, To output the color of the image.
[0101] It should be noted that the above example only uses the division of the image's color regions into three color regions: red, green, and blue. It is not limited to this; the image's color regions can also be divided into more or fewer color regions. This application does not limit this.
[0102] It should be noted that the above example of using the LCH color space to illustrate how the blend model adjusts the saturation of different color regions of an image should not be construed as limiting this application. In other color spaces, such as the LAB color space, the process of the blend model adjusting the saturation of different color regions of an image is similar and will not be elaborated here.
[0103] It should be noted that the above uses a Gaussian function to represent the relationship between hue and saturation enhancement ratio. It is not limited to this, and other functions can also be used to represent the relationship between hue and saturation enhancement ratio. This application does not limit this.
[0104] Figure 14 The specific flow of an image processing method provided by an embodiment of this application is illustrated by way of example.
[0105] like Figure 14 As shown, this method can be applied to electronic devices. The specific steps of this method are described in detail below: S1401. The electronic device performs image enhancement processing on the first image to obtain the second image.
[0106] The first image can be, for example, Figure 5 The second image, as shown in the RGB input, can be, for example, RGB input. Figure 5 The RGB output shown is 1. Image enhancement can include, but is not limited to, contrast enhancement and saturation enhancement.
[0107] S1402. 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 or LCH color space.
[0108] For example, see Figure 5 The conversion of the first image from the first color space to the second color space can be, for example, from 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, from RGB output 1 to Lab output 1.
[0109] For example, 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.
[0110] 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, wherein 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.
[0111] Where the second color space is the LAB color space, the third image can be, for example, Figure 5 The Lab output 2 shown; if the second color space is the LCH color space, the third image can be, for example, Lch output 2.
[0112] The differences 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, then the multiple regions include multiple regions with different brightness; if the difference includes the color difference, then the multiple regions include multiple regions with different colors.
[0113] 1. Image enhancement as contrast enhancement: In one possible implementation, the electronic device adjusts the intensity of image enhancement in multiple regions of the first image to obtain a third image. Specifically, this includes: the electronic device subtracting the brightness values corresponding to pixels in the second image from the brightness values corresponding to pixels in the first image to obtain a first brightness change; the electronic device determining a first weight, which indicates the contrast enhancement ratio corresponding to each pixel in the first image; the electronic device multiplying the first brightness change by the first weight to obtain a second brightness change; and the electronic device obtaining a third image based on the first image and the second brightness change, wherein the brightness values corresponding to pixels in the third image are obtained by adding the brightness values corresponding to pixels in the first image to the second brightness change.
[0114] In one possible implementation, the contrast enhancement ratio of each pixel has a preset correspondence with the brightness value of that pixel.
[0115] In one possible implementation, the aforementioned preset correspondence is determined by a first preset function, which includes a Gaussian function, such as... Figure 6 The Gaussian function shown.
[0116] In one possible implementation, in a first brightness region of the first image, the higher the brightness value of a pixel, the lower the contrast enhancement ratio corresponding to that pixel; in a second brightness region of the first image, the higher the brightness value of a pixel, the higher the contrast enhancement ratio corresponding to that pixel; in a third brightness region of the first image, the higher the brightness value of a pixel within the first brightness range, the higher the contrast enhancement ratio corresponding to that pixel; and the higher the brightness value of a pixel within the second brightness range, the lower the contrast enhancement ratio corresponding to that pixel; 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 pixels within the first brightness range is lower than the brightness value of pixels within the second brightness range.
[0117] In one possible implementation, the first brightness region may be, for example, a low-brightness region, the second brightness region may be, for example, a high-brightness region, the third brightness region may be, for example, a medium-brightness region, and the first brightness range may be, for example, a low-brightness region. Figure 6 The left half of the peak of curve 2 shown above, the aforementioned second brightness range can be, for example, the... Figure 6 The right half of the peak of curve 2 shown.
[0118] 2. Image enhancement as saturation enhancement: In one possible implementation, the electronic device adjusts the intensity of image enhancement in multiple regions of the first image to obtain a third image. Specifically, this includes: the electronic device subtracting the saturation values corresponding to pixels in the second image from the saturation values corresponding to pixels in the first image to obtain a first saturation change; the electronic device determining a second weight, which indicates the saturation enhancement ratio corresponding to each pixel in the first image; the electronic device multiplying the first saturation change by the second weight to obtain a second saturation change; and the electronic device obtaining a third image based on the first image and the second saturation change, wherein the saturation values corresponding to pixels in the third image are obtained by adding the saturation values corresponding to pixels in the first image to the second saturation change.
[0119] In one possible implementation, the saturation enhancement ratio of each pixel has a preset correspondence with the hue value of that pixel.
[0120] In one possible implementation, the aforementioned preset correspondence is determined by a second preset function, which includes a Gaussian function, such as... Figure 10 The Gaussian function shown.
[0121] In one possible implementation, in a first color region of the first image, the higher the hue value of a pixel within a first hue range, the higher the saturation enhancement ratio of that pixel; the higher the hue value of a pixel within a second hue range, the lower the saturation enhancement ratio of that pixel; wherein the hue values of pixels within the first hue range are less than the hue values of pixels within the second hue range. In a second color region of the first image, the higher the hue value of a pixel within a third hue range, the higher the saturation enhancement ratio of that pixel; the higher the hue value of a pixel within a fourth hue range, the lower the saturation enhancement ratio of that pixel; wherein the hue values of pixels within the third hue range are less than the hue values of pixels within the fourth hue range. In a third color region of the first image, the higher the hue value of a pixel within a fifth hue range, the higher the saturation enhancement ratio of that pixel; the higher the hue value of a pixel within a sixth hue range, the lower the saturation enhancement ratio of that pixel; wherein the hue values of pixels within the fifth hue range are less than the hue values of pixels within the sixth hue range.
[0122] In one possible implementation, the first color region may be, for example, a red region, the second color region may be, for example, a green region, the third color region may be, for example, a blue region, and the first hue range may be, for example, a red region, a green region, a blue region, and a blue region. Figure 10 The left half of the peak of curve 1 shown above, the aforementioned second hue range can be, for example, the... Figure 10 The right half of the peak of curve 1 shown above, the aforementioned third hue range can be, for example, the... Figure 10 The left half of the peak of curve 2 shown above, the aforementioned fourth hue range can be, for example, the... Figure 10 The right half of the peak of curve 2 shown above, the aforementioned fifth hue range can be, for example, the... Figure 10 The left half of the peak of curve 3 shown above, the aforementioned sixth hue range can be, for example, the... Figure 10 The right half of the peak of curve 3 shown.
[0123] S1404. The electronic device converts the third image from the second color space to the first color space and outputs the third image.
[0124] The third image output can be, for example, Figure 5 The RGB output shown is 2.
[0125] By implementing the image processing method provided in the embodiments of this application, electronic devices can control the intensity of image enhancement in multiple regions of the image after image enhancement of the black box model in different spaces (e.g., LAB space, LCH space) and different dimensions, thereby achieving better image enhancement effects and providing users with a better visual experience.
[0126] The following describes the software structure of an electronic device provided by an embodiment of this application.
[0127] Figure 15 An exemplary embodiment of the software structure of an electronic device provided in this application is illustrated.
[0128] like Figure 15 As shown, the software system of an electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of an electronic device.
[0129] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the system libraries, and the kernel layer.
[0130] The application layer can include a series of application packages.
[0131] like Figure 15 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0132] The image processing method provided in this application can be applied to various image-related applications, such as camera applications, gallery applications, etc.
[0133] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0134] like Figure 15 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0135] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0136] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0137] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0138] A phone manager is used to provide communication functions for electronic devices. For example, it manages call status (including connection and disconnection).
[0139] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0140] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0141] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0142] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0143] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.
[0144] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0145] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0146] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0147] A 2D graphics engine is a graphics engine for 2D drawing.
[0148] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0149] The following is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0150] Figure 16 An exemplary embodiment of the present application provides the structure of an electronic device.
[0151] like Figure 16 As 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 jack 270D, a sensor module 280, a camera 293, a display screen 294, etc. The sensor module 280 may include a pressure sensor 280A, a touch sensor 280B, etc.
[0152] Processor 210 may include one or more processing units, such as application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0153] The controller can serve as the nerve center and command center of an electronic device. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.
[0154] The processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. This memory can store instructions or data that the processor 210 has just used or that are used repeatedly. If the processor 210 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.
[0155] The USB 230 interface is a USB standard compliant interface, which can be a Mini USB interface, Micro USB interface, USB Type-C interface, etc. The USB 230 interface can be used to connect a charger to charge electronic devices, and can also be used for data transfer between electronic devices and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other terminal devices.
[0156] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0157] The charging management module 240 is used to receive charging input from the charger. The charger can be a wireless charger or a wired charger.
[0158] 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 input from the battery 242 and / or the charging management module 240 to power the processor 210, internal memory 221, external memory interface 220, display screen 294, camera 293, etc.
[0159] Display screen 294 is used to display images, videos, etc. Display screen 294 includes a display panel. The display panel may be 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 Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include one or N displays 294, where N is a positive integer greater than 1.
[0160] 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.
[0161] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when an electronic device is selecting a frequency, a DSP can perform a Fourier transform on the frequency energy.
[0162] Video codecs are used to compress or decompress digital video. Electronic devices can support one or more video codecs. This allows the electronic device to play or record video in various encoded formats.
[0163] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0164] The external storage 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 storage interface 220 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0165] Internal memory 221 can be used to store computer executable program code, which includes instructions. Processor 210 executes various functional applications and data processing of the electronic device by running the instructions stored in internal memory 221. Internal memory 221 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application required for a function (such as facial recognition, fingerprint recognition, mobile payment, etc.). The data storage area may store data created during the use of the electronic device (such as facial information template data, fingerprint information templates, etc.). Furthermore, internal memory 221 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0166] Electronic devices can implement audio functions through audio modules 270, speakers 270A, receivers 270B, microphones 270C, headphone jacks 270D, and application processors. Examples include music playback and recording.
[0167] The audio module 270 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 270 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 270 may be located in the processor 210, or some functional modules of the audio module 270 may be located in the processor 210.
[0168] The speaker 270A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. Electronic devices can listen to music or make hands-free calls through the speaker 270A.
[0169] The receiver 270B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When an electronic device answers a phone call or voice message, the receiver 270B can be brought close to the ear to hear the voice.
[0170] The microphone 270C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals.
[0171] The headphone jack 270D is used to connect wired headphones. The headphone jack 270D can be a USB 230 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
[0172] Pressure sensor 280A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 280A can be disposed on display screen 294. There are many types of pressure sensors 280A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 280A, the capacitance between the electrodes changes. The electronic device determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 294, the electronic device detects the intensity of the touch operation based on pressure sensor 280A. The electronic device can also calculate the touch position based on the detection signal from pressure sensor 280A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands.
[0173] Touch sensor 280B, also known as a "touch panel," can be located on display screen 294. The touch sensor 280B and display screen 294 together form a touchscreen, also known as a "touch screen." Touch sensor 280B detects touch operations applied to or near it. 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 display screen 294. In other embodiments, touch sensor 280B may also be located on the surface of the electronic device, in a different position than display screen 294.
[0174] It should be understood that, Figure 16 The electronic device shown is merely an example, and electronic devices can have more than... Figure 16 The more or fewer components shown can be combined into two or more components, or they can 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.
[0175] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0176] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as meaning "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".
[0177] This application provides a chip system including: a processor coupled to a memory for storing programs or instructions, wherein when the program or instructions are executed by the processor, the chip system implements the methods described in any of the above method embodiments.
[0178] Optionally, the chip system may contain one or more processors. These processors can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.
[0179] Optionally, the chip system may contain one or more memories. The memory may be integrated with the processor or disposed separately from it; this application embodiment does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed separately on different chips. This application embodiment does not specifically limit the type of memory or the arrangement of the memory and processor.
[0180] For example, the chip system may be a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a system-on-a-chip (SoC), a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), or other integrated chips.
[0181] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.
[0182] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially 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 a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0183] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
Claims
1. An image processing method, characterized in that, Applied to electronic devices, the method includes: The second image is obtained by performing image enhancement processing on the first image using a black-box model; The first image and the second image are converted from a first color space to a second color space that decouples brightness and color. 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 or LCH color space. A first change in image enhancement is determined based on the difference between the first image converted to the second color space and the second image converted to the second color space, the difference including brightness difference and / or saturation difference; Obtain a weight mapping map, which is used to indicate the image enhancement ratio corresponding to multiple regions of the first image. The multiple regions are regions corresponding to different brightness levels or different colors. The image enhancement ratio includes a contrast enhancement ratio and / or a saturation enhancement ratio. The contrast enhancement ratio is determined based on the mapping relationship between the brightness value of a pixel and the contrast enhancement ratio, and the saturation enhancement ratio is determined based on the mapping relationship between the hue value of a pixel and the saturation enhancement ratio. A second change in image enhancement is determined based on the first change in image enhancement and the weight map; A third image is obtained based on the first image converted to the second color space and the second change amount of the image enhancement; The third image is converted from the second color space to the first color space, and the converted third image is output.
2. The method according to claim 1, characterized in that, If the difference includes the brightness difference, then the plurality of regions include a plurality of regions with different brightness, and the weighted mapping is used to indicate the contrast enhancement ratio corresponding to the plurality of regions with different brightness; If the difference includes the saturation difference, then the plurality of regions include a plurality of regions of different colors, and the weighted mapping is used to indicate the saturation enhancement ratio corresponding to the plurality of regions of different colors.
3. The method according to claim 1 or 2, characterized in that, The first change amount for image enhancement is a first brightness change amount, which is obtained by subtracting the brightness value corresponding to the pixel of the second image converted to the second color space from the brightness value corresponding to the pixel of the first image converted to the second color space. The second change amount for image enhancement is a second brightness change amount. The second change amount for image enhancement is determined based on the first change amount for image enhancement and the weight mapping map, specifically including: A first weight is determined based on the weight mapping, and the first weight is used to indicate the contrast enhancement ratio corresponding to each pixel of the first image. The second brightness change is obtained by multiplying the first brightness change by the first weight. A third image is obtained based on the first image converted to the second color space and the second change amount of image enhancement, specifically including: The third image is obtained based on the first image converted to the second color space and the second brightness change amount, wherein the brightness value corresponding to the pixel of the third image is obtained by adding the brightness value corresponding to the pixel of the first image converted to the second color space with the second brightness change amount.
4. The method according to claim 3, characterized in that, In the first brightness region of the first image, the higher the brightness value of a pixel, the lower the contrast enhancement ratio of the corresponding pixel. In the second brightness region of the first image, the higher the brightness value of a pixel, the higher the contrast enhancement ratio of the corresponding pixel. In the third brightness region of the first image, the higher the brightness value of a pixel within the first brightness range, the higher the contrast enhancement ratio of the corresponding pixel. The higher the brightness value of a pixel within the second brightness range, the lower the contrast enhancement ratio of the corresponding pixel. 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 in the first brightness range is lower than the brightness value of the pixel in the second brightness range.
5. The method according to claim 1, 2, or 4, characterized in that, The mapping relationship between the brightness value of a pixel and the contrast enhancement ratio is determined by a first preset function, which includes a Gaussian function.
6. The method according to claim 3, characterized in that, The mapping relationship between the brightness value of a pixel and the contrast enhancement ratio is determined by a first preset function, which includes a Gaussian function.
7. The method according to claim 1 or 2, characterized in that, The first change amount for image enhancement is a first saturation change amount, which is obtained by subtracting the saturation value corresponding to the pixel of the second image converted to the second color space from the saturation value corresponding to the pixel of the first image converted to the second color space. The second change amount for image enhancement is a second saturation change amount. The second change amount for image enhancement is determined based on the first change amount and the weight mapping map, specifically including: A second weight is determined based on the weight map, and the second weight is used to indicate the saturation enhancement ratio corresponding to each pixel of the first image; The second saturation change is obtained by multiplying the first saturation change with the second weight. A third image is obtained based on the first image converted to the second color space and the second change amount of image enhancement, specifically including: The third image is obtained based on the first image converted to the second color space and the second saturation change, wherein the saturation value corresponding to the pixel of the third image is obtained by adding the saturation value corresponding to the pixel of the first image converted to the second color space to the second saturation change.
8. The method according to claim 7, characterized in that, In the first color region of the first image, the higher the hue value of a pixel within the first hue range, the higher the saturation enhancement ratio of the corresponding pixel. The higher the hue value of a pixel within the second hue range, the lower the saturation enhancement ratio of that pixel; wherein, the hue value of a pixel within the first hue range is lower than the hue value of a pixel within the second hue range; In the second color region of the first image, the higher the hue value of a pixel in the third hue range, the higher the saturation enhancement ratio of the corresponding pixel; the higher the hue value of a pixel in the fourth hue range, the lower the saturation enhancement ratio of the corresponding pixel; wherein, the hue value of the pixel in the third hue range is less than the hue value of the pixel in the fourth hue range; In the third color region of the first image, the higher the hue value of a pixel in the fifth hue range, the higher the saturation enhancement ratio of the corresponding pixel; the higher the hue value of a pixel in the sixth hue range, the lower the saturation enhancement ratio of the corresponding pixel; wherein, the hue value of the pixel in the fifth hue range is less than the hue value of the pixel in the sixth hue range.
9. The method according to claim 8, characterized in that, The first color area is a red area, the second color area is a green area, and the third color area is a blue area.
10. The method according to claim 1, 2, 4, 6, 8, or 9, characterized in that, The mapping relationship between the hue value of a pixel and the saturation enhancement ratio is determined by a second preset function, which includes a Gaussian function.
11. The method according to claim 3, characterized in that, The mapping relationship between the hue value of a pixel and the saturation enhancement ratio is determined by a second preset function, which includes a Gaussian function.
12. The method according to claim 5, characterized in that, The mapping relationship between the hue value of a pixel and the saturation enhancement ratio is determined by a second preset function, which includes a Gaussian function.
13. The method according to claim 7, characterized in that, The mapping relationship between the hue value of a pixel and the saturation enhancement ratio is determined by a second preset function, which includes a Gaussian function.
14. An electronic device, characterized in that, 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 used to store computer program code, the computer program code including computer instructions, which, when executed by the one or more processors, cause the electronic device to perform the method as described in any one of claims 1-13.
15. A computer-readable storage medium comprising computer instructions, characterized in that, The computer storage medium stores a computer program, which includes program instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-13.
Citation Information
Patent Citations
Dynamic contrast enhancement device and method
CN102231264A
Saturation-adaptive image enhancement apparatus and method
US20050276470A1