Car window face image processing method and device, electronic equipment and storage medium
By extracting the window and face areas, determining the window color type and skin color area, combining the preset lookup table to calculate the skin color weight matrix, and adjusting the face areas, solving the color shift and brightness problems in the face images of the windows and improving image quality.
Patent Information
- Application Number
- CN202311782679.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2025-06-24
AI Technical Summary
In traffic capture scenes, due to the influence of glass film, the face images of the car windows have different degrees of color cast and low brightness, and the saturation and white skin tone when used at night, resulting in poor image quality.
By extracting the window area and face area, determining the window color type and corresponding skin color area, combining the preset window color offset lookup table, the skin color weight matrix of the target skin color area is calculated, and the face area is adjusted to generate the target face area with no color cast.
Accurate detection and adjustment of the skin tone areas with color shifts in the face images of the car windows, making the adjusted skin tone areas more suitable for normal skin tone, thereby improving the display effect of the face images of the windows.
Smart Images

Figure CN120198283A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular, to a method, device, electronic device, and storage medium for processing window face images. Background Art
[0002] With the development of special fields such as international and domestic security monitoring, safe cities, and intelligent transportation, the demand for intelligent transportation checkpoints and electronic police illegal capture systems has been continuously increasing, and the requirements for the quality of window face images in the images captured by checkpoint cameras of intelligent transportation systems have also been increasing. However, in the traffic capture scenario, during the day, due to the influence of thick films on window glass, the window face images will show varying degrees of skin color deviation and low face brightness; at night, the saturation of the face window images captured by the camera in cooperation with the exposure lamp is low and the skin color is white.
[0003] In the related art, when processing the skin color area in the window face image, it usually relies on some prior information of the skin color, and uses some empirical skin color values as judgment thresholds to identify the skin color area in the window face image. However, in the case of existing color deviation, the identification of the skin color area is not accurate enough, and it is difficult to generalize and apply. Summary of the Invention
[0004] The present invention provides a method, device, electronic device, and storage medium for processing window face images, which can accurately detect the skin color area with color deviation in the window face image, and adjust the face area according to the skin color weight matrix, so that the skin color area in the adjusted face area is more consistent with the normal skin color.
[0005] According to one aspect of the present invention, there is provided a method for processing window face images, including:
[0006] Extracting a window area and an initial face area from an initial window face image to be processed;
[0007] Determining the window color type corresponding to the window area, and determining a first skin color area in the window area according to the window color type and a preset window color deviation lookup table;
[0008] Determining a second skin color area in the initial face area, and using the intersection area of the first skin color area and the second skin color area as the target skin color area;
[0009] Determining a skin color weight matrix corresponding to the initial face area according to the target skin color area; wherein, the skin color weight matrix includes the skin color weight corresponding to each pixel point in the initial face area;
[0010] Adjust the initial face region according to the skin color weight matrix to generate a target face region, and splice the target face region to the initial window face image to generate a target window face image.
[0011] According to another aspect of the present invention, there is provided a window face image processing device, including:
[0012] A region extraction module for extracting a window region and an initial face region from an initial window face image to be processed;
[0013] A first skin color region determination module for determining the window color type corresponding to the window region, and determining the first skin color region within the window region according to the window color type and a preset window color deviation lookup table;
[0014] A target skin color region determination module for determining the second skin color region in the initial face region, and taking the intersection region of the first skin color region and the second skin color region as the target skin color region;
[0015] A skin color weight matrix determination module for determining the skin color weight matrix corresponding to the initial face region according to the target skin color region; wherein, the skin color weight matrix includes the skin color weight corresponding to each pixel point in the initial face region;
[0016] A target window face image generation module for adjusting the initial face region according to the skin color weight matrix to generate a target face region, and splicing the target face region into the initial window face image to generate a target window face image.
[0017] According to another aspect of the present invention, there is provided an electronic device, the electronic device includes:
[0018] At least one processor; and
[0019] A memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the window face image processing method according to any embodiment of the present invention.
[0021] According to another aspect of the present invention, there is provided a computer-readable storage medium, the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the window face image processing method according to any embodiment of the present invention when executed.
[0022] The window face image processing solution according to the embodiments of the present invention extracts a window area and an initial face area from an initial window face image to be processed; determines the window color type corresponding to the window area, and determines a first skin color area within the window area according to the window color type and a preset window color deviation lookup table; determines a second skin color area in the initial face area, and takes the intersection area of the first skin color area and the second skin color area as a target skin color area; determines a skin color weight matrix corresponding to the initial face area according to the target skin color area; wherein, the skin color weight matrix includes the skin color weight corresponding to each pixel point in the initial face area; adjusts the initial face area according to the skin color weight matrix to generate a target face area, and splices the target face area to the initial window face image to generate a target window face image. Through the technical solution provided by the embodiments of the present invention, the skin color area with color deviation in the window face image can be accurately detected, and the face area can be adjusted according to the skin color weight matrix, so that the skin color area in the adjusted face area is more consistent with the normal skin color, thereby making the window face image present a better display effect.
[0023] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.
[0025] Figure 1 is a flowchart of a window face image processing method according to Embodiment 1 of the present invention;
[0026] Figure 2 is a flowchart of a window face image processing method according to Embodiment 2 of the present invention;
[0027] Figure 3 is a schematic structural diagram of a window face image processing device according to Embodiment 3 of the present invention;
[0028] Figure 4 is a schematic structural diagram of an electronic device for implementing the window face image processing method of the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0029] In order to enable those skilled in the art to better understand the solution of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned accompanying drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0031] Embodiment 1
[0032] Figure 1 A flowchart of a method for processing a window face image is provided for Embodiment 1 of the present invention. This embodiment is applicable to the situation of processing a window face image. This method can be executed by a window face image processing device, which can be implemented in the form of hardware and / or software, and the window face image processing device can be configured in an electronic device. As Figure 1 shown, the method includes:
[0033] S110. Extract a window area and an initial face area from an initial window face image to be processed.
[0034] In an embodiment of the present invention, an initial window face image to be processed is obtained. Among them, the initial window face image can be the window face image captured by a bayonet camera in an intelligent transportation system. Due to the influence of window glass film, there is a certain color cast in the skin color area of the initial window face image. Target detection is performed on the initial window face image according to the face feature information, and the initial face area in the initial window face image is extracted. Among them, the initial face area can be the minimum circumscribed rectangle area of the face image in the initial window face image. Target detection is performed on the initial window face image according to the window feature information, and the window area in the initial window face image is extracted. Since the face area in the initial window face image is a face image taken through the window, the initial face area is within the window area, that is, the window area includes the initial face area.
[0035] S120. Determine the window color type corresponding to the window area, and determine the first skin color area in the window area according to the window color type and a preset window color cast lookup table.
[0036] In an embodiment of the present invention, the window area can be analyzed based on a preset color analysis algorithm to determine the window color type corresponding to the window area. Optionally, the window area can also be input into a pre-trained window color type determination model, and the output result of the window color type determination model is used to determine the window color type corresponding to the window area. Among them, the window color type can be any one of color windows such as a cyan-greenish window, a yellowish-green window, a dark green window, and a dark blue window.
[0037] Generally, when the window permeability is good, the internal color information is relatively rich, and the mean values of the RGB three channels of the window area will be relatively unified. When different color films are pasted on the window, there will be an obvious color cast tendency in the window, which mostly shows that the color mean value of one channel in the RGB three channels is significantly different from the mean values of the other two channels, that is, there will be an obvious peak difference in the histogram of the RGB three channels of the window area. In an embodiment of the present invention, face images taken through windows of different window color types are obtained, and the value ranges of the RGB components of the skin color area in the face image are determined, so as to establish a mapping relationship between the window color type and the value ranges of the RGB components of the skin color area taken through the window of this window color type. Optionally, according to the prior information of human skin color R>95&G>40&B>20&max(R,G,B)-min(R,G,B)>15&ABS(R-G)>15&R>G&R>B (that is, the value ranges of the RGB components of the normal human skin color area are (135±10, 95±10, 65±10)), the value ranges of the RGB components of the color-cast skin color area corresponding to different window color types can be obtained. For example, the preset window color cast lookup table is shown in Table 1:
[0038] Window color type RGB components of the skin color area Cyan-greenish window (105±10,130±10,105±10) Yellowish-greenish window (110±10,140±10,115±10) Dark-greenish window (100±20,120±20,85±20) Dark-blueish window (45±20,80±20,90±20)
[0039] In an embodiment of the present invention, a preset window color cast lookup table is obtained, and according to the window color type corresponding to the window area and the preset window color cast lookup table, a first skin color area within the window area is determined. Optionally, the preset window color cast lookup table includes the value ranges of the RGB components of the skin color areas under different window color types; determining the first skin color area within the window area according to the window color type and the preset window color cast lookup table includes: determining the target value range of the RGB components of the skin color area corresponding to the window color type from the preset window color cast lookup table; traversing each pixel point in the window area, and determining whether the RGB components corresponding to the pixel point are within the target value range, and if so, using the pixel point as a pixel point of the first skin color area within the window area.
[0040] Exemplarily, if it is determined that the window color type corresponding to the window area is a yellowish-greenish window, then according to the preset window color cast lookup table, the target value range of the RGB components of the skin color area corresponding to this window color type (yellowish-greenish window) is (110±10, 140±10, 115±10). Then, traverse each pixel point in the window area, and determine whether the RGB components corresponding to the pixel point are within the target value range (110±10, 140±10, 115±10), and if so, use the pixel point as a pixel point of the first skin color area within the window area. It can be understood that according to the window color type and the preset window color cast lookup table, the skin color area with color cast in the window area (i.e., the first skin color area) can be determined.
[0041] Optionally, since the user wears a mask or glasses, there may be a situation where part of the face is blocked in the window face image. Therefore, based on a preset occluder (such as a mask) lookup table and the preset window color cast lookup table, the occluded areas in the window area are screened. Since the occluded areas are relatively concentrated within the face area, the number of pixels in the window area can be used as the horizontal axis of the histogram, and based on the face position information within the window area and the color characteristics of occluded areas such as masks under the influence of window color cast, the equally spaced distribution characteristics on the histogram are used as the basis for detecting occluded areas. It is also possible to screen out the occluded areas from the window area by a rough clustering method according to the obvious brightness differences between the skin area, the occluded area and the eye area within the window area under the influence of window color cast.
[0042] S130. Determine a second skin color area in the initial face area, and use the intersection area of the first skin color area and the second skin color area as the target skin color area.
[0043] In an embodiment of the present invention, RGB pixel feature information in an initial face region is obtained, and a skin color region in the initial face region is determined according to the RGB pixel feature information. For the convenience of description, the skin color region in the initial face region determined according to the RGB pixel feature information is referred to as the second skin color region. Optionally, determining the second skin color region in the initial face region includes: clustering all pixel points in the initial face region according to the pixel values of each pixel point in the initial face region to obtain at least two clustering clusters; for each clustering cluster, determining the centroid of the clustering cluster, and taking the clustering cluster with the largest pixel value of the centroid as the second skin color region. Exemplarily, all pixel points in the initial face region are clustered according to the pixel values of each pixel point in the initial face region by a clustering algorithm to generate at least two clustering clusters. Although there is a color deviation in the skin color region in the initial face region, the pixel values in the skin color region in the initial face region are still greater than the pixel values in high-frequency regions such as eyes and eyebrows. Therefore, the centroid of each clustering cluster is determined, and the clustering cluster with the largest pixel value corresponding to the centroid among all clustering clusters is taken as the second skin color region. Optionally, the area of the skin color region is usually larger than the area of high-frequency regions such as eyes and eyebrows. Therefore, the region with the number of pixel points greater than a preset threshold among all clustering clusters can also be taken as the second skin color region.
[0044] Optionally, determining the second skin color region in the initial face region includes: clustering all pixel points in the initial face region according to the pixel values of each pixel point in the initial face region to obtain at least two clustering clusters; for each clustering cluster, determining the proportion of the number of pixel points in the clustering cluster; wherein, the proportion of the number of pixel points is the ratio of the number of pixel points included in the clustering cluster to the number of pixel points included in the initial face region; taking the clustering cluster with the largest proportion of the number of pixel points among the at least two clustering clusters as the second skin color region. It can be understood that the area of the skin color region is usually larger than the area of high-frequency regions such as eyes and eyebrows. Even if there are occlusion regions such as glasses and masks in the face region, the area of the occlusion region is usually smaller than the unoccluded face region. Therefore, for each of the at least two clustering clusters, the proportion of the number of pixel points in the clustering cluster can be calculated. The proportion of the number of pixel points is the ratio of the number of pixel points included in the clustering cluster to the number of pixel points included in the entire initial face region. Then, the clustering cluster with the largest proportion of the number of pixel points among all clustering clusters is taken as the second skin color region.
[0045] The intersection region of the first skin color region and the second skin color region is determined, and this intersection region is taken as the target skin color region. The advantage of such a setting is that the target skin color region with color deviation in the window face image can be accurately determined by combining the window color type and the RGB pixel feature information in the initial face region.
[0046] S140. Determine the skin color weight matrix corresponding to the initial face region according to the target skin color region; wherein, the skin color weight matrix includes the skin color weight corresponding to each pixel point in the initial face region.
[0047] In the embodiment of the present invention, the target skin color region is analyzed to determine the characteristic information of the target skin color region, and the skin color weight matrix corresponding to the initial face region is determined according to the characteristic information of the target skin color region. Among them, the skin color weight matrix includes the skin color weight corresponding to each pixel point in the initial face region. It can be understood that the skin color weight corresponding to each pixel point in the initial face region is determined according to the characteristic information of the target skin color region. Among them, the greater the skin color weight, the greater the possibility that the pixel point is a pixel point in the skin color region.
[0048] Optionally, determining the skin color weight matrix corresponding to the initial face region according to the target skin color region includes: determining the brightness and chromaticity characteristic information of the target skin color region in the Lab color space; determining the skin color weight matrix corresponding to the initial face region according to the brightness and chromaticity characteristic information. Exemplarily, the target skin color region is converted from the RGB color space to the Lab color space, or the entire window face image is converted from the RGB color space to the Lab color space, where L represents brightness, a represents the range from red to green, and b represents the range from yellow to blue. Obtain the brightness and chromaticity characteristic information of the target skin color region in the Lab color space, and construct a Gaussian model according to the brightness and chromaticity characteristic information of the target skin color region and the brightness value and chromaticity value of each pixel point in the initial face region in the Lab color space, so as to determine the skin color weight of each pixel point in the initial face region.
[0049] Optionally, the brightness and chromaticity characteristic information includes brightness mean, brightness standard deviation, chromaticity mean, and chromaticity standard deviation; determining the skin color weight matrix corresponding to the initial face region according to the brightness and chromaticity characteristic information includes: for each pixel point in the initial face region, calculating the brightness weight of the pixel point according to the brightness value, the brightness standard deviation, and the brightness mean of the pixel point, and calculating the chromaticity weight of the pixel point according to the chromaticity value, the chromaticity standard deviation, and the chromaticity mean of the pixel point; calculating the skin color weight corresponding to the pixel point according to the brightness weight and the chromaticity weight; generating the skin color weight matrix corresponding to the initial face region based on the skin color weight corresponding to each pixel point in the initial face region.
[0050] Exemplarily, determine the brightness mean, brightness standard deviation, chromaticity mean, and chromaticity standard deviation of the target skin color region in the Lab color space. Among them, the chromaticity mean includes the a-component chromaticity mean and the b-component chromaticity mean, and the chromaticity standard deviation includes the a-component chromaticity standard deviation and the b-component chromaticity standard deviation. In the Lab color space, for each pixel point in the initial face region, calculate the brightness weight of the pixel point according to the brightness value of the pixel point, the brightness standard deviation, and the brightness mean of the target skin color region. In the Lab color space, for each pixel point in the initial face region, calculate the a-component chromaticity weight of the pixel point according to the a-component chromaticity value of the pixel point, the a-component chromaticity standard deviation, and the a-component chromaticity mean of the target skin color region. Similarly, in the Lab color space, for each pixel point in the initial face region, calculate the b-component chromaticity weight of the pixel point according to the b-component chromaticity value of the pixel point, the b-component chromaticity standard deviation, and the b-component chromaticity mean of the target skin color region. Exemplarily, the brightness weight, a-component chromaticity weight, and b-component chromaticity weight of each pixel point in the initial face region can be determined according to the following formula:
[0051]
[0052]
[0053]
[0054] Among them, alpha represents a preset regulation coefficient of brightness and chromaticity, l std represents the brightness standard deviation, a std represents the a-component chromaticity standard deviation, b std represents the b-component chromaticity standard deviation, l mean represents the brightness mean, a mean represents the a-component chromaticity mean, b mean represents the b-component chromaticity mean, l i represents the brightness value of the i-th pixel point, a i represents the a-component chromaticity value of the i-th pixel point, b i represents the b-component chromaticity value of the i-th pixel point, represents the brightness weight of the i-th pixel point, represents the a-component chromaticity weight of the i-th pixel point, represents the b-component chromaticity weight of the i-th pixel point.
[0055] Optionally, the chromaticity weight includes the a-component chromaticity weight and the b-component chromaticity weight; calculating the skin color weight corresponding to the pixel point according to the brightness weight and the chromaticity weight includes: calculating the product of the brightness weight, the a-component chromaticity weight, and the b-component chromaticity weight, and taking the product as the skin color weight corresponding to the pixel point. Exemplarily, wherein, weight i represents the skin color weight of the i-th pixel point.
[0056] It can be understood that when the brightness value and chromaticity value of the pixel points in the initial face region are close to the overall distribution, the closer the skin weight value of the pixel point is to 1, the greater the possibility that the pixel point is a skin pixel point. The skin color weight matrix corresponding to the initial face region can be understood as the skin color mask image of the initial face region, then the skin color mask image is normalized to (0, 1), and the normalized skin color mask image is eroded, dilated and filtered to smooth the skin color mask image.
[0057] S150. Adjust the initial face region according to the skin color weight matrix to generate a target face region, and splice the target face region to the initial window face image to generate a target window face image.
[0058] Exemplarily, the initial face region is adjusted according to the skin color weight matrix corresponding to the initial face region to generate a target face region. Optionally, adjusting the initial face region according to the skin color weight matrix to generate a target face region includes: determining the HSV feature information of the target skin color region in the HSV color space, and adjusting the initial face region according to the HSV feature information; generating a target face region according to the adjusted initial face region, the skin color weight matrix, and the initial face region. Exemplarily, the target skin color region or the initial window face region is converted from the RGB color space to the HSV color space, and the HSV feature information of the target skin color region in the HSV color space is determined, where the HSV feature information is the hue mean value, saturation mean value, and brightness mean value. The color of the initial face region is adjusted according to the hue mean value, the saturation of the initial face region is adjusted according to the saturation mean value, and the brightness of the initial face region is adjusted according to the brightness mean value. Then, the initial face region adjusted based on the hue mean value, saturation mean value, and brightness mean value is converted to the RGB color space. In the RGB color space, a target face region is generated according to the adjusted initial face region, the initial face region before adjustment, and the skin color weight matrix corresponding to the initial face region. Exemplarily, if the skin color weight matrix in S130 is a matrix normalized to (0, 1), the skin color weight matrix is extended to the interval (0, 255), and then the adjusted initial face region and the initial face region before adjustment are fused based on the skin color weight matrix to generate a target face region. Exemplarily, for each pixel point in the initial face region, the pixel value of the current pixel point in the target face region is calculated according to the pixel value of the current pixel point in the adjusted initial face region, the pixel value of the current pixel point in the initial face region before adjustment, and the skin color weight corresponding to the pixel point in the skin color weight matrix. Specifically, the pixel value of each pixel point in the target face region can be determined according to the following formula: Where, represents the pixel value of the i-th pixel point in the target face region, represents the pixel value of the i-th pixel point in the adjusted initial face region, represents the pixel value of the i-th pixel point in the initial face region before adjustment, weight i represents the skin color weight corresponding to the i-th pixel point of the initial face region in the skin color weight matrix.
[0059] In the embodiment of the present invention, the target face region is spliced into the initial window face image to generate a target window face image. It can be understood that the skin color region included in the target window face image is an unbiased skin color region.
[0060] The window face image processing method according to an embodiment of the present invention extracts a window area and an initial face area from an initial window face image to be processed; determines the window color type corresponding to the window area, and determines a first skin color area within the window area according to the window color type and a preset window color deviation look-up table; determines a second skin color area in the initial face area, and uses the intersection area of the first skin color area and the second skin color area as a target skin color area; determines a skin color weight matrix corresponding to the initial face area according to the target skin color area; wherein, the skin color weight matrix includes the skin color weight corresponding to each pixel point in the initial face area; adjusts the initial face area according to the skin color weight matrix to generate a target face area, and splices the target face area to the initial window face image to generate a target window face image. Through the technical solution provided by the embodiment of the present invention, the skin color area with color deviation in the window face image can be accurately detected, and the face area is adjusted according to the skin color weight matrix, so that the skin color area in the adjusted face area is more consistent with the normal skin color, thereby making the window face image present a better display effect.
[0061] Embodiment 2
[0062] Figure 2 The flowchart of a window face image processing method provided by Embodiment 2 of the present invention is shown as Figure 2 shown, and the method includes:
[0063] S210. Extract a window area and an initial face area from an initial window face image to be processed.
[0064] S220. Determine the window color type corresponding to the window area, and determine a first skin color area within the window area according to the window color type and a preset window color deviation look-up table.
[0065] S230. Cluster all pixel points in the initial face area according to the pixel values of each pixel point in the initial face area to obtain at least two clusters.
[0066] S240. For each cluster, determine the centroid of the cluster, and use the cluster with the largest pixel value of the centroid as the second skin color area.
[0067] S250. Use the intersection area of the first skin color area and the second skin color area as the target skin color area.
[0068] S260. Determine the brightness and chromaticity feature information of the target skin color area in the Lab color space.
[0069] S270. Determine a skin color weight matrix corresponding to the initial face area according to the brightness and chromaticity feature information.
[0070] S280. Determine the HSV feature information of the target skin color region in the HSV color space, and adjust the initial face region according to the HSV feature information.
[0071] S290. Generate a target face region based on the adjusted initial face region, skin color weight matrix, and the initial face region.
[0072] S2100. Stitch the target face region to the initial window face image to generate a target window face image.
[0073] The window face image processing method according to the embodiments of the present invention can accurately detect the skin color region with color deviation in the window face image, and adjust the face region according to the skin color weight matrix, so that the skin color region in the adjusted face region is more consistent with the normal skin color, thereby making the window face image present a better display effect.
[0074] Embodiment III
[0075] Figure 3 It is a schematic structural diagram of a window face image processing device provided by Embodiment III of the present invention. As Figure 3 shown, the device includes:
[0076] A region extraction module 310, configured to extract a window region and an initial face region from an initial window face image to be processed;
[0077] A first skin color region determination module 320, configured to determine the window color type corresponding to the window region, and determine the first skin color region in the window region according to the window color type and a preset window color deviation lookup table;
[0078] A target skin color region determination module 330, configured to determine the second skin color region in the initial face region, and use the intersection region of the first skin color region and the second skin color region as the target skin color region;
[0079] A skin color weight matrix determination module 340, configured to determine the skin color weight matrix corresponding to the initial face region according to the target skin color region; wherein, the skin color weight matrix includes the skin color weight corresponding to each pixel point in the initial face region;
[0080] A target window face image generation module 350, configured to adjust the initial face region according to the skin color weight matrix to generate a target face region, and stitch the target face region to the initial window face image to generate a target window face image.
[0081] Optionally, the preset window color deviation lookup table includes the value ranges of the RGB components of the skin color region under different window color types;
[0082] The first skin color area determination module is configured to:
[0083] Determine the target value range of the RGB components of the skin color area corresponding to the window color type from the preset window color deviation look-up table;
[0084] Traverse each pixel point in the window area, and determine whether the RGB components corresponding to the pixel point are within the target value range. If so, use the pixel point as the pixel point of the first skin color area within the window area.
[0085] Optionally, the target skin color area determination module is configured to:
[0086] Cluster all pixel points in the initial face area according to the pixel values of each pixel point in the initial face area to obtain at least two clusters;
[0087] For each cluster, determine the centroid of the cluster, and use the cluster with the largest pixel value of the centroid as the second skin color area.
[0088] Optionally, the target skin color area determination module is configured to:
[0089] Cluster all pixel points in the initial face area according to the pixel values of each pixel point in the initial face area to obtain at least two clusters;
[0090] For each cluster, determine the proportion of the number of pixel points in the cluster; wherein, the proportion of the number of pixel points is the ratio of the number of pixel points included in the cluster to the number of pixel points included in the initial face area;
[0091] Use the cluster with the largest proportion of the number of pixel points among the at least two clusters as the second skin color area.
[0092] Optionally, the skin color weight matrix determination module includes:
[0093] A brightness and chromaticity feature information determination unit for determining the brightness and chromaticity feature information of the target skin color area in the Lab color space;
[0094] A skin color weight matrix determination unit for determining the skin color weight matrix corresponding to the initial face area according to the brightness and chromaticity feature information.
[0095] Optionally, the brightness and chromaticity feature information includes a brightness mean value, a brightness standard deviation, a chromaticity mean value, and a chromaticity standard deviation;
[0096] The skin color weight matrix determination unit includes:
[0097] A brightness and chroma weight calculation subunit, configured to calculate the brightness weight of each pixel point in the initial face region according to the brightness value, the brightness standard deviation, and the brightness mean of the pixel point, and calculate the chroma weight of the pixel point according to the chroma value, the chroma standard deviation, and the chroma mean of the pixel point;
[0098] A skin color weight calculation subunit, configured to calculate the skin color weight corresponding to the pixel point according to the brightness weight and the chroma weight;
[0099] A skin color weight matrix generation subunit, configured to generate a skin color weight matrix corresponding to the initial face region based on the skin color weights corresponding to each pixel point in the initial face region.
[0100] Optionally, the chroma weight includes an a-component chroma weight and a b-component chroma weight;
[0101] The skin color weight matrix generation subunit is configured to:
[0102] Calculate the product of the brightness weight, the a-component chroma weight, and the b-component chroma weight, and use the product as the skin color weight corresponding to the pixel point.
[0103] Optionally, the target window face image generation module is configured to:
[0104] Determine the HSV feature information of the target skin color region in the HSV color space, and adjust the initial face region according to the HSV feature information;
[0105] Generate a target face region according to the adjusted initial face region, the skin color weight matrix, and the initial face region.
[0106] The window face image processing device provided by the embodiments of the present invention can execute the window face image processing method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method.
[0107] Embodiment 4
[0108] Figure 4FIG. 0 shows a schematic structural diagram of an electronic device 10 that can be used to implement embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, personal digital processors, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0109] As Figure 4 shown, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. The memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0110] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0111] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the window face image processing method.
[0112] In some embodiments, the window face image processing method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the window face image processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the window face image processing method by any other suitable means (e.g., by means of firmware).
[0113] The various embodiments of the systems and techniques described above in this document may be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), systems on a chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a special-purpose or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0114] The computer program for implementing the method of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that the computer program, when executed by the processor, causes the functions / operations specified in the flowchart and / or block diagram to be implemented. The computer program may be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.
[0115] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0116] To provide for interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0117] The systems and techniques described herein can be implemented in a computing system that includes backend components (such as, for example, a data server), or a computing system that includes middleware components (such as, for example, an application server), or a computing system that includes frontend components (such as, for example, a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (such as, for example, a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0118] A computing system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The client-server relationship is created by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.
[0119] It should be understood that various forms of processes shown above can be used, with steps reordered, added or deleted. For example, the steps described in the present invention can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is imposed herein.
[0120] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for processing face images of a vehicle window, characterized in that, Including: Extracting a window region and an initial face region from an initial window face image to be processed; Determining a window color type corresponding to the window region, and determining a first skin color region within the window region according to the window color type and a preset window color deviation lookup table; Determining a second skin color region in the initial face region, and taking an intersection region of the first skin color region and the second skin color region as a target skin color region; Determining a skin color weight matrix corresponding to the initial face region according to the target skin color region; wherein, the skin color weight matrix includes skin color weights corresponding to each pixel point in the initial face region; Adjusting the initial face region according to the skin color weight matrix to generate a target face region, and splicing the target face region to the initial window face image to generate a target window face image.
2. The method according to claim 1, wherein The preset window color deviation lookup table contains value ranges of RGB components of skin color regions under different window color types; Determining the first skin color region within the window region according to the window color type and the preset window color deviation lookup table includes: Determining a target value range of RGB components of a skin color region corresponding to the window color type from the preset window color deviation lookup table; Traversing each pixel point in the window region, and determining whether the RGB components corresponding to the pixel point are within the target value range. If so, taking the pixel point as a pixel point of the first skin color region within the window region.
3. The method according to claim 1, wherein Determining the second skin color region in the initial face region includes: Clustering all pixel points in the initial face region according to pixel values of each pixel point in the initial face region to obtain at least two clustering clusters; For each clustering cluster, determining a centroid of the clustering cluster, and taking the clustering cluster with the largest pixel value of the centroid as the second skin color region.
4. The method according to claim 1, characterized in that Determining the second skin color region in the initial face region includes: Clustering all pixel points in the initial face region according to pixel values of each pixel point in the initial face region to obtain at least two clustering clusters; For each clustering cluster, determining a pixel point quantity proportion; wherein, the pixel point quantity proportion is a ratio of the number of pixel points included in the clustering cluster to the number of pixel points included in the initial face region; Taking the clustering cluster with the largest pixel point quantity proportion among the at least two clustering clusters as the second skin color region.
5. The method according to claim 1, characterized in that Determining the skin color weight matrix corresponding to the initial face region according to the target skin color region includes: Determining luminance and chrominance feature information of the target skin color region in the Lab color space; Determining the skin color weight matrix corresponding to the initial face region according to the luminance and chrominance feature information.
6. The method according to claim 5, characterized in that, The luminance and chrominance feature information includes a luminance mean value, a luminance standard deviation, a chrominance mean value, and a chrominance standard deviation; Determining the skin color weight matrix corresponding to the initial face region according to the luminance and chrominance feature information includes: For each pixel point in the initial face region, calculate the brightness weight of the pixel point according to the brightness value, the brightness standard deviation, and the brightness mean of the pixel point, and calculate the chromaticity weight of the pixel point according to the chromaticity value, the chromaticity standard deviation, and the chromaticity mean of the pixel point; Calculate the skin color weight corresponding to the pixel point according to the brightness weight and the chromaticity weight; Based on the skin color weights corresponding to each pixel point in the initial face region, generate a skin color weight matrix corresponding to the initial face region.
7. The method according to claim 1, characterized in that, Adjust the initial face region according to the skin color weight matrix to generate a target face region, including: Determine the HSV feature information of the target skin color region in the HSV color space, and adjust the initial face region according to the HSV feature information; Generate a target face region according to the adjusted initial face region, the skin color weight matrix, and the initial face region.
8. A window face image processing device, characterized in that Including: A region extraction module, configured to extract a window region and an initial face region from an initial window face image to be processed; A first skin color region determination module, configured to determine the window color type corresponding to the window region, and determine a first skin color region within the window region according to the window color type and a preset window color deviation look-up table; A target skin color region determination module, configured to determine a second skin color region in the initial face region, and use the intersection region of the first skin color region and the second skin color region as the target skin color region; A skin color weight matrix determination module, configured to determine a skin color weight matrix corresponding to the initial face region according to the target skin color region; wherein, the skin color weight matrix includes the skin color weights corresponding to each pixel point in the initial face region; A target window face image generation module, configured to adjust the initial face region according to the skin color weight matrix to generate a target face region, and splice the target face region into the initial window face image to generate a target window face image.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the window face image processing method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the processor to implement the window face image processing method according to any one of claims 1-7 when executed.