Image processing method and device, electronic equipment, chip and medium
The skin color pixels are determined through multi-color space representation and multi-threshold conditions, and skin color correction is solved, and the problem of low accuracy of skin color recognition in the prior art is solved, improving the accuracy and effect of skin color display.
Patent Information
- Application Number
- CN202311117379.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2025-03-04
AI Technical Summary
In the prior art, the accuracy of skin tone recognition is low, resulting in inaccurate skin tone display. Especially in different brightness scenarios, the skin tone performance is inconsistent, affecting the display effect.
By obtaining the multi-color space representation of the image to be corrected, including RGB, YCbCr and HSV color spaces, and determining the skin color pixels in combination with multi-threshold conditions, then performing skin color correction to improve recognition accuracy and display effect.
It improves the accuracy of skin tone recognition, eliminates the ribbon phenomenon, improves the display effect of skin tone in different brightness scenarios, and improves the user's viewing experience.
Smart Images

Figure CN119559266A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer vision, and in particular to an image processing method, device, electronic device, chip and medium. Background Art
[0002] In the field of video display, image data signals are usually compressed or processed by multiple modules, and the skin color in the image often deviates from the original color, which eventually causes discomfort to the user when displayed on the screen. In addition, people's preferred skin color performance is usually different in different brightness scenes, so the skin color in the image needs to be corrected.
[0003] In the related art, skin color correction first performs skin color recognition on the image. Skin color recognition is usually performed in the YCbCr color space. It is necessary to convert the RGB color space to the YCbCr color space, and then determine the skin color area in the image according to the preset threshold. Finally, the CbCr signal is multiplied by the corresponding gain coefficient to obtain the corrected skin color. Since the color space used for skin color recognition is single, it is difficult to accurately determine the skin color pixels, resulting in low skin color recognition accuracy, which is easy to cause color banding and reduce the display effect. Summary of the invention
[0004] The present disclosure provides an image processing method, device, electronic device, chip and medium to solve the problem of low skin color recognition accuracy existing in the related art. Based on the multi-color space representation of the image to be corrected, the skin color recognition accuracy is improved by setting the skin color in the multi-color space representation, the skin color is corrected, and the skin color display effect is improved.
[0005] A first aspect of the present disclosure provides an image processing method, comprising: obtaining a first color space representation and a second color space representation of an image to be corrected; determining skin color pixels in the image to be corrected based on the first color space representation and the second color space representation; and correcting the skin color pixels.
[0006] In one embodiment of the present disclosure, determining a skin color pixel in an image to be corrected based on a first color space representation and a second color space representation includes: determining that a first pixel in the image to be corrected is a skin color pixel, wherein a first color space representation of the first pixel satisfies a first condition, and a second color space representation of the first pixel satisfies a second condition.
[0007] In an embodiment of the present disclosure, the first color space is represented by RGB values, and the second color space is represented by YCbCr values and / or HSV values.
[0008] In an embodiment of the present disclosure, the first condition includes: the red component R in the first color space representation is the largest, and the relationship between the red component R, the green component G and the blue component B satisfies the first rule.
[0009] In one embodiment of the present disclosure, the first rule includes: the red component R is greater than the first red threshold, and the green component G is greater than the first green threshold, and the blue component B is greater than the first blue threshold, and the difference between the red component R and the smallest of the green component G and the blue component B is greater than the first threshold, and the difference between the red component R and the green component G is greater than or equal to the second threshold; or, the red component R is greater than the second red threshold, and the green component G is greater than the second green threshold, and the blue component B is greater than the second blue threshold, and the difference between the red component R and the green component G is greater than or equal to the third threshold, and the difference between the red component R and the green component G is less than or equal to the fourth threshold, and the green component G is greater than the blue component B.
[0010] In one embodiment of the present disclosure, the second condition includes: in the second color space representation, the blue chromaticity component Cb is greater than or equal to the first blue chromaticity component threshold, and the blue chromaticity component Cb is less than or equal to the second blue chromaticity component threshold, and the red chromaticity component Cr is greater than or equal to the first red chromaticity component threshold, and the red chromaticity component Cr is less than or equal to the second red chromaticity component threshold; and / or, in the second color space representation, the hue H is greater than or equal to the first hue threshold, and the hue H is less than or equal to the second hue threshold, and the saturation S is greater than or equal to the first saturation threshold, and the saturation S is less than or equal to the second saturation threshold.
[0011] In one embodiment of the present disclosure, correcting the skin color of a skin area includes: determining correction gain values of hue H, saturation S, and brightness V corresponding to the skin color pixels in a preset lookup table according to the HSV color space representation of the skin color pixels; and correcting the skin color pixels based on the correction gain values of hue H, saturation S, and brightness V corresponding to the skin color pixels.
[0012] In one embodiment of the present disclosure, based on the representation of skin color pixels in a skin area in the HSV color space, determining the gains of hue H, saturation S and brightness V corresponding to the skin color pixels in a preset lookup table includes: if the HSV color space representation of the skin color pixels exists in the preset lookup table, using the gain values of hue H, saturation S and brightness V corresponding to the HSV color space representation of the skin color pixels as correction gain values; if the HSV color space representation of the skin color pixels does not exist in the preset lookup table, determining the adjacent values of the HSV color space representation of the skin color pixels, determining the interpolation gain value based on the adjacent values, and determining the interpolation gain value as the correction gain value.
[0013] In one embodiment of the present disclosure, according to the first condition, determining the correction gain value includes: taking the HSV color space representation of the skin color pixel to be in a preset lookup table as the first condition; if the HSV color space representation of the skin color pixel satisfies the first condition, then taking the gain values of the hue H, saturation S and brightness V corresponding to the HSV color space representation of the skin color pixel as the correction gain value.
[0014] In one embodiment of the present disclosure, determining the correction gain value according to the second condition includes: taking the HSV color space representation of the skin color pixel not existing in the preset lookup table as the second condition; if the HSV color space representation of the skin color pixel satisfies the second condition, using the adjacent values of the HSV color space representation of the skin color pixel, determining the interpolation gain value based on the adjacent values, and determining the interpolation gain value as the correction gain value.
[0015] The second aspect embodiment of the present disclosure proposes an image processing device, which includes: an acquisition module, which acquires a first color space representation and a second color space representation of an image to be corrected; a determination module, which determines skin color pixels in the image to be corrected based on the first color space representation and the second color space representation; and a correction module, which corrects the skin color pixels.
[0016] In one embodiment of the present disclosure, the determination module is used to: determine that a first pixel in the image to be corrected is a skin color pixel, wherein a first color space representation of the first pixel satisfies a first condition, and a second color space representation of the first pixel satisfies a second condition.
[0017] In one embodiment of the present disclosure, the first color space of the determination module is represented as RGB values, and the second color space is represented as YCbCr values and / or HSV values.
[0018] In an embodiment of the present disclosure, the first condition of the determination module includes: the red component R in the first color space representation is the largest, and the relationship between the red component R, the green component G and the blue component B satisfies the first rule.
[0019] In one embodiment of the present disclosure, the first rule of the determination module includes: the red component R is greater than the first red threshold, and the green component G is greater than the first green threshold, and the blue component B is greater than the first blue threshold, and the difference between the red component R and the smallest of the green component G and the blue component B is greater than the first threshold, and the difference between the red component R and the green component G is greater than or equal to the second threshold; or, the red component R is greater than the second red threshold, and the green component G is greater than the second green threshold, and the blue component B is greater than the second blue threshold, and the difference between the red component R and the green component G is greater than or equal to the third threshold, and the difference between the red component R and the green component G is less than or equal to the fourth threshold, and the green component G is greater than the blue component B.
[0020] In one embodiment of the present disclosure, the second condition of the determination module includes: in the second color space representation, the blue chromaticity component Cb is greater than or equal to the first blue chromaticity component threshold, and the blue chromaticity component Cb is less than or equal to the second blue chromaticity component threshold, and the red chromaticity component Cr is greater than or equal to the first red chromaticity component threshold, and the red chromaticity component Cr is less than or equal to the second red chromaticity component threshold; and / or, in the second color space representation, the hue H is greater than or equal to the first hue threshold, and the hue H is less than or equal to the second hue threshold, and the saturation S is greater than or equal to the first saturation threshold, and the saturation S is less than or equal to the second saturation threshold.
[0021] In one embodiment of the present disclosure, a correction module is used to: determine the correction gain values of hue H, saturation S and brightness V corresponding to the skin color pixels in a preset lookup table according to the HSV color space representation of the skin color pixels; and correct the skin color pixels based on the correction gain values of hue H, saturation S and brightness V corresponding to the skin color pixels.
[0022] In one embodiment of the present disclosure, the correction module adopts the following method to determine the gains of hue H, saturation S and brightness V corresponding to the skin color pixels in a preset lookup table according to the representation of the skin color pixels in the skin area in the HSV color space: determine the correction gain value according to the first condition, or determine the correction gain value according to the second condition.
[0023] In one embodiment of the present disclosure, the correction module adopts the following method to determine the correction gain value according to the first condition, including: taking the HSV color space representation of the skin color pixel existing in a preset lookup table as the first condition; if the HSV color space representation of the skin color pixel satisfies the first condition, then taking the gain values of the hue H, saturation S and brightness V corresponding to the HSV color space representation of the skin color pixel as the correction gain value.
[0024] In one embodiment of the present disclosure, the correction module determines the correction gain value according to the second condition in the following manner: taking the HSV color space representation of the skin color pixel not existing in the preset lookup table as the second condition; if the HSV color space representation of the skin color pixel satisfies the second condition, using the adjacent values of the HSV color space representation of the skin color pixel, determining the interpolation gain value based on the adjacent values, and determining the interpolation gain value as the correction gain value.
[0025] The third aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the methods in the first aspect embodiment of the present disclosure.
[0026] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to enable a computer to execute any one of the methods in the first aspect embodiment of the present disclosure.
[0027] The fifth aspect embodiment of the present disclosure proposes a chip, characterized in that it includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from the memory of the electronic device and send signals to the processor, the signals include computer instructions stored in the memory, and when the processor executes the computer instructions, the electronic device executes any one of the methods in the first aspect embodiment.
[0028] In summary, according to the image processing method proposed in the present disclosure, the first color space representation and the second color space representation of the image to be corrected are obtained; based on the first color space representation and the second color space representation, the skin color pixels in the image to be corrected are determined; and the skin color pixels are corrected. Through the technical solution of the present disclosure, by using the multi-color space representation based on the image to be corrected, the skin color recognition accuracy is improved, the skin color is corrected, and the skin color display effect is improved. The problem of inaccurate skin color display is solved, the accuracy of skin color recognition is improved, and the display effect of skin color under different brightness adjustments is improved.
[0029] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0031] Figure 1 is a flow chart of an image processing method according to an embodiment of the present disclosure;
[0032] Figure 2 A flow chart of a method for determining skin color pixels in an image to be corrected according to an embodiment of the present disclosure;
[0033] Figure 3 is a flow chart of a skin color pixel correction method according to an embodiment of the present disclosure;
[0034] Figure 4 A flowchart of determining a correction gain value according to a first condition in a specific implementation of an embodiment of the present disclosure;
[0035] Figure 5 A flowchart of determining a correction gain value according to a second condition in a specific implementation of an embodiment of the present disclosure;
[0036] Figure 6 A flowchart of determining a correction gain value according to a first condition according to an embodiment of the present disclosure;
[0037] Figure 7 is a flow chart of determining a correction gain value according to a second condition according to an embodiment of the present disclosure;
[0038] Figure 8 is a correction flow chart of skin color pixels according to an embodiment of the present disclosure;
[0039] Fig. 9 is a structural schematic diagram of an image processing device according to an embodiment of the present disclosure;
[0040] Fig.10 It is a block diagram of an electronic device for implementing the image processing method disclosed in the present invention according to an exemplary embodiment. DETAILED DESCRIPTION
[0041] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout identify the same or similar originals or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0042] In the field of video display, image data signals are usually compressed or processed by multiple modules, and the skin color in the image often deviates from the original color, which eventually causes discomfort to the user when displayed on the screen. In addition, people's preferred skin color performance is usually different in different brightness scenes, so the skin color in the image needs to be corrected.
[0043] In the related skin color correction technology, the skin color characteristics in different color spaces are used to identify skin color pixels. There are many commonly used color spaces, among which the more common ones include RGB color space, YCbCr color space, HSV color space, and the color spaces can be converted to each other through parameter conversion matrices.
[0044] The RGB color space is a hardware-oriented color space in image processing. It uses a linear combination of three color components: red component R, green component G, and blue component B to represent color. Any color is related to these three components.
[0045] YCbCr is a color space representation based on the YUV color space after scaling and offset, where Y represents the brightness component, Cb represents the blue chroma component, and Cr represents the red chroma component. Since the human eye is more sensitive to the Y component of the video, after reducing the chroma component by subsampling the chroma component, the naked eye will not be able to perceive the change in image quality. It is usually used in video preprocessing in movies or in digital photography systems.
[0046] The HSV color space is a color model based on brightness, saturation, and hue. It decomposes a complete spectrum into three parts: hue, saturation, and value.
[0047] The related skin color correction algorithm first performs skin color recognition in the image. Skin color recognition is usually performed in the YCbCr color space. It is necessary to convert the RGB color space to YCbCr, and then determine the skin color area in the image according to the preset threshold. Finally, the CbCr signal of the skin color pixel in the skin color area is multiplied by the corresponding gain coefficient to obtain the corrected skin color. However, this technical solution does not consider the impact of different brightness on skin color, which is easy to form color bands and reduce the display effect.
[0048] The main purpose of the present invention is to utilize the recognition of skin color pixels in multiple color spaces to improve the recognition accuracy of skin color in related technologies, and to complete the correction of skin color display based on the gain value of skin color under different brightness conditions. In other words, in order to address the problem of single color space and inaccurate judgment of skin color pixels used in related algorithms for skin color pixel recognition, the present invention proposes a skin color pixel recognition algorithm based on multiple color spaces and multiple thresholds. This method uses multiple color spaces to represent the skin color pixels in the image to be corrected in many aspects, forming a more accurate definition of skin color. At the same time, the gain value of skin color under different brightness is used to correct the display of skin color, restoring the accurate display effect of skin color.
[0049] The method proposed in the present disclosure is applied to skin color correction tasks, and can be specifically used in digital image processing in the fields of mobile phone photography, industrial camera imaging, display equipment in exhibitions, virtual reality VR, mixed reality MR, digital design, etc., and the application scenarios are not limited in the embodiments of the present disclosure.
[0050] The image processing method provided in this application is described in detail below with reference to the accompanying drawings.
[0051] Figure 1 FIG. 1 is a flow chart of an image processing method according to an embodiment of the present disclosure. Figure 1 As shown, the image processing method includes:
[0052] Step 101: Obtain a first color space representation and a second color space representation of an image to be corrected.
[0053] In the present disclosure, the image to be corrected is an image that needs to be corrected for skin color, and the image includes skin color pixels. The image processing component in the electronic device obtains the data representation of the image to be corrected in the first color space, which is the first color space representation, and obtains the data representation of the image to be corrected in the second color space, which is the second color space representation. The image processing component of the electronic device acquires or receives the image to be corrected, and the first color space representation and the second color space representation of the image to be corrected can be directly acquired, or received by receiving the image data stream sent by other devices, or by using the original color space representation of the image to be corrected as the first color space representation, and converting the first color space representation into the second color space representation through a color space conversion algorithm.
[0054] In some embodiments, the first color space may be any one of RGB, YCbCr, Lab, YUV, CMYK, HSV color spaces, or other color spaces, which are not limited in the present disclosure. The first color space may preferably be an RGB color space.
[0055] In some embodiments, the second color space may be at least one of RGB, YCbCr, Lab, YUV, CMYK, and HSV color spaces, and the first color space is different from the second color space.
[0056] For example, the second color space may be a single color space, such as a YCbCr color space or an HSV color space. It may also be multiple color spaces, such as a YCbCr and HSV color space, or a YCbCr, Lab and HSV color space. Step 102, based on the first color space representation and the second color space representation, determine the skin color pixels in the image to be corrected.
[0057] In the present disclosure, by using each component value in the first color space representation and the second color space representation of the image to be corrected, the judgment conditions for the skin color pixels are respectively set, so as to determine the skin color pixels in the image to be corrected by combining different color space representations, thereby improving the recognition accuracy of the skin color pixels. Step 103, correcting the skin color pixels.
[0058] In the present disclosure, based on the skin color pixels determined in the image to be corrected, the corresponding correction gain value is determined by utilizing the data mapping formed by the representation of the skin color pixels in the color space and the corresponding skin color correction gain value, and the skin color pixels can be corrected based on the calculation result of the representation of the skin color pixels in the color space and the corresponding correction gain value. The correction gain value is the multiplier that needs to be applied to correct the skin color pixels in the image to be corrected in the process of correcting the skin color pixels in the image to be corrected to the skin color pixels of the target display effect. In summary, according to the image processing method proposed in the present disclosure, the first color space representation and the second color space representation of the image to be corrected are obtained, and a plurality of representations of different dimensions are provided for the image to be corrected. Based on the first color space representation and the second color space representation, the skin color pixels in the image to be corrected are determined, thereby improving the accuracy of skin color pixel recognition. Correcting the skin color pixels improves the display effect of the skin color.
[0059] Figure 2 This is a flow chart of a method for determining skin color pixels in an image to be corrected according to an embodiment of the present disclosure. Figure 1 The embodiment shown, Figure 2 The steps include:
[0060] Step 201: Obtain a first color space representation and a second color space representation of an image to be corrected.
[0061] In the present disclosure, the principle of step 201 is the same as Figure 1 Step 101 in the embodiment shown is the same as that in the embodiment shown in FIG. Figure 1 The relevant description will not be repeated here.
[0062] In particular, in one embodiment of the present disclosure, the first color space representation of the image to be corrected is RGB values, which are usually acquired by an image sensor, and the second color space representation is YCbCr values and / or HSV values. The second color space representation can be obtained by converting the first color space representation and the conversion relationship between color spaces.
[0063] In this embodiment, the first color space is converted into the second color space, which specifically includes converting from RGB color space to YCbCr color space, converting from RGB color space to HSV color space, and converting from RGB color space to YCbCr and HSV color space.
[0064] In a specific implementation of this embodiment, the first color space is represented by RGB values, and the second color space is represented by YCbCr values, that is, skin color pixels are identified by defining skin color features in the RGB color space and the YCbCr color space.
[0065] Among them, the YCbCr color space can be converted from the RGB color space according to the following parameter conversion matrices W and b:
[0066] Preferably,
[0067] The conversion process can also be expressed as:
[0068] Y=0.2126R+0.7152G+0.0722B;
[0069] Cb=-0.1146R-0.3854G+0.5B+128;
[0070] Cr=0.5R-0.4542G-0.0458B+128.
[0071] In a specific implementation of this embodiment, the first color space is represented by RGB values, and the second color space is represented by HSV values, that is, skin color pixels are identified by defining skin color features in the RGB color space and the HSV color space.
[0072] Among them, the HSV color space can be converted from the RGB color space according to the following steps:
[0073] The maximum value of the three components R, G, and B in the RGB color space is taken as the brightness V in the HSV color space, that is, V = max(R, max(G, B)).
[0074] a) If V is equal to 0, then S = 0;
[0075] If V is not equal to 0, then Where min(G, B) means taking the smaller value of the two.
[0076] b) If V is equal to min(R,min(G,B)), then H is equal to 0.
[0077] c) If V is equal to R and G is greater than or equal to B, then
[0078]
[0079] d) If V is equal to R and G is less than B, then
[0080]
[0081] e) If V is equal to G, then
[0082]
[0083] f) If none of the above is true,
[0084]
[0085] In a specific implementation of this embodiment, the first color space is represented by RGB values, and the second color space is represented by YCbCr values and HSV values, and the second color space can be obtained by the specific implementation of this embodiment as described above. That is, skin color pixels are identified by limiting skin color features in the three color spaces of RGB color space, YCbCr color space, and HSV color space.
[0086] In this embodiment, the first color space representation and the second color space representation of the image to be corrected are obtained, and the image to be corrected is represented by different color spaces, which provides a multi-dimensional description of skin color features for further recognition of skin color pixels, and helps to improve the recognition accuracy of skin color pixels.
[0087] Step 202: Determine that a first pixel in the image to be corrected is a skin color pixel, wherein a first color space representation of the first pixel satisfies a first condition, and a second color space representation of the first pixel satisfies a second condition.
[0088] In the embodiment of the present disclosure, the first pixel is a skin color pixel in the image to be corrected, and the image to be corrected satisfies the first condition in the first color space. In other words, the first condition is the limitation of the skin color pixel in the first color space. In the second color space, the image to be corrected satisfies the second condition. In other words, the second condition is the limitation of the skin color pixel in the second color space.
[0089] In this embodiment, the pixels of the image to be corrected that meet the skin color determination conditions in different color spaces are taken as skin color pixels. For example, the pixels that meet the first condition in the first color space and the second condition in the second color space are taken as skin color pixels. The different color spaces may include multiple color spaces. For example, the color space may include RGB, YUV, YCbCr, HSV, Lab, CMYK, etc. Through this embodiment, the skin color pixels of the image to be corrected in different color space representations are accurately defined, and the skin color pixels are accurately identified.
[0090] In one implementation of the embodiment of the present disclosure, the first condition includes: the red component R in the first color space representation is the largest, and the relationship between the red component R, the green component G and the blue component B satisfies the first rule.
[0091] In this embodiment, in order to determine the skin color pixels in the image to be corrected, the first skin color determination condition that needs to be satisfied in the RGB color space includes: the red component R is the largest in the RGB color space representation, that is, R==max(R, G, B), and the relationship between the red component R, the green component G, and the blue component B conforms to the first rule. The first rule is the definition of the skin color characteristics of the skin color pixels in the RGB color space.
[0092] In one implementation of the disclosed embodiment, the first rule includes: the red component R is greater than a first red threshold, and the green component G is greater than the first green threshold, and the blue component B is greater than the first blue threshold, and the difference between the red component R and the smallest of the green component G and the blue component B is greater than the first threshold, and the difference between the red component R and the green component G is greater than or equal to the second threshold; or,
[0093] The red component R is greater than the second red threshold, and the green component G is greater than the second green threshold, and the blue component B is greater than the second blue threshold, and the difference between the red component R and the green component G is greater than or equal to the third threshold, and the difference between the red component R and the green component G is less than or equal to the fourth threshold, and the green component G is greater than the blue component B.
[0094] In this embodiment, Tr1 is the first red threshold, Tg1 is the first green threshold, Tb1 is the first blue threshold, T1 is the first threshold, T2 is the second threshold; Tr2 is the second red threshold, Tg2 is the second green threshold, Tb2 is the second blue threshold, T3 is the third threshold, and T4 is the fourth threshold. Then the first rule can be expressed as the union of the first sub-rule condition1 and the second sub-rule condition2, that is, condition1∪condition2.
[0095] The first sub-rule condition1 is: R>Tr1&&G>Tg1&&B>Tb1&&R-min(G,B)>T1&&R-G≥T2. Preferably, Tr1=50, Tg1=40, Tb1=20, T1=10, T2=10.
[0096] The second sub-rule condition2 is: R>Tr2&&G>Tg2&&B>Tb2&&T3≤RG≤T4&&G>B. Preferably, Tr2=220, Tg2=210, Tb2=170, T3=10, T4=15.
[0097] The first condition formed by the first rule and the maximum red component R in the first color space forms the recognition of skin color pixels in the RGB color space of the corrected image. In order to obtain a more accurate skin color recognition effect, it is necessary to further recognize skin color pixels in the second color space.
[0098] In one implementation of the disclosed embodiment, the second condition includes: in the second color space representation, the blue chromaticity component Cb is greater than or equal to the first blue chromaticity component threshold, and the blue chromaticity component Cb is less than or equal to the second blue chromaticity component threshold, and the red chromaticity component Cr is greater than or equal to the first red chromaticity component threshold, and the red chromaticity component Cr is less than or equal to the second red chromaticity component threshold; and / or,
[0099] In the second color space representation, the hue H is greater than or equal to the first hue threshold, and the hue H is less than or equal to the second hue threshold, and the saturation S is greater than or equal to the first saturation threshold, and the saturation S is less than or equal to the second saturation threshold.
[0100] In this embodiment, the second color space is a YCbCr color space and / or an HSV color space, that is,
[0101] In one implementation of this embodiment, when the second color space is a YCbCr color space, T Cb 1 is the first blue chromaticity component threshold, T Cb 2 is the second blue chromaticity component threshold, T Cr 1 is the first red chromaticity component threshold, T Cr 2 is the second red chromaticity component threshold. Then the second condition can be expressed as the second rule condition3: T Cb 1≤Cb≤T Cb 2&&T Cr 1≤Cr≤T Cr 2. Preferably, T Cb 1=60,T Cb 2=130,T Cr 1=130,T Cr 2=165.
[0102] In one implementation of this embodiment, when the second color space is the HSV color space, H1 is the first hue threshold, H2 is the second hue threshold, S1 is the first saturation threshold, and S2 is the second saturation threshold. Then the second condition can be expressed as the third rule condition4: H1≤H≤H2&&S1≤S≤S2. Preferably, H1=0, H2=50, S1=0.1, S2=0.9.
[0103] In an implementation of this embodiment, when the second color space is a YCbCr color space and an HSV color space, the second condition can be expressed as the intersection of the second rule and the third rule, that is, condition3∩condition4.
[0104] Therefore, to determine that the pixel in the image to be corrected is a skin color pixel, one of the following conditions is sufficient:
[0105] (R==max(R,G,B))∩(condition1∪condition2)∩condition3;
[0106] (R==max(R,G,B))∩(condition1∪condition2)∩condition4;
[0107] (R==max(R,G,B))∩(condition1∪condition2)∩condition3∩condition4.
[0108] Through the above embodiments, skin color pixels in the image to be corrected can be identified, and the accuracy of skin color pixel identification is improved due to the limitation of skin color features through the combination of multiple color spaces. After the skin color pixels in the image to be corrected are determined, the skin color pixels need to be corrected.
[0109] Figure 3 FIG. 4 is a flow chart of a skin color pixel correction method according to an embodiment of the present disclosure. Figure 3 As shown, the corrected skin color pixel includes:
[0110] Step 301: According to the HSV color space representation of the skin color pixel, the correction gain values of the hue H, saturation S and brightness V corresponding to the skin color pixel are determined in a preset lookup table;
[0111] According to the representation of the identified skin color pixel in the HSV color space, the constructed lookup table is used to index through the hue H, saturation S and brightness V to determine the respective correction gain values corresponding to the three variables.
[0112] In a specific implementation of this embodiment, the preset lookup table can be a data storage unit of the type of a database, a data table, an array, a dictionary, a tuple, a list, etc., which stores a table of correction gain values that have achieved good correction effects in actual experimental tests. The lookup table can receive three variables of hue H, saturation S and brightness V in the HSV color space as input for indexing, thereby outputting a hue correction gain value H_gain, a saturation correction gain value S_gain and a brightness correction gain value V_gain corresponding to the three variables.
[0113] Step 302: Correct the skin color pixel based on the correction gain values of hue H, saturation S and brightness V corresponding to the skin color pixel.
[0114] According to the representation value of the current skin color pixel in the HSV color space and the corresponding correction gain values of hue H, saturation S and brightness V, the current skin color pixel is corrected for skin color. The correction calculation is as follows:
[0115] V′=V*V_gain
[0116] S′=S*S_gain
[0117] H′=H*H_gain
[0118] Among them, H, S, and V are the representations of the skin color pixels in the image to be corrected in the HSV color space.′ , S ′ , V′ is the representation of the corrected skin color pixel in the HSV color space.
[0119] In this embodiment, the corrected representation of the skin color pixel in the HSV color space is obtained by the representation of the skin color pixel in the HSV color space and the correction gain value corresponding to the skin color pixel in the lookup table, wherein the correction gain value determined in the lookup table determines the correction effect.
[0120] In the embodiment of the present disclosure, according to the representation of the skin color pixel in the HSV color space, the gains of the hue H, saturation S and brightness V corresponding to the skin color pixel can be determined in the preset lookup table by the following two methods:
[0121] According to the first condition, the correction gain value is determined; or, according to the second condition, the correction gain value is determined.
[0122] In this embodiment, the first condition and the second condition are determined by whether the HSV color space representation of the skin color pixel exists in the preset lookup table. The first condition is that the HSV color space representation of the skin color pixel exists in the preset lookup table, and the second condition is that the HSV color space representation of the skin color pixel does not exist in the preset lookup table. According to the first condition or the second condition, the correction gain value is determined respectively.
[0123] Figure 4 This is a flow chart of determining a correction gain value according to a first condition in a specific implementation manner of this embodiment. Figure 4 Yes Figure 3 Further description of step 301 of the embodiment is based on Figure 4 As shown, the following steps are included:
[0124] Step 401, according to the HSV color space representation of the skin color pixel, the correction gain values of the hue H, saturation S and brightness V corresponding to the skin color pixel are determined in a preset lookup table.
[0125] According to the HSV color space representation of the skin color pixel, the correction gain values of the three parameters of hue H, saturation S and brightness V corresponding to the skin color pixel are searched in a preset lookup table.
[0126] Step 402: Determine a correction gain value according to a first condition.
[0127] The correction gain value is determined based on the HSV color space representation of the skin color pixel that meets the first condition.
[0128] Figure 5 This is a flow chart of determining a correction gain value according to a second condition in a specific implementation manner of this embodiment. Figure 5 Yes Figure 3Further description of step 301 of the embodiment is based on Figure 5 As shown, the following steps are included:
[0129] Step 501 , according to the HSV color space representation of the skin color pixel, the correction gain values of the hue H, the saturation S and the brightness V corresponding to the skin color pixel are determined in a preset lookup table.
[0130] According to the HSV color space representation of the skin color pixel, the correction gain values of the three parameters of hue H, saturation S and brightness V corresponding to the skin color pixel are searched in a preset lookup table.
[0131] Step 502: Determine a correction gain value according to the second condition.
[0132] The correction gain value is determined based on the HSV color space representation of the skin color pixel that meets the second condition.
[0133] Figure 6 FIG. 1 is a flow chart of determining a correction gain value according to a first condition according to an embodiment of the present disclosure. Figure 6 The embodiment shown comprises the following steps:
[0134] Step 601 , taking the HSV color space representation of the skin color pixel existing in a preset lookup table as a first condition.
[0135] In this embodiment, the existence of the HSV color space representation of the skin color pixel in the preset lookup table is used as the first condition, that is, the HSV color space representation of the current skin color pixel can be directly located in the preset lookup table.
[0136] Step 602: If the HSV color space representation of the skin color pixel satisfies the first condition, the gain values of the hue H, saturation S and brightness V corresponding to the HSV color space representation of the skin color pixel are used as correction gain values.
[0137] In this embodiment, if the HSV color space representation of the skin color pixel exists in the preset lookup table, the gain values of the hue H, saturation S and brightness V corresponding to the HSV color space representation of the skin color pixel can be directly found in the preset lookup table, and these three gain values can be used as correction gain values.
[0138] When the HSV color space representation of the skin color pixel exists in the preset lookup table, the corresponding gain value stored in the preset lookup table can be directly used as the correction gain value, which facilitates the rapid correction of the skin color.
[0139] Figure 7 FIG. 1 is a flow chart of determining a correction gain value according to a second condition according to an embodiment of the present disclosure. Figure 7 The embodiment shown comprises the following steps:
[0140] Step 701 , taking the HSV color space representation of the skin color pixel as not existing in the preset lookup table as the second condition.
[0141] In this embodiment, the HSV color space representation of the skin color pixel does not exist in the preset lookup table as the second condition.
[0142] Step 702: If the HSV color space representation of the skin color pixel satisfies the second condition, an interpolation gain value is determined based on the neighboring value using the neighboring value of the HSV color space representation of the skin color pixel, and the interpolation gain value is determined as the correction gain value.
[0143] In this embodiment, if the HSV color space representation of the skin color pixel does not exist in the preset lookup table, the adjacent value of the HSV color space representation of the skin color pixel is determined, and the interpolation gain value is determined based on the adjacent value, and the interpolation gain value is determined as the correction gain value.
[0144] In one implementation of this embodiment, if at least one of the three values of hue H, saturation S and brightness V represented by the current skin color pixel in the HSV color space is not in the preset lookup table, then the value not in the preset lookup table is indexed in the preset lookup table through the component values of multiple adjacent skin color pixels to obtain the corresponding multiple gain values, and then the gain value corresponding to the component value of the current skin color pixel is obtained by performing a difference based on the gain values of the adjacent skin color pixels. Among them, the interpolation algorithm can use linear interpolation, nearest neighbor interpolation, bilinear interpolation, Newton interpolation and other algorithms.
[0145] In this embodiment, the corresponding correction gain value is determined by indexing the preset lookup table based on H, S, and V, thereby providing correction parameters for skin color correction.
[0146] In one implementation of the disclosed embodiment, in order to restore the display of the corrected skin color pixel, it is necessary to convert the H′, S′, and V′ of the corrected HSV color space into the RGB color space. The conversion method is as follows:
[0147]
[0148] C=V*S′
[0149]
[0150] M=VC
[0151] a) If H is greater than or equal to 0 and less than 60, then
[0152] R0=C,G0=X,B0=0
[0153] b) If H is greater than or equal to 60 and less than 120, then
[0154] R0=X,G0=C,B0=0
[0155] c) If H is greater than or equal to 120 and less than 180, then
[0156] R0=0,G0=C,B0=X
[0157] d) If H is greater than or equal to 180 and less than 240, then
[0158] R0=0,G0=X,B0=C
[0159] e) If H is greater than or equal to 240 and less than 300, then
[0160] R0=X,G0=0,B0=C
[0161] d) If H is other, then
[0162] R0=C,G0=0,B0=X
[0163] The final RGB calculation is as follows:
[0164] R=(R0+M)*255
[0165] G=(G0+M)*255
[0166] B=(B0+M)*255
[0167] Figure 8 is a correction flow chart of a skin color pixel according to an embodiment of the present disclosure, such as Figure 8 As shown, the correction of the skin color pixel includes:
[0168] Convert RGB to YCbCr and HSV color spaces.
[0169] In this embodiment, the image to be corrected in the current RGB color space is converted into the YCbCr and HSV color spaces to obtain a multi-dimensional feature representation of the image to be corrected using multiple color spaces.
[0170] Skin color pixels are identified according to the set threshold.
[0171] In this embodiment, for skin color pixel identification, a threshold is set in each color space where the image to be corrected is located to distinguish the skin color pixels.
[0172] The corresponding correction gain value is calculated according to a preset lookup table.
[0173] In this embodiment, based on the skin color pixels determined in the image to be corrected, the corresponding skin color correction gain values are searched for for all skin color pixels according to the constructed lookup table of color space representation and corresponding skin color correction gain values.
[0174] Correction of all skin tone pixels is completed.
[0175] In this embodiment, all skin color pixels are corrected according to the determined skin color correction gain value, thereby completing the correction of skin color display in the image to be corrected. This embodiment provides a method of detecting different color space thresholds to identify skin color pixels, and identifies the representation of the image to be corrected based on multiple color spaces, thereby improving the accuracy of skin color pixel identification; the gain correction lookup table with preset brightness V, saturation S and hue H is used to ensure the display effect of skin color under different brightness adjustments.
[0176] Corresponding to the methods provided in the above-mentioned embodiments, the present disclosure also provides an image processing device. Since the device provided in the embodiment of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation method of the method is also applicable to the device provided in this embodiment and will not be described in detail in this embodiment.
[0177] Fig. 9 FIG. 9 is a schematic diagram of the structure of an image processing device 900 according to an embodiment of the present disclosure. Fig. 9 As shown, the image processing device comprises:
[0178] An acquisition module 910 is used to acquire a first color space representation and a second color space representation of the image to be corrected;
[0179] A determination module 920, configured to determine skin color pixels in the image to be corrected based on the first color space representation and the second color space representation;
[0180] The correction module 930 is used to correct skin color pixels.
[0181] In some embodiments, the determination module 920 is specifically used to: determine that a first pixel in the image to be corrected is a skin color pixel, wherein a first color space representation of the first pixel satisfies a first condition, and a second color space representation of the first pixel satisfies a second condition.
[0182] In some embodiments, the first color space of the determination module 920 is represented as RGB values, and the second color space is represented as YCbCr values and / or HSV values.
[0183] In some embodiments, the first condition of the determination module 920 includes: the red component R in the first color space representation is the largest, and the relationship among the red component R, the green component G, and the blue component B satisfies a first rule.
[0184] In some embodiments, the first rule of the determination module 920 includes: the red component R is greater than the first red threshold, and the green component G is greater than the first green threshold, and the blue component B is greater than the first blue threshold, and the difference between the red component R and the minimum of the green component G and the blue component B is greater than the first threshold, and the difference between the red component R and the green component G is greater than or equal to the second threshold; or the red component R is greater than the second red threshold, and the green component G is greater than the second green threshold, and the blue component B is greater than the second blue threshold, and the difference between the red component R and the green component G is greater than or equal to the third threshold, and the difference between the red component R and the green component G is less than or equal to the fourth threshold, and the green component G is greater than the blue component B.
[0185] In some embodiments, the second condition of the determination module 920 includes: the blue chromaticity component Cb in the second color space representation is greater than or equal to the first blue chromaticity component threshold, and the blue chromaticity component Cb is less than or equal to the second blue chromaticity component threshold, and the red chromaticity component Cr is greater than or equal to the first red chromaticity component threshold, and the red chromaticity component Cr is less than or equal to the second red chromaticity component threshold; and / or, the hue H in the second color space representation is greater than or equal to the first hue threshold, and the hue H is less than or equal to the second hue threshold, and the saturation S is greater than or equal to the first saturation threshold, and the saturation S is less than or equal to the second saturation threshold.
[0186] In some embodiments, the correction module 930 is used to: determine the correction gain values of the hue H, saturation S and brightness V corresponding to the skin color pixel in a preset lookup table according to the HSV color space representation of the skin color pixel;
[0187] The skin color pixel is corrected based on the correction gain values of the hue H, saturation S and brightness V corresponding to the skin color pixel.
[0188] In some embodiments, the correction module 930 uses the following method to determine the gains of the hue H, saturation S and brightness V corresponding to the skin color pixel in a preset lookup table according to the representation of the skin color pixel in the HSV color space:
[0189] The correction gain value is determined according to the first condition, or the correction gain value is determined according to the second condition.
[0190] In some embodiments, the correction module 930 uses the following method to determine the correction gain value according to the first condition:
[0191] The HSV color space representation of the skin color pixel exists in the preset lookup table as a first condition;
[0192] If the HSV color space representation of the skin color pixel satisfies the first condition, the gain values of the hue H, saturation S and brightness V corresponding to the HSV color space representation of the skin color pixel are used as correction gain values.
[0193] In some embodiments, the correction module 930 determines the correction gain value according to the second condition in the following manner:
[0194] The HSV color space representation of the skin color pixel does not exist in the preset lookup table as the second condition;
[0195] If the HSV color space representation of the skin color pixel satisfies the second condition, an interpolation gain value is determined based on the neighboring value using the neighboring value of the HSV color space representation of the skin color pixel, and the interpolation gain value is determined as the correction gain value.
[0196] In summary, the image processing device is used to obtain the first color space representation and the second color space representation of the image to be corrected; based on the first color space representation and the second color space representation, the skin color pixels in the image to be corrected are determined; and the skin color pixels are corrected. The device improves the accuracy of skin color recognition, eliminates the color banding problem existing in skin color display in the related art, and improves the display effect of skin color under different brightness adjustments.
[0197] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.
[0198] Fig.10 is a block diagram of an electronic device 1000 for implementing the above image processing method according to an exemplary embodiment.
[0199] For example, the electronic device 1000 may be a mobile phone, a computer, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0200] Reference Fig.10 , the electronic device 1000 may include one or more of the following components: a processing component 1002 , a memory 1004 , a power component 1006 , a multimedia component 1008 , an audio component 1010 , an input / output (I / O) interface 1012 , a sensor component 1014 , and a communication component 1016 .
[0201] The processing component 1002 generally controls the overall operation of the electronic device 1000, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1002 may include one or more processors 1020 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1002 may include one or more modules to facilitate the interaction between the processing component 1002 and other components. For example, the processing component 1002 may include a multimedia module to facilitate the interaction between the multimedia component 1008 and the processing component 1002.
[0202] The memory 1004 is configured to store various types of data to support operations on the electronic device 1000. Examples of such data include instructions for any application or method operating on the electronic device 1000, contact data, phone book data, messages, pictures, videos, etc. The memory 1004 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0203] The power supply component 1006 provides power to various components of the electronic device 1000. The power supply component 1006 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1000.
[0204] The multimedia component 1008 includes a screen that provides an output interface between the electronic device 1000 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1008 includes a front camera and / or a rear camera. When the electronic device 1000 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0205] The audio component 1010 is configured to output and / or input audio signals. For example, the audio component 1010 includes a microphone (MIC), and when the electronic device 1000 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1004 or sent via the communication component 1016. In some embodiments, the audio component 1010 also includes a speaker for outputting audio signals.
[0206] I / O interface 1012 provides an interface between processing component 1002 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0207] The sensor assembly 1014 includes one or more sensors for providing various aspects of status assessment for the electronic device 1000. For example, the sensor assembly 1014 can detect the open / closed state of the electronic device 1000, the relative positioning of components, such as the display and keypad of the electronic device 1000, and the sensor assembly 1014 can also detect the position change of the electronic device 1000 or a component of the electronic device 1000, the presence or absence of user contact with the electronic device 1000, the orientation or acceleration / deceleration of the electronic device 1000, and the temperature change of the electronic device 1000. The sensor assembly 1014 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 1014 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1014 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0208] The communication component 1016 is configured to facilitate wired or wireless communication between the electronic device 1000 and other devices. The electronic device 1000 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio) or a combination thereof. In an exemplary embodiment, the communication component 1016 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1016 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0209] In an exemplary embodiment, the electronic device 1000 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0210] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1004 including instructions, and the instructions can be executed by the processor 1020 of the electronic device 1000 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0211] An embodiment of the present disclosure further proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the image processing method described in the above embodiment of the present disclosure.
[0212] An embodiment of the present disclosure further provides a computer program product, including a computer program, which executes the image processing method described in the above embodiment of the present disclosure when a processor is used.
[0213] An embodiment of the present disclosure also proposes a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send signals to the processor, the signals include computer instructions stored in the memory, and when the processor executes the computer instructions, the electronic device executes the image processing method described in the above embodiments of the present disclosure.
[0214] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0215] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0216] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.
[0217] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.
[0218] It should be understood that the various parts of the embodiments of the present disclosure can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0219] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0220] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0221] Although the embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present disclosure. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present disclosure.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire a first color space representation and a second color space representation of the image to be corrected; Determining skin color pixels in the image to be corrected based on the first color space representation and the second color space representation; The skin color pixels are corrected.
2. The method according to claim 1, characterized in that: The determining, based on the first color space representation and the second color space representation, skin color pixels in the image to be corrected comprises: Determining that a first pixel in the image to be corrected is a skin color pixel, The first color space of the first pixel indicates that a first condition is satisfied, and the second color space of the first pixel indicates that a second condition is satisfied.
3. The method according to claim 2, characterized in that The first color space is represented by RGB values, and the second color space is represented by YCbCr values and / or HSV values.
4. The method according to claim 3, characterized in that The first condition includes: The red component R in the first color space representation is the largest, and the relationship among the red component R, the green component G and the blue component B satisfies a first rule.
5. The method according to claim 4, characterized in that The first rule includes: The red component R is greater than a first red threshold, and the green component G is greater than a first green threshold, and the blue component B is greater than a first blue threshold, and the difference between the red component R and the smallest of the green component G and the blue component B is greater than a first threshold, and the difference between the red component R and the green component G is greater than or equal to a second threshold; or, The red component R is greater than the second red threshold, and the green component G is greater than the second green threshold, and the blue component B is greater than the second blue threshold, and the difference between the red component R and the green component G is greater than or equal to the third threshold, and the difference between the red component R and the green component G is less than or equal to the fourth threshold, and the green component G is greater than the blue component B.
6. The method according to claim 3, characterized in that The second condition includes: In the second color space representation, a blue chromaticity component Cb is greater than or equal to a first blue chromaticity component threshold, and the blue chromaticity component Cb is less than or equal to a second blue chromaticity component threshold, and a red chromaticity component Cr is greater than or equal to a first red chromaticity component threshold, and the red chromaticity component Cr is less than or equal to a second red chromaticity component threshold; and / or, In the second color space representation, the hue H is greater than or equal to a first hue threshold, and the hue H is less than or equal to a second hue threshold, and the saturation S is greater than or equal to a first saturation threshold, and the saturation S is less than or equal to a second saturation threshold.
7. The method according to claim 1, characterized in that The correcting the skin color pixel comprises: According to the HSV color space representation of the skin color pixel, the correction gain values of the hue H, the saturation S and the brightness V corresponding to the skin color pixel are determined in a preset lookup table; The skin color pixel is corrected based on the correction gain values of the hue H, the saturation S and the brightness V corresponding to the skin color pixel.
8. The method according to claim 7, characterized in that Determining the gains of the hue H, saturation S, and brightness V corresponding to the skin color pixel in a preset lookup table according to the representation of the skin color pixel in the HSV color space includes: According to the first condition, the correction gain value is determined, or According to the second condition, the correction gain value is determined.
9. The method according to claim 8, characterized in that The determining the correction gain value according to the first condition comprises: The HSV color space representation of the skin color pixel exists in the preset lookup table as the first condition; If the HSV color space representation of the skin color pixel satisfies the first condition, the gain values of the hue H, saturation S and brightness V corresponding to the HSV color space representation of the skin color pixel are used as the correction gain values.
10. The method according to claim 8, characterized in that The determining the correction gain value according to the second condition comprises: The HSV color space representation of the skin color pixel does not exist in the preset lookup table as the second condition; If the HSV color space representation of the skin color pixel satisfies the second condition, an interpolation gain value is determined based on the neighboring value represented by the HSV color space of the skin color pixel using the neighboring value, and the interpolation gain value is determined as the correction gain value.
11. An image processing device, characterized in that: The device comprises: An acquisition module, which acquires a first color space representation and a second color space representation of the image to be corrected; A determination module, which determines skin color pixels in the image to be corrected based on the first color space representation and the second color space representation; A correction module is used to correct the skin color pixels.
12. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
13. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.
14. A chip, characterized in that: It comprises one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory of an electronic device and send the signal to the processor, the signal includes a computer instruction stored in the memory, and when the processor executes the computer instruction, the electronic device executes the method described in any one of claims 1 to 10.
Citation Information
Cited By
Reflection removal method, device and equipment for ultra-high-definition image, medium and product
CN121053050A