Image processing method and device
By identifying and adjusting the skin tone categories and brightness of different portrait features in multi-person group images, the skin overexposed or underexposed problems caused by single focus is solved, and the shooting quality of multi-person group photos is improved.
Patent Information
- Application Number
- CN202411763564.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-12-03
AI Technical Summary
In multi-person group photo scenes, some portrait features in the group photo are overexposed or underexposed and blackened.
By acquiring an image containing at least two portrait features, determine the skin tone category corresponding to each portrait feature, and adjust the brightness of each portrait area separately according to the skin tone category and the average brightness value of the image to avoid overexposed or underexposed.
In multi-person photo scenes, the brightness of each portrait feature is personalized to avoid overexposed or underexposed skin, and improve shooting quality and effect.
Smart Images

Figure CN119629493A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and specifically relates to an image processing method and a device thereof. Background Art
[0002] In current photography technology, exposure algorithms usually adjust focus and exposure based on the background or a single subject.
[0003] In the related art, the exposure algorithm often only exposes one person in the picture. When taking a group photo of people with different skin colors, if the camera focuses on the person with darker skin, the camera will increase the exposure of the entire image, resulting in overexposure of the portrait area with lighter skin. If the camera focuses on the person with lighter skin, the camera will reduce the exposure, resulting in underexposure of the portrait area with darker skin, thus resulting in poor shooting effects in group photo scenes. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an image processing method and device thereof, which avoids the problem of overexposure or underexposure of the skin of some portrait features in group photos due to single focus.
[0005] In a first aspect, an embodiment of the present application provides an image processing method, including: acquiring a first image, the first image including at least two portrait features; determining skin color categories corresponding to the at least two portrait features respectively; and adjusting the brightness of at least two portrait areas respectively according to the skin color categories and a first brightness value of the first image, wherein the at least two portrait areas are areas where at least two portrait features are located, and the first brightness value is an average brightness value of the first image.
[0006] In a second aspect, an embodiment of the present application provides an image processing device, including: an acquisition module, used to acquire a first image, the first image including at least two portrait features; a determination module, used to determine the skin color categories corresponding to the at least two portrait features respectively; an adjustment module, used to adjust the brightness of at least two portrait areas respectively according to the skin color category and the first brightness value of the first image, wherein the at least two portrait areas are areas where at least two portrait features are located, and the first brightness value is the average brightness value of the first image.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the memory stores programs or instructions that can be executed on the processor, and when the programs or instructions are executed by the processor, the steps of the method of the first aspect are implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the steps of the method of the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method of the first aspect.
[0011] In an embodiment of the present application, when the first image obtained by capture includes at least two portrait features, the skin color categories corresponding to the at least two portrait features are classified, and the brightness of the corresponding portrait areas are adjusted based on the skin color categories corresponding to the at least two portrait features obtained by the classification, so that the adjusted image can take into account the exposure requirements of portrait features with different skin colors or whiter or darker skin colors under the same skin color, thereby avoiding the problem of overexposure or underexposure and darkening of the skin of some portrait features in group photos due to single focus, and providing personalized brightness adjustment for different portrait features, thereby improving the shooting quality and shooting effect when taking group photos of multiple people. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A schematic diagram showing a flow chart of an image processing method provided in some embodiments of the present application;
[0013] Figure 2 A schematic diagram of a first image provided in some embodiments of the present application is shown;
[0014] Figure 3 A schematic block diagram of an image processing device provided in some embodiments of the present application is shown;
[0015] Figure 4 A structural block diagram of an electronic device according to an embodiment of the present application is shown;
[0016] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in some embodiments of the present application is shown. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0018] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0019] The following is combined with Figures 1 to 5 , the image processing method and device provided by the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0020] In some embodiments of the present application, an image processing method is provided. Figure 1 A schematic diagram of the process of image processing methods provided in some embodiments of the present application is shown. Figure 1 As shown, the image processing method comprises:
[0021] Step 102, obtaining a first image, the first image including at least two portrait features;
[0022] In the embodiment of the present application, the first image is an original image obtained by shooting, the first image stores shooting parameter information obtained by shooting, and the first image is a group photo, that is, the first image includes at least two portrait features. It should be noted that the portrait features include but are not limited to facial features, torso features, limb features, etc.
[0023] Specifically, after the electronic device starts shooting, it uses an image recognition algorithm to quickly and accurately identify and locate the portrait features in the first image captured, thereby locating the position information of at least two portrait features, thereby determining the portrait area where each portrait feature is located in the first image.
[0024] Exemplarily, the image recognition method includes a face frame detection algorithm, such as: Haar feature cascade classifier (a technology used for image processing and object detection in computer vision), HOG (Histogram of Oriented Gradient) feature algorithm, deep learning algorithm Faster R-CNN (regional convolutional neural network), YOLO (You Only Look Once, a real-time object detection algorithm) algorithm, etc., which will not be elaborated here.
[0025] Step 104, determining skin color categories corresponding to at least two portrait features respectively;
[0026] In the embodiment of the present application, after identifying and locating at least two portrait features in the first image, the skin color parameters of the portrait area corresponding to the extracted portrait features can be determined, thereby classifying the skin color categories of the at least two portrait features, thereby determining the skin color category corresponding to each portrait feature. After identifying the skin color categories corresponding to different portrait features, it is convenient to adjust the brightness of the corresponding portrait area based on the skin color category, thereby avoiding the problem of overexposure or underexposure of portrait features of different skin color categories in the final output image.
[0027] It should be noted that the skin color categories are all preset categories, and can be divided into at least two categories from black to white.
[0028] Step 106, adjusting the brightness of at least two portrait areas respectively according to the skin color category and the first brightness value of the first image, wherein the at least two portrait areas are areas where at least two portrait features are located, and the first brightness value is an average brightness value of the first image.
[0029] In the embodiment of the present application, the first brightness value is the average brightness value of the overall brightness of the first image, and the at least two portrait areas are image areas where at least two portrait features are located. Adjusting the brightness of the at least two portrait areas separately can avoid the problem of overexposure or underexposure of at least one of the portrait areas. When adjusting the brightness of the at least two portrait areas separately, the adjustment parameters are set based on the determination of the skin color category adaptability, so that the at least two portrait areas after the brightness adjustment do not have the problem of overexposure or underexposure, and when adjusting the brightness of the at least two portrait areas, the overall average brightness of the first image is also combined to avoid excessive differences in the overall brightness of the at least two portrait areas after the brightness adjustment and the first image, thereby further improving the final image quality.
[0030] Figure 2 A schematic diagram of a first image provided in some embodiments of the present application is shown, such as Figure 2 As shown, the first image includes a first portrait feature 202 with a white skin color and a second portrait feature 204 with a dark skin color. In the exposure stage, the first portrait feature 202 with a white skin color is exposed, while the face of the second portrait feature 204 with a dark skin color is underexposed, resulting in unclear facial features. By adjusting the brightness of the first portrait area corresponding to the first portrait feature 202 and the second portrait area corresponding to the second portrait feature 204, the faces of the first portrait feature 202 and the second portrait feature 204 in the first image are clearly visible.
[0031] In an embodiment of the present application, when the first image obtained by capture includes at least two portrait features, the skin color categories corresponding to the at least two portrait features are classified, and the brightness of the corresponding portrait areas are adjusted based on the skin color categories corresponding to the at least two portrait features obtained by the classification, so that the adjusted image can take into account the exposure requirements of portrait features with different skin colors or whiter or darker skin colors under the same skin color, thereby avoiding the problem of overexposure or underexposure and darkening of the skin of some portrait features in group photos due to single focus, and providing personalized brightness adjustment for different portrait features, thereby improving the shooting quality and shooting effect when taking group photos of multiple people.
[0032] In some embodiments of the present application, determining the skin color categories corresponding to at least two portrait features respectively includes: obtaining the average feature vector of at least two portrait areas in a first color space; and determining the skin color category corresponding to each portrait feature based on the average feature vector, a preset mean vector, and a preset covariance matrix.
[0033] In an embodiment of the present application, when classifying the skin color categories of at least two portrait features, it is necessary to determine the average feature vector of at least two portrait areas in a first color space, wherein the first color space is a YCbCr (brightness, blue chromaticity, red chromaticity) color space.
[0034] Specifically, for the detected i-th portrait area, its average feature vector in the YCbCr color space is determined by the following calculation formulas (1), (2), (3) and (4):
[0035]
[0036] in, is the average eigenvector, is the average brightness, is the average blue chromaticity, is the average red chromaticity, N is the number of portrait areas, Cb(x,y) is the blue chromaticity of the pixel, Cr(x,y) is the red chromaticity of the pixel, and Y(x,y) is the brightness of the pixel.
[0037] In the embodiment of the present application, the preset mean vector and the preset covariance matrix are parameters determined by the skin color model established in advance, so the number of the preset mean vectors and the preset covariance matrix is the same as the number of skin color categories, and they correspond one to one. The established skin color model is stored in the electronic device, and when the electronic device needs to identify and classify the skin color category of the portrait feature, the stored skin color model is directly called.
[0038] Exemplarily, by collecting a large number of sample images corresponding to different skin color categories, their feature vectors (Y, Cb, Cr) in the first color space are extracted. Different skin color categories are assumed to obey Gaussian distribution and can be represented by mean vectors and covariance matrices.
[0039] In an embodiment of the present application, when classifying the skin color categories of at least two portrait features, the average feature vector of the first image in the first color space is obtained, and based on the preset mean vector and the preset covariance matrix corresponding to the preset skin color category, it is possible to accurately judge whether the at least two portrait features belong to the preset skin color category, thereby improving the accuracy of the electronic device in identifying the skin color categories of the at least two portrait features after extracting the at least two portrait features.
[0040] In some embodiments of the present application, the skin color category includes at least two preset categories, the number of preset mean vectors and the number of preset covariance matrices match the number of preset categories, and the at least two preset mean vectors, the at least two preset covariance matrices, and the at least two preset categories correspond one to one;
[0041] According to the average feature vector, the preset mean vector and the preset covariance matrix, the skin color category corresponding to each portrait feature is determined, including:
[0042] Each average feature vector is calculated with at least two preset mean vectors and at least two preset covariance matrices to determine at least two category probabilities, wherein the at least two category probabilities are respectively the probabilities that the portrait feature belongs to at least two preset categories; based on the numerical relationship between the at least two category probabilities, a target category among the at least two preset categories is determined.
[0043] In the embodiment of the present application, the skin color category includes at least two preset categories, and each preset category corresponds to a corresponding preset covariance matrix and a preset mean vector. Specifically, sample images corresponding to different preset categories are collected in advance, and the feature vectors and covariance matrices of these sample images in the first color space are extracted, and determined as the preset mean vector and preset covariance matrix corresponding to the corresponding preset category.
[0044] For example, the number of preset categories is two, namely black and white. For the preset category of white, assume that its mean vector is μ white =(Y white ,Cb white ,Cr white ), where Y white is brightness, Cb white is the blue chromaticity, Cr white is the red chromaticity, and the covariance matrix is Σ white For the default category of black people, assume that its mean vector is μblack =(Y black ,Cb black ,Cr black ), where Y black is brightness, Cb black is the blue chromaticity, Cr black is the red chromaticity, and the covariance matrix is Σ black .
[0045] In the embodiment of the present application, at least two average feature vectors correspond one-to-one to at least two portrait features in the first image. Since the skin color category of each portrait feature needs to be determined one by one, each average feature vector is calculated with a preset mean vector and a preset covariance matrix corresponding to at least two preset categories, so that at least two category probabilities that each portrait feature belongs to at least two preset categories can be determined. After calculating at least two category probabilities corresponding to a portrait feature, the at least two category probabilities are numerically compared, and the preset category to which the portrait feature belongs is determined based on the numerical relationship obtained by the comparison.
[0046] Specifically, after calculating at least two category probabilities corresponding to a certain portrait feature, the maximum value of the at least two category probabilities is used as the target category of at least two preset categories, and the skin color category of the portrait feature is determined.
[0047] Exemplarily, the preset categories include a black skin color category and a white skin color category. The category probability of the black skin color category and the category probability of the white skin color category are calculated respectively by the following calculation formula (5) and calculation formula (6):
[0048]
[0049] Among them, P white (R i ) is the category probability of the white skin color category, P black (S i ) is the category probability of black skin color category, μ white is the preset mean vector for the Caucasian skin color category, μ nlack is the preset mean vector of the black skin color category, ∑ white is the preset covariance matrix for the Caucasian skin color category, ∑ black is the preset covariance matrix for the black skin color category, is the average feature vector of the portrait area.
[0050] If P white (R i )>P black (R i), the face is considered to belong to the white skin color category; otherwise, it is considered to belong to the black skin color category.
[0051] It should be noted that the relevant image parameters of the portrait area can be further recorded to assist in the determination of the skin color category, for example: recording the brightness mean, chromaticity mean and contrast of the portrait area. The expression (7) of contrast is as follows:
[0052]
[0053] Among them, Contrast i For the contrast of the portrait area, is the average brightness, is the average blue chromaticity, is the average red chromaticity, N is the number of portrait areas, Cb(x,y) is the blue chromaticity of the pixel, Cr(x,y) is the red chromaticity of the pixel, and Y(x,y) is the brightness of the pixel.
[0054] In an embodiment of the present application, the preset mean vector and the preset covariance matrix corresponding to the preset categories are stored. In the process of the electronic device determining the target category corresponding to each portrait feature, the average feature vector of each portrait area is respectively calculated with the preset mean vector and the preset covariance matrix of at least two preset categories. This can determine at least two category probabilities that each portrait feature corresponds to at least two preset categories, and determine the target category based on the numerical relationship between the at least two category probabilities, thereby further improving the accuracy of determining the skin color category of each portrait feature.
[0055] In some embodiments of the present application, obtaining the average feature vector of at least two portrait areas in the first color space includes: when the first image is an image represented in the second color space, performing Gaussian filtering on the first image to obtain a second image; performing color space conversion on the second image to obtain a third image, wherein the third image is an image represented in the first color space; and extracting the average feature vector of at least two portrait areas in the first color space from the third image.
[0056] In an embodiment of the present application, after the first image is captured, the first image needs to be preprocessed. Since the first image is an image represented by a second color space, and the second color space is an RGB (red, green, and blue) color space, the first image is firstly subjected to Gaussian filtering, thereby denoising the first image, and the denoised image is the second image.
[0057] Specifically, the expression (8) for performing Gaussian filtering on the first image is as follows:
[0058]
[0059] Among them, I filtered (x, y) is the second image after filtering, u and v are the image coordinates of the second image, x and y are the image coordinates of the first image, exp() is the natural exponential calculation, and σ is the standard deviation of the Gaussian filter.
[0060] In the embodiment of the present application, after obtaining the second image after Gaussian filtering, since the image noise in the second image is less, the second image can be converted from the second color space to the first color space, that is, the second image is converted from the RGB color space to the YCbCr color space, thereby obtaining a third image in the YCbCr color space. Since the image information in the third image is consistent with that in the first image, the average feature vector of the portrait area in the first color space can be extracted in the third image.
[0061] Specifically, the conversion formulas (9), (10) and (11) for converting the second image from the RGB color space to the YCbCr color space are as follows:
[0062] Y=0.299R+0.587G+0.113B; (9)
[0063] Cb=-0.1687R-0.3313G+0.5B+128; (10)
[0064] Cr=0.5R-0.4187G-0.0813B+128; (11)
[0065] Among them, R is the red component of the RGB color space, G is the green component of the RGB color space, B is the blue component of the RGB color space, Y is the brightness component of the YCbCr color space, Cb is the blue chromaticity component of the YCbCr color space, and Cr is the red chromaticity component of the YCbCr color space.
[0066] In an embodiment of the present application, a corresponding third image is obtained by performing color space conversion processing on the denoised second image. Since the image information in the third image is consistent with that in the first image, the average feature vector of the portrait area in the first color space can be extracted in the third image.
[0067] Specifically, the average feature vector of each portrait region can be calculated by using the above calculation formula (1), calculation formula (2), calculation formula (3) and calculation formula (4).
[0068] In an embodiment of the present application, by sequentially performing Gaussian filtering and color space conversion processing on the acquired first image, a third image represented by the first color space can be obtained, and the average feature vector of the portrait area in the first color space can be determined in the third image, thereby ensuring the accuracy of determining the average feature vector of each portrait feature in the first color space.
[0069] In some embodiments of the present application, the brightness of at least two portrait areas is adjusted respectively according to the skin color category and the first brightness value of the first image, including: obtaining the light and dark state of each portrait area; determining the brightness adjustment coefficient according to the light and dark state and skin color category corresponding to each portrait area; adjusting the brightness of the corresponding portrait area according to the first brightness value, the second brightness value, the third brightness value and the brightness adjustment coefficient, wherein the second brightness value is the average brightness value corresponding to the portrait area, and the third brightness value is the brightness of each pixel in the portrait area.
[0070] In the embodiment of the present application, in the process of adjusting the brightness of at least two portrait areas, the brightness of each portrait area is adjusted one by one. When adjusting the brightness of a certain portrait area, it is necessary to obtain the light and dark state of the portrait area, which can reflect whether the portrait area needs to be brightened or dimmed. After determining the light and dark state of the portrait area, it is necessary to determine a corresponding brightness adjustment coefficient based on the skin color category and light and dark state of the portrait feature displayed in the portrait area, and the brightness adjustment coefficient can brighten or dim the current portrait area.
[0071] Specifically, when adjusting the brightness of the portrait area, it is necessary to adjust the brightness of each pixel in the portrait area separately. The first brightness value is the average brightness value of the first image, the second brightness value is the average brightness value of the portrait area, and the third brightness value is the brightness of each pixel in the portrait area, that is, the brightness of the pixel before adjustment. The brightness of each pixel in the portrait area is adjusted by the following calculation formula (12):
[0072]
[0073] Among them, Y ixyadjusted is the brightness value of each pixel in the portrait area after adjustment, Y ixy is the third brightness value, that is, the brightness value of each pixel in the portrait area before adjustment, α is the brightness adjustment coefficient, is the first brightness value, that is, the average brightness value of the first image, is the second brightness value, that is, the average brightness value of the portrait area.
[0074] In an embodiment of the present application, a brightness adjustment coefficient for adjusting the brightness of each pixel in the portrait area is determined based on the current light and dark state of the portrait area and the skin color category corresponding to the portrait area. That is, the corresponding brightness adjustment coefficient is set based on the different light and dark states and skin color categories corresponding to each portrait area, so that the brightness of the pixels in each portrait area is adjusted separately, further avoiding the problem of overexposure or underexposure of the portrait skin due to a single portrait object, and improving the shooting effect of portrait group photos.
[0075] In some embodiments of the present application, a brightness adjustment coefficient is determined according to the light and dark state and skin color category corresponding to each portrait area, including: obtaining an initial adjustment coefficient and a first constant for each skin color category; determining a coefficient adjustment value according to the brightness standard deviation, the first brightness value, the first constant and the third brightness value of the first image; when the light and dark state of the portrait area is a darker state, the brightness adjustment coefficient is obtained by increasing the initial adjustment coefficient by the coefficient adjustment value; when the light and dark state of the portrait area is a brighter state, the brightness adjustment coefficient is obtained by decreasing the initial adjustment coefficient by the coefficient adjustment value; when the light and dark state of the portrait area is a moderate state, the initial adjustment coefficient is determined as the brightness adjustment coefficient.
[0076] In the embodiment of the present application, different skin color categories correspond to different initial adjustment coefficients and first constants, and the first constant is used to adjust the initial adjustment coefficient, that is, the initial adjustment coefficient is updated based on the first constant. The first constant and the initial adjustment coefficient are only related to the skin color category corresponding to the portrait feature, that is, different initial adjustment coefficients are selected according to different skin color categories, and the initial adjustment coefficient is adjusted based on the first constant matching the skin color category when the light and dark states are different.
[0077] In the embodiment of the present application, when the initial adjustment coefficient corresponding to the skin color category is adjusted based on the light and dark state, it is necessary to adjust the initial adjustment coefficient according to the first constant corresponding to the skin color category, the third brightness value of the portrait area, the first brightness value of the first image, and the brightness standard deviation of the first image. Specifically, the following calculation formula (13) is used to adjust the initial adjustment coefficient:
[0078]
[0079] Among them, α1 is the adjusted brightness adjustment coefficient, α2 is the initial adjustment coefficient, A is the first constant, is the first brightness value, that is, the average brightness value of the first image, Y ixy is the third brightness value, that is, the brightness value of each pixel in the portrait area before adjustment, and σ is the brightness standard deviation of the first image.
[0080] Exemplarily, the skin color category includes a white skin color category and a black skin color category, wherein the initial adjustment coefficient corresponding to the white skin color category is 0.2, and the first constant is 0.1, and the initial adjustment coefficient corresponding to the black skin color category is 0.5, and the first constant is 0.2. The process of adjusting the initial adjustment coefficient based on the light and dark state of the portrait area is as follows:
[0081] When the portrait area is dark, the brightness adjustment factor corresponding to the black skin color category is set to And set the brightness adjustment factor for the Caucasian skin color category to
[0082]
[0083] When the portrait area is brighter, the brightness adjustment factor corresponding to the black skin color category is set to And set the brightness adjustment factor for the Caucasian skin color category to
[0084]
[0085] When the portrait area is moderate, the initial adjustment coefficient is directly determined as the brightness adjustment coefficient, that is, the brightness adjustment coefficient of the white skin color category is 0.2, and the brightness adjustment coefficient of the black skin color category is 0.5.
[0086] In an embodiment of the present application, by setting corresponding initial adjustment coefficients and first constants for different skin color categories, when it is necessary to adjust the brightness of pixels in portrait areas of different skin color categories, the corresponding initial adjustment coefficients are updated based on the first constant corresponding to the skin color category according to the light and dark state of the portrait area to obtain the brightness adjustment coefficient of the portrait area, so that the brightness adjustment coefficient is related to the skin color category and the light and dark state of the portrait area, thereby further improving the accuracy of adjusting the brightness of each pixel in the portrait area, thereby improving the effect of multi-person group shooting.
[0087] In some embodiments of the present application, when the second brightness value is less than the target difference value, the portrait area is in a darker state, the target difference value is the difference between the first brightness value and the target standard deviation, and the target standard deviation is the product of the brightness standard deviation and the second constant;
[0088] When the second brightness value is greater than the target sum value, the portrait area is in a brighter state, and the target sum value is the sum of the first brightness value and the target standard deviation;
[0089] When the second brightness value is less than or equal to the target sum value and greater than or equal to the target difference value, the portrait area is in a moderate state.
[0090] In the embodiment of the present application, when the second brightness value of the portrait area is less than the target difference value, the light and dark state of the portrait area is determined to be a darker state. When the second brightness value is greater than the target sum value, the light and dark state of the portrait area is determined to be a brighter state. When the second brightness value is between the target difference value and the target sum value, the light and dark state of the portrait area is determined to be a moderate state. The target difference value and the target sum value are both determined based on the first brightness value, the brightness standard deviation, and the second constant, wherein the target standard deviation can be obtained by multiplying the brightness standard deviation by the second constant, the first brightness value and the target standard deviation are calculated by difference to determine the target difference value, and the first brightness value and the target standard deviation are calculated by sum to determine the target sum value.
[0091] Specifically, the expression (14) of the target difference value and the expression (15) of the target sum value are as follows:
[0092]
[0093] Wherein, L1 is the target difference value, L2 is the target sum value, σ is the brightness standard deviation of the first image, and k is the second constant.
[0094] For example, in When the light and dark state of the portrait area is determined to be darker, When the brightness of the portrait area is determined to be brighter, , determine that the light and dark state of the portrait area is moderate.
[0095] In an embodiment of the present application, a target difference value and a target sum value are determined based on the first brightness value, the brightness standard deviation and the second constant, and the second brightness is compared with the target difference value and the target sum value respectively, so as to accurately determine the light and dark state of the portrait area.
[0096] In some embodiments of the present application, after adjusting the brightness of at least two portrait areas respectively according to the skin color category and the first brightness value of the first image, the method further includes:
[0097] Brightness smoothing processing is performed on a first region and a second region of at least two portrait regions, wherein the first region and the second region are adjacent to each other in the first image.
[0098] In the embodiment of the present application, the first area and the second area are two adjacent portrait areas of at least two portrait areas. In order to ensure the brightness smoothness between the two adjacent portrait areas, after adjusting the brightness of the at least two portrait areas, the adjacent first area and the second area are brightness smoothed.
[0099] For example, the portrait area R i and R j Adjacent, the smoothed brightness mean is The expression (16) of the smoothed brightness mean is as follows:
[0100]
[0101] in, is the smoothed brightness mean, For portrait area R i The mean brightness of For portrait area R j The average brightness of .
[0102] The image processing method provided in the embodiment of the present application can be executed by an image processing device. In the embodiment of the present application, an image processing device executing the image processing method is taken as an example to illustrate the image processing method provided in the embodiment of the present application.
[0103] In some embodiments of the present application, an image processing device is provided, which is applied to an electronic device. Figure 3 A schematic block diagram of an image processing device provided in some embodiments of the present application is shown. Figure 3 As shown, the image processing device 300 includes:
[0104] An acquisition module 302 is used to acquire a first image, where the first image includes at least two portrait features;
[0105] A determination module 304, configured to determine skin color categories corresponding to at least two portrait features;
[0106] The adjustment module 306 is used to adjust the brightness of at least two portrait areas respectively according to the skin color category and the first brightness value of the first image, wherein the at least two portrait areas are areas where at least two portrait features are located, and the first brightness value is the average brightness value of the first image.
[0107] In an embodiment of the present application, when the first image obtained by capture includes at least two portrait features, the skin color categories corresponding to the at least two portrait features are classified, and the brightness of the corresponding portrait areas are adjusted based on the skin color categories corresponding to the at least two portrait features obtained by the classification, so that the adjusted image can take into account the exposure requirements of portrait features with different skin colors or whiter or darker skin colors under the same skin color, thereby avoiding the problem of overexposure or underexposure and darkening of the skin of some portrait features in group photos due to single focus, and providing personalized brightness adjustment for different portrait features, thereby improving the shooting quality and shooting effect when taking group photos of multiple people.
[0108] In some embodiments of the present application, the acquisition module 302 is further used to obtain average feature vectors of at least two portrait regions in the first color space;
[0109] The determination module 304 is further configured to determine the skin color category corresponding to each portrait feature according to the average feature vector, the preset mean vector and the preset covariance matrix.
[0110] In an embodiment of the present application, when classifying the skin color categories of at least two portrait features, the average feature vector of the first image in the first color space is obtained, and based on the preset mean vector and the preset covariance matrix corresponding to the preset skin color category, it is possible to accurately judge whether the at least two portrait features belong to the preset skin color category, thereby improving the accuracy of the electronic device in identifying the skin color categories of the at least two portrait features after extracting the at least two portrait features.
[0111] In some embodiments of the present application, the skin color category includes at least two preset categories, the number of preset mean vectors and the number of preset covariance matrices match the number of preset categories, and the at least two preset mean vectors, the at least two preset covariance matrices, and the at least two preset categories correspond one to one;
[0112] A determination module 304 is used to calculate each average feature vector with at least two preset mean vectors and at least two preset covariance matrices to determine at least two category probabilities, wherein the at least two category probabilities are probabilities that the portrait feature belongs to at least two preset categories;
[0113] The determination module 304 is configured to determine a target category from among at least two preset categories according to a numerical relationship between the probabilities of at least two categories.
[0114] In an embodiment of the present application, the preset mean vector and the preset covariance matrix corresponding to the preset categories are stored. In the process of the electronic device determining the target category corresponding to each portrait feature, the average feature vector of each portrait area is respectively calculated with the preset mean vector and the preset covariance matrix of at least two preset categories. This can determine at least two category probabilities that each portrait feature corresponds to at least two preset categories, and determine the target category based on the numerical relationship between the at least two category probabilities, thereby further improving the accuracy of determining the skin color category of each portrait feature.
[0115] In some embodiments of the present application, the image processing device 300 further includes:
[0116] A processing module, configured to perform Gaussian filtering on the first image to obtain a second image when the first image is an image represented in a second color space;
[0117] The processing module is further used to perform color space conversion processing on the second image to obtain a third image, wherein the third image is an image represented by the first color space;
[0118] The extraction module is used to extract the average feature vector of at least two portrait regions in the first color space from the third image.
[0119] In an embodiment of the present application, by sequentially performing Gaussian filtering and color space conversion processing on the acquired first image, a third image represented by the first color space can be obtained, and the average feature vector of the portrait area in the first color space can be determined in the third image, thereby ensuring the accuracy of determining the average feature vector of each portrait feature in the first color space.
[0120] In some embodiments of the present application, the acquisition module 302 is further used to acquire the light and dark state of each portrait area;
[0121] The determination module 304 is further used to determine a brightness adjustment coefficient according to the light and dark state and skin color category corresponding to each portrait area;
[0122] The adjustment module 306 is also used to adjust the brightness of the corresponding portrait area according to the first brightness value, the second brightness value, the third brightness value and the brightness adjustment coefficient, wherein the second brightness value is the average brightness value corresponding to the portrait area, and the third brightness value is the brightness of each pixel in the portrait area.
[0123] In an embodiment of the present application, a brightness adjustment coefficient for adjusting the brightness of each pixel in the portrait area is determined based on the current light and dark state of the portrait area and the skin color category corresponding to the portrait area. That is, the corresponding brightness adjustment coefficient is set based on the different light and dark states and skin color categories corresponding to each portrait area, so that the brightness of the pixels in each portrait area is adjusted separately, further avoiding the problem of overexposure or underexposure of the portrait skin due to a single portrait object, and improving the shooting effect of portrait group photos.
[0124] In some embodiments of the present application, the acquisition module 302 is further used to acquire an initial adjustment coefficient and a first constant for each skin color category;
[0125] The determination module 304 is further used to determine the coefficient adjustment value according to the brightness standard deviation of the first image, the first brightness value, the first constant and the third brightness value;
[0126] The adjustment module 306 is further configured to, when the light and dark state of the portrait area is a relatively dark state, increase the initial adjustment coefficient by the coefficient adjustment value to obtain a brightness adjustment coefficient;
[0127] The adjustment module 306 is further configured to adjust the initial adjustment coefficient by using the coefficient adjustment value to obtain a brightness adjustment coefficient when the light and dark state of the portrait area is a relatively bright state;
[0128] The adjustment module 306 is further configured to determine the initial adjustment coefficient as the brightness adjustment coefficient when the light and dark state of the portrait area is in a moderate state.
[0129] In an embodiment of the present application, by setting corresponding initial adjustment coefficients and first constants for different skin color categories, when it is necessary to adjust the brightness of pixels in portrait areas of different skin color categories, the corresponding initial adjustment coefficients are updated based on the first constant corresponding to the skin color category according to the light and dark state of the portrait area to obtain the brightness adjustment coefficient of the portrait area, so that the brightness adjustment coefficient is related to the skin color category and the light and dark state of the portrait area, thereby further improving the accuracy of adjusting the brightness of each pixel in the portrait area, thereby improving the effect of multi-person group shooting.
[0130] In some embodiments of the present application, when the second brightness value is less than the target difference value, the portrait area is in a darker state, the target difference value is the difference between the first brightness value and the target standard deviation, and the target standard deviation is the product of the brightness standard deviation and the second constant;
[0131] When the second brightness value is greater than the target sum value, the portrait area is in a brighter state, and the target sum value is the sum of the first brightness value and the target standard deviation;
[0132] When the second brightness value is less than or equal to the target sum value and greater than or equal to the target difference value, the portrait area is in a moderate state.
[0133] In an embodiment of the present application, a target difference value and a target sum value are determined based on the first brightness value, the brightness standard deviation and the second constant, and the second brightness is compared with the target difference value and the target sum value respectively, so as to accurately determine the light and dark state of the portrait area.
[0134] In some embodiments of the present application, the image processing device 300 further includes:
[0135] The processing module is used to perform brightness smoothing processing on a first area and a second area of at least two portrait areas, wherein the first area and the second area are adjacent to each other in the first image.
[0136] In the embodiment of the present application, the first area and the second area are two adjacent portrait areas of at least two portrait areas. In order to ensure the brightness smoothness between the two adjacent portrait areas, after adjusting the brightness of the at least two portrait areas, the adjacent first area and the second area are brightness smoothed.
[0137] The image processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0138] The image processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0139] The image processing device provided in the embodiment of the present application can implement each process implemented in the above-mentioned image processing method embodiment, and will not be described again here to avoid repetition.
[0140] Optionally, an embodiment of the present application further provides an electronic device, which includes an image processing device as in any of the above embodiments, and thus has all the beneficial effects of the image processing method in any of the embodiments, which will not be elaborated herein.
[0141] Optionally, an embodiment of the present application further provides an electronic device, Figure 4 A structural block diagram of an electronic device according to an embodiment of the present application is shown. Figure 4 As shown, the electronic device 400 includes a processor 402, a memory 404, and a program or instruction stored in the memory 404 and executable on the processor 402. When the program or instruction is executed by the processor 402, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0142] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0143] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0144] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509 and a processor 510.
[0145] Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 510 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0146] The processor 510 is used to obtain a first image, where the first image includes at least two portrait features;
[0147] Processor 510, used to determine skin color categories corresponding to at least two portrait features respectively;
[0148] Processor 510 is used to adjust the brightness of at least two portrait areas respectively according to the skin color category and the first brightness value of the first image, wherein the at least two portrait areas are areas where at least two portrait features are located, and the first brightness value is the average brightness value of the first image.
[0149] In an embodiment of the present application, when the first image obtained by capture includes at least two portrait features, the skin color categories corresponding to the at least two portrait features are classified, and the brightness of the corresponding portrait areas are adjusted based on the skin color categories corresponding to the at least two portrait features obtained by the classification, so that the adjusted image can take into account the exposure requirements of portrait features with different skin colors or whiter or darker skin colors under the same skin color, thereby avoiding the problem of overexposure or underexposure and darkening of the skin of some portrait features in group photos due to single focus, and providing personalized brightness adjustment for different portrait features, thereby improving the shooting quality and shooting effect when taking group photos of multiple people.
[0150] Further, the processor 510 is used to obtain an average feature vector of at least two portrait regions in the first color space;
[0151] The processor 510 is used to determine the skin color category corresponding to each portrait feature according to the average feature vector, the preset mean vector and the preset covariance matrix.
[0152] In an embodiment of the present application, when classifying the skin color categories of at least two portrait features, the average feature vector of the first image in the first color space is obtained, and based on the preset mean vector and the preset covariance matrix corresponding to the preset skin color category, it is possible to accurately judge whether the at least two portrait features belong to the preset skin color category, thereby improving the accuracy of the electronic device in identifying the skin color categories of the at least two portrait features after extracting the at least two portrait features.
[0153] Further, the skin color category includes at least two preset categories, the number of preset mean vectors and the number of preset covariance matrices match the number of preset categories, and the at least two preset mean vectors, the at least two preset covariance matrices, and the at least two preset categories correspond one to one;
[0154] Processor 510, used to calculate each average feature vector with at least two preset mean vectors and at least two preset covariance matrices to determine at least two category probabilities, wherein the at least two category probabilities are probabilities that the portrait feature belongs to at least two preset categories;
[0155] The processor 510 is configured to determine a target category from among at least two preset categories according to a numerical relationship between the probabilities of the at least two categories.
[0156] In an embodiment of the present application, the preset mean vector and the preset covariance matrix corresponding to the preset categories are stored. In the process of the electronic device determining the target category corresponding to each portrait feature, the average feature vector of each portrait area is respectively calculated with the preset mean vector and the preset covariance matrix of at least two preset categories. This can determine at least two category probabilities that each portrait feature corresponds to at least two preset categories, and determine the target category based on the numerical relationship between the at least two category probabilities, thereby further improving the accuracy of determining the skin color category of each portrait feature.
[0157] Further, the processor 510 is configured to, when the first image is an image represented in the second color space, perform Gaussian filtering on the first image to obtain a second image;
[0158] The processor 510 is configured to perform color space conversion processing on the second image to obtain a third image, wherein the third image is an image represented by the first color space;
[0159] The processor 510 is configured to extract an average feature vector of at least two portrait regions in the first color space from the third image.
[0160] In an embodiment of the present application, by sequentially performing Gaussian filtering and color space conversion processing on the acquired first image, a third image represented by the first color space can be obtained, and the average feature vector of the portrait area in the first color space can be determined in the third image, thereby ensuring the accuracy of determining the average feature vector of each portrait feature in the first color space.
[0161] Further, the processor 510 is used to obtain the light and dark state of each portrait area;
[0162] Processor 510, for determining a brightness adjustment coefficient according to a light and dark state and a skin color category corresponding to each portrait area;
[0163] Processor 510 is used to adjust the brightness of the corresponding portrait area according to the first brightness value, the second brightness value, the third brightness value and the brightness adjustment coefficient, wherein the second brightness value is the average brightness value corresponding to the portrait area, and the third brightness value is the brightness of each pixel in the portrait area.
[0164] In an embodiment of the present application, a brightness adjustment coefficient for adjusting the brightness of each pixel in the portrait area is determined based on the current light and dark state of the portrait area and the skin color category corresponding to the portrait area. That is, the corresponding brightness adjustment coefficient is set based on the different light and dark states and skin color categories corresponding to each portrait area, so that the brightness of the pixels in each portrait area is adjusted separately, further avoiding the problem of overexposure or underexposure of the portrait skin due to a single portrait object, and improving the shooting effect of portrait group photos.
[0165] Further, the processor 510 is used to obtain an initial adjustment coefficient and a first constant for each skin color category;
[0166] The processor 510 is used to determine a coefficient adjustment value according to a brightness standard deviation of the first image, a first brightness value, a first constant, and a third brightness value;
[0167] The processor 510 is used to increase the initial adjustment coefficient by the coefficient adjustment value to obtain a brightness adjustment coefficient when the brightness state of the portrait area is in a relatively dark state;
[0168] The processor 510 is used to adjust the initial adjustment coefficient by the coefficient adjustment value to obtain a brightness adjustment coefficient when the light and dark state of the portrait area is a relatively bright state;
[0169] The processor 510 is configured to determine the initial adjustment coefficient as the brightness adjustment coefficient when the light and dark state of the portrait area is in a moderate state.
[0170] In an embodiment of the present application, by setting corresponding initial adjustment coefficients and first constants for different skin color categories, when it is necessary to adjust the brightness of pixels in portrait areas of different skin color categories, the corresponding initial adjustment coefficients are updated based on the first constant corresponding to the skin color category according to the light and dark state of the portrait area to obtain the brightness adjustment coefficient of the portrait area, so that the brightness adjustment coefficient is related to the skin color category and the light and dark state of the portrait area, thereby further improving the accuracy of adjusting the brightness of each pixel in the portrait area, thereby improving the effect of multi-person group shooting.
[0171] Further, when the second brightness value is less than the target difference value, the portrait area is in a darker state, the target difference value is the difference between the first brightness value and the target standard deviation, and the target standard deviation is the product of the brightness standard deviation and the second constant;
[0172] When the second brightness value is greater than the target sum value, the portrait area is in a brighter state, and the target sum value is the sum of the first brightness value and the target standard deviation;
[0173] When the second brightness value is less than or equal to the target sum value and greater than or equal to the target difference value, the portrait area is in a moderate state.
[0174] In an embodiment of the present application, a target difference value and a target sum value are determined based on the first brightness value, the brightness standard deviation and the second constant, and the second brightness is compared with the target difference value and the target sum value respectively, so as to accurately determine the light and dark state of the portrait area.
[0175] Further, the processor 510 is used to perform brightness smoothing processing on a first area and a second area of the at least two portrait areas, wherein the first area and the second area are adjacent to each other in the first image.
[0176] In the embodiment of the present application, the first area and the second area are two adjacent portrait areas of at least two portrait areas. In order to ensure the brightness smoothness between the two adjacent portrait areas, after adjusting the brightness of the at least two portrait areas, the adjacent first area and the second area are brightness smoothed.
[0177] It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of the static picture or action file obtained by the image capture device (such as a camera) in the action file capture mode or the image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes a touch panel 5071 and at least one of other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0178] The memory 509 can be used to store software programs and various data. The memory 509 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 509 may include a volatile memory or a non-volatile memory, or the memory 509 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 509 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0179] The processor 510 may include one or more processing units; optionally, the processor 510 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 510.
[0180] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0181] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0182] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0183] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0184] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned image processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0185] It should be noted that, in this article, the term "comprises", "includes" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, device, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or device. In the absence of further restrictions, an element defined by the statement "includes one..." does not exclude the presence of other identical elements in the process, device, article or device including the element. In addition, it should be noted that the scope of the devices and apparatuses in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described device may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0186] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment device can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), including a number of instructions for a terminal (which can be a mobile phone, computer, server, or network equipment, etc.) to execute the device of each embodiment of the present application.
[0187] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An image processing method, characterized in that: include: Acquire a first image, wherein the first image includes at least two portrait features; Determine skin color categories corresponding to the at least two portrait features respectively; According to the skin color category and the first brightness value of the first image, the brightness of at least two portrait areas is adjusted respectively, wherein the at least two portrait areas are areas where the at least two portrait features are located, and the first brightness value is an average brightness value of the first image.
2. The image processing method according to claim 1, characterized in that: The step of determining the skin color categories corresponding to the at least two portrait features respectively includes: Obtaining an average feature vector of the at least two portrait regions in the first color space; The skin color category corresponding to each of the portrait features is determined according to the average feature vector, the preset mean vector and the preset covariance matrix.
3. The image processing method according to claim 2, characterized in that: The skin color category includes at least two preset categories, the number of the preset mean vectors and the number of the preset covariance matrices match the number of the preset categories, and the at least two preset mean vectors, the at least two preset covariance matrices, and the at least two preset categories correspond one to one; The step of determining the skin color category corresponding to each portrait feature according to the average feature vector, the preset mean vector and the preset covariance matrix includes: Calculate each of the average feature vectors with the at least two preset mean vectors and the at least two preset covariance matrices to determine at least two category probabilities, wherein the at least two category probabilities are respectively probabilities that the portrait feature belongs to the at least two preset categories; According to the numerical relationship between the at least two category probabilities, a target category among the at least two preset categories is determined.
4. The image processing method according to claim 2, characterized in that: The obtaining the average feature vector of the at least two portrait regions in the first color space includes: When the first image is an image represented in a second color space, performing Gaussian filtering on the first image to obtain a second image; Performing color space conversion processing on the second image to obtain a third image, wherein the third image is an image represented by the first color space; The average feature vector of the at least two portrait regions in the first color space is extracted from the third image.
5. The image processing method according to any one of claims 1 to 4, characterized in that: The step of adjusting the brightness of at least two portrait areas respectively according to the skin color category and the first brightness value of the first image includes: Obtaining the light and dark state of each portrait area; Determining a brightness adjustment coefficient according to the light and dark state and the skin color category corresponding to each portrait area; The brightness of the corresponding portrait area is adjusted according to the first brightness value, the second brightness value, the third brightness value and the brightness adjustment coefficient, wherein the second brightness value is the average brightness value corresponding to the portrait area, and the third brightness value is the brightness of each pixel in the portrait area.
6. An image processing device, characterized in that: include: An acquisition module, configured to acquire a first image, wherein the first image includes at least two portrait features; A determination module, used to determine the skin color categories corresponding to the at least two portrait features respectively; An adjustment module is used to adjust the brightness of at least two portrait areas respectively according to the skin color category and the first brightness value of the first image, wherein the at least two portrait areas are areas where the at least two portrait features are located, and the first brightness value is an average brightness value of the first image.
7. The image processing device according to claim 6, characterized in that: The acquisition module is further used to acquire the average feature vector of the at least two portrait regions in the first color space; The determination module is further used to determine the skin color category corresponding to each portrait feature according to the average feature vector, the preset mean vector and the preset covariance matrix.
8. The image processing device according to claim 7, characterized in that: The skin color category includes at least two preset categories, the number of the preset mean vectors and the number of the preset covariance matrices match the number of the preset categories, and the at least two preset mean vectors, the at least two preset covariance matrices, and the at least two preset categories correspond one to one; The determination module is used to calculate each of the average feature vectors with the at least two preset mean vectors and the at least two preset covariance matrices to determine at least two category probabilities, wherein the at least two category probabilities are respectively probabilities that the portrait feature belongs to the at least two preset categories; The determination module is used to determine the target category among the at least two preset categories according to the numerical relationship between the at least two category probabilities.
9. The image processing device according to claim 7, characterized in that: Also includes: a processing module, configured to, when the first image is an image represented in a second color space, perform Gaussian filtering on the first image to obtain a second image; The processing module is further used to perform color space conversion processing on the second image to obtain a third image, wherein the third image is an image represented by the first color space; An extraction module is used to extract the average feature vector of the at least two portrait regions in the first color space from the third image.
10. The image processing device according to any one of claims 6 to 9, characterized in that: The acquisition module is further used to acquire the light and dark state of each portrait area; The determination module is further used to determine a brightness adjustment coefficient according to the light and dark state and the skin color category corresponding to each portrait area; The adjustment module is also used to adjust the brightness of the corresponding portrait area according to the first brightness value, the second brightness value, the third brightness value and the brightness adjustment coefficient, wherein the second brightness value is the average brightness value corresponding to the portrait area, and the third brightness value is the brightness of each pixel in the portrait area.
Citation Information
Patent Citations
Photo taking method and mobile terminal
CN108366194A
Human face skin color recognition method and device, and intelligent terminal
CN108701217A
Exposure compensation method, device and computer readable storage medium
CN111567034A
Face image exposure method and device, electronic equipment and storage medium
CN113379650A
Image processing method and device, equipment and storage medium
CN114742716A