WO2022016326A1 - Image processing method, electronic device, and computer-readable medium - Google Patents

Image processing method, electronic device, and computer-readable medium Download PDF

Info

Publication number
WO2022016326A1
WO2022016326A1 PCT/CN2020/103061 CN2020103061W WO2022016326A1 WO 2022016326 A1 WO2022016326 A1 WO 2022016326A1 CN 2020103061 W CN2020103061 W CN 2020103061W WO 2022016326 A1 WO2022016326 A1 WO 2022016326A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
pixel
frequency
frequency image
pixel value
Prior art date
Application number
PCT/CN2020/103061
Other languages
French (fr)
Chinese (zh)
Inventor
丁蕾
李静
徐斌
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/103061 priority Critical patent/WO2022016326A1/en
Publication of WO2022016326A1 publication Critical patent/WO2022016326A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/10Image enhancement or restoration using non-spatial domain filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • the embodiments of the present application relate to the field of computer technologies, and in particular, to an image processing method, an electronic device, and a computer-readable medium.
  • the microdermabrasion algorithm as the basic algorithm of the beautification function, can affect the overall image quality level of the beautified image.
  • the embodiments of the present application propose an image processing method, an electronic device, and a computer-readable medium, so as to solve the problem that the facial texture information and contrast features of the face are lost in the process of beautifying and dermabrasion in the prior art, and the face after dermabrasion has no stereoscopic effect technical problem.
  • an embodiment of the present application provides an image processing method, including:
  • Image fusion is performed on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
  • an embodiment of the present application provides an electronic device, including: a processor and a memory;
  • the memory for storing program instructions
  • the processor executes the program instructions stored in the memory, and when the program instructions are executed, the processor is configured to perform the following steps:
  • Image fusion is performed on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
  • an embodiment of the present application provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the above image processing method.
  • the embodiments of the present application provide an image processing method, an electronic device, and a computer-readable medium.
  • the high-frequency texture of the image can be preserved while the high-frequency texture of the image can be preserved.
  • the facial color spots, blackheads and other defects in the original image can be eliminated, and the facial texture information and The contrast feature enhances the three-dimensionality of the face in the image.
  • FIG. 1 is a flowchart of an embodiment of an image processing method according to the present application.
  • FIG. 2 is a flowchart of another embodiment of an image processing method according to the present application.
  • Fig. 3 is the flow chart of the process of dividing the frequency of original image into high frequency image and low frequency image
  • Fig. 4 is a flow chart of the process of dividing the frequency of a medium and low frequency image into an intermediate frequency image and a low frequency image;
  • Fig. 5 is the flow chart of the process of filtering medium and low frequency images
  • FIG. 6 is a schematic structural diagram of an embodiment of an electronic device according to the present application.
  • FIG. 1 shows a flowchart of an image processing method according to the present application.
  • the image processing method can run on various electronic devices, which may include but are not limited to: servers, smart phones, tablet computers, laptop computers, in-vehicle computers, desktop computers, set-top boxes, wearable devices, and the like.
  • the flow of the image processing method includes the following steps:
  • Step 101 Perform frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image.
  • the execution body of the image processing method may first acquire the original image.
  • the original image can be captured by the above-mentioned executive body through an image acquisition device (such as a camera) installed in it, or can be pre-stored locally (such as stored in a local album), or obtained by the above-mentioned executive body from the Internet or other devices.
  • the original image can be an image to be beautified and skinned, and usually can be an image containing a face area.
  • the above-mentioned execution body may divide the original image according to three frequency bands of high, middle and low frequencies, thereby obtaining a high-frequency image, an intermediate-frequency image and a low-frequency image.
  • the high frequency information of the original image is mainly reflected in the high frequency image
  • the intermediate frequency information of the original image is mainly reflected in the intermediate frequency image
  • the low frequency information of the original image is mainly reflected in the low frequency image.
  • the main component of the image is the low-frequency information, which forms the basic gray level of the image and has little effect on the image structure.
  • the intermediate frequency information determines the basic structure of the image and forms the main edge structure of the image.
  • the high-frequency information forms the edges and details of the image, which is a further enhancement of the image content on the intermediate-frequency information.
  • places with sharp changes in brightness or grayscale, such as blackheads, face texture, etc. are usually reflected in high-frequency images.
  • Face contours, color spots, etc. are usually reflected in intermediate frequency images.
  • the gently changing part of the image usually manifested in low-frequency images.
  • the original image may be divided into a high frequency image and a medium and low frequency image first, and then the intermediate frequency image and the low frequency image may be divided by frequency division of the medium and low frequency image.
  • the original image can also be divided into low-frequency images and medium-high-frequency images first, and then the medium-high-frequency images can be divided into high-frequency images and low-frequency images.
  • the order of frequency division is not limited in this embodiment.
  • the above-mentioned execution body may perform frequency division by using various commonly used filtering operators.
  • first-order differential operators can be used, such as Roberts (Roberts) operator, Prewitt (Pruitt) operator, Sobel (Sobel) operator, etc.
  • second-order differential operators can also be used, such as Laplace (Laplace (Laplace) operator Plath) operator, Kirsh operator, etc.
  • the above method can effectively distinguish high-frequency, intermediate-frequency and low-frequency components in an image, and the filter operator used is not specifically limited in this embodiment.
  • Step 102 Perform intensity suppression on the pixels in the high-frequency image that satisfy the preset condition.
  • the above-mentioned execution subject can perform intensity suppression on the pixels in the high-frequency image that meet the preset conditions, so as to suppress high-frequency defects such as blackheads on the human face while retaining the high-frequency texture.
  • the preset conditions are used to filter out pixels that need to be suppressed in intensity, such as pixels where blackheads and other defects are located. High-frequency defects such as blackheads are often significantly higher than the pixel values of surrounding pixels, so pixels that need loudness suppression can be screened based on the pixel values of the neighborhood.
  • each pixel in the high-frequency image can be used as a target point in turn, and the intensity of the pixels that meet the preset conditions in the high-frequency image is suppressed by the following steps:
  • the first step is to determine the neighborhood of the target point.
  • the neighborhood of the target point is the area formed by the pixels in the designated area around the target point.
  • an area formed by 8 pixels that are adjacent to the target point can be taken as the area of the target point.
  • These 8 pixel points can be respectively the pixel point located at the upper left of the target point, the pixel point located directly above the target point, the pixel point located at the upper right of the target point, the pixel point located on the left side of the target point, and the pixel point located on the right side of the target point.
  • Pixel point, the pixel point at the lower left of the target point, the pixel point directly below the target point, the pixel point at the lower right of the target point may also be performed on the target point area, which is not limited to the above example.
  • the second step is to obtain the maximum pixel value and/or the minimum pixel value in the neighborhood.
  • the pixel value of the target point in response to the difference between the pixel value of the target point and the maximum pixel value being greater than the first preset value, or the difference between the minimum pixel value and the pixel value of the target point being greater than the second preset value, the pixel value of the target point Make corrections.
  • the difference between the pixel value of the target point and the maximum pixel value is greater than the first preset value, it means that the pixel value of the target point is significantly larger than the pixel values of other pixels in its neighborhood, and the target point is a high-frequency defect.
  • the pixel value of the target point can be reduced.
  • the difference between the minimum pixel value and the pixel value of the target point is greater than the second preset value, it means that the pixel value of the target point is significantly smaller than the pixel values of other pixels in its neighborhood, and the target point is a high-frequency defect.
  • the pixel value of the target point can be increased.
  • the median filter algorithm in response to the difference between the pixel value of the target point and the maximum pixel value being greater than the first preset value, or the difference between the minimum pixel value and the pixel value of the target point being greater than the second preset value Set the value, the median filter algorithm can be used to filter the pixel value of the target point to obtain the corrected pixel value of the target point.
  • the median filter method is a nonlinear smoothing technique, which sets the gray value of each pixel to the median of all pixel gray values in a certain neighborhood window of the point, so as to achieve the effect of suppressing high-frequency defects. .
  • image enhancement processing or no image enhancement processing may be performed on the high-frequency images.
  • Step 103 correcting the pixel points in the intermediate frequency image whose pixel values are outside the preset value range.
  • the intermediate frequency information determines the basic structure of the image and forms the main edge structure of the image, important features such as face contours are usually reflected in the intermediate frequency image.
  • dark spots such as stains and acne marks are usually present in the IF image, so some pixels in the IF image need to be corrected.
  • the numerical range of the pixel value can be preset. For each pixel in the intermediate frequency image, it can be detected whether the pixel value of the pixel is within a preset value range. If it is not within the preset value range, the pixel value can be corrected to be within the preset value range.
  • the foregoing preset numerical value range may have a minimum value.
  • the above-mentioned preset value range is [luma2, + ⁇ ].
  • the pixel value of the pixel in response to the pixel value of the pixel being less than the minimum value in the preset value range (ie luma2), the pixel value of the pixel can be adjusted to the minimum value (ie luma2) ). In this way, points with low brightness (such as stains, acne marks, etc.) can be removed, and the highlight area of the face can be retained.
  • the foregoing preset numerical range may have a maximum value.
  • the above preset value range is [- ⁇ , luma1].
  • the pixel value of the pixel is adjusted to the maximum value (ie luma1) . In this way, the points in other areas with obvious high brightness can be eliminated to make the face smoother.
  • the above-mentioned preset value range may have a maximum value and a minimum value at the same time.
  • the above-mentioned preset value range is [luma2, luma1].
  • the pixel value of the pixel in response to the pixel value of the pixel being less than the minimum value in the preset value range (ie luma2), the pixel value of the pixel can be adjusted to the minimum value (ie luma2) ).
  • the pixel value of the pixel point is adjusted to the maximum value (ie luma1 ). In this way, the points that make the brightness lower and the points that are obviously too bright can be eliminated, and the highlight area of the face can be retained, making the face smoother.
  • Step 104 Perform image fusion on the intensity-suppressed high-frequency image, the corrected intermediate-frequency image, and the low-frequency image to generate a target image.
  • the execution subject may perform image fusion of the intensity-suppressed high-frequency image, the corrected intermediate-frequency image, and the low-frequency image to generate the target image.
  • the fusion method here can be summation of pixel values by pixel.
  • the size of the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image is 64 ⁇ 64, which can be regarded as three 64 ⁇ 64 pixel matrices.
  • the above-mentioned execution body may sum the three pixel matrices, and obtain a new pixel matrix after the summation, and the image corresponding to the new pixel matrix is the target image.
  • the above-mentioned execution subject may continue to perform the following steps:
  • the first step is to perform skin color detection on the original image to determine the skin color confidence of the pixels in the original image.
  • the confidence of the skin color of the pixel point can be used to represent the probability that the pixel point is the skin color.
  • the foregoing executive body may determine the confidence level of the skin color of the pixels in the original image in various ways.
  • the pixel range of the skin color may be preset. If the pixel value of a certain pixel is within the pixel range, the confidence level of the skin color of the pixel can be set to a certain preset value (such as 1 and 0.9, etc.). If the pixel value of a certain pixel is outside the range of the pixel, the confidence of the skin color of the pixel may be set to another preset value (such as 0 or 0.1, etc.).
  • multiple pixel ranges may be preset, and different pixel ranges correspond to different confidence levels of skin color.
  • the above executive body may match the pixel value of each pixel in the original image with each pixel range, and detect the pixel range where each pixel value is located. For each pixel, if the pixel value of the pixel is located in a predetermined pixel range, the skin color confidence corresponding to the pixel range is used as the skin color confidence of the pixel.
  • skin color detection when performing skin color detection on the original image, skin color detection may be performed on the entire original image, or skin color detection may be performed on a local area (such as a face area) in the original image, which is not specifically limited here.
  • the skin color confidence of each pixel in the background area can be set to a small value (such as 0).
  • the manner of determining the confidence level of the skin color of the pixels in the original image is not limited to the above enumeration, and other manners may also be used, which will not be repeated here.
  • the original image and the target image are image-fused to generate the final image.
  • the pixels with high confidence in the skin color are usually located in the skin area and need to be retouched. Pixels with low confidence in skin color are usually not located in the skin area, and the original features of the area need to be preserved, and the beauty and skin resurfacing of the area should be avoided as much as possible to ensure the clarity of the non-skin area. Therefore, for a pixel with a high confidence in skin color, a larger weight can be set for the pixel value of the pixel in the target image, so as to achieve the effect of beautifying and smoothing the skin. For pixels with low confidence in skin color, a large weight can be set for the pixel value of the pixel in the original image, and the non-skin area remains clear.
  • the following steps can be performed: first, obtain the pixel value of the pixel from the target image (which can be recorded as the first pixel value), and obtain the pixel of the pixel from the original image. value (can be recorded as the second pixel value). Then, the skin color confidence of the pixel is used as the weight of the first pixel value, and the difference between the preset value (eg, 1) and the above weight is used as the weight of the second pixel value. After that, the first pixel value and the second pixel value are weighted and summed to obtain the final pixel value of the pixel. Thus, the pixel value of each pixel point is obtained. Finally, a final image is generated based on the final pixel value of each pixel.
  • the background clarity can be maintained in the case of beautifying and resurfacing the face area.
  • the method provided by the above-mentioned embodiments of the present application can suppress the blackheads and other heights on the face while retaining the high-frequency texture of the image by suppressing the intensity of the pixels that meet the preset conditions in the high-frequency image obtained after frequency division. frequent flaws.
  • By correcting the pixel points whose pixel values are outside the preset value range in the intermediate frequency image obtained after frequency division it is possible to remove the dark parts such as facial color spots while retaining the contrast information such as the contour of the face.
  • the facial color spots, blackheads and other defects in the original image can be eliminated, and the facial texture information and The contrast feature enhances the three-dimensionality of the face in the image.
  • FIG. 2 shows the flow of the image processing method according to the present application.
  • the image processing method includes the following steps:
  • Step 201 Perform frequency division processing on the original image to obtain a high frequency image and a medium and low frequency image.
  • the execution body of the image processing method may first perform filtering processing on the original image through a filtering operator to obtain a high-frequency image. Then, based on the high frequency image and the original image, the medium and low frequency image is obtained.
  • various common filtering operators can be used to filter the original image. For example, the Roberts operator, the Prewitt operator, the Sobel operator, the Laplace operator, the Kirsh operator, etc. can be used, which are not specifically limited here.
  • the process of frequency-dividing the original image into a high-frequency image and a medium-low frequency image may be performed through the following sub-steps S11 to S12:
  • a Gaussian filter operator is used to filter the original image to obtain a medium and low frequency image.
  • a Gaussian filter operator (which can be denoted as mask) can be used to filter the original image (which can be regarded as a pixel matrix, denoted as I) to obtain a filtered low-frequency image (which can be regarded as a pixel matrix, denoted as I) lf).
  • I a pixel matrix
  • the mask can be preset, for example, can be set to:
  • Sub-step S12 Determine the first pixel difference between the original image and the medium and low frequency image by pixel, and use the image formed by the first pixel difference of each pixel as the high frequency image.
  • both I and lf are pixel matrices of 64 ⁇ 64.
  • the pixel value of the pixel point in the original image and the pixel value of the pixel point in the medium and low frequency image can be different to obtain the first pixel difference value corresponding to the pixel point.
  • 64 ⁇ 64 first pixel difference values can be obtained.
  • the 64 ⁇ 64 first pixel difference values constitute a new 64 ⁇ 64 pixel matrix, and the pixel matrix can be used as a high-frequency image.
  • step 202 frequency division processing is performed on the mid-low frequency image to obtain the mid-frequency image and the low-frequency image.
  • the executing subject of the image processing method may first filter the mid-low frequency image to obtain the mid-frequency image.
  • edge-preserving filters such as bilateral filtering, guided filtering, or other directional filters may be used to filter the mid-low frequency image to obtain the mid-frequency image, and the filtering method used is not specifically limited here.
  • the low frequency image can be calculated based on the intermediate and low frequency image and the intermediate frequency image.
  • the process of dividing the frequency of the original image into a high-frequency image and a medium-low frequency image may be performed through the following sub-steps S21 to S23:
  • sub-step S21 the medium and low frequency images are filtered to obtain an intermediate frequency image (which may be denoted as mf).
  • the filtering result may be referred to as I F
  • the intermediate image can be calculated by the following equation:
  • a target coefficient (which can be recorded as Gain) is determined based on the degree of dermabrasion set by the user.
  • the value of Gain can be within a preset range (eg [1, 2]).
  • the degree of microdermabrasion set by the user is positively correlated with Gain. That is, the higher the degree of microdermabrasion set by the user, the greater the value of Gain.
  • sub-step S21 may be further specifically performed according to the following sub-steps S211 to S215:
  • sub-step S211 face detection is performed on the original image to determine the face area in the original image.
  • the above executive body may use a pre-trained face detection model to perform face detection.
  • the above face detection model can be obtained by pre-training the basic model based on the machine learning method.
  • the above basic models may include but are not limited to CNN (Convolutional Neural Network, Convolutional Neural Network), R-CNN (Regions with Convolutional Neural Network Features), DCNN (Deep Convolutional Network, Deep Convolutional Neural Network), Faster-RCNN (Faster-RCNN) -Regions with Convolutional Neural Network Features), SSD (Single Shot MultiBox Detector), etc.
  • Sub-step S212 detecting the skin type of the face region.
  • the above executive body can detect the skin type of the face region in various ways.
  • a skin type detection model for detecting skin type can be pre-trained, and the face region is input into the skin type detection model, so as to obtain the skin type.
  • the above skin type detection model can be obtained by training a machine learning method (such as a supervised learning method).
  • the sample set for training the model can include multiple face image samples. Each face image sample can have an annotation representing the skin type.
  • the above-mentioned execution subject may also detect the skin type of the face region through the following steps: first, perform face key point detection on the face region to obtain the coordinates of the face key points.
  • the key points of the face may include the key points of the outline of the facial features of the face.
  • the facial features in the face region are determined. For example, for a nose, a nose contour may be determined based on key points in the contour of the nose, and an area surrounded by the contour may be determined as a nose area. After the facial features area is determined, the face area is converted into a brightness map, and the facial features area in the brightness map is removed to obtain the remaining area.
  • Y represents the brightness value of a pixel in the brightness map
  • R, G, B represent the three-channel value of the pixel in the image of the face area
  • the skin type of the face area can be determined by the following steps:
  • the first step is to filter the remaining area to obtain the gradient of each pixel in the remaining area.
  • various filtering algorithms can be used to filter the remaining regions, such as Roberts operator, Prewitt operator, and Sobel operator.
  • the Sobel operator can be used to filter the remaining area first to obtain the horizontal gradient and vertical gradient of each pixel in the remaining area. Then, for each pixel in the remaining area, the sum of the absolute value of the horizontal gradient and the vertical gradient of the pixel is determined as the gradient of the pixel. Thus, the gradient of each pixel in the remaining area is obtained.
  • the gradient of the pixel can be denoted as gard, then:
  • the second step is to perform statistics on the gradient, and determine the skin type of the face region based on the statistical results.
  • pixels with a gradient smaller than a preset threshold may be used as flat skin pixels, and the ratio of the number of flat skin pixels to the total number of pixels in the remaining area may be determined; then, based on the ratio, the skin of the face area may be determined. quality category.
  • the sum of the gradients of each pixel point in the remaining area may be determined; and then, based on the sum of the gradients, the skin type of the face area is determined.
  • th1 and th2 are preset thresholds, and th1 is smaller than th2.
  • Sub-step S213, construct the background mask of the original image.
  • the above actor can construct the background mask of the original image in various ways.
  • the background mask here can be a weight map, such as a weight map whose weight values are in the numerical interval [0, 1]. The greater the weight, the greater the probability of belonging to the face region.
  • the original image can be first converted to a binary image.
  • the weight value of the background area is set to 0, and the weight value of the face area is set to 1.
  • a mean filter operator is used to filter the binary image to obtain a background mask.
  • mean filtering there can be a transition value at the junction of the background area and the face area, and the transition value is greater than 0 and less than 1.
  • the face contour point detection may be performed on the face region first to obtain the coordinates of the face contour point.
  • Face contour points can be detected by means of face key point detection.
  • the coordinates of the face contour points can be down-sampled to obtain the down-sampled face contour point coordinates. For example, when performing double downsampling, if the original coordinates of a face contour point in the face region are (100, 100), the downsampled coordinates are (50, 50). Afterwards, a downsampled binary image can be generated based on the downsampled face contour point coordinates.
  • the pixel value is 1 in the area surrounded by the down-sampled face contour points; the pixel value is 0 outside the area surrounded by the down-sampled face contour points.
  • the binary image is upsampled by interpolation to obtain the background mask of the original image. Through interpolation, a transition value can exist at the junction between the background area and the face area in the background mask, and the transition value is greater than 0 and less than 1.
  • the filtering strength is determined based on the skin type and the background mask.
  • a mapping table may be preset to represent the corresponding relationship between the skin type, the value of the background mask and the filtering strength. Among them, the larger the value of the background mask, the greater the filtering strength. The greater the skin quality estimation result value (that is, the worse the skin quality), the greater the filtering strength. Based on this mapping table, the filtering strength of each pixel can be viewed.
  • Sub-step S215 filter the medium and low frequency images based on the filtering strength to obtain an intermediate frequency image.
  • the filtering method can perform relatively strong filtering on the face area. Since the larger the skin quality estimation result value is, the stronger the filtering strength is, so relatively strong filtering can be performed when the skin quality is poor. In this way, different intensities of filtering can be implemented for different regions and different skin quality levels, so as to achieve the purpose of facial microdermabrasion and beauty that preserves the contour of the face and maintains the clarity of the background.
  • the filter can have the functions of edge protection and filtering strength flexibly and controllable.
  • Step 202 Perform intensity suppression on the pixels in the high-frequency image that satisfy the preset condition.
  • Step 203 correcting the pixel points in the intermediate frequency image whose pixel values are outside the preset value range.
  • Step 204 Perform image fusion on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
  • steps 202 to 204 in this embodiment reference may be made to steps 102 to 104 in the corresponding embodiment of FIG. 1 , and details are not repeated here.
  • the target coefficient Gain is used in the frequency division process, which can support the user to manually adjust the degree of skin beautification and dermabrasion, so as to flexibly meet the needs of the user.
  • the value of the background mask and the type of skin type are considered in the frequency division process, so that different areas and different skin quality levels can be filtered with different intensities, so as to preserve the face contour and maintain the background clarity of the face.
  • the present application provides an embodiment of an electronic device, which corresponds to the method embodiment shown in FIG. 6 .
  • the electronic device described in this embodiment includes: a memory 601 and a processor 602 .
  • the memory 601 is used to store program instructions; the processor 602 is used to execute the program instructions stored in the memory, and when the program instructions are executed, the processor 602 is used to perform the following steps:
  • Image fusion is performed on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
  • the performing intensity suppression on the pixels in the high-frequency image that meet the preset condition includes: sequentially taking each pixel in the high-frequency image as a target point, perform the following steps: determine the neighborhood of the target point; obtain the maximum pixel value and/or the minimum pixel value in the neighborhood; in response to the difference between the pixel value of the target point and the maximum pixel value greater than the first A preset value, or the difference between the minimum pixel value and the pixel value of the target point is greater than a second preset value, and the pixel value of the target point is corrected.
  • the modifying the pixel value of the target point includes: using a median filtering algorithm to filter the pixel value of the target point, to obtain the corrected pixel value of the target point. pixel value.
  • the modifying the pixel points in the intermediate frequency image whose pixel values are outside the preset value range includes: for each pixel point in the intermediate frequency image, responding to If the pixel value of the pixel point is smaller than the minimum value in the preset value range, the pixel value of the pixel point is adjusted to the minimum value.
  • the modifying the pixel points in the intermediate frequency image whose pixel values are outside the preset value range includes: for each pixel point in the intermediate frequency image, responding to If the pixel value of the pixel point is greater than the maximum value in the preset value range, the pixel value of the pixel point is adjusted to the maximum value.
  • the processor 602 further performs the following steps: performing skin color detection on the original image, and determining the skin color confidence of the pixels in the original image; The confidence level of the skin color of the pixels in the image, and the original image and the target image are image-fused to generate the final image.
  • performing image fusion on the original image and the target image based on the skin color confidence of the pixels in the original image to generate a final image including: for For each pixel, the first pixel value of the pixel is obtained from the target image, and the second pixel value of the pixel is obtained from the original image; the skin color confidence of the pixel is taken as the first pixel value.
  • the weight of a pixel value, the difference between the preset value and the weight is used as the weight of the second pixel value; the weighted summation is performed on the first pixel value and the second pixel value to obtain the pixel point
  • the final pixel value of based on the final pixel value of each pixel, the final image is generated.
  • performing frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image includes: performing frequency division processing on the original image to obtain a high-frequency image and middle and low frequency images; frequency division processing is performed on the middle and low frequency images to obtain an intermediate frequency image and a low frequency image.
  • performing frequency division processing on the original image to obtain a high-frequency image and a medium-low frequency image includes: filtering the original image with a Gaussian filter operator to obtain a medium-frequency image.
  • Low-frequency image determine the first pixel difference between the original image and the medium-low-frequency image by pixel, and use the image formed by the first pixel difference of each pixel as the high-frequency image.
  • the performing frequency division processing on the medium and low frequency images to obtain an intermediate frequency image and a low frequency image includes: filtering the medium and low frequency images to obtain an intermediate frequency image; Determine the target coefficient according to the set degree of microdermabrasion; determine the second pixel difference between the mid-low frequency image and the mid-frequency image multiplied by the target coefficient according to the pixel point, and determine the second pixel difference value of each pixel by the second pixel difference.
  • the constructed image is regarded as a low frequency image.
  • the filtering the mid-low frequency image to obtain the mid-frequency image includes: performing face detection on the original image, and determining a face region in the original image ; Detect the skin quality category of the face area; construct the background mask of the original image, and the background mask is a weight map; Based on the skin quality category and the background mask, determine the filtering strength; The intermediate and low frequency images are filtered by the filtering strength to obtain an intermediate frequency image.
  • the detecting the skin type of the face region includes: performing face key point detection on the face region to obtain the coordinates of the face key points; based on The coordinates of the key points of the face determine the facial features area in the facial area; convert the facial area into a luminance map, remove the facial features area in the luminance graph, and obtain the remaining area; based on the The remaining area in the luminance map determines the skin type of the face area.
  • the determining the skin type of the face region based on the remaining region in the luminance map includes: filtering the remaining region to obtain the The gradient of each pixel in the remaining area is calculated; the gradient is counted, and the skin type of the face area is determined based on the statistical result.
  • the filtering the remaining area to obtain the gradient of each pixel in the remaining area includes: using a Sobel operator to filter the remaining area , to obtain the horizontal gradient and vertical gradient of each pixel in the remaining area; for each pixel in the remaining area, the sum of the absolute value of the horizontal gradient and the vertical gradient of the pixel is determined as the pixel. gradient.
  • the performing statistics on the gradients and determining the skin quality category of the face region based on the statistical results includes: using pixels with gradients smaller than a preset threshold as flat skins quality pixels, determine the ratio of the number of flat skin quality pixels to the total number of pixels in the remaining area; based on the ratio, determine the skin quality category of the face area.
  • the performing statistics on the gradients, and determining the skin type of the face region based on the statistical results includes: determining a difference between the gradients of the pixels in the remaining region. and; based on the sum of the gradients, determine the skin type of the face region.
  • the constructing the background mask of the original image includes: converting the original image into a binary image; Filter processing to get the background mask.
  • the constructing the background mask of the original image includes: performing face contour point detection on the face region to obtain the coordinates of the face contour points; The coordinates of the face contour points are down-sampled to obtain the down-sampled face contour point coordinates; based on the down-sampled face contour point coordinates, a down-sampled binary image is generated; The binary image is upsampled to obtain the background mask of the original image.
  • the electronic device provided by the above-mentioned embodiments of the present application can suppress the blackheads on the face while retaining the high-frequency texture of the image by suppressing the intensity of the pixels satisfying the preset conditions in the high-frequency image obtained after frequency division. High frequency imperfections. By correcting the pixel points whose pixel values are outside the preset value range in the intermediate frequency image obtained after frequency division, it is possible to remove the dark parts such as facial color spots while retaining the contrast information such as the contour of the face.
  • the facial color spots, blackheads and other defects in the original image can be eliminated, and the facial texture information and The contrast feature enhances the three-dimensionality of the face in the image.
  • Embodiments of the present application further provide a computer-readable medium, where a computer program is stored on the computer-readable medium.
  • a computer program is stored on the computer-readable medium.
  • the embodiments of the present application may be provided as a method, an apparatus, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-readable media having computer-usable program code embodied therein, including but not limited to disk storage, CD-ROM, optical storage, and the like.
  • These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal equipment to operate in a particular manner, such that the instructions stored in the computer readable memory result in an article of manufacture comprising instruction means, the The instruction means implement the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

An image processing method, an electronic device, and a computer-readable medium. An embodiment of the image processing method comprises: performing frequency-division processing on an original image to obtain a high-frequency image, an intermediate-frequency image, and a low-frequency image; performing intensity suppression on pixels in the high-frequency image that meet a preset condition; correcting pixels in the intermediate-frequency image of which the pixels values are outside a preset numerical range; and performing image fusion on the high-frequency image subjected to the intensity suppression, the corrected intermediate-frequency image, and the low-frequency image to generate a target image. Thus, defects such as facial spots and blackheads in an image can be eliminated, and facial texture information and contrast features can be retained, thereby improving the stereoscopic impression of the face in the image.

Description

图像处理方法、电子设备和计算机可读介质Image processing method, electronic device and computer readable medium 技术领域technical field
本申请实施例涉及计算机技术领域,具体涉及图像处理方法、电子设备和计算机可读介质。The embodiments of the present application relate to the field of computer technologies, and in particular, to an image processing method, an electronic device, and a computer-readable medium.
背景技术Background technique
随着智能终端的普及,人脸美颜磨皮功能得到越来越多的应用。用户通常会对图像进行美颜,以使图像中呈现的人脸皮肤更为光滑。磨皮算法作为美颜功能的基础算法,能够影响美颜后图像的整体画质水平。With the popularization of smart terminals, the facial beauty and skin resurfacing function has been applied more and more. Users typically perform beautification of images to smoothen the skin of the faces presented in the images. The microdermabrasion algorithm, as the basic algorithm of the beautification function, can affect the overall image quality level of the beautified image.
现有技术中,通常使用一些简单的滤波算子对图像进行低频滤波处理,以达到人脸磨皮美颜的图像效果,然而,这种方法在剔除人脸色斑等瑕疵的同时,也损失了人脸纹理信息和对比度特征,导致磨皮后的人脸没有立体感。In the prior art, some simple filtering operators are usually used to perform low-frequency filtering on the image, so as to achieve the image effect of facial microdermabrasion and beautification. The texture information and contrast features of the face are obtained, resulting in no three-dimensional sense of the face after microdermabrasion.
发明内容SUMMARY OF THE INVENTION
本申请实施例提出了图像处理方法、电子设备和计算机可读介质,以解决现有技术中美颜磨皮过程中因损失了人脸纹理信息和对比度特征导致磨皮后的人脸没有立体感技术问题。The embodiments of the present application propose an image processing method, an electronic device, and a computer-readable medium, so as to solve the problem that the facial texture information and contrast features of the face are lost in the process of beautifying and dermabrasion in the prior art, and the face after dermabrasion has no stereoscopic effect technical problem.
第一方面,本申请实施例提供了一种图像处理方法,包括:In a first aspect, an embodiment of the present application provides an image processing method, including:
对原始图像进行分频处理,得到高频图像、中频图像和低频图像;Perform frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image;
对所述高频图像中满足预设条件的像素点进行强度抑制;performing intensity suppression on the pixels that meet the preset conditions in the high-frequency image;
对所述中频图像中像素值位于预设数值范围以外的像素点进行修正;Correcting the pixels whose pixel values are outside the preset value range in the intermediate frequency image;
将强度抑制后的所述高频图像、修正后的所述中频图像和所述低频图像进行图像融合,生成目标图像。Image fusion is performed on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
第二方面,本申请实施例提供了一种电子设备,包括:处理器和存储器;In a second aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;
所述存储器,用于存储程序指令;the memory for storing program instructions;
所述处理器,执行所述存储器存储的程序指令,当程序指令被执行时,所述处理器用于执行如下步骤:The processor executes the program instructions stored in the memory, and when the program instructions are executed, the processor is configured to perform the following steps:
对原始图像进行分频处理,得到高频图像、中频图像和低频图像;Perform frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image;
对所述高频图像中满足预设条件的像素点进行强度抑制;performing intensity suppression on the pixels that meet the preset conditions in the high-frequency image;
对所述中频图像中像素值位于预设数值范围以外的像素点进行修正;Correcting the pixels whose pixel values are outside the preset value range in the intermediate frequency image;
将强度抑制后的所述高频图像、修正后的所述中频图像和所述低频图像进行图像融合,生成目标图像。Image fusion is performed on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
第三方面,本申请实施例提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理器执行时实现如上述图像处理方法。In a third aspect, an embodiment of the present application provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the above image processing method.
本申请实施例提供了图像处理方法、电子设备和计算机可读介质,通过对分频后得到的高频图像中满足预设条件的像素点进行强度抑制,能够在保留图像的高频 纹理的同时抑制人脸上的黑头等高频瑕疵。通过对分频后得到的中频图像中像素值位于预设数值范围以外的像素点进行修正,能够在保留人脸轮廓等对比度信息的同时剔除人脸色斑等暗部瑕疵。通过将强度抑制后的高频图像、修正后的中频图像和分频后得到的低频图像进行图像融合,能够消除原始图像中的人脸色斑、黑头等瑕疵,同时保留了人脸纹理信息和对比度特征,提升了图像中的人脸的立体感。The embodiments of the present application provide an image processing method, an electronic device, and a computer-readable medium. By suppressing the intensity of pixels satisfying a preset condition in a high-frequency image obtained after frequency division, the high-frequency texture of the image can be preserved while the high-frequency texture of the image can be preserved. Suppresses high frequency imperfections such as blackheads on the human face. By correcting the pixel points whose pixel values are outside the preset value range in the intermediate frequency image obtained after frequency division, it is possible to remove the dark parts such as facial color spots while retaining the contrast information such as the contour of the face. By image fusion of the high-frequency image after intensity suppression, the modified intermediate-frequency image, and the low-frequency image obtained after frequency division, the facial color spots, blackheads and other defects in the original image can be eliminated, and the facial texture information and The contrast feature enhances the three-dimensionality of the face in the image.
附图说明Description of drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
图1是根据本申请的图像处理方法的一个实施例的流程图;1 is a flowchart of an embodiment of an image processing method according to the present application;
图2是根据本申请的图像处理方法的又一个实施例的流程图;FIG. 2 is a flowchart of another embodiment of an image processing method according to the present application;
图3是将原始图像分频为高频图像和中低频图像的过程的流程图;Fig. 3 is the flow chart of the process of dividing the frequency of original image into high frequency image and low frequency image;
图4是将中低频图像分频为中频图像和低频图像的过程的流程图;Fig. 4 is a flow chart of the process of dividing the frequency of a medium and low frequency image into an intermediate frequency image and a low frequency image;
图5是对中低频图像进行滤波的过程的流程图;Fig. 5 is the flow chart of the process of filtering medium and low frequency images;
图6是根据本申请的电子设备的一个实施例的结构示意图。FIG. 6 is a schematic structural diagram of an embodiment of an electronic device according to the present application.
具体实施例specific embodiment
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
请参考图1,其示出了根据本申请的图像处理方法的流程图。图像处理方法可运行于各种电子设备,上述电子设备可以包括但不限于:服务器、智能手机、平板电脑、膝上型便携计算机、车载电脑、台式计算机、机顶盒、可穿戴设备等等。Please refer to FIG. 1 , which shows a flowchart of an image processing method according to the present application. The image processing method can run on various electronic devices, which may include but are not limited to: servers, smart phones, tablet computers, laptop computers, in-vehicle computers, desktop computers, set-top boxes, wearable devices, and the like.
该图像处理方法的流程包括以下步骤:The flow of the image processing method includes the following steps:
步骤101,对原始图像进行分频处理,得到高频图像、中频图像和低频图像。Step 101: Perform frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image.
在本实施例中,图像处理方法的执行主体(如上述电子设备)可以首先获取原始图像。原始图像可以由上述执行主体通过其所安装的图像采集装置(如摄像头)拍摄获取,也可以预先存储于本地(如存储于本地相册中),还可以由上述执行主体从互联网或其他设备中获取。原始图像可以是待进行美颜磨皮的图像,通常可以是包含人脸区域的图像。In this embodiment, the execution body of the image processing method (such as the above-mentioned electronic device) may first acquire the original image. The original image can be captured by the above-mentioned executive body through an image acquisition device (such as a camera) installed in it, or can be pre-stored locally (such as stored in a local album), or obtained by the above-mentioned executive body from the Internet or other devices. . The original image can be an image to be beautified and skinned, and usually can be an image containing a face area.
在获取到原始图像后,上述执行主体可以按照高、中、低三个频段对该原始图像进行分频,从而得到高频图像、中频图像和低频图像。原始图像的高频信息主要体现于高频图像中,原始图像的中频信息主要体现于中频图像中,原始图像的低频信息主要体现于低频图像中。After acquiring the original image, the above-mentioned execution body may divide the original image according to three frequency bands of high, middle and low frequencies, thereby obtaining a high-frequency image, an intermediate-frequency image and a low-frequency image. The high frequency information of the original image is mainly reflected in the high frequency image, the intermediate frequency information of the original image is mainly reflected in the intermediate frequency image, and the low frequency information of the original image is mainly reflected in the low frequency image.
通常,不同频率信息在图像结构中有不同的作用。图像的主要成分是低频信息, 它形成了图像的基本灰度等级,对图像结构的决定作用较小。中频信息决定了图像的基本结构,形成了图像的主要边缘结构。高频信息形成了图像的边缘和细节,是在中频信息上对图像内容的进一步强化。以人脸图像为例,亮度或灰度变化激烈的地方,如黑头、人脸纹理等,通常在高频图像中体现。人脸轮廓、色斑等,通常在中频图像中体现。图像平缓变化部分,通常在低频图像中体现。In general, different frequency information has different roles in the image structure. The main component of the image is the low-frequency information, which forms the basic gray level of the image and has little effect on the image structure. The intermediate frequency information determines the basic structure of the image and forms the main edge structure of the image. The high-frequency information forms the edges and details of the image, which is a further enhancement of the image content on the intermediate-frequency information. Taking a face image as an example, places with sharp changes in brightness or grayscale, such as blackheads, face texture, etc., are usually reflected in high-frequency images. Face contours, color spots, etc., are usually reflected in intermediate frequency images. The gently changing part of the image, usually manifested in low-frequency images.
在本实施例中,在分频时,可首先将原始图像分频为高频图像和中低频图像,而后将中低频图像分频出中频图像和低频图像。或者,也可以首先将原始图像分频为低频图像和中高频图像,而后将中高频图像分频为高频图像和低频图像。本实施例对分频的次序不作限定。In this embodiment, during frequency division, the original image may be divided into a high frequency image and a medium and low frequency image first, and then the intermediate frequency image and the low frequency image may be divided by frequency division of the medium and low frequency image. Alternatively, the original image can also be divided into low-frequency images and medium-high-frequency images first, and then the medium-high-frequency images can be divided into high-frequency images and low-frequency images. The order of frequency division is not limited in this embodiment.
在本实施例中,上述执行主体可以借助各种常用的滤波算子进行分频。例如,可使用一阶微分算子,如Roberts(罗伯茨)算子、Prewitt(普鲁伊特)算子、Sobel(索贝尔)算子等;也可使用二阶微分算子,如Laplace(拉普拉斯)算子、Kirsh算子等。利用上述方法能够有效地区分图像中的高频、中频与低频分量,本实施例对所采用的滤波算子不作具体限定。In this embodiment, the above-mentioned execution body may perform frequency division by using various commonly used filtering operators. For example, first-order differential operators can be used, such as Roberts (Roberts) operator, Prewitt (Pruitt) operator, Sobel (Sobel) operator, etc.; second-order differential operators can also be used, such as Laplace (Laplace (Laplace) operator Plath) operator, Kirsh operator, etc. The above method can effectively distinguish high-frequency, intermediate-frequency and low-frequency components in an image, and the filter operator used is not specifically limited in this embodiment.
步骤102,对高频图像中满足预设条件的像素点进行强度抑制。Step 102: Perform intensity suppression on the pixels in the high-frequency image that satisfy the preset condition.
在本实施例中,上述执行主体可以对高频图像中满足预设条件的像素点进行强度抑制,以便在保留高频纹理的同时抑制人脸上黑头等高频瑕疵。此处,预设条件用于筛选出需要进行强度抑制的像素点,如黑头等瑕疵所在的像素点。黑头等高频瑕疵往往明显高于周围像素点的像素值,因而可基于邻域的像素值来筛选出需要进行响度抑制的像素点。In this embodiment, the above-mentioned execution subject can perform intensity suppression on the pixels in the high-frequency image that meet the preset conditions, so as to suppress high-frequency defects such as blackheads on the human face while retaining the high-frequency texture. Here, the preset conditions are used to filter out pixels that need to be suppressed in intensity, such as pixels where blackheads and other defects are located. High-frequency defects such as blackheads are often significantly higher than the pixel values of surrounding pixels, so pixels that need loudness suppression can be screened based on the pixel values of the neighborhood.
在本实施例的一些可选的实现方式中,可依次将高频图像中的每一个像素点作为目标点,并通过如下步骤对高频图像中满足预设条件的像素点进行强度抑制:In some optional implementations of this embodiment, each pixel in the high-frequency image can be used as a target point in turn, and the intensity of the pixels that meet the preset conditions in the high-frequency image is suppressed by the following steps:
第一步,确定目标点的邻域。The first step is to determine the neighborhood of the target point.
此处,目标点的邻域即为目标点周围指定区域内的像素点所构成的区域。作为示例,可将紧邻目标点的8个像素点构成的区域作为目标点的领域。这8个像素点可以分别为位于目标点左上方的像素点、位于目标点正上方的像素点、位于目标点右上方的像素点、位于目标点左侧的像素点、位于目标点右侧的像素点、位于目标点左下方的像素点、位于目标点正下方的像素点、位于目标点右下方的像素点。需要说明的是,目标点的领域还可以进行其他设定,不限于上述示例。Here, the neighborhood of the target point is the area formed by the pixels in the designated area around the target point. As an example, an area formed by 8 pixels that are adjacent to the target point can be taken as the area of the target point. These 8 pixel points can be respectively the pixel point located at the upper left of the target point, the pixel point located directly above the target point, the pixel point located at the upper right of the target point, the pixel point located on the left side of the target point, and the pixel point located on the right side of the target point. Pixel point, the pixel point at the lower left of the target point, the pixel point directly below the target point, the pixel point at the lower right of the target point. It should be noted that other settings may also be performed on the target point area, which is not limited to the above example.
第二步,获取邻域内的最大像素值和/或最小像素值。The second step is to obtain the maximum pixel value and/or the minimum pixel value in the neighborhood.
第三步,响应于目标点的像素值与最大像素值之差大于第一预设值,或者,最小像素值与目标点的像素值之差大于第二预设值,对目标点的像素值进行修正。In the third step, in response to the difference between the pixel value of the target point and the maximum pixel value being greater than the first preset value, or the difference between the minimum pixel value and the pixel value of the target point being greater than the second preset value, the pixel value of the target point Make corrections.
具体地,若目标点的像素值与最大像素值之差大于第一预设值,意味着目标点的像素值明显大于其邻域内的其他像素的像素值,目标点为高频瑕疵,此时可对目标点的像素值进行减小处理。Specifically, if the difference between the pixel value of the target point and the maximum pixel value is greater than the first preset value, it means that the pixel value of the target point is significantly larger than the pixel values of other pixels in its neighborhood, and the target point is a high-frequency defect. The pixel value of the target point can be reduced.
同理,若最小像素值与目标点的像素值之差大于第二预设值,意味着目标点的像素值明显小于其邻域内的其他像素的像素值,目标点为高频瑕疵,此时可对目标 点的像素值进行增大处理。Similarly, if the difference between the minimum pixel value and the pixel value of the target point is greater than the second preset value, it means that the pixel value of the target point is significantly smaller than the pixel values of other pixels in its neighborhood, and the target point is a high-frequency defect. The pixel value of the target point can be increased.
在本实施例的一些可选的实现方式中,响应于目标点的像素值与最大像素值之差大于第一预设值,或者,最小像素值与目标点的像素值之差大于第二预设值,可以采用中值滤波算法对目标点的像素值进行滤波,得到目标点的修正后的像素值。中值滤波法是一种非线性平滑技术,它将每一像素点的灰度值设置为该点某邻域窗口内的所有像素点灰度值的中值,从而达到抑制高频瑕疵的效果。In some optional implementations of this embodiment, in response to the difference between the pixel value of the target point and the maximum pixel value being greater than the first preset value, or the difference between the minimum pixel value and the pixel value of the target point being greater than the second preset value Set the value, the median filter algorithm can be used to filter the pixel value of the target point to obtain the corrected pixel value of the target point. The median filter method is a nonlinear smoothing technique, which sets the gray value of each pixel to the median of all pixel gray values in a certain neighborhood window of the point, so as to achieve the effect of suppressing high-frequency defects. .
可选的,对高频图像可以进行图像增强处理或者不进行图像增强处理。Optionally, image enhancement processing or no image enhancement processing may be performed on the high-frequency images.
步骤103,对中频图像中像素值位于预设数值范围以外的像素点进行修正。 Step 103 , correcting the pixel points in the intermediate frequency image whose pixel values are outside the preset value range.
在本实施例中,由于中频信息决定了图像的基本结构,形成了图像的主要边缘结构,因而人脸轮廓等重要的特征通常在中频图像中体现。然而,色斑、痘印等暗部瑕疵也通常存在于中频图像中,因此需要对中频图像中的一些像素进行修正。In this embodiment, since the intermediate frequency information determines the basic structure of the image and forms the main edge structure of the image, important features such as face contours are usually reflected in the intermediate frequency image. However, dark spots such as stains and acne marks are usually present in the IF image, so some pixels in the IF image need to be corrected.
在本实施例中,针对中频图像,可预先设定像素值的数值范围。对于中频图像中的每一个像素点,可检测该像素点的像素值是否位于预设数值范围。若不位于该预设数值范围,可对该像素值进行修正,使之位于该预设数值范围内。In this embodiment, for the intermediate frequency image, the numerical range of the pixel value can be preset. For each pixel in the intermediate frequency image, it can be detected whether the pixel value of the pixel is within a preset value range. If it is not within the preset value range, the pixel value can be corrected to be within the preset value range.
在本实施例的一些可选的实现方式中,上述预设数值范围可以具有最小值。例如,上述预设数值范围为[luma2,+∞]。此时,对于中频图像中的每一个像素点,响应于该像素点的像素值小于预设数值范围中的最小值(即luma2),可以将该像素点的像素值调整为最小值(即luma2)。由此,能够剔除使亮度较低的点(如色斑、痘印等瑕疵点),保留人脸的高光区域。In some optional implementations of this embodiment, the foregoing preset numerical value range may have a minimum value. For example, the above-mentioned preset value range is [luma2, +∞]. At this time, for each pixel in the intermediate frequency image, in response to the pixel value of the pixel being less than the minimum value in the preset value range (ie luma2), the pixel value of the pixel can be adjusted to the minimum value (ie luma2) ). In this way, points with low brightness (such as stains, acne marks, etc.) can be removed, and the highlight area of the face can be retained.
在本实施例的一些可选的实现方式中,上述预设数值范围可以具有最大值。例如,上述预设数值范围为[-∞,luma1]。此时,对于中频图像中的每一个像素点,响应于该像素点的像素值大于预设数值范围中的最大值(即luma1),将该像素点的像素值调整为最大值(即luma1)。由此,可以将亮度明显高区其他区域的点进行剔除,使人脸更为平滑。In some optional implementations of this embodiment, the foregoing preset numerical range may have a maximum value. For example, the above preset value range is [-∞, luma1]. At this time, for each pixel in the intermediate frequency image, in response to the pixel value of the pixel being greater than the maximum value in the preset value range (ie luma1), the pixel value of the pixel is adjusted to the maximum value (ie luma1) . In this way, the points in other areas with obvious high brightness can be eliminated to make the face smoother.
在本实施例的一些可选的实现方式中,上述预设数值范围可以同时具有最大值和最小值。例如,上述预设数值范围为[luma2,luma1]。此时,对于中频图像中的每一个像素点,响应于该像素点的像素值小于预设数值范围中的最小值(即luma2),可以将该像素点的像素值调整为最小值(即luma2)。响应于该像素点的像素值大于预设数值范围中的最大值(即luma1),将该像素点的像素值调整为最大值(即luma1)。由此,能够剔除使亮度较低的点以及明显过亮的点,同时保留人脸的高光区域,使人脸更为平滑。In some optional implementations of this embodiment, the above-mentioned preset value range may have a maximum value and a minimum value at the same time. For example, the above-mentioned preset value range is [luma2, luma1]. At this time, for each pixel in the intermediate frequency image, in response to the pixel value of the pixel being less than the minimum value in the preset value range (ie luma2), the pixel value of the pixel can be adjusted to the minimum value (ie luma2) ). In response to the pixel value of the pixel point being greater than the maximum value in the preset value range (ie luma1 ), the pixel value of the pixel point is adjusted to the maximum value (ie luma1 ). In this way, the points that make the brightness lower and the points that are obviously too bright can be eliminated, and the highlight area of the face can be retained, making the face smoother.
步骤104,将强度抑制后的高频图像、修正后的中频图像和低频图像进行图像融合,生成目标图像。Step 104: Perform image fusion on the intensity-suppressed high-frequency image, the corrected intermediate-frequency image, and the low-frequency image to generate a target image.
在本实施例中,上述执行主体可将强度抑制后的高频图像、修正后的中频图像和低频图像进行图像融合,生成目标图像。此处的融合方式可以是按像素点进行像素值求和。In this embodiment, the execution subject may perform image fusion of the intensity-suppressed high-frequency image, the corrected intermediate-frequency image, and the low-frequency image to generate the target image. The fusion method here can be summation of pixel values by pixel.
例如,强度抑制后的高频图像、修正后的中频图像和低频图像的尺寸为64×64, 则可视为三个64×64的像素矩阵。上述执行主体可以将这三个像素矩阵求和,将求和后所得到的新的像素矩阵,新的像素矩阵对应的图即为目标图像。For example, the size of the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image is 64×64, which can be regarded as three 64×64 pixel matrices. The above-mentioned execution body may sum the three pixel matrices, and obtain a new pixel matrix after the summation, and the image corresponding to the new pixel matrix is the target image.
在本实施例的一些可选的实现方式中,在得到目标图像后,上述执行主体还可以继续执行如下步骤:In some optional implementation manners of this embodiment, after obtaining the target image, the above-mentioned execution subject may continue to perform the following steps:
第一步,对原始图像进行肤色检测,确定原始图像中的像素点的肤色置信度。The first step is to perform skin color detection on the original image to determine the skin color confidence of the pixels in the original image.
其中,像素点的肤色置信度可用于表示像素点为肤色的概率。上述执行主体可以通过多种方式确定原始图像中的像素点的肤色置信度。Among them, the confidence of the skin color of the pixel point can be used to represent the probability that the pixel point is the skin color. The foregoing executive body may determine the confidence level of the skin color of the pixels in the original image in various ways.
作为一个示例,可以预先设定肤色的像素范围。若某一像素点的像素值位于该像素范围,可将该像素点的肤色置信度设置为某一预设值(如1和0.9等)。若某一像素点的像素值位于该像素范围外,可将该像素点的肤色置信度设置为另一预设值(如0或者0.1等)。As an example, the pixel range of the skin color may be preset. If the pixel value of a certain pixel is within the pixel range, the confidence level of the skin color of the pixel can be set to a certain preset value (such as 1 and 0.9, etc.). If the pixel value of a certain pixel is outside the range of the pixel, the confidence of the skin color of the pixel may be set to another preset value (such as 0 or 0.1, etc.).
作为又一示例,可以预先设定多个像素范围,不同像素范围对应不同的肤色置信度。上述执行主体可以将原始图像中的各像素点的像素值与各个像素范围进行匹配,检测各像素值所位于的像素范围。对于每一个像素点,若该像素点的像素值位于某一预设的像素范围,则将该像素范围对应的肤色置信度作为该像素点的肤色置信度。As another example, multiple pixel ranges may be preset, and different pixel ranges correspond to different confidence levels of skin color. The above executive body may match the pixel value of each pixel in the original image with each pixel range, and detect the pixel range where each pixel value is located. For each pixel, if the pixel value of the pixel is located in a predetermined pixel range, the skin color confidence corresponding to the pixel range is used as the skin color confidence of the pixel.
需要说明的是,在对原始图像进行肤色检测时,可对原始图像整体进行肤色检测,也可以对原始图像中的局部区域(如人脸区域)进行肤色检测,此处不作具体限定。当对原始图像中的局部区域(如人脸区域)进行肤色检测时,可将背景区域中各像素点的肤色置信度设置为较小数值(如0)。It should be noted that, when performing skin color detection on the original image, skin color detection may be performed on the entire original image, or skin color detection may be performed on a local area (such as a face area) in the original image, which is not specifically limited here. When skin color detection is performed on a local area (such as a face area) in the original image, the skin color confidence of each pixel in the background area can be set to a small value (such as 0).
需要指出的是,确定原始图像中的像素点的肤色置信度的方式不限于上述列举,还可采用其他方式,这里不再一一赘述。It should be pointed out that the manner of determining the confidence level of the skin color of the pixels in the original image is not limited to the above enumeration, and other manners may also be used, which will not be repeated here.
第二步,基于原始图像中的像素点的肤色置信度,将原始图像与目标图像进行图像融合,生成最终图像。In the second step, based on the confidence of the skin color of the pixels in the original image, the original image and the target image are image-fused to generate the final image.
可以理解的是,肤色置信度较大的像素点,通常位于皮肤区域,需要进行美颜磨皮。肤色置信度较小的像素点,通常不位于皮肤区域,需要保留该区域的原始特征,尽量避免对该区域进行美颜磨皮,以保证非皮肤区域的清晰度。由此,对于肤色置信度较大的像素点,可对目标图像中该像素点的像素值设置较大的权重,以达到对皮肤进行美颜磨皮的效果。对于肤色置信度较小的像素点,可对原始图像中该像素点的像素值设置大的权重,非皮肤区域保持清晰。It is understandable that the pixels with high confidence in the skin color are usually located in the skin area and need to be retouched. Pixels with low confidence in skin color are usually not located in the skin area, and the original features of the area need to be preserved, and the beauty and skin resurfacing of the area should be avoided as much as possible to ensure the clarity of the non-skin area. Therefore, for a pixel with a high confidence in skin color, a larger weight can be set for the pixel value of the pixel in the target image, so as to achieve the effect of beautifying and smoothing the skin. For pixels with low confidence in skin color, a large weight can be set for the pixel value of the pixel in the original image, and the non-skin area remains clear.
可选的,对于每一个像素点,可按照如下步骤执行:首先,从目标图像中获取该像素点的像素值(可记为第一像素值),并从原始图像中获取该像素点的像素值(可记为第二像素值)。而后,将该像素点的肤色置信度作为第一像素值的权重,将预设数值(如1)与上述权重的差值作为第二像素值的权重。之后,对第一像素值和第二像素值进行加权求和,得到该像素点的最终像素值。由此,得到各个像素点的像素值。最后,基于各像素点的最终像素值,生成最终图像。Optionally, for each pixel, the following steps can be performed: first, obtain the pixel value of the pixel from the target image (which can be recorded as the first pixel value), and obtain the pixel of the pixel from the original image. value (can be recorded as the second pixel value). Then, the skin color confidence of the pixel is used as the weight of the first pixel value, and the difference between the preset value (eg, 1) and the above weight is used as the weight of the second pixel value. After that, the first pixel value and the second pixel value are weighted and summed to obtain the final pixel value of the pixel. Thus, the pixel value of each pixel point is obtained. Finally, a final image is generated based on the final pixel value of each pixel.
通过检测原始图像中的像素点的肤色置信度,并基于肤色置信度对将原始图像 与目标图像进行进一步融合,可在对人脸区域美颜磨皮的情况下保持背景清晰度。By detecting the skin color confidence of the pixels in the original image, and further fusing the original image with the target image based on the skin color confidence, the background clarity can be maintained in the case of beautifying and resurfacing the face area.
本申请的上述实施例提供的方法,通过对分频后得到的高频图像中满足预设条件的像素点进行强度抑制,能够在保留图像的高频纹理的同时抑制人脸上的黑头等高频瑕疵。通过对分频后得到的中频图像中像素值位于预设数值范围以外的像素点进行修正,能够在保留人脸轮廓等对比度信息的同时剔除人脸色斑等暗部瑕疵。通过将强度抑制后的高频图像、修正后的中频图像和分频后得到的低频图像进行图像融合,能够消除原始图像中的人脸色斑、黑头等瑕疵,同时保留了人脸纹理信息和对比度特征,提升了图像中的人脸的立体感。The method provided by the above-mentioned embodiments of the present application can suppress the blackheads and other heights on the face while retaining the high-frequency texture of the image by suppressing the intensity of the pixels that meet the preset conditions in the high-frequency image obtained after frequency division. frequent flaws. By correcting the pixel points whose pixel values are outside the preset value range in the intermediate frequency image obtained after frequency division, it is possible to remove the dark parts such as facial color spots while retaining the contrast information such as the contour of the face. By image fusion of the high-frequency image after intensity suppression, the modified intermediate-frequency image, and the low-frequency image obtained after frequency division, the facial color spots, blackheads and other defects in the original image can be eliminated, and the facial texture information and The contrast feature enhances the three-dimensionality of the face in the image.
进一步参考图2,其示出了根据本申请的图像处理方法的流程。该图像处理方法包括以下步骤:Further reference is made to FIG. 2 , which shows the flow of the image processing method according to the present application. The image processing method includes the following steps:
步骤201,对原始图像进行分频处理,得到高频图像和中低频图像。Step 201: Perform frequency division processing on the original image to obtain a high frequency image and a medium and low frequency image.
在本实施例中,图像处理方法的执行主体可以首先通过滤波算子对原始图像进行滤波处理,得到高频图像。而后基于高频图像和原始图像,得到中低频图像。此处,可采用各种常用的滤波算子进行原始图像的滤波。例如,可采用Roberts算子、Prewitt算子、Sobel算子、Laplace算子、Kirsh算子等,在此不作具体限定。In this embodiment, the execution body of the image processing method may first perform filtering processing on the original image through a filtering operator to obtain a high-frequency image. Then, based on the high frequency image and the original image, the medium and low frequency image is obtained. Here, various common filtering operators can be used to filter the original image. For example, the Roberts operator, the Prewitt operator, the Sobel operator, the Laplace operator, the Kirsh operator, etc. can be used, which are not specifically limited here.
在本实施例的一些可选的实现方式中,参见图3,对原始图像分频为高频图像和中低频图像的过程可通过如下子步骤S11至子步骤S12执行:In some optional implementations of this embodiment, referring to FIG. 3 , the process of frequency-dividing the original image into a high-frequency image and a medium-low frequency image may be performed through the following sub-steps S11 to S12:
子步骤S11,采用高斯滤波算子对将原始图像进行滤波,得到中低频图像。In sub-step S11, a Gaussian filter operator is used to filter the original image to obtain a medium and low frequency image.
具体地,可使用高斯滤波算子(可记为mask)对原始图像(可视为一个像素矩阵,记为I)进行滤波,得到滤波后的中低频图像(可视为一个像素矩阵,记为lf)。即:Specifically, a Gaussian filter operator (which can be denoted as mask) can be used to filter the original image (which can be regarded as a pixel matrix, denoted as I) to obtain a filtered low-frequency image (which can be regarded as a pixel matrix, denoted as I) lf). which is:
lf=I×mashlf=I×mash
其中,mask可以预先设定,例如,可设定为:Among them, the mask can be preset, for example, can be set to:
Figure PCTCN2020103061-appb-000001
Figure PCTCN2020103061-appb-000001
子步骤S12,按像素点确定原始图像与中低频图像的第一像素差值,将由各像素点的第一像素差值构成的图像作为高频图像。Sub-step S12: Determine the first pixel difference between the original image and the medium and low frequency image by pixel, and use the image formed by the first pixel difference of each pixel as the high frequency image.
具体地,以原始图像以及中低频图像中均包含64×64个像素点为例,此时I和lf均为64×64的像素矩阵。对于像素矩阵中的每一个像素点,可以将原始图像中的该像素点的像素值与中低频图像中的该像素点的像素值作差,得到该像素点对应的第一像素差值。将各个像素点执行上述操作后,即可得到64×64个第一像素差值。这64×64个第一像素差值即构成一个64×64的新的像素矩阵,该像素矩阵即可作为高频图像。此处,可将高频图像记为hf,则hf=I-lf。Specifically, taking 64×64 pixels contained in both the original image and the low-frequency image as an example, at this time, both I and lf are pixel matrices of 64×64. For each pixel point in the pixel matrix, the pixel value of the pixel point in the original image and the pixel value of the pixel point in the medium and low frequency image can be different to obtain the first pixel difference value corresponding to the pixel point. After performing the above operations on each pixel, 64×64 first pixel difference values can be obtained. The 64×64 first pixel difference values constitute a new 64×64 pixel matrix, and the pixel matrix can be used as a high-frequency image. Here, the high-frequency image can be denoted as hf, then hf=I-lf.
步骤202,对中低频图像进行分频处理,得到中频图像和低频图像。In step 202, frequency division processing is performed on the mid-low frequency image to obtain the mid-frequency image and the low-frequency image.
在本实施例中,图像处理方法的执行主体可以首先对中低频图像进行滤波,得 到中频图像。例如,可采用双边滤波、导向滤波等保边滤波器,或是其他方向滤波器对中低频图像进行滤波,得到中频图像,在此不对所采用的滤波方式作具体限定。在得到中频图像后,可基于中低频图像和中频图像,计算得到低频图像。In this embodiment, the executing subject of the image processing method may first filter the mid-low frequency image to obtain the mid-frequency image. For example, edge-preserving filters such as bilateral filtering, guided filtering, or other directional filters may be used to filter the mid-low frequency image to obtain the mid-frequency image, and the filtering method used is not specifically limited here. After the intermediate frequency image is obtained, the low frequency image can be calculated based on the intermediate and low frequency image and the intermediate frequency image.
在本实施例的一些可选的实现方式中,参见图4,对原始图像分频为高频图像和中低频图像的过程可通过如下子步骤S21至子步骤S23执行:In some optional implementations of this embodiment, referring to FIG. 4 , the process of dividing the frequency of the original image into a high-frequency image and a medium-low frequency image may be performed through the following sub-steps S21 to S23:
子步骤S21,对中低频图像进行滤波,得到中频图像(可记为mf)。In sub-step S21, the medium and low frequency images are filtered to obtain an intermediate frequency image (which may be denoted as mf).
此处,可将滤波结果记为I F,则中频图像可通过如下公式计算: Here, the filtering result may be referred to as I F, the intermediate image can be calculated by the following equation:
mf=lf-I Fmf=lf- IF .
子步骤S22,基于用户设定的磨皮程度,确定目标系数(可记为Gain)。In sub-step S22, a target coefficient (which can be recorded as Gain) is determined based on the degree of dermabrasion set by the user.
其中,Gain的值可位于预设范围(如[1,2])内。用户设置的磨皮程度与Gain可呈正相关。即,用户设置的磨皮程度越高,Gain的值越大。Wherein, the value of Gain can be within a preset range (eg [1, 2]). The degree of microdermabrasion set by the user is positively correlated with Gain. That is, the higher the degree of microdermabrasion set by the user, the greater the value of Gain.
子步骤S23,按像素点确定中低频图像与乘目标系数后的中频图像的第二像素差值,并将由各像素点的第二像素差值构成的图像作为低频图像(可记为dc)。即:dc=lf-Gain×mf。Sub-step S23: Determine the second pixel difference between the mid-low frequency image and the mid-frequency image multiplied by the target coefficient by pixel, and use the image formed by the second pixel difference of each pixel as the low-frequency image (can be denoted as dc). That is: dc=lf-Gain×mf.
通过设定与磨皮程度相关联的目标系数,可支持用户手动调节美颜磨皮程度,从而可灵活满足用户需求。By setting a target coefficient associated with the degree of microdermabrasion, users can be supported to manually adjust the degree of beautification microdermabrasion, so as to flexibly meet user needs.
在本实施例的一些可选的实现方式中,参见图5,上述子步骤S21具体可进一步按照如下子步骤S211至子步骤S215执行:In some optional implementations of this embodiment, referring to FIG. 5 , the foregoing sub-step S21 may be further specifically performed according to the following sub-steps S211 to S215:
子步骤S211,对原始图像进行人脸检测,确定原始图像中的人脸区域。In sub-step S211, face detection is performed on the original image to determine the face area in the original image.
上述执行主体可采用预先训练的人脸检测模型进行人脸检测。上述人脸检测模型可基于机器学习方法对基础模型预先训练得到。上述基础模型可以包括但不限于CNN(Convolutional Neural Network,卷积神经网络)、R-CNN(Regions with Convolutional Neural Network Features)、DCNN(Deep Convolutional Network,深度卷积神经网络)、Faster-RCNN(Faster-Regions with Convolutional Neural Network Features)、SSD(Single Shot MultiBox Deteceor)等。The above executive body may use a pre-trained face detection model to perform face detection. The above face detection model can be obtained by pre-training the basic model based on the machine learning method. The above basic models may include but are not limited to CNN (Convolutional Neural Network, Convolutional Neural Network), R-CNN (Regions with Convolutional Neural Network Features), DCNN (Deep Convolutional Network, Deep Convolutional Neural Network), Faster-RCNN (Faster-RCNN) -Regions with Convolutional Neural Network Features), SSD (Single Shot MultiBox Detector), etc.
子步骤S212,检测人脸区域的肤质类别。Sub-step S212, detecting the skin type of the face region.
上述执行主体可以通过多种方式检测人脸区域的肤质类别。例如,可以预先训练一个用于检测肤质类别的肤质类别检测模型,将该人脸区域输入至该肤质类别检测模型,从而得到肤质类别。上述肤质类别检测模型可以通过机器学习方法(如有监督学习方法)训练得到。训练该模型的样本集可以包括多个人脸图像样本。每个人脸图像样本可以带有用于表示肤质类别的标注。The above executive body can detect the skin type of the face region in various ways. For example, a skin type detection model for detecting skin type can be pre-trained, and the face region is input into the skin type detection model, so as to obtain the skin type. The above skin type detection model can be obtained by training a machine learning method (such as a supervised learning method). The sample set for training the model can include multiple face image samples. Each face image sample can have an annotation representing the skin type.
可选的,上述执行主体还可以通过如下步骤检测人脸区域的肤质类别:首先,对人脸区域进行人脸关键点检测,得到人脸关键点的坐标。其中,人脸关键点可以包括人脸五官的轮廓的关键点。而后,基于人脸关键点的坐标,确定人脸区域中的五官区域。例如,对于鼻子,可基于鼻子的轮廓中的关键点确定出鼻子轮廓,将该轮廓包围区域确定为鼻子区域。在确定出五官区域后,将人脸区域转换为亮度图,并去除亮度图中的五官区域,得到剩余区域。其中,以Y表示亮度图中的某一像素 的亮度值,以R、G、B分别表示该像素在人脸区域的图像中的三通道值,则Y=0.299×R+0.57×G+0.114×B。最后,基于亮度图中的剩余区域,确定人脸区域的肤质类别。Optionally, the above-mentioned execution subject may also detect the skin type of the face region through the following steps: first, perform face key point detection on the face region to obtain the coordinates of the face key points. Among them, the key points of the face may include the key points of the outline of the facial features of the face. Then, based on the coordinates of the key points of the face, the facial features in the face region are determined. For example, for a nose, a nose contour may be determined based on key points in the contour of the nose, and an area surrounded by the contour may be determined as a nose area. After the facial features area is determined, the face area is converted into a brightness map, and the facial features area in the brightness map is removed to obtain the remaining area. Among them, Y represents the brightness value of a pixel in the brightness map, and R, G, B represent the three-channel value of the pixel in the image of the face area, then Y=0.299×R+0.57×G+0.114 ×B. Finally, based on the remaining areas in the luminance map, the skin type of the face area is determined.
其中,基于亮度图中的剩余区域,可通过如下步骤确定人脸区域的肤质类别:Among them, based on the remaining areas in the luminance map, the skin type of the face area can be determined by the following steps:
第一步,对剩余区域进行滤波,得到剩余区域中的各像素点的梯度。The first step is to filter the remaining area to obtain the gradient of each pixel in the remaining area.
此处,可采用多种滤波算计对剩余区域进行滤波,如Roberts算子、Prewitt算子、Sobel算子。以采用Sobel算子为例,可首先利用Sobel算子对剩余区域进行滤波,得到剩余区域中的各像素点的横向梯度和纵向梯度。而后,针对剩余区域中的每一个像素点,将该像素点的横向梯度与纵向梯度的绝对值之和确定为该像素点的梯度。从而,得到剩余区域中的各像素点的梯度。对于每一个像素点,可将该像素点的梯度记为gard,则有:Here, various filtering algorithms can be used to filter the remaining regions, such as Roberts operator, Prewitt operator, and Sobel operator. Taking the use of the Sobel operator as an example, the Sobel operator can be used to filter the remaining area first to obtain the horizontal gradient and vertical gradient of each pixel in the remaining area. Then, for each pixel in the remaining area, the sum of the absolute value of the horizontal gradient and the vertical gradient of the pixel is determined as the gradient of the pixel. Thus, the gradient of each pixel in the remaining area is obtained. For each pixel, the gradient of the pixel can be denoted as gard, then:
Figure PCTCN2020103061-appb-000002
Figure PCTCN2020103061-appb-000002
其中,
Figure PCTCN2020103061-appb-000003
表示卷积操作。上述式子中的两个矩阵,均为Sobel算子。
in,
Figure PCTCN2020103061-appb-000003
Represents a convolution operation. The two matrices in the above formula are Sobel operators.
第二步,对梯度进行统计,基于统计结果确定人脸区域的肤质类别。The second step is to perform statistics on the gradient, and determine the skin type of the face region based on the statistical results.
在一些示例中,可将梯度小于预设阈值的像素点作为平坦肤质像素点,确定平坦肤质像素点的数量与剩余区域的像素点总数的比值;而后基于比值,确定人脸区域的肤质类别。In some examples, pixels with a gradient smaller than a preset threshold may be used as flat skin pixels, and the ratio of the number of flat skin pixels to the total number of pixels in the remaining area may be determined; then, based on the ratio, the skin of the face area may be determined. quality category.
在另一些示例中,可确定剩余区域的各像素点的梯度之和;而后基于梯度之和,确定人脸区域的肤质类别。例如,可将肤质类别记为skin,若梯度之和小于th1,则skin=0。若梯度之和大于或等于th1且小于或等于th2,则skin=1。若梯度之和大于th2,则skin=2。其中,th1、th2为预先设置的阈值,且th1小于th2。skin=0、skin=1、skin=2分别表示光滑肤质、一般肤质、疤痕肤质三种肤质水平。In other examples, the sum of the gradients of each pixel point in the remaining area may be determined; and then, based on the sum of the gradients, the skin type of the face area is determined. For example, the skin type can be denoted as skin, and if the sum of the gradients is less than th1, then skin=0. If the sum of the gradients is greater than or equal to th1 and less than or equal to th2, then skin=1. If the sum of gradients is greater than th2, then skin=2. Among them, th1 and th2 are preset thresholds, and th1 is smaller than th2. skin=0, skin=1, and skin=2 represent three skin types: smooth skin, normal skin, and scarred skin, respectively.
子步骤S213,构建原始图像的背景蒙板。Sub-step S213, construct the background mask of the original image.
上述执行主体可以通过多种方式构建原始图像的背景蒙板。此处的背景蒙板可以是权重图,如权重值位于数值区间[0,1]的权重图。权重越大,属于人脸区域的概率越大。The above actor can construct the background mask of the original image in various ways. The background mask here can be a weight map, such as a weight map whose weight values are in the numerical interval [0, 1]. The greater the weight, the greater the probability of belonging to the face region.
作为一个示例,可以首先将原始图像转换为二值图像。如将背景区域的权重值设为0,将人脸区域的权重值设为1。而后,采用均值滤波算子对二值图像进行滤波处理,得到背景蒙板。均值滤波后,背景区域与人脸区域的交界处即可存在过渡值,过渡值大于0且小于1。As an example, the original image can be first converted to a binary image. For example, the weight value of the background area is set to 0, and the weight value of the face area is set to 1. Then, a mean filter operator is used to filter the binary image to obtain a background mask. After mean filtering, there can be a transition value at the junction of the background area and the face area, and the transition value is greater than 0 and less than 1.
作为又一示例,可以首先对人脸区域进行人脸轮廓点检测,得到人脸轮廓点的坐标。人脸轮廓点可通过人脸关键点检测的方式检测出。而后,可以对人脸轮廓点的坐标进行下采样,得到下采样后的人脸轮廓点坐标。例如,在进行两倍下采样时, 若某人脸轮廓点的在人脸区域中的原始坐标为(100,100),则下采样后的坐标即为(50,50)。之后,可以基于下采样后的人脸轮廓点坐标,生成下采样后的二值图像。其中,下采样后的人脸轮廓点所包围的区域内,像素值为1;下采样后的人脸轮廓点所包围的区域外,像素值为0。最后,通过插值方式对二值图像进行上采样,得到原始图像的背景蒙板。通过插值,可使背景蒙板中的背景区域与人脸区域的交界处即可存在过渡值,过渡值大于0且小于1。As another example, the face contour point detection may be performed on the face region first to obtain the coordinates of the face contour point. Face contour points can be detected by means of face key point detection. Then, the coordinates of the face contour points can be down-sampled to obtain the down-sampled face contour point coordinates. For example, when performing double downsampling, if the original coordinates of a face contour point in the face region are (100, 100), the downsampled coordinates are (50, 50). Afterwards, a downsampled binary image can be generated based on the downsampled face contour point coordinates. Among them, the pixel value is 1 in the area surrounded by the down-sampled face contour points; the pixel value is 0 outside the area surrounded by the down-sampled face contour points. Finally, the binary image is upsampled by interpolation to obtain the background mask of the original image. Through interpolation, a transition value can exist at the junction between the background area and the face area in the background mask, and the transition value is greater than 0 and less than 1.
子步骤S214,基于肤质类别和背景蒙版,确定滤波强度。In sub-step S214, the filtering strength is determined based on the skin type and the background mask.
此处,可以预先设置一个映射表,用于表征肤质类别、背景蒙板的值与滤波强度的对应关系。其中,背景蒙板的值越大,滤波强度越大。肤质估计结果值越大(即肤质越差),滤波强度越大。基于该映射表,即可查看各个像素的滤波强度。Here, a mapping table may be preset to represent the corresponding relationship between the skin type, the value of the background mask and the filtering strength. Among them, the larger the value of the background mask, the greater the filtering strength. The greater the skin quality estimation result value (that is, the worse the skin quality), the greater the filtering strength. Based on this mapping table, the filtering strength of each pixel can be viewed.
子步骤S215,基于滤波强度对中低频图像进行滤波,得到中频图像。Sub-step S215, filter the medium and low frequency images based on the filtering strength to obtain an intermediate frequency image.
此处,可用filter()表示滤波过程,ε表示映射表。则上述子步骤21中的滤波结果I F=filter(lf,ε)。 Here, filter() can be used to represent the filtering process, and ε represents the mapping table. Then the filtering result in the above sub-step 21 IF =filter(lf, ε).
由于背景蒙板的值越大,滤波强度越大,因而这种滤波方式可对人脸区域进行相对较强滤波。由于肤质估计结果值越大,滤波强度越大,因而可在肤质较差时进行相对较强的滤波。由此,可实现对不同区域及不同的肤质水平进行不同强度的滤波,达到保留人脸轮廓和保持背景清晰度的人脸磨皮美颜的目的。同时,通过设定映射表,可使滤波器具有边缘保护和滤波强度灵活可控的功能。Since the larger the value of the background mask, the stronger the filtering strength, so this filtering method can perform relatively strong filtering on the face area. Since the larger the skin quality estimation result value is, the stronger the filtering strength is, so relatively strong filtering can be performed when the skin quality is poor. In this way, different intensities of filtering can be implemented for different regions and different skin quality levels, so as to achieve the purpose of facial microdermabrasion and beauty that preserves the contour of the face and maintains the clarity of the background. At the same time, by setting the mapping table, the filter can have the functions of edge protection and filtering strength flexibly and controllable.
步骤202,对高频图像中满足预设条件的像素点进行强度抑制。Step 202: Perform intensity suppression on the pixels in the high-frequency image that satisfy the preset condition.
步骤203,对中频图像中像素值位于预设数值范围以外的像素点进行修正。 Step 203 , correcting the pixel points in the intermediate frequency image whose pixel values are outside the preset value range.
步骤204,将强度抑制后的高频图像、修正后的中频图像和低频图像进行图像融合,生成目标图像。Step 204: Perform image fusion on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
本实施例的上述步骤202至步骤204,可参见图1对应实施例的步骤102至步骤104,此处不再赘述。For the above steps 202 to 204 in this embodiment, reference may be made to steps 102 to 104 in the corresponding embodiment of FIG. 1 , and details are not repeated here.
本申请的上述实施例提供的方法,在分频过程中使用到了目标系数Gain,可支持用户手动调节美颜磨皮程度,从而可灵活满足用户需求。同时,分频过程中考虑到了背景蒙板的值以及肤质类型,由此可实现对不同区域及不同的肤质水平进行不同强度的滤波,达到保留人脸轮廓和保持背景清晰度的人脸磨皮美颜的目的。In the method provided by the above-mentioned embodiments of the present application, the target coefficient Gain is used in the frequency division process, which can support the user to manually adjust the degree of skin beautification and dermabrasion, so as to flexibly meet the needs of the user. At the same time, the value of the background mask and the type of skin type are considered in the frequency division process, so that different areas and different skin quality levels can be filtered with different intensities, so as to preserve the face contour and maintain the background clarity of the face. The purpose of skin resurfacing.
进一步参考图6,作为对上述各图所示方法的实现,本申请提供了一种电子设备的一个实施例,该实施例与图6所示的方法实施例相对应。Further referring to FIG. 6 , as an implementation of the methods shown in the above figures, the present application provides an embodiment of an electronic device, which corresponds to the method embodiment shown in FIG. 6 .
如图6所示,本实施例所述的电子设备包括:存储器601和处理器602。As shown in FIG. 6 , the electronic device described in this embodiment includes: a memory 601 and a processor 602 .
所述存储器601,用于存储程序指令;所述处理器602,执行所述存储器存储的程序指令,当程序指令被执行时,所述处理器602用于执行如下步骤:The memory 601 is used to store program instructions; the processor 602 is used to execute the program instructions stored in the memory, and when the program instructions are executed, the processor 602 is used to perform the following steps:
对原始图像进行分频处理,得到高频图像、中频图像和低频图像;Perform frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image;
对所述高频图像中满足预设条件的像素点进行强度抑制;performing intensity suppression on the pixels that meet the preset conditions in the high-frequency image;
对所述中频图像中像素值位于预设数值范围以外的像素点进行修正;Correcting the pixels whose pixel values are outside the preset value range in the intermediate frequency image;
将强度抑制后的所述高频图像、修正后的所述中频图像和所述低频图像进行图像融合,生成目标图像。Image fusion is performed on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
在本实施例的一些可选的实现方式中,所述对所述高频图像中满足预设条件的像素点进行强度抑制,包括:依次将所述高频图像中的每一个像素点作为目标点,执行如下步骤:确定所述目标点的邻域;获取所述邻域内的最大像素值和/或最小像素值;响应于所述目标点的像素值与所述最大像素值之差大于第一预设值,或者,所述最小像素值与所述目标点的像素值之差大于第二预设值,对所述目标点的像素值进行修正。In some optional implementation manners of this embodiment, the performing intensity suppression on the pixels in the high-frequency image that meet the preset condition includes: sequentially taking each pixel in the high-frequency image as a target point, perform the following steps: determine the neighborhood of the target point; obtain the maximum pixel value and/or the minimum pixel value in the neighborhood; in response to the difference between the pixel value of the target point and the maximum pixel value greater than the first A preset value, or the difference between the minimum pixel value and the pixel value of the target point is greater than a second preset value, and the pixel value of the target point is corrected.
在本实施例的一些可选的实现方式中,所述对所述目标点的像素值进行修正,包括:采用中值滤波算法对所述目标点的像素值进行滤波,得到目标点的修正后的像素值。In some optional implementation manners of this embodiment, the modifying the pixel value of the target point includes: using a median filtering algorithm to filter the pixel value of the target point, to obtain the corrected pixel value of the target point. pixel value.
在本实施例的一些可选的实现方式中,所述对所述中频图像中像素值位于预设数值范围以外的像素点进行修正,包括:对于所述中频图像中的每一个像素点,响应于该像素点的像素值小于所述预设数值范围中的最小值,将该像素点的像素值调整为所述最小值。In some optional implementations of this embodiment, the modifying the pixel points in the intermediate frequency image whose pixel values are outside the preset value range includes: for each pixel point in the intermediate frequency image, responding to If the pixel value of the pixel point is smaller than the minimum value in the preset value range, the pixel value of the pixel point is adjusted to the minimum value.
在本实施例的一些可选的实现方式中,所述对所述中频图像中像素值位于预设数值范围以外的像素点进行修正,包括:对于所述中频图像中的每一个像素点,响应于该像素点的像素值大于所述预设数值范围中的最大值,将该像素点的像素值调整为所述最大值。In some optional implementations of this embodiment, the modifying the pixel points in the intermediate frequency image whose pixel values are outside the preset value range includes: for each pixel point in the intermediate frequency image, responding to If the pixel value of the pixel point is greater than the maximum value in the preset value range, the pixel value of the pixel point is adjusted to the maximum value.
在本实施例的一些可选的实现方式中,所述处理器602还执行如下步骤:对所述原始图像进行肤色检测,确定所述原始图像中的像素点的肤色置信度;基于所述原始图像中的像素点的肤色置信度,将所述原始图像与所述目标图像进行图像融合,生成最终图像。In some optional implementations of this embodiment, the processor 602 further performs the following steps: performing skin color detection on the original image, and determining the skin color confidence of the pixels in the original image; The confidence level of the skin color of the pixels in the image, and the original image and the target image are image-fused to generate the final image.
在本实施例的一些可选的实现方式中,所述基于所述原始图像中的像素点的肤色置信度,将所述原始图像与所述目标图像进行图像融合,生成最终图像,包括:对于每一个像素点,从所述目标图像中获取该像素点的第一像素值,并从所述原始图像中获取该像素点的第二像素值;将该像素点的肤色置信度作为所述第一像素值的权重,将预设数值与所述权重的差值作为所述第二像素值的权重;对所述第一像素值和所述第二像素值进行加权求和,得到该像素点的最终像素值;基于各像素点的最终像素值,生成最终图像。In some optional implementations of this embodiment, performing image fusion on the original image and the target image based on the skin color confidence of the pixels in the original image to generate a final image, including: for For each pixel, the first pixel value of the pixel is obtained from the target image, and the second pixel value of the pixel is obtained from the original image; the skin color confidence of the pixel is taken as the first pixel value. The weight of a pixel value, the difference between the preset value and the weight is used as the weight of the second pixel value; the weighted summation is performed on the first pixel value and the second pixel value to obtain the pixel point The final pixel value of ; based on the final pixel value of each pixel, the final image is generated.
在本实施例的一些可选的实现方式中,所述对原始图像进行分频处理,得到高频图像、中频图像和低频图像,包括:对所述原始图像进行分频处理,得到高频图像和中低频图像;对所述中低频图像进行分频处理,得到中频图像和低频图像。In some optional implementations of this embodiment, performing frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image includes: performing frequency division processing on the original image to obtain a high-frequency image and middle and low frequency images; frequency division processing is performed on the middle and low frequency images to obtain an intermediate frequency image and a low frequency image.
在本实施例的一些可选的实现方式中,所述对所述原始图像进行分频处理,得到高频图像和中低频图像,包括:采用高斯滤波算子对将原始图像进行滤波,得到中低频图像;按像素点确定所述原始图像与中低频图像的第一像素差值,将由各像素点的第一像素差值构成的图像作为高频图像。In some optional implementation manners of this embodiment, performing frequency division processing on the original image to obtain a high-frequency image and a medium-low frequency image includes: filtering the original image with a Gaussian filter operator to obtain a medium-frequency image. Low-frequency image; determine the first pixel difference between the original image and the medium-low-frequency image by pixel, and use the image formed by the first pixel difference of each pixel as the high-frequency image.
在本实施例的一些可选的实现方式中,所述对所述中低频图像进行分频处理,得到中频图像和低频图像,包括:对所述中低频图像进行滤波,得到中频图像;基于用户设定的磨皮程度,确定目标系数;按像素点确定所述中低频图像与乘所述目标系数后的所述中频图像的第二像素差值,并将由各像素点的第二像素差值构成的图像作为低频图像。In some optional implementations of this embodiment, the performing frequency division processing on the medium and low frequency images to obtain an intermediate frequency image and a low frequency image includes: filtering the medium and low frequency images to obtain an intermediate frequency image; Determine the target coefficient according to the set degree of microdermabrasion; determine the second pixel difference between the mid-low frequency image and the mid-frequency image multiplied by the target coefficient according to the pixel point, and determine the second pixel difference value of each pixel by the second pixel difference. The constructed image is regarded as a low frequency image.
在本实施例的一些可选的实现方式中,所述对所述中低频图像进行滤波,得到中频图像,包括:对所述原始图像进行人脸检测,确定所述原始图像中的人脸区域;检测所述人脸区域的肤质类别;构建所述原始图像的背景蒙板,所述背景蒙板为权重图;基于所述肤质类别和所述背景蒙版,确定滤波强度;基于所述滤波强度对所述中低频图像进行滤波,得到中频图像。In some optional implementation manners of this embodiment, the filtering the mid-low frequency image to obtain the mid-frequency image includes: performing face detection on the original image, and determining a face region in the original image ; Detect the skin quality category of the face area; construct the background mask of the original image, and the background mask is a weight map; Based on the skin quality category and the background mask, determine the filtering strength; The intermediate and low frequency images are filtered by the filtering strength to obtain an intermediate frequency image.
在本实施例的一些可选的实现方式中,所述检测所述人脸区域的肤质类别,包括:对所述人脸区域进行人脸关键点检测,得到人脸关键点的坐标;基于所述人脸关键点的坐标,确定所述人脸区域中的五官区域;将所述人脸区域转换为亮度图,去除所述亮度图中的所述五官区域,得到剩余区域;基于所述亮度图中的所述剩余区域,确定所述人脸区域的肤质类别。In some optional implementations of this embodiment, the detecting the skin type of the face region includes: performing face key point detection on the face region to obtain the coordinates of the face key points; based on The coordinates of the key points of the face determine the facial features area in the facial area; convert the facial area into a luminance map, remove the facial features area in the luminance graph, and obtain the remaining area; based on the The remaining area in the luminance map determines the skin type of the face area.
在本实施例的一些可选的实现方式中,所述基于所述亮度图中的所述剩余区域,确定所述人脸区域的肤质类别,包括:对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的梯度;对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别。In some optional implementations of this embodiment, the determining the skin type of the face region based on the remaining region in the luminance map includes: filtering the remaining region to obtain the The gradient of each pixel in the remaining area is calculated; the gradient is counted, and the skin type of the face area is determined based on the statistical result.
在本实施例的一些可选的实现方式中,所述对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的梯度,包括:采用索贝尔算子对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的横向梯度和纵向梯度;对于所述剩余区域中的每一个像素点,将该像素点的横向梯度与纵向梯度的绝对值之和确定为该像素点的梯度。In some optional implementation manners of this embodiment, the filtering the remaining area to obtain the gradient of each pixel in the remaining area includes: using a Sobel operator to filter the remaining area , to obtain the horizontal gradient and vertical gradient of each pixel in the remaining area; for each pixel in the remaining area, the sum of the absolute value of the horizontal gradient and the vertical gradient of the pixel is determined as the pixel. gradient.
在本实施例的一些可选的实现方式中,所述对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别,包括:将梯度小于预设阈值的像素点作为平坦肤质像素点,确定所述平坦肤质像素点的数量与所述剩余区域的像素点总数的比值;基于所述比值,确定所述人脸区域的肤质类别。In some optional implementations of this embodiment, the performing statistics on the gradients and determining the skin quality category of the face region based on the statistical results includes: using pixels with gradients smaller than a preset threshold as flat skins quality pixels, determine the ratio of the number of flat skin quality pixels to the total number of pixels in the remaining area; based on the ratio, determine the skin quality category of the face area.
在本实施例的一些可选的实现方式中,所述对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别,包括:确定所述剩余区域的各像素点的梯度之和;基于所述梯度之和,确定所述人脸区域的肤质类别。In some optional implementations of this embodiment, the performing statistics on the gradients, and determining the skin type of the face region based on the statistical results, includes: determining a difference between the gradients of the pixels in the remaining region. and; based on the sum of the gradients, determine the skin type of the face region.
在本实施例的一些可选的实现方式中,所述构建所述原始图像的背景蒙板,包括:将所述原始图像转换为二值图像;采用均值滤波算子对所述二值图像进行滤波处理,得到背景蒙板。In some optional implementations of this embodiment, the constructing the background mask of the original image includes: converting the original image into a binary image; Filter processing to get the background mask.
在本实施例的一些可选的实现方式中,所述构建所述原始图像的背景蒙板,包括:对所述人脸区域进行人脸轮廓点检测,得到人脸轮廓点的坐标;对所述人脸轮廓点的坐标进行下采样,得到下采样后的人脸轮廓点坐标;基于所述下采样后的人 脸轮廓点坐标,生成下采样后的二值图像;通过差值方式对所述二值图像进行上采样,得到所述原始图像的背景蒙板。In some optional implementations of this embodiment, the constructing the background mask of the original image includes: performing face contour point detection on the face region to obtain the coordinates of the face contour points; The coordinates of the face contour points are down-sampled to obtain the down-sampled face contour point coordinates; based on the down-sampled face contour point coordinates, a down-sampled binary image is generated; The binary image is upsampled to obtain the background mask of the original image.
本申请的上述实施例提供的电子设备,通过对分频后得到的高频图像中满足预设条件的像素点进行强度抑制,能够在保留图像的高频纹理的同时抑制人脸上的黑头等高频瑕疵。通过对分频后得到的中频图像中像素值位于预设数值范围以外的像素点进行修正,能够在保留人脸轮廓等对比度信息的同时剔除人脸色斑等暗部瑕疵。通过将强度抑制后的高频图像、修正后的中频图像和分频后得到的低频图像进行图像融合,能够消除原始图像中的人脸色斑、黑头等瑕疵,同时保留了人脸纹理信息和对比度特征,提升了图像中的人脸的立体感。The electronic device provided by the above-mentioned embodiments of the present application can suppress the blackheads on the face while retaining the high-frequency texture of the image by suppressing the intensity of the pixels satisfying the preset conditions in the high-frequency image obtained after frequency division. High frequency imperfections. By correcting the pixel points whose pixel values are outside the preset value range in the intermediate frequency image obtained after frequency division, it is possible to remove the dark parts such as facial color spots while retaining the contrast information such as the contour of the face. By image fusion of the high-frequency image after intensity suppression, the modified intermediate-frequency image, and the low-frequency image obtained after frequency division, the facial color spots, blackheads and other defects in the original image can be eliminated, and the facial texture information and The contrast feature enhances the three-dimensionality of the face in the image.
本申请实施例还提供一种计算机可读介质,计算机可读介质上存储有计算机程序,该计算机程序被处理器执行时实现上述图像处理方法的实施例的各个过程,且能达到相同的技术效果。为避免重复,该计算机程序被处理器执行时实现上述各方法的实施例的各个过程,这里不再赘述。Embodiments of the present application further provide a computer-readable medium, where a computer program is stored on the computer-readable medium. When the computer program is executed by a processor, each process of the foregoing image processing method embodiments can be realized, and the same technical effect can be achieved. . In order to avoid repetition, when the computer program is executed by the processor, each process of the embodiments of the above-mentioned methods is implemented, which will not be repeated here.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments may be referred to each other.
本领域内的技术人员应明白,本申请的实施例可提供为方法、装置、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可读介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It should be understood by those skilled in the art that the embodiments of the present application may be provided as a method, an apparatus, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-readable media having computer-usable program code embodied therein, including but not limited to disk storage, CD-ROM, optical storage, and the like.
本申请是参照根据本申请的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to the present application. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal equipment to produce a machine that causes the instructions to be executed by the processor of the computer or other programmable data processing terminal equipment Means are created for implementing the functions specified in the flow or flows of the flowcharts and/or the blocks or blocks of the block diagrams.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal equipment to operate in a particular manner, such that the instructions stored in the computer readable memory result in an article of manufacture comprising instruction means, the The instruction means implement the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing terminal equipment, so that a series of operational steps are performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby executing on the computer or other programmable terminal equipment The instructions executed on the above provide steps for implementing the functions specified in the flowchart or blocks and/or the block or blocks of the block diagrams.
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创 造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。While the preferred embodiments of the present application have been described, additional changes and modifications to these embodiments may occur to those skilled in the art once armed with the basic inventive concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiment and all changes and modifications that fall within the scope of this application.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个......”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should also be noted that in this document, relational terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply these entities or that there is any such actual relationship or sequence between operations. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion such that a process, method, article or terminal device that includes a list of elements includes not only those elements, but also a non-exclusive list of elements. other elements, or also include elements inherent to such a process, method, article or terminal equipment. Without further limitation, an element defined by the phrase "comprises a..." does not preclude the presence of additional identical elements in the process, method, article or terminal device comprising said element.
以上对本申请所提供的数据传输系统、方法、发送端和计算机可读介质,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The data transmission system, method, sending end and computer-readable medium provided by the present application have been introduced in detail above. The principles and implementations of the present application are described with specific examples. The description of the above embodiments is only used for In order to help understand the method of the present application and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation and application scope. In summary, this specification The content should not be construed as a limitation on this application.

Claims (37)

  1. 一种图像处理方法,其特征在于,所述方法包括:An image processing method, characterized in that the method comprises:
    对原始图像进行分频处理,得到高频图像、中频图像和低频图像;Perform frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image;
    对所述高频图像中满足预设条件的像素点进行强度抑制;performing intensity suppression on the pixels that meet the preset conditions in the high-frequency image;
    对所述中频图像中像素值位于预设数值范围以外的像素点进行修正;Correcting the pixels whose pixel values are outside the preset value range in the intermediate frequency image;
    将强度抑制后的所述高频图像、修正后的所述中频图像和所述低频图像进行图像融合,生成目标图像。Image fusion is performed on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
  2. 根据权利要求1所述的方法,其特征在于,所述对所述高频图像中满足预设条件的像素点进行强度抑制,包括:The method according to claim 1, wherein the performing intensity suppression on the pixels satisfying a preset condition in the high-frequency image comprises:
    依次将所述高频图像中的每一个像素点作为目标点,执行如下步骤:Take each pixel in the high-frequency image as a target point in turn, and perform the following steps:
    确定所述目标点的邻域;determine the neighborhood of the target point;
    获取所述邻域内的最大像素值和/或最小像素值;obtaining the maximum pixel value and/or the minimum pixel value in the neighborhood;
    响应于所述目标点的像素值与所述最大像素值之差大于第一预设值,或者,所述最小像素值与所述目标点的像素值之差大于第二预设值,对所述目标点的像素值进行修正。In response to the difference between the pixel value of the target point and the maximum pixel value being greater than the first preset value, or the difference between the minimum pixel value and the pixel value of the target point being greater than the second preset value, The pixel value of the target point is corrected.
  3. 根据权利要求2所述的方法,其特征在于,所述对所述目标点的像素值进行修正,包括:The method according to claim 2, wherein the modifying the pixel value of the target point comprises:
    采用中值滤波算法对所述目标点的像素值进行滤波,得到目标点的修正后的像素值。A median filtering algorithm is used to filter the pixel value of the target point to obtain the corrected pixel value of the target point.
  4. 根据权利要求1所述的方法,其特征在于,所述对所述中频图像中像素值位于预设数值范围以外的像素点进行修正,包括:The method according to claim 1, wherein the modifying the pixels whose pixel values are outside the preset value range in the intermediate frequency image comprises:
    对于所述中频图像中的每一个像素点,响应于该像素点的像素值小于所述预设数值范围中的最小值,将该像素点的像素值调整为所述最小值。For each pixel in the intermediate frequency image, in response to the pixel value of the pixel being less than the minimum value in the preset value range, the pixel value of the pixel is adjusted to the minimum value.
  5. 根据权利要求1或4所述的方法,其特征在于,所述对所述中频图像中像素值位于预设数值范围以外的像素点进行修正,包括:The method according to claim 1 or 4, wherein the modifying the pixels whose pixel values are outside the preset value range in the intermediate frequency image comprises:
    对于所述中频图像中的每一个像素点,响应于该像素点的像素值大于所述预设数值范围中的最大值,将该像素点的像素值调整为所述最大值。For each pixel in the intermediate frequency image, in response to the pixel value of the pixel being greater than the maximum value in the preset value range, the pixel value of the pixel is adjusted to the maximum value.
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    对所述原始图像进行肤色检测,确定所述原始图像中的像素点的肤色置信度;skin color detection is performed on the original image to determine the skin color confidence of the pixels in the original image;
    基于所述原始图像中的像素点的肤色置信度,将所述原始图像与所述目标图像进行图像融合,生成最终图像。Based on the confidence of the skin color of the pixels in the original image, image fusion is performed on the original image and the target image to generate a final image.
  7. 根据权利要求6所述的方法,其特征在于,所述基于所述原始图像中的像素点的肤色置信度,将所述原始图像与所述目标图像进行图像融合,生成最终图像,包括:The method according to claim 6, wherein, performing image fusion on the original image and the target image based on the confidence of skin color of pixels in the original image to generate a final image, comprising:
    对于每一个像素点,从所述目标图像中获取该像素点的第一像素值,并从所述原始图像中获取该像素点的第二像素值;将该像素点的肤色置信度作为所述第一像素值的权重,将预设数值与所述权重的差值作为所述第二像素值的权重;对所述第一像素值和所述第二像素值进行加权求和,得到该像素点的最终像素值;For each pixel, the first pixel value of the pixel is obtained from the target image, and the second pixel value of the pixel is obtained from the original image; the skin color confidence of the pixel is used as the The weight of the first pixel value, the difference between the preset value and the weight is used as the weight of the second pixel value; the weighted summation is performed on the first pixel value and the second pixel value to obtain the pixel value the final pixel value of the point;
    基于各像素点的最终像素值,生成最终图像。Based on the final pixel value of each pixel, the final image is generated.
  8. 根据权利要求1所述的方法,其特征在于,所述对原始图像进行分频处理,得到高频图像、中频图像和低频图像,包括:The method according to claim 1, wherein the performing frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image, comprising:
    对所述原始图像进行分频处理,得到高频图像和中低频图像;Perform frequency division processing on the original image to obtain a high frequency image and a medium and low frequency image;
    对所述中低频图像进行分频处理,得到中频图像和低频图像。The intermediate and low frequency images are subjected to frequency division processing to obtain an intermediate frequency image and a low frequency image.
  9. 根据权利要求8所述的方法,其特征在于,所述对所述原始图像进行分频处理,得到高频图像和中低频图像,包括:The method according to claim 8, wherein the performing frequency division processing on the original image to obtain a high-frequency image and a medium-low frequency image, comprising:
    采用高斯滤波算子对将原始图像进行滤波,得到中低频图像;The original image is filtered by the Gaussian filter operator to obtain the medium and low frequency image;
    按像素点确定所述原始图像与中低频图像的第一像素差值,将由各像素点的第一像素差值构成的图像作为高频图像。Determine the first pixel difference between the original image and the medium and low frequency image by pixel, and take the image formed by the first pixel difference of each pixel as the high frequency image.
  10. 根据权利要求8所述的方法,其特征在于,所述对所述中低频图像进行分频处理,得到中频图像和低频图像,包括:The method according to claim 8, wherein the performing frequency division processing on the medium and low frequency images to obtain the intermediate frequency images and the low frequency images, comprising:
    对所述中低频图像进行滤波,得到中频图像;Filtering the medium and low frequency images to obtain an intermediate frequency image;
    基于用户设定的磨皮程度,确定目标系数;Determine the target coefficient based on the microdermabrasion degree set by the user;
    按像素点确定所述中低频图像与乘所述目标系数后的所述中频图像的第二像素差值,并将由各像素点的第二像素差值构成的图像作为低频图像。Determine the second pixel difference between the intermediate and low frequency image and the intermediate frequency image multiplied by the target coefficient according to pixel points, and use the image formed by the second pixel difference of each pixel as the low frequency image.
  11. 根据权利要求10所述的方法,其特征在于,所述对所述中低频图像进行滤波,得到中频图像,包括:The method according to claim 10, wherein the filtering the mid-low frequency image to obtain the mid-frequency image comprises:
    对所述原始图像进行人脸检测,确定所述原始图像中的人脸区域;performing face detection on the original image to determine the face area in the original image;
    检测所述人脸区域的肤质类别;detecting the skin type of the face region;
    构建所述原始图像的背景蒙板,所述背景蒙板为权重图;constructing a background mask of the original image, and the background mask is a weight map;
    基于所述肤质类别和所述背景蒙版,确定滤波强度;determining a filtering strength based on the skin type and the background mask;
    基于所述滤波强度对所述中低频图像进行滤波,得到中频图像。The intermediate and low frequency images are filtered based on the filtering strength to obtain an intermediate frequency image.
  12. 根据权利要求11所述的方法,其特征在于,所述检测所述人脸区域的肤质 类别,包括:The method according to claim 11, wherein the detecting the skin type of the face region comprises:
    对所述人脸区域进行人脸关键点检测,得到人脸关键点的坐标;Performing face key point detection on the face area to obtain the coordinates of the face key points;
    基于所述人脸关键点的坐标,确定所述人脸区域中的五官区域;Determine the facial features area in the face area based on the coordinates of the key points of the face;
    将所述人脸区域转换为亮度图,去除所述亮度图中的所述五官区域,得到剩余区域;Converting the face area into a brightness map, removing the facial features in the brightness map, and obtaining the remaining area;
    基于所述亮度图中的所述剩余区域,确定所述人脸区域的肤质类别。Based on the remaining regions in the luminance map, a skin quality category of the face region is determined.
  13. 根据权利要求12所述的方法,其特征在于,所述基于所述亮度图中的所述剩余区域,确定所述人脸区域的肤质类别,包括:The method according to claim 12, wherein the determining the skin type of the face region based on the remaining region in the luminance map comprises:
    对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的梯度;Filtering the remaining area to obtain the gradient of each pixel in the remaining area;
    对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别。Statistics are performed on the gradient, and the skin type of the face region is determined based on the statistical result.
  14. 根据权利要求13所述的方法,其特征在于,所述对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的梯度,包括:The method according to claim 13, wherein the filtering the remaining area to obtain the gradient of each pixel in the remaining area, comprising:
    采用索贝尔算子对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的横向梯度和纵向梯度;The remaining area is filtered by the Sobel operator to obtain the horizontal gradient and the vertical gradient of each pixel in the remaining area;
    对于所述剩余区域中的每一个像素点,将该像素点的横向梯度与纵向梯度的绝对值之和确定为该像素点的梯度。For each pixel point in the remaining area, the sum of the absolute value of the horizontal gradient and the vertical gradient of the pixel point is determined as the gradient of the pixel point.
  15. 根据权利要求13所述的方法,其特征在于,所述对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别,包括:The method according to claim 13, wherein the performing statistics on the gradients, and determining the skin type of the face region based on the statistical results, comprises:
    将梯度小于预设阈值的像素点作为平坦肤质像素点,确定所述平坦肤质像素点的数量与所述剩余区域的像素点总数的比值;Taking the pixels whose gradient is less than the preset threshold as the flat skin quality pixels, the ratio of the number of the flat skin quality pixels to the total number of pixels in the remaining area is determined;
    基于所述比值,确定所述人脸区域的肤质类别。Based on the ratio, the skin type of the face region is determined.
  16. 根据权利要求13所述的方法,其特征在于,所述对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别,包括:The method according to claim 13, wherein the performing statistics on the gradients, and determining the skin type of the face region based on the statistical results, comprises:
    确定所述剩余区域的各像素点的梯度之和;determining the sum of the gradients of the pixels in the remaining area;
    基于所述梯度之和,确定所述人脸区域的肤质类别。Based on the sum of the gradients, the skin type of the face region is determined.
  17. 根据权利要求11所述的方法,其特征在于,所述构建所述原始图像的背景蒙板,包括:The method according to claim 11, wherein the constructing the background mask of the original image comprises:
    将所述原始图像转换为二值图像;converting the original image into a binary image;
    采用均值滤波算子对所述二值图像进行滤波处理,得到背景蒙板。A mean filter operator is used to filter the binary image to obtain a background mask.
  18. 根据权利要求11所述的方法,其特征在于,所述构建所述原始图像的背景蒙板,包括:The method according to claim 11, wherein the constructing the background mask of the original image comprises:
    对所述人脸区域进行人脸轮廓点检测,得到人脸轮廓点的坐标;Performing face contour point detection on the face region to obtain the coordinates of the face contour points;
    对所述人脸轮廓点的坐标进行下采样,得到下采样后的人脸轮廓点坐标;down-sampling the coordinates of the face contour points to obtain down-sampled face contour point coordinates;
    基于所述下采样后的人脸轮廓点坐标,生成下采样后的二值图像;Based on the down-sampled face contour point coordinates, a down-sampled binary image is generated;
    通过差值方式对所述二值图像进行上采样,得到所述原始图像的背景蒙板。The binary image is up-sampled by a difference method to obtain a background mask of the original image.
  19. 一种电子设备,其特征在于,包括:处理器和存储器;An electronic device, comprising: a processor and a memory;
    所述存储器,用于存储程序指令;the memory for storing program instructions;
    所述处理器,执行所述存储器存储的程序指令,当程序指令被执行时,所述处理器用于执行如下步骤:The processor executes the program instructions stored in the memory, and when the program instructions are executed, the processor is configured to perform the following steps:
    对原始图像进行分频处理,得到高频图像、中频图像和低频图像;Perform frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image;
    对所述高频图像中满足预设条件的像素点进行强度抑制;performing intensity suppression on the pixels that meet the preset conditions in the high-frequency image;
    对所述中频图像中像素值位于预设数值范围以外的像素点进行修正;Correcting the pixels whose pixel values are outside the preset value range in the intermediate frequency image;
    将强度抑制后的所述高频图像、修正后的所述中频图像和所述低频图像进行图像融合,生成目标图像。Image fusion is performed on the intensity-suppressed high-frequency image, the modified intermediate-frequency image, and the low-frequency image to generate a target image.
  20. 根据权利要求19所述的电子设备,其特征在于,所述对所述高频图像中满足预设条件的像素点进行强度抑制,包括:The electronic device according to claim 19, wherein the performing intensity suppression on the pixels satisfying a preset condition in the high-frequency image comprises:
    依次将所述高频图像中的每一个像素点作为目标点,执行如下步骤:Take each pixel in the high-frequency image as a target point in turn, and perform the following steps:
    确定所述目标点的邻域;determine the neighborhood of the target point;
    获取所述邻域内的最大像素值和/或最小像素值;obtaining the maximum pixel value and/or the minimum pixel value in the neighborhood;
    响应于所述目标点的像素值与所述最大像素值之差大于第一预设值,或者,所述最小像素值与所述目标点的像素值之差大于第二预设值,对所述目标点的像素值进行修正。In response to the difference between the pixel value of the target point and the maximum pixel value being greater than the first preset value, or the difference between the minimum pixel value and the pixel value of the target point being greater than the second preset value, The pixel value of the target point is corrected.
  21. 根据权利要求20所述的电子设备,其特征在于,所述对所述目标点的像素值进行修正,包括:The electronic device according to claim 20, wherein the modifying the pixel value of the target point comprises:
    采用中值滤波算法对所述目标点的像素值进行滤波,得到目标点的修正后的像素值。A median filtering algorithm is used to filter the pixel value of the target point to obtain the corrected pixel value of the target point.
  22. 根据权利要求19所述的电子设备,其特征在于,所述对所述中频图像中像素值位于预设数值范围以外的像素点进行修正,包括:The electronic device according to claim 19, wherein the revising the pixels whose pixel values are outside the preset value range in the intermediate frequency image comprises:
    对于所述中频图像中的每一个像素点,响应于该像素点的像素值小于所述预设数值范围中的最小值,将该像素点的像素值调整为所述最小值。For each pixel in the intermediate frequency image, in response to the pixel value of the pixel being less than the minimum value in the preset value range, the pixel value of the pixel is adjusted to the minimum value.
  23. 根据权利要求19所述的电子设备,其特征在于,所述对所述中频图像中像素值位于预设数值范围以外的像素点进行修正,包括:The electronic device according to claim 19, wherein the revising the pixels whose pixel values are outside the preset value range in the intermediate frequency image comprises:
    对于所述中频图像中的每一个像素点,响应于该像素点的像素值大于所述预设 数值范围中的最大值,将该像素点的像素值调整为所述最大值。For each pixel in the intermediate frequency image, in response to the pixel value of the pixel being greater than the maximum value in the preset value range, the pixel value of the pixel is adjusted to the maximum value.
  24. 根据权利要求19所述的电子设备,其特征在于,所述处理器还执行如下步骤:The electronic device according to claim 19, wherein the processor further performs the following steps:
    对所述原始图像进行肤色检测,确定所述原始图像中的像素点的肤色置信度;skin color detection is performed on the original image to determine the skin color confidence of the pixels in the original image;
    基于所述原始图像中的像素点的肤色置信度,将所述原始图像与所述目标图像进行图像融合,生成最终图像。Based on the confidence of the skin color of the pixels in the original image, image fusion is performed on the original image and the target image to generate a final image.
  25. 根据权利要求24所述的电子设备,其特征在于,所述基于所述原始图像中的像素点的肤色置信度,将所述原始图像与所述目标图像进行图像融合,生成最终图像,包括:The electronic device according to claim 24, wherein the image fusion of the original image and the target image based on the confidence of the skin color of the pixels in the original image to generate a final image comprises:
    对于每一个像素点,从所述目标图像中获取该像素点的第一像素值,并从所述原始图像中获取该像素点的第二像素值;将该像素点的肤色置信度作为所述第一像素值的权重,将预设数值与所述权重的差值作为所述第二像素值的权重;对所述第一像素值和所述第二像素值进行加权求和,得到该像素点的最终像素值;For each pixel, the first pixel value of the pixel is obtained from the target image, and the second pixel value of the pixel is obtained from the original image; the skin color confidence of the pixel is used as the The weight of the first pixel value, the difference between the preset value and the weight is used as the weight of the second pixel value; the weighted summation is performed on the first pixel value and the second pixel value to obtain the pixel value the final pixel value of the point;
    基于各像素点的最终像素值,生成最终图像。Based on the final pixel value of each pixel, the final image is generated.
  26. 根据权利要求19所述的电子设备,其特征在于,所述对原始图像进行分频处理,得到高频图像、中频图像和低频图像,包括:The electronic device according to claim 19, wherein the performing frequency division processing on the original image to obtain a high-frequency image, an intermediate-frequency image and a low-frequency image, comprising:
    对所述原始图像进行分频处理,得到高频图像和中低频图像;Perform frequency division processing on the original image to obtain a high frequency image and a medium and low frequency image;
    对所述中低频图像进行分频处理,得到中频图像和低频图像。The intermediate and low frequency images are subjected to frequency division processing to obtain an intermediate frequency image and a low frequency image.
  27. 根据权利要求26所述的电子设备,其特征在于,所述对所述原始图像进行分频处理,得到高频图像和中低频图像,包括:The electronic device according to claim 26, wherein the performing frequency division processing on the original image to obtain a high-frequency image and a medium-low frequency image, comprising:
    采用高斯滤波算子对将原始图像进行滤波,得到中低频图像;The original image is filtered by the Gaussian filter operator to obtain the medium and low frequency image;
    按像素点确定所述原始图像与中低频图像的第一像素差值,将由各像素点的第一像素差值构成的图像作为高频图像。Determine the first pixel difference between the original image and the medium and low frequency image by pixel, and take the image formed by the first pixel difference of each pixel as the high frequency image.
  28. 根据权利要求26所述的电子设备,其特征在于,所述对所述中低频图像进行分频处理,得到中频图像和低频图像,包括:The electronic device according to claim 26, wherein the performing frequency division processing on the mid- and low-frequency images to obtain an intermediate-frequency image and a low-frequency image, comprising:
    对所述中低频图像进行滤波,得到中频图像;Filtering the medium and low frequency images to obtain an intermediate frequency image;
    基于用户设定的磨皮程度,确定目标系数;Determine the target coefficient based on the microdermabrasion degree set by the user;
    按像素点确定所述中低频图像与乘所述目标系数后的所述中频图像的第二像素差值,并将由各像素点的第二像素差值构成的图像作为低频图像。Determine the second pixel difference between the intermediate and low frequency image and the intermediate frequency image multiplied by the target coefficient according to pixel points, and use the image formed by the second pixel difference of each pixel as the low frequency image.
  29. 根据权利要求28所述的电子设备,其特征在于,所述对所述中低频图像进行滤波,得到中频图像,包括:The electronic device according to claim 28, wherein the filtering the mid-low frequency image to obtain the mid-frequency image comprises:
    对所述原始图像进行人脸检测,确定所述原始图像中的人脸区域;performing face detection on the original image to determine the face area in the original image;
    检测所述人脸区域的肤质类别;detecting the skin type of the face region;
    构建所述原始图像的背景蒙板,所述背景蒙板为权重图;constructing a background mask of the original image, and the background mask is a weight map;
    基于所述肤质类别和所述背景蒙版,确定滤波强度;determining a filtering strength based on the skin type and the background mask;
    基于所述滤波强度对所述中低频图像进行滤波,得到中频图像。The intermediate and low frequency images are filtered based on the filtering strength to obtain an intermediate frequency image.
  30. 根据权利要求29所述的电子设备,其特征在于,所述检测所述人脸区域的肤质类别,包括:The electronic device according to claim 29, wherein the detecting the skin type of the face region comprises:
    对所述人脸区域进行人脸关键点检测,得到人脸关键点的坐标;Performing face key point detection on the face area to obtain the coordinates of the face key points;
    基于所述人脸关键点的坐标,确定所述人脸区域中的五官区域;Determine the facial features area in the face area based on the coordinates of the key points of the face;
    将所述人脸区域转换为亮度图,去除所述亮度图中的所述五官区域,得到剩余区域;Converting the face area into a brightness map, removing the facial features in the brightness map, and obtaining the remaining area;
    基于所述亮度图中的所述剩余区域,确定所述人脸区域的肤质类别。Based on the remaining regions in the luminance map, a skin quality category of the face region is determined.
  31. 根据权利要求30所述的电子设备,其特征在于,所述基于所述亮度图中的所述剩余区域,确定所述人脸区域的肤质类别,包括:The electronic device according to claim 30, wherein the determining the skin type of the face region based on the remaining region in the luminance map comprises:
    对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的梯度;Filtering the remaining area to obtain the gradient of each pixel in the remaining area;
    对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别。Statistics are performed on the gradient, and the skin type of the face region is determined based on the statistical result.
  32. 根据权利要求31所述的电子设备,其特征在于,所述对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的梯度,包括:The electronic device according to claim 31, wherein the filtering the remaining area to obtain the gradient of each pixel in the remaining area comprises:
    采用索贝尔算子对所述剩余区域进行滤波,得到所述剩余区域中的各像素点的横向梯度和纵向梯度;The remaining area is filtered by the Sobel operator to obtain the horizontal gradient and the vertical gradient of each pixel in the remaining area;
    对于所述剩余区域中的每一个像素点,将该像素点的横向梯度与纵向梯度的绝对值之和确定为该像素点的梯度。For each pixel point in the remaining area, the sum of the absolute value of the horizontal gradient and the vertical gradient of the pixel point is determined as the gradient of the pixel point.
  33. 根据权利要求31所述的电子设备,其特征在于,所述对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别,包括:The electronic device according to claim 31, wherein the performing statistics on the gradients, and determining the skin type of the face region based on the statistical results, comprises:
    将梯度小于预设阈值的像素点作为平坦肤质像素点,确定所述平坦肤质像素点的数量与所述剩余区域的像素点总数的比值;Taking the pixels whose gradient is less than the preset threshold as the flat skin quality pixels, the ratio of the number of the flat skin quality pixels to the total number of pixels in the remaining area is determined;
    基于所述比值,确定所述人脸区域的肤质类别。Based on the ratio, the skin type of the face region is determined.
  34. 根据权利要求31所述的电子设备,其特征在于,所述对所述梯度进行统计,基于统计结果确定所述人脸区域的肤质类别,包括:The electronic device according to claim 31, wherein the performing statistics on the gradients, and determining the skin type of the face region based on the statistical results, comprises:
    确定所述剩余区域的各像素点的梯度之和;determining the sum of the gradients of the pixels in the remaining area;
    基于所述梯度之和,确定所述人脸区域的肤质类别。Based on the sum of the gradients, the skin type of the face region is determined.
  35. 根据权利要求29所述的电子设备,其特征在于,所述构建所述原始图像的背景蒙板,包括:The electronic device according to claim 29, wherein the constructing the background mask of the original image comprises:
    将所述原始图像转换为二值图像;converting the original image into a binary image;
    采用均值滤波算子对所述二值图像进行滤波处理,得到背景蒙板。A mean filter operator is used to filter the binary image to obtain a background mask.
  36. 根据权利要求29所述的电子设备,其特征在于,所述构建所述原始图像的背景蒙板,包括:The electronic device according to claim 29, wherein the constructing the background mask of the original image comprises:
    对所述人脸区域进行人脸轮廓点检测,得到人脸轮廓点的坐标;Performing face contour point detection on the face area to obtain the coordinates of the face contour points;
    对所述人脸轮廓点的坐标进行下采样,得到下采样后的人脸轮廓点坐标;down-sampling the coordinates of the face contour points to obtain down-sampled face contour point coordinates;
    基于所述下采样后的人脸轮廓点坐标,生成下采样后的二值图像;Based on the down-sampled face contour point coordinates, a down-sampled binary image is generated;
    通过差值方式对所述二值图像进行上采样,得到所述原始图像的背景蒙板。Up-sampling the binary image by means of difference value to obtain the background mask of the original image.
  37. 一种计算机可读介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-18中任一所述的方法。A computer-readable medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the method according to any one of claims 1-18 is implemented.
PCT/CN2020/103061 2020-07-20 2020-07-20 Image processing method, electronic device, and computer-readable medium WO2022016326A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/103061 WO2022016326A1 (en) 2020-07-20 2020-07-20 Image processing method, electronic device, and computer-readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/103061 WO2022016326A1 (en) 2020-07-20 2020-07-20 Image processing method, electronic device, and computer-readable medium

Publications (1)

Publication Number Publication Date
WO2022016326A1 true WO2022016326A1 (en) 2022-01-27

Family

ID=79729614

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/103061 WO2022016326A1 (en) 2020-07-20 2020-07-20 Image processing method, electronic device, and computer-readable medium

Country Status (1)

Country Link
WO (1) WO2022016326A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114708166A (en) * 2022-04-08 2022-07-05 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and terminal
CN116245754A (en) * 2022-12-29 2023-06-09 北京百度网讯科技有限公司 Image processing method, device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030222991A1 (en) * 2002-05-29 2003-12-04 Eastman Kodak Company Image processing
US20120308126A1 (en) * 2011-05-31 2012-12-06 Korea Electronics Technology Institute Corresponding image processing method for compensating colour
CN105005973A (en) * 2015-06-30 2015-10-28 广东欧珀移动通信有限公司 Fast image denoising method and apparatus
CN110580688A (en) * 2019-08-07 2019-12-17 北京达佳互联信息技术有限公司 Image processing method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030222991A1 (en) * 2002-05-29 2003-12-04 Eastman Kodak Company Image processing
US20120308126A1 (en) * 2011-05-31 2012-12-06 Korea Electronics Technology Institute Corresponding image processing method for compensating colour
CN105005973A (en) * 2015-06-30 2015-10-28 广东欧珀移动通信有限公司 Fast image denoising method and apparatus
CN110580688A (en) * 2019-08-07 2019-12-17 北京达佳互联信息技术有限公司 Image processing method and device, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114708166A (en) * 2022-04-08 2022-07-05 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and terminal
CN116245754A (en) * 2022-12-29 2023-06-09 北京百度网讯科技有限公司 Image processing method, device, electronic equipment and storage medium
CN116245754B (en) * 2022-12-29 2024-01-09 北京百度网讯科技有限公司 Image processing method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
Liu et al. Efficient single image dehazing and denoising: An efficient multi-scale correlated wavelet approach
Dai et al. Retinal fundus image enhancement using the normalized convolution and noise removing
Sun et al. Fast single image haze removal via local atmospheric light veil estimation
WO2016206087A1 (en) Low-illumination image processing method and device
Zhou et al. Retinex-based laplacian pyramid method for image defogging
CN110706174B (en) Image enhancement method, terminal equipment and storage medium
US9811882B2 (en) Method and apparatus for processing super resolution image using adaptive preprocessing filtering and/or postprocessing filtering
US9443286B2 (en) Gray image processing method and apparatus based on wavelet transformation
WO2022016326A1 (en) Image processing method, electronic device, and computer-readable medium
CN115619683B (en) Image processing method, apparatus, device, storage medium, and computer program product
CN113592776A (en) Image processing method and device, electronic device and storage medium
Ghosh et al. Saliency guided image detail enhancement
Liu et al. Joint denoising and contrast enhancement of images using graph laplacian operator
Dai et al. Dual-purpose method for underwater and low-light image enhancement via image layer separation
CN110503704B (en) Method and device for constructing three-dimensional graph and electronic equipment
CN111161177B (en) Image self-adaptive noise reduction method and device
JP2009025862A (en) Image processor, image processing method, image processing program and image display device
Xu et al. An image-enhancement method based on variable-order fractional differential operators
Pham Kriging-weighted laplacian kernels for grayscale image sharpening
Liu et al. One-dimensional image surface blur algorithm based on wavelet transform and bilateral filtering
CN114862729A (en) Image processing method, image processing device, computer equipment and storage medium
El Hassani et al. Efficient image denoising method based on mathematical morphology reconstruction and the Non-Local Means filter for the MRI of the head
Wang et al. Image enhancement
Peng et al. Detail enhancement for infrared images based on propagated image filter
CN114519675A (en) Image processing method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20945917

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20945917

Country of ref document: EP

Kind code of ref document: A1