Image processing method and electronic device

By adjusting the global brightness and local contrast of the image, the problem of unbalanced brightness during image mode switching in the prior art is solved, the image quality and visual effects are improved, and the user experience is improved.

CN114066748BActive Publication Date: 2025-05-13SHENZHEN CULTRAVIEW DIGITAL TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111217780.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-19
Publication Date
2025-05-13
Estimated Expiration
2041-10-19

AI Technical Summary

Technical Problem

When switching between image modes in existing electronic devices, it is easy to overexpose the image content with higher brightness in the picture and the content with lower brightness in the picture cannot be seen clearly, and the mode adjustment is not universal, affecting the user's visual experience.

Method used

By performing global brightness enhancement and local contrast enhancement processing on the image, the dark and bright fields are adjusted separately, the dynamic adjustment range is refined, the image quality is enhanced, and the visual effect is improved without affecting the sense of layering.

Benefits of technology

It realizes detailed adjustments to the image, improves image quality and visual effects, solves the problem of unbalanced brightness, and improves the user's visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114066748B_ABST
    Figure CN114066748B_ABST
Patent Text Reader

Abstract

The present application provides an image processing method and electronic device, which relates to the field of image processing. The image processing method includes: performing global brightness enhancement processing on an input image to obtain a first enhanced image, and performing local contrast enhancement processing on the first enhanced image to obtain a second enhanced image. The present application adjusts the image brightness and local contrast, raises the brightness of the dark field in the image, and reduces the brightness of the bright field, while not affecting the layering performance, and refines the dynamic adjustment range to enhance the image quality, thereby improving the visual effect of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to an image processing method and electronic equipment. Background Art

[0002] With technological advancements, existing electronic devices are increasingly equipped with adjustment technologies to meet people's visual needs. For example, televisions typically offer a variety of picture modes for people to choose from, such as bright mode, soft mode, sports mode, and movie mode. By switching between these modes, people can select the desired visual effect.

[0003] However, when switching between these preset modes, it is easy for the image content with higher brightness to be overexposed and the image content with lower brightness to be unclear. Moreover, each mode actually makes the same adjustment to different images. When the situations between images are different, this patterned adjustment is not universal.

[0004] Therefore, in order to effectively adjust the display effect and improve the user's visual experience, a new image processing method is urgently needed. Summary of the Invention

[0005] The embodiments of the present application provide an image processing method and electronic device, which enhance the image quality by increasing the brightness of dark fields and reducing the brightness of bright fields in an image without affecting the sense of layering, and refining the dynamic adjustment range, thereby improving the visual effect of the image.

[0006] To achieve the above objectives, this application adopts the following technical solutions:

[0007] In a first aspect, an image processing method is provided, which is applied to an electronic device. The image processing method includes:

[0008] Performing global brightness enhancement processing on the input image to obtain a first enhanced image, wherein the global brightness enhancement processing is used to indicate that nonlinear enhancement is performed on the brightness value corresponding to each pixel in the input image, and the brightness value corresponding to each pixel in the first enhanced image is a first enhanced brightness value; performing local contrast enhancement processing on the first enhanced image to obtain a second enhanced image, wherein the local contrast enhancement processing is used to indicate that the first enhanced brightness value of a local area of ​​the first enhanced image is enhanced.

[0009] The embodiments of the present application provide an image processing method and electronic device, which adjust the global brightness and local contrast of the image, increase the brightness of the dark field in the image, and reduce the brightness of the bright field, without affecting the sense of layering, and refine the dynamic adjustment range to enhance the image quality, thereby achieving an improvement in the visual effect of the image.

[0010] In one possible implementation, performing global brightness enhancement on an input image to obtain a first enhanced image includes: determining the maximum value among the three primary color pixel values ​​corresponding to each pixel in the input image, using the maximum value as the corresponding initial brightness value; normalizing the initial brightness value to obtain an intermediate brightness value; and determining the corresponding first enhanced brightness value based on the intermediate brightness value using a brightness enhancement formula. In this implementation, the brightness enhancement formula can be used to perform nonlinear enhancement on the brightness value corresponding to each pixel in the input image.

[0011] In a possible implementation, the brightness enhancement formula is:

[0012]

[0013] Among them, B is the first enhanced brightness value, V is the intermediate brightness value, and L is the initial brightness value corresponding to when the sum of the accumulated brightness values ​​accounts for 10% of the sum of the brightness of all pixel values ​​when accumulating from small to large in the brightness accumulation histogram.

[0014] In one possible implementation, local contrast enhancement processing is performed on the first enhanced image to obtain a second enhanced image, including: determining the image standard deviation at a preset scale for the first enhanced image; determining a doubling index corresponding to the image standard deviation based on a doubling index formula; determining a contrast enhancement index based on the first enhanced brightness value and the doubling index corresponding to each pixel in the first enhanced image; and determining a second enhanced brightness value based on the first enhanced brightness value and the contrast enhancement index corresponding to each pixel in the first enhanced image, thereby generating the second enhanced image. In this implementation, using the doubling index formula, different doubling indices corresponding to different local regions can be determined, thereby determining different contrast enhancement indices, and thus different regions of the first enhanced image can be enhanced differently.

[0015] In a possible implementation, determining an image standard deviation at a preset scale for the first enhanced image includes: determining the image standard deviation at the preset scale for the first enhanced image using Gaussian filtering, bilateral filtering, or guided filtering.

[0016] In one possible implementation, the doubling index formula is:

[0017] ρ=(p1+p3*σ+p5*σ 2 +p7*σ 3 +p9*σ 4 ) / (1+p2*σ+p4*σ 2 +p6*σ 3+p8*σ 4 )

[0018] Wherein, σ is the standard deviation of the image under the preset scale, P1 to P9 are all preset values, and ρ is the doubling exponent.

[0019] In one possible implementation, determining a contrast enhancement index based on the first enhanced brightness value and the doubling index corresponding to each pixel in the first enhanced image includes: determining a corresponding convolution brightness value using adaptive scale bilateral filtering based on the first enhanced brightness value corresponding to each pixel in the first enhanced image; and determining the contrast enhancement index based on the convolution brightness value, the first enhanced brightness value, and the doubling index.

[0020] In a possible implementation, the method further includes: determining a corresponding enhanced saturation according to a saturation adjustment formula based on a brightness mean value of the second enhanced image.

[0021] In one possible implementation, the method further includes: converting the input image from the RGB domain to the HSV domain, determining the hue angle, saturation, and brightness corresponding to each pixel of the input image; determining a skin color image block in the input image located in the HSV domain; converting the skin color image block from the HSV domain to the RGB domain; performing guided filtering on the skin color image block located in the RGB domain to obtain a skin color enhanced image block; and obtaining an output image based on the skin color enhanced image block and the input image.

[0022] In a second aspect, an electronic device is provided for executing the image processing method in the above first aspect or any possible implementation manner of the first aspect.

[0023] In a third aspect, a computer-readable storage medium is provided, in which a computer program or instructions are stored. When a computer reads and executes the computer program or instructions, the computer executes the image processing method in the first aspect or any possible implementation of the first aspect.

[0024] The embodiments of the present application provide an image processing method and electronic device, which adjust the global brightness, local contrast, and skin color of the image, increase the brightness of the dark field in the image, and reduce the brightness of the bright field without affecting the sense of layering, and refine the dynamic adjustment range to enhance the image quality, thereby achieving an improvement in the visual effect of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a flowchart of an image processing method provided by an embodiment of the present application;

[0026] Figure 2is a brightness cumulative histogram provided in an embodiment of the present application;

[0027] Figure 3 It is a variation trend graph of the intermediate brightness value and the first enhanced brightness value;

[0028] Figure 4 It is a graph of the relationship between the standard deviation of an image and the doubling index;

[0029] Figure 5 is a flowchart of another image processing method provided in an embodiment of the present application;

[0030] Figure 6 is an adjustment relationship table provided in an embodiment of the present application;

[0031] Figure 7 This is a flowchart of another image processing method provided by an embodiment of the present application;

[0032] Figure 8 This is a flowchart of another image processing method provided by an embodiment of the present application;

[0033] Figure 9 It is an HSV model;

[0034] Figure 10 yes Figure 9 Projection of the HSV model shown. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0036] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in this article is merely a way to describe the association relationship of associated objects, indicating that three relationships can exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0037] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0038] Directional terms such as "left", "right", "up" and "down" are defined relative to the orientation of the display components in the accompanying drawings. It should be understood that these directional terms are relative concepts. They are used for relative descriptions and clarifications, and they may change accordingly according to changes in the orientation of the display device.

[0039] With technological advancements, existing electronic devices are increasingly equipped with adjustment technologies to meet people's visual needs. For example, televisions typically offer a variety of picture modes for users to choose from, such as bright, soft, sports, and movie modes. By switching between these modes, users can select the desired visual effect. Furthermore, televisions often offer the ability to adjust the clarity of their videos individually.

[0040] However, when switching between these preset modes, it is easy for the image content with higher brightness to be overexposed and the image content with lower brightness to be unclear. Moreover, each mode actually makes the same adjustment to different images. When the situations between images are different, this patterned adjustment is not universal.

[0041] In addition, existing TVs do not process skin tones in any way, resulting in uneven color distribution on faces in some displayed images and poor performance.

[0042] Therefore, in order to effectively adjust the display effect and improve the user's visual experience, a new image processing method is urgently needed.

[0043] In view of this, an embodiment of the present application provides an image processing method, which adjusts the global brightness, local contrast, and skin color of the image, increases the brightness of the dark field in the image, and reduces the brightness of the bright field, while not affecting the sense of layering, and refines the dynamic adjustment range to enhance the image quality, thereby achieving an improvement in the visual effect of the image.

[0044] The image processing method provided in the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0045] Figure 1 A flowchart of an image processing method is shown in FIG. Figure 1 As shown, the method includes the following S10 to S20.

[0046] S10: Perform global brightness enhancement processing on the input image to obtain a first enhanced image.

[0047] The global brightness enhancement process is used to indicate that the brightness corresponding to each pixel in the input image is nonlinearly enhanced. The brightness value corresponding to each pixel in the first enhanced image is a first enhanced brightness value.

[0048] It should be understood that nonlinear enhancement means that the intensity of the brightness enhancement corresponding to each pixel is different, which can improve the overall image quality and make the enhancement more delicate. The input image is in the RGB domain, and the first enhanced image is in the HSV domain.

[0049] S20: Perform local contrast enhancement processing on the first enhanced image to obtain a second enhanced image.

[0050] The local contrast enhancement processing is used to indicate that the first enhanced brightness value of the local area of ​​the first enhanced image is enhanced.

[0051] It should be understood that after global brightness enhancement, the first enhanced image has a reduced sense of layering compared to the input image. To further improve this, the first enhanced image can be subjected to local contrast enhancement to increase the contrast of the local content. The second enhanced image is in the HSV domain.

[0052] An embodiment of the present application provides an image processing method, which adjusts the global brightness and local contrast of an image, raises the brightness of dark fields in the image, and reduces the brightness of bright fields, while not affecting the sense of layering, and refines the dynamic adjustment range to enhance the image quality, thereby achieving an improvement in the visual effect of the image.

[0053] Optionally, as a feasible embodiment, the above S10 may include S11 to S13.

[0054] S11. Determine the maximum value among the three primary color pixel values ​​corresponding to each pixel in the input image, and use the maximum value as the corresponding initial brightness value.

[0055] S12: Normalize the initial brightness value of each pixel to obtain an intermediate brightness value.

[0056] S13. Determine a corresponding first enhanced brightness value according to the intermediate brightness value using a brightness enhancement formula.

[0057] The brightness enhancement formula is:

[0058]

[0059] It should be understood that B is the first enhanced brightness value; V is the intermediate brightness value corresponding to the initial brightness value after normalization; and L is the initial brightness value corresponding to when the sum of the accumulated brightness values ​​accounts for 10% of the sum of the brightness of all pixel values ​​when accumulating from small to large in the brightness cumulative histogram.

[0060] It should be understood that if L is small, it means that the dark field in the input image accounts for a high proportion, and if L is large, it means that the bright field in the input image accounts for a high proportion.

[0061] For example, if the three primary color pixel values ​​corresponding to each pixel in the input image are red pixel value r, green pixel value g and blue pixel value b, then the maximum value of r, g and b is determined. The maximum value is the initial brightness value corresponding to the pixel, which can be expressed by the formula: v(x,y)=max(r,g,b); where x and y are used to represent the coordinates of the pixel.

[0062] Then, the initial brightness value corresponding to each pixel is normalized. This means that the ratio of each initial brightness value to the maximum initial brightness value is determined. This can be expressed as: V(x,y) = v(x,y) / 255. It should be understood that the initial brightness value ranges from 0 to 255, with the maximum initial brightness value being 255.

[0063] At the same time, the initial brightness values ​​are accumulated to generate a brightness accumulation histogram.

[0064] For example, Figure 2 A brightness cumulative histogram is shown. Figure 2 As shown in the figure, the initial brightness range is 0-255, and accordingly, the value range of L is also 0-255. If L = 30, it means that the sum of the initial brightness values ​​less than or equal to 30 accounts for 10% of the total initial brightness value of the entire image. In this case, L belongs to the first value range (0, 30], so λ is 0. After substituting it into the above brightness enhancement formula, the formula can be used to determine the first enhanced brightness value corresponding to each pixel.

[0065] If L = 150, it means that the sum of the initial brightness values ​​less than or equal to 150 accounts for 10% of the total initial brightness value of the entire image. Conversely, the sum of the initial brightness values ​​greater than 150 accounts for 90% of the total initial brightness value of the entire image. In this case, the proportion of bright fields is very high. At this time, L belongs to the second value range (30, 150], so λ is 1. After substituting it into the above brightness enhancement formula, the formula can be used to determine the first enhanced brightness value corresponding to each pixel.

[0066] For example, Figure 3 A diagram showing the changing trend of the intermediate brightness value and the first enhanced brightness value is shown. Figure 3 As shown, the horizontal axis is the middle brightness value V, and the vertical axis is the first enhanced brightness value B.

[0067] As λ changes, the global brightness enhancement process significantly improves the smaller intermediate brightness values. This means that in low-light areas, the brightness is significantly brightened after global brightness enhancement. Here, the brightness at 0 in the dark field is retained to prevent the image from being too white.

[0068] Combine Figure 3 From left to right, it can be seen that as the middle brightness value increases, the enhanced intensity gradually decreases until the middle brightness value is not changed at all.

[0069] Optionally, as a feasible embodiment, the above S20 may include S21 to S24.

[0070] S21 . Determine, for the first enhanced image, an image standard deviation at a preset scale.

[0071] Optionally, for the first enhanced image, Gaussian filtering, bilateral filtering, or guided filtering can be used to determine the image standard deviation at a preset scale. Of course, other methods can also be used to determine the image standard deviation at a preset scale, and this embodiment of the application does not impose any limitation on this.

[0072] The preset scale is used to indicate the sampling size when determining the image standard deviation. For example, if the preset scale is 4*4, a corresponding image standard deviation is determined for every 4*4 pixels.

[0073] S22. Determine the doubling index corresponding to the image standard deviation according to the doubling index formula.

[0074] Optionally, the doubling index formula is:

[0075] ρ=(p1+p3*σ+p5*σ 2 +p7*σ 3 +p9*σ 4 ) / (1+p2*σ+p4*σ 2 +p6*σ 3 +p8*σ 4 )

[0076] Wherein, σ is the standard deviation of the image at the preset scale, P1 to P9 are all preset values, and ρ is the doubling exponent.

[0077] For example, Figure 4 The relationship between the image standard deviation and the doubling index is shown in the figure. The doubling index formula is a curve obtained from multiple experiments based on actual results (such as Figure 4 shown) fitting.

[0078] When the image standard deviation is less than 3, the doubling exponent is approximately 3; when the image standard deviation is between 3 and 10, the doubling exponent decreases until it reaches 1; when the image standard deviation is greater than 10, because the image contrast is already very strong, no enhancement is required and the doubling exponent is close to 1. According to the above rules, we can get the following fitting result: Figure 4 The curve shown in FIG. 1 can be used to determine the sizes of the preset values ​​P1 to P9.

[0079] For example, p1 can be preset to 2.79346116062302, p2 can be preset to -0.368889384242114, p3 can be preset to -0.826063393568492, p4 can be preset to 0.0782179297518896, p5 can be preset to 0.119570046400767, p6 can be preset to -0.00875163735457361, p7 can be preset to -0.0102994601530972, p8 can be preset to 0.000377888114853294, and p9 can be preset to 0.000397578762299649.

[0080] Based on this, once the image standard deviation and P1 to P9 are determined, the doubling exponent ρ corresponding to the image standard deviation can be determined by substituting them into the above doubling exponent formula. In actual calculations, the doubling exponent ρ can be rounded to one decimal place to simplify the calculation.

[0081] S23. Determine a contrast enhancement index according to the first enhanced brightness value and the doubling index corresponding to each pixel in the first enhanced image.

[0082] Optionally, the above S23 may include:

[0083] According to the first enhanced brightness value corresponding to each pixel in the first enhanced image, the corresponding convolution brightness value is determined by using adaptive scale bilateral filtering; then, the contrast enhancement index is determined according to the convolution brightness value, the first enhanced brightness value and the doubling index.

[0084] It should be understood that the use of the adaptive bilateral filtering algorithm can avoid the problem of dark edges at the edges of the image content in the first enhanced image. Of course, other algorithms can also be used to determine the convolution brightness value, and the embodiment of the present application does not impose any limitation on this.

[0085] For example, the first enhanced brightness value corresponding to each pixel in the first enhanced image is B, and the corresponding convolution brightness value can be determined by using adaptive scale bilateral filtering to be B ac , according to the formula The contrast enhancement index is determined to be K.

[0086] S24. Determine a second enhanced brightness value according to the first enhanced brightness value and the contrast enhancement index corresponding to each pixel in the first enhanced image, and generate a second enhanced image.

[0087] If the first enhanced brightness value is B and the contrast enhancement index is K, then the corresponding second enhanced brightness value F=B κ .

[0088] It should be understood that, depending on the contrast enhancement index K, the bright field in the first enhanced image can be enhanced and the dark field can be reduced.

[0089] It should be understood that the image standard deviation σ at the preset scale reflects the image distribution in the first enhanced image. A larger image standard deviation indicates a steeper image, resulting in a smaller doubling exponent ρ. This reduces the contrast enhancement exponent K, and consequently, the increase in F is smaller. This prevents dark areas from becoming excessively dark, and bright areas from becoming excessively bright.

[0090] The smaller the image standard deviation, the flatter the picture, and the larger the doubling exponent ρ calculated based on this, which leads to an increase in the contrast enhancement exponent K. As a result, F increases accordingly, making the dark field darker and the bright field brighter.

[0091] In the prior art, when electronic devices adjust dynamic contrast, they usually use three adjustment curves corresponding to different brightness ranges. For example, the three brightness curves are a low brightness adjustment curve, a medium brightness adjustment curve, and a high brightness adjustment curve.

[0092] The adjustment relationship between the three adjustment curves and the image is:

[0093] When the average brightness value of the image is less than the first brightness value L1, the low brightness adjustment curve is used for adjustment. When the average brightness value of the image is greater than the first brightness value L1 but less than the second brightness value L2, the mid-brightness adjustment curve is used for adjustment, and the highlight adjustment curve is used for auxiliary adjustment.

[0094] When the brightness mean value corresponding to the image is greater than the second brightness value L2, the highlight adjustment curve is used for adjustment, and the mid-brightness adjustment curve is used for auxiliary adjustment.

[0095] The three traditional adjustment curves are relatively rough in controlling brightness. In view of this, the image processing method provided in the embodiment of the present application refines the brightness mean interval and makes different adjustments to the images belonging to each brightness mean interval according to preset rules, so that the picture brightness control is more precise and accurate.

[0096] exist Figure 1 The image processing method shown is based on Figure 5 As shown, the method may further include the following S30 to S40.

[0097] S10 and S20 are the same as the above steps and will not be described again here.

[0098] S30: Determine the brightness mean of the second enhanced image.

[0099] That is, the average of all second enhanced brightness values ​​of the second enhanced image is determined.

[0100] S40: Determine the adjustment range of the dynamic contrast adjustment curve based on the average brightness value using an adjustment relationship table. The dynamic contrast adjustment curve includes a low brightness adjustment curve, a medium brightness adjustment curve, and a high brightness adjustment curve. The adjustment relationship table indicates the corresponding relationship between the average brightness value and the dynamic contrast adjustment curve.

[0101] For example, Figure 6 This is an adjustment relationship table provided in the embodiment of the present application. Figure 6 As shown, when the determined brightness mean of the second enhanced image belongs to the first brightness mean range [0,15], it indicates that the brightness dark field of the current second enhanced image accounts for a large proportion. Therefore, the low-brightness adjustment curve can be significantly raised by 30%, the medium-brightness adjustment curve can be slightly raised by 15%, and the high-brightness adjustment curve remains unchanged, so as to adjust the dark field while not changing the bright field.

[0102] exist Figure 5 The image processing method shown is based on Figure 7 As shown, the method may further include the following S50.

[0103] S10 to S40 are the same as the above steps and will not be described again here.

[0104] S50 : Determine the corresponding enhanced saturation according to the brightness mean of the second enhanced image using a saturation adjustment formula.

[0105] Optionally, the saturation adjustment formula is:

[0106]

[0107] Wherein, F is the second enhanced brightness value of the second enhanced image, V is the intermediate brightness value corresponding to the normalized initial brightness value; μ is the brightness mean of the second enhanced image, is the saturation compensation negative feedback, S is the initial saturation corresponding to the second enhanced image, and S′ is the enhanced saturation corresponding to the second enhanced image.

[0108] It should be understood that in order to prevent the saturation from deviating seriously, when adjusting the saturation, the brightness mean of the second enhanced image is added for regulation. When the brightness mean μ of the second enhanced image is small, that is, the overall brightness of the second enhanced image is relatively small, As the brightness increases, its value gradually approaches 1.

[0109] It should be understood that the saturation compensation negative feedback is used to prevent excessive enhancement. The size of the saturation compensation negative feedback can be set and changed based on experience, and the embodiment of the present application does not impose any limitation on this.

[0110] Figure 8FIG. 1 shows a flow chart of another image processing method provided by an embodiment of the present application. Figure 8 As shown, the method may further include the following S110 to S130.

[0111] S110 , converting the input image from the RGB domain to the HSV domain, and determining the hue angle, saturation, and brightness corresponding to each pixel of the input image.

[0112] Among them, the hue angle is H, the saturation is S, and the brightness is V.

[0113] It should be understood that the input image can be converted from the RGB domain to the HSV domain using the following conversion formula.

[0114] For example, according to The hue angle corresponding to each pixel is calculated to be H. The saturation corresponding to each pixel is calculated as S. According to V=MAX, the brightness corresponding to each pixel is calculated as V.

[0115] It should be understood that the input image here can be Figure 1 、 Figure 5 and Figure 7 Alternatively, the image may be processed by the method shown above. Figure 1 、 Figure 5 and Figure 7 The image is processed by the method shown. At this time, since the processed images are all in the HSV domain, the hue angle, saturation and brightness corresponding to each pixel can be directly determined.

[0116] S120 : Determine a skin color image block in the input image in the HSV domain.

[0117] Optionally, a skin color reference area may be first determined in the projection area of ​​the HSV model on the horizontal plane, and then an image block in the input image in the HSV domain that meets the skin color reference range is determined, and this image block is the skin color image block.

[0118] Figure 9 is an HSV model, correspondingly, Figure 10 The projection diagram of the HSV model is shown below. Figure 10 The skin color reference area is divided into Figure 10 local area in .

[0119] S130: Convert the skin color image block from the HSV domain to the RGB domain.

[0120] S140 , performing guided filtering on the skin color image block in the RGB domain to obtain a skin color enhanced image block.

[0121] S150 , obtaining an output image according to the skin color enhanced image block and the input image.

[0122] Optionally, the following set of formulas may be used to perform guided filtering, and some pixels in the sampled data may be selected as windows for filtering.

[0123]

[0124] q i =a k p k +b k

[0125] Among them, p k is the pixel value of the skin color image block in the RGB domain under the current window; is to calculate b k The coefficient is the mean pixel value of the skin color image block in the RGB domain under the current window, q i Enhance image patches for skin color; I k is the guide frame, ∈ is the filter coefficient, is the difference below the current calculation window; a k and b k is the coefficient of the linear equation at window K.

[0126] It should be understood that the original formula is: q i =a k I k +b k ; when I k =p k When , the formula becomes the third formula above, and a filter with both edge preservation and filtering functions is obtained.

[0127] It should be understood that at the edge of the image, the variance is large, a k tends to 1, b k tends to 0, the obtained skin color enhanced image block is equal to the skin color image block, and the edge is preserved; in the flat or textured part of the image, the variance is small, a k Smaller, the output is closer to b k , and b k Tends to the average value, thus achieving mean filtering.

[0128] Optionally, after obtaining the skin color enhanced image block, the region in the input image corresponding to the skin color enhanced image block may be replaced with the skin color enhanced image block, thereby obtaining an output image.

[0129] It should be understood that through the above image processing method, according to the expected skin color reference range, it is only necessary to perform a beautification effect on the skin color image block in the input image without changing other background colors, making the overall effect more natural.

[0130] An embodiment of the present application also provides an electronic device, which is used to execute the image processing method provided in the above embodiment.

[0131] The beneficial effects of the electronic device provided by the embodiment of the present application are the same as the beneficial effects corresponding to the above-mentioned image processing method, and will not be repeated here.

[0132] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program or instruction is stored. When a computer reads and executes the computer program or instruction, the computer executes the image processing method.

[0133] The beneficial effects of the computer-readable storage medium provided in the embodiment of the present application are the same as the beneficial effects corresponding to the above-mentioned image processing method, and will not be repeated here.

[0134] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit of the technical solutions of the embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. An image processing method, characterized in that: Applied to electronic equipment, the image processing method comprises: Performing global brightness enhancement processing on the input image to obtain a first enhanced image, wherein the global brightness enhancement processing is used to indicate that a brightness value corresponding to each pixel in the input image is nonlinearly enhanced, and the brightness value corresponding to each pixel in the first enhanced image is a first enhanced brightness value; Performing a local contrast enhancement process on the first enhanced image to obtain a second enhanced image, wherein the local contrast enhancement process is used to indicate that the first enhanced brightness value of a local area of ​​the first enhanced image is enhanced; Performing local contrast enhancement processing on the first enhanced image to obtain a second enhanced image includes: For the first enhanced image, determining an image standard deviation at a preset scale; Determine the doubling index corresponding to the image standard deviation according to the doubling index formula; determining a contrast enhancement index according to the first enhanced brightness value and the doubling index corresponding to each pixel in the first enhanced image; Determine a second enhanced brightness value according to the first enhanced brightness value and the contrast enhancement index corresponding to each pixel in the first enhanced image, and generate the second enhanced image; The doubling index formula is: ρ=(p1+p3*σ+p5*σ 2 +p7*s 3 +p9*s 4 ) / (1+p2*σ+p4*σ 2 +p6*s 3 +p8*s 4 ) Wherein, σ is the standard deviation of the image under the preset scale, P1 to P9 are all preset values, and ρ is the doubling exponent.

2. The image processing method according to claim 1, characterized in that: Performing global brightness enhancement processing on the input image to obtain a first enhanced image includes: Determine the maximum value of the three primary color pixel values ​​corresponding to each pixel in the input image, and use the maximum value as the corresponding initial brightness value; Normalizing the initial brightness value to obtain an intermediate brightness value; According to the intermediate brightness value, the corresponding first enhanced brightness value is determined using a brightness enhancement formula.

3. The image processing method according to claim 2, characterized in that: The brightness enhancement formula is: Among them, B is the first enhanced brightness value, V is the intermediate brightness value, and L is the initial brightness value corresponding to when the sum of the accumulated brightness values ​​accounts for 10% of the sum of the brightness of all pixel values ​​when accumulating from small to large in the brightness accumulation histogram.

4. The image processing method according to claim 1, characterized in that: For the first enhanced image, determining an image standard deviation at a preset scale includes: For the first enhanced image, a Gaussian filter, a bilateral filter or a guided filter is used to determine the image standard deviation at the preset scale.

5. The image processing method according to claim 1, characterized in that: Determining a contrast enhancement index according to the first enhanced brightness value corresponding to each pixel in the first enhanced image and the doubling index includes: Determine a corresponding convolution brightness value by using adaptive scale bilateral filtering according to the first enhanced brightness value corresponding to each pixel in the first enhanced image; The contrast enhancement index is determined according to the convolution brightness value, the first enhanced brightness value and the doubling index.

6. The image processing method according to claim 1 or 5, characterized in that: The method further comprises: According to the brightness mean of the second enhanced image, the corresponding enhanced saturation is determined using a saturation adjustment formula.

7. The image processing method according to claim 1, characterized in that: The method further comprises: Convert the input image from the RGB domain to the HSV domain, and determine the hue angle, saturation, and brightness corresponding to each pixel of the input image; Determine a skin color image block in the input image in the HSV domain; Convert the skin color image block from the HSV domain to the RGB domain; Performing guided filtering on the skin color image block in the RGB domain to obtain a skin color enhanced image block; An output image is obtained according to the skin color enhanced image block and the input image.

8. An electronic device, characterized in that: Used to execute the image processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Adaptive colour image processing method and system

    CN101951523A

  • Graphic processing unit (GPU)-based low-luminance image enhancement method

    CN103208103A

  • Image processing method, electronic equipment, and server

    CN108307101A

  • Apparatus and method of enhancing color of image

    US20090022395A1