CN112581380A - Image color enhancement method and device and server - Google Patents

Image color enhancement method and device and server Download PDF

Info

Publication number
CN112581380A
CN112581380A CN201910947319.8A CN201910947319A CN112581380A CN 112581380 A CN112581380 A CN 112581380A CN 201910947319 A CN201910947319 A CN 201910947319A CN 112581380 A CN112581380 A CN 112581380A
Authority
CN
China
Prior art keywords
pixel point
color information
skin
current pixel
color
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201910947319.8A
Other languages
Chinese (zh)
Inventor
鲁方波
樊鸿飞
蔡媛
汪贤
成超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
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 Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201910947319.8A priority Critical patent/CN112581380A/en
Publication of CN112581380A publication Critical patent/CN112581380A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Landscapes

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

Abstract

The invention provides a color enhancement method, a color enhancement device and a server of an image; wherein, the method comprises the following steps: detecting a human body region from an image to be processed; determining a skin area from the human body area according to preset skin color information; aiming at each pixel point in the skin area, determining a color enhancement factor of the current pixel point according to the similarity degree of the color information of the current pixel point and the skin color information; and carrying out color enhancement processing on the current pixel point according to the color enhancement factor. According to the invention, the color enhancement factor of each pixel point in the skin area is determined according to the color information of each pixel point in the skin area, and the color enhancement factor is matched with the color information of the pixel point, so that reasonable color enhancement processing can be carried out on each pixel point in the skin area, thereby avoiding excessive enhancement of the color of the skin area in the image and further improving the overall viewing effect of the image.

Description

Image color enhancement method and device and server
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method, an apparatus, and a server for enhancing color of an image.
Background
In the related art, when performing color enhancement on an image, the image may be directly processed in an RGB (Red, green, Blue, Red, green, Blue) channel, or the image may be converted into an HSV (Hue, Saturation, Value, color, brightness, Saturation) space or an HSL (Hue, Saturation, brightness) space and then subjected to color enhancement processing; in the processing process, a uniform color enhancement algorithm and parameters are generally adopted to enhance the color of all areas of the image, if human skin exists in the image, the color enhancement mode easily causes the color of the skin area to be excessively enhanced, so that the skin color is excessively natural, and the overall viewing effect of the image is influenced.
Disclosure of Invention
In view of the above, the present invention provides a color enhancement method, device and server for an image, so as to avoid over enhancement of a skin area, thereby improving the overall viewing effect of the image.
In a first aspect, an embodiment of the present invention provides a method for enhancing color of an image, where the method includes: detecting a human body region from an image to be processed; determining a skin area from the human body area according to preset skin color information; aiming at each pixel point in the skin area, determining a color enhancement factor of the current pixel point according to the similarity degree of the color information of the current pixel point and the skin color information; and carrying out color enhancement processing on the current pixel point according to the color enhancement factor.
In a preferred embodiment of the present invention, the step of detecting the human body region from the image to be processed includes: extracting brightness channel data from an image to be processed; inputting the brightness channel data into a human body detection model which is trained in advance, and outputting a human body region detection result of the image to be processed; the human body detection model is obtained by deep learning network training.
In a preferred embodiment of the present invention, the step of determining the skin region from the human body region according to the preset skin color information includes: judging whether the distance value between the color information of the current pixel point and the skin color information meets a preset threshold value or not for each pixel point in the human body area; if the preset threshold value is met, determining the current pixel point as a skin pixel point; and forming the determined all skin pixel points into a skin area.
In a preferred embodiment of the present invention, the step of determining whether the distance value between the color information of the current pixel point and the skin color information satisfies a preset threshold includes: judging whether the color information of the current pixel point is located in a preset ellipse, and if so, determining that the distance value between the color information of the current pixel point and the skin color information meets a preset threshold value; the preset ellipse takes skin color information as a central point, and a long semi-axis and a short semi-axis of the preset ellipse are preset values; or judging whether the Euclidean distance between the color information of the current pixel point and the skin color information meets a preset Euclidean distance threshold, and if the Euclidean distance threshold is met, determining that the distance value between the color information of the current pixel point and the skin color information meets the preset threshold.
In a preferred embodiment of the present invention, the step of determining whether the color information of the current pixel point is located in the preset ellipse includes: judging whether the chromatic value and the saturation value of the current pixel point meet the formula:
Figure BDA0002223895240000021
if the formula is met, determining that the color information of the current pixel point is located in a preset ellipse; wherein, U0Is a chromatic value in the skin color information; v0Is a saturation value in the skin color information; u is the chroma value of the current pixel point; v is the saturation value of the current pixel point; θ is a preset elliptical rotation angle; a is a preset value of the long half shaft; b is the preset value of the minor semi-axis.
In a preferred embodiment of the present invention, the step of determining the color enhancement factor of the current pixel according to the similarity between the color information of the current pixel and the skin color information includes: calculating the distance value between the color information of the current pixel point and the skin color information; and determining the color enhancement factor of the current pixel point according to the distance value.
In a preferred embodiment of the present invention, the step of calculating the distance value between the color information of the current pixel point and the skin color information includes: calculating the distance value between the color information of the current pixel point and the skin color information
Figure BDA0002223895240000031
Wherein, U0Is a chromatic value in the skin color information; v0Is a saturation value in the skin color information; u is the chroma value of the current pixel point; v is the saturation value of the current pixel point; θ is a preset elliptical rotation angle; a is a preset value of the long half shaft; b is a preset value of the minor semi-axis; the step of determining the color enhancement factor of the current pixel point according to the distance value comprises the following steps: determining color enhancement factor of current pixel point
Figure BDA0002223895240000032
Wherein p ═ max (1-d, 0); enhance0 is a preset initial color enhancement factor.
In a preferred embodiment of the present invention, the step of performing color enhancement processing on the current pixel point according to the color enhancement factor includes: carrying out color enhancement processing on the chromatic value of the current pixel point by the following formula: u shapeenhance(1+ enhance) × U; carrying out color enhancement processing on the saturation value of the current pixel point by the following formula: venhance=(1+enhance)*V。
In a second aspect, an embodiment of the present invention provides an apparatus for enhancing color of an image, the apparatus including: the human body region detection module is used for detecting a human body region from the image to be processed; the skin area determining module is used for determining a skin area from the human body area according to preset skin color information; the color enhancement factor determining module is used for determining the color enhancement factor of the current pixel point according to the similarity degree of the color information of the current pixel point and the skin color information aiming at each pixel point in the skin area; and the color enhancement module is used for carrying out color enhancement processing on the current pixel point according to the color enhancement factor.
In a preferred embodiment of the present invention, the skin region determining module is further configured to: judging whether the distance value between the color information of the current pixel point and the skin color information meets a preset threshold value or not for each pixel point in the human body area; if the preset threshold value is met, determining the current pixel point as a skin pixel point; and forming the determined all skin pixel points into a skin area.
In a preferred embodiment of the present invention, the color enhancement factor determining module is further configured to: calculating the distance value between the color information of the current pixel point and the skin color information; and determining the color enhancement factor of the current pixel point according to the distance value.
In a third aspect, an embodiment of the present invention provides a server, including a processor and a memory, where the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to implement the color enhancement method for the image.
In a fourth aspect, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement a method of color enhancement for an image as described above.
The embodiment of the invention has the following beneficial effects:
the invention provides a color enhancement method, a color enhancement device and a color enhancement server of an image, wherein after a human body area is detected from an image to be processed, a skin area is determined from the human body area according to preset skin color information; further, aiming at each pixel point in the skin area, determining a color enhancement factor of the current pixel point according to the similarity degree of the color information of the pixel point and the skin color information; and finally, carrying out color enhancement processing on the pixel point according to the color enhancement factor. The mode determines the color enhancement factor of each pixel point according to the color information of each pixel point in the skin area, and the color enhancement factor is matched with the color information of the pixel points, so that reasonable color enhancement processing can be performed on each pixel point in the skin area, excessive enhancement of the skin area color in the image is avoided, and the overall ornamental effect of the image is improved.
Additional features and advantages of the disclosure will be set forth in the description which follows, or in part may be learned by the practice of the above-described techniques of the disclosure, or may be learned by practice of the disclosure.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flowchart of a method for enhancing color of an image according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for enhancing color of an image according to an embodiment of the present invention;
FIG. 3 is a flow chart of another method for enhancing color of an image according to an embodiment of the present invention;
FIG. 4 is a flow chart of another method for enhancing color of an image according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an apparatus for enhancing color of an image according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
With the development of computer vision and multimedia technology, color image processing technology is receiving more and more attention. In the process of acquiring a video or an image, the acquired image is easily dim in color, poor in quality and the like under the influence of imaging equipment and ambient light. In order to improve the quality of video or image, color enhancement processing is usually performed on the video or image to improve the subjective effect of human eyes on the video or image.
There are two main types of image color enhancement methods in the related art: the first method is to perform color enhancement processing on the image directly in the RGB channels, for example, the color difference signals of R, G, B channels of the image are multiplied by enhancement coefficients and added with the original luminance information to obtain a color enhanced image; for another example, the reflection component of the image is obtained according to the color component set, and the reflection component is adjusted, so as to avoid the problems of color over-enhancement and noise of the image; the second method is to change the image into HSV space or HSL space, and achieve the purpose of color enhancement by processing the saturation components separately.
However, no matter which color enhancement method is used, a uniform color enhancement algorithm and parameters are adopted to perform color enhancement on all areas of an image, if human skin exists in the image, the color enhancement method of the image is easy to cause excessive color enhancement of the skin area in the image, so that skin color transition is unnatural, and the overall effect of the image is affected.
To facilitate understanding of the present embodiment, first, a detailed description is given to a color enhancement method for an image disclosed in the present embodiment; as shown in fig. 1, the method is applied to a server, and the method includes the following steps:
step S102, detecting a human body region from the image to be processed.
If the image to be processed contains people, the human body area can be detected from the image to be processed; specifically, training models such as deep learning and neural networks can be adopted, and the image to be processed is input into the model, so that the image to be processed marked with the human body region can be output. In most cases, the human body region may be an image region including a human body identified by a rectangular identification frame, or an irregular line may be used to identify the edge of the human body, and the region surrounded by the irregular line is used as the human body region.
And step S104, determining a skin area from the human body area according to preset skin color information.
The preset skin color information is used for indicating color information of pixel points in a skin area in the image; the skin color information may be set empirically, for example, the color information of each pixel point in the skin region is extracted from a large number of pictures and analyzed, so as to obtain standard color information that can represent the skin region, and the standard color information may be used as the skin color information. The skin color information usually includes parameters such as a chrominance value and a saturation value, and these parameters may be specific values or may be a certain range. The skin color information can be classified according to factors such as shooting environment, skin color race, illumination intensity and the like; for example, the skin color information photographed indoors and the skin color information photographed outdoors are divided according to the photographing environment; dividing the skin color information into skin color information of yellow skin, skin color information of white skin and skin color information of black skin according to skin color race; the skin color information in the high light photographing, the skin color information in the low light photographing, or the skin color information in the backlight photographing, etc. may be classified according to the illumination intensity.
The human body area may include a hair area, a skin area, a clothing area, a background area near the human body, and the like. In the process of determining the skin area from the human body area, pixels, pixel sets, pixel blocks and the like which are matched with or similar to the preset skin color multimedia message can be screened from the human body area, and the screened pixels, pixel sets and pixel blocks are combined into the skin area.
And step S106, aiming at each pixel point in the skin area, determining the color enhancement factor of the current pixel point according to the similarity degree of the color information of the current pixel point and the skin color information.
Because the human body is three-dimensional, the distribution of light on the surface of the human body is usually uneven, shadows, highlight areas, backlight areas and the like can be generated in a skin area, the skin colors of different people of the same race are different, and even the skin of different parts of the same person is also divided into different shades; however, since the skin color information is standard color information representing the skin area, the similarity between each of the skin areas and the skin color information is different depending on the above-mentioned factors, and there is a possibility that the color information of some of the skin areas is the same as the skin color information, and the color information of the area is greatly different from the skin color information although some of the skin areas belong to the skin area.
Based on the above description, the skin color information can be used as a standard, and the color enhancement factor of the pixel point is determined according to the similarity between the color information of each pixel point in the skin area and the skin color information, so as to ensure that the skin area after color enhancement still has normal skin color and has normal skin color transition.
In practical implementation, various numerical distance formulas can be adopted to calculate the similarity degree between the color information of each pixel point and the skin color information; the closer the distance is, the higher the similarity degree between the color information of the pixel point and the skin color information is; the farther the distance is, the lower the similarity degree between the color information of the pixel point and the skin color information is. In addition, the corresponding relationship between the similarity degree and the color enhancement factor may be preset, the corresponding relationship may be in the form of a table or a formula, and after the similarity degree is obtained through calculation, the color enhancement factor may be determined based on the corresponding relationship. As an example, the higher the similarity between the color information of the pixel point and the skin color information is, the smaller the color enhancement factor is; the lower the similarity degree between the color information of the pixel points and the skin color information is, the larger the color enhancement factor is; thereby protecting the color of the skin area and effectively preventing the skin area from being excessively strengthened.
And step S108, performing color enhancement processing on the current pixel point according to the color enhancement factor.
After the color enhancement factor of the pixel is determined, color enhancement processing can be performed on the pixel by adopting a related color enhancement algorithm based on the color enhancement factor, and the processing process can be directly performed on an RGB channel or an HSV space or an HSL space. For other regions of the image than the skin region, a fixed or default color enhancement factor may be used for enhancement.
The invention provides a color enhancement method of an image, which comprises the steps of detecting a human body area from an image to be processed, and then determining a skin area from the human body area according to preset skin color information; further, aiming at each pixel point in the skin area, determining a color enhancement factor of the current pixel point according to the similarity degree of the color information of the pixel point and the skin color information; and finally, carrying out color enhancement processing on the pixel point according to the color enhancement factor. The mode determines the color enhancement factor of each pixel point according to the color information of each pixel point in the skin area, and the color enhancement factor is matched with the color information of the pixel points, so that reasonable color enhancement processing can be performed on each pixel point in the skin area, excessive enhancement of the skin area color in the image is avoided, and the overall ornamental effect of the image is improved.
The embodiment of the invention also provides another image color enhancement method, which is realized on the basis of the method in the embodiment; the method mainly describes a specific process of detecting a human body region from an image to be processed, namely the following steps S202 and S204; as shown in fig. 2, the color enhancement method includes the steps of:
step S202, extracting brightness channel data from the image to be processed.
The brightness channel data contains the brightness value of each pixel point in the image to be processed. In practical implementation, the image to be processed may be converted from RGB channel to YUV space, where "Y" represents brightness; "U" represents chroma; "V" represents saturation; in the YUV space, each pixel point comprises three parameter values of a brightness value, a chromatic value and a saturation value, and then the brightness value in each pixel point is extracted to obtain the brightness channel data.
Step S204, inputting the brightness channel data into a human body detection model which is trained in advance, and outputting a human body region detection result of the image to be processed; wherein, the human body detection model is obtained by deep learning network training.
The human body detection model can be obtained through training of various deep learning networks, for example, the deep learning networks can comprise multiple network structures such as a multilayer perceptron, a convolutional neural network, a cyclic neural network and a deep confidence network. As an example, the human body detection model may be a fast-RCNN (fast-regional Convolutional Neural Networks) model, SSD (Single Shot multi box Detector), Deep Belief network (Deep Belief Neural Networks) model, or the like.
In the training process of the model, a training data set is usually collected and labeled, wherein the training data set comprises a large amount of image data labeled with a human body region; and then inputting the image data marked with the human body area into the initial model for training, and obtaining the human body detection model after the training is finished.
Step S206, according to the preset skin color information, determining a skin area from the human body area.
Step S208, aiming at each pixel point in the skin area, determining the color enhancement factor of the current pixel point according to the similarity degree of the color information of the current pixel point and the skin color information.
Step S210, performing color enhancement processing on the current pixel point according to the color enhancement factor.
In the above mode, after extracting the luminance channel data from the image to be processed, the luminance channel data is input into the human body detection model trained in advance, and the human body region detection result of the image to be processed is output; in the method, the human body area is detected only in the brightness channel, so that compared with the traditional RGB channel detection, the method reduces the calculated amount, thereby improving the calculation efficiency of the human body area detection.
The embodiment of the invention also provides another image color enhancement method, which is realized on the basis of the method in the embodiment; the method mainly describes a specific process of determining a skin area from a human body area, namely the following steps S304 to S308; as shown in fig. 3, the color enhancement method includes the steps of:
in step S302, a human body region is detected from the image to be processed.
Step S304, judging whether the distance value between the color information of the current pixel point and the preset skin color information meets a preset threshold value or not for each pixel point in the human body area; if the preset threshold is met, executing step S306; if the preset threshold is not satisfied, step S308 is performed.
The distance value between the color information of the current pixel point and the preset skin color information can be obtained by calculating various numerical distance formulas, such as an Euclidean distance formula, a cosine distance formula and the like. Taking a YUV space as an example, the color information of the current pixel point and the preset skin color information can be represented by two parameters, namely a chromatic value and a saturation value. For example, if the chroma value of the current pixel is 100 and the saturation value is 120, then the coordinates of the color information of the current pixel are represented as (100, 120); for the yellow person, the chroma value of the preset skin color information may be selected as 115, and the saturation value may be selected as 155, and then the coordinates of the skin color information are expressed as (115,155). At this time, the distance value between the two coordinates, that is, the distance value between the color information of the current pixel point and the preset skin color information, may be calculated by an euclidean distance formula or a cosine distance formula.
In a specific implementation, the determination process of whether the distance value between the color information of the current pixel point and the preset skin color information in step S304 meets the preset threshold may be implemented in one or two of the following manners:
the first method is as follows: judging whether the color information of the current pixel point is located in a preset ellipse, and if so, determining that the distance value between the color information of the current pixel point and the skin color information meets a preset threshold value; the preset ellipse takes skin color information as a central point, and a long semi-axis and a short semi-axis of the preset ellipse are preset values; and determining the current pixel points meeting the preset threshold as skin pixel points.
As can be seen from the above description, both the color information of the current pixel point and the skin color information can be represented by using a plurality of parameters; taking two parameters as an example (as described above, the chromatic value and the saturation value in the YUV space, and certainly, related parameters in other spaces may also be adopted), the color information and the skin color information of the current pixel point may both be represented by two-dimensional coordinate values; at this time, an ellipse can be drawn by using a preset major semi-axis and minor semi-axis with the coordinate value corresponding to the skin color information as a central point; if the coordinate corresponding to the color information of the current pixel point is positioned in the ellipse, the color information of the current pixel point is determined to be closer to the skin color information; and if the coordinate corresponding to the color information of the current pixel point is positioned outside the ellipse, determining that the difference between the color information of the current pixel point and the skin color information is larger.
The values of the major and minor semiaxes of the ellipse can be determined according to the color of the skin and the shooting scene, for example, if the shooting object is a yellow person and the shooting illumination is good, the value of the major half sleeve can be set to 24, and the value of the minor half sleeve can be set to 15.
In the specific implementation, the process of determining whether the color information of the current pixel point is located in the preset ellipse in the first mode may be implemented through the following steps 10 to 11:
step 10, judging whether the chromatic value and the saturation value of the current pixel point meet the following formula:
Figure BDA0002223895240000121
wherein, U0Is the color of skinA chrominance value in the information; v0Is a saturation value in the skin color information; u is the chroma value of the current pixel point; v is the saturation value of the current pixel point; θ is a preset elliptical rotation angle; a is a preset value of the long half shaft; b is the preset value of the minor semi-axis.
And 11, if the formula is met, determining that the color information of the current pixel point is located in a preset ellipse.
The above formula is an ellipse formula of a preset ellipse, and the chromatic value U of the skin color information in the formula0And saturation value V0Is preset and is a known quantity; the rotation angles of the long half shaft, the short half shaft and the ellipse of the preset ellipse are preset values; substituting the chromatic value U and the saturation value V of the pixel point in the skin area into the ellipse formula for calculation, and if the calculation result is less than or equal to 1, determining the pixel point to be a skin pixel point; and if the calculation result is larger than 1, determining that the pixel point is a non-skin pixel point if the pixel point is positioned outside the preset ellipse.
The second method comprises the following steps: judging whether the Euclidean distance between the color information of the current pixel point and the skin color information meets a preset Euclidean distance threshold value, and if the Euclidean distance meets the preset Euclidean distance threshold value, determining that the distance value between the color information of the current pixel point and the skin color information meets the preset threshold value.
The Euclidean distance between the color information of the current pixel point and the skin color information can be expressed as
Figure BDA0002223895240000122
Wherein, U0Is a chromatic value in the skin color information; v0Is a saturation value in the skin color information; u is the chroma value of the current pixel point; and V is the saturation value of the current pixel point.
If the Euclidean distance D meets a preset threshold value, determining the current pixel point as a skin pixel point; otherwise, the current pixel point is a non-skin pixel point.
Step S306, determining the current pixel points as skin pixel points; forming a skin area by all the determined skin pixel points; step S310 is performed.
In the process of performing the above steps S304 and S306, the steps S304 and S306 are usually performed once for each pixel point in the human region, and thus the process usually needs to be implemented in multiple cycles.
Step S308, determining the current pixel point as a non-skin pixel point, and performing color enhancement processing on the current pixel point through a preset initial color enhancement factor; and (6) ending.
Aiming at non-skin pixel points, color enhancement can be generally carried out through a preset initial color enhancement factor; for a skin pixel, the initial color enhancement factor needs to be modified to a color enhancement factor matched with the color information of the skin pixel, so as to avoid over-enhancement of the color of the skin region, and the initial color enhancement factor is usually a fixed or default color enhancement factor.
Step S310, aiming at each skin pixel point in the skin area, determining a color enhancement factor of the current skin pixel point according to the similarity degree of the color information of the current skin pixel point and the skin color information.
Step S312, performing color enhancement processing on the current skin pixel according to the color enhancement factor.
In the above manner, after a human body region is detected from an image to be processed, whether the distance value between the color information of the current pixel point and the preset skin color information meets a preset threshold value is judged for each pixel point in the human body region; determining current pixel points meeting a preset threshold as skin pixel points; then determining the color enhancement factor of the skin pixel points according to the calculated similarity degree of the color information of each skin pixel point and the skin color information; and finally, carrying out color enhancement treatment on the skin pixel points through the color enhancement factors, and carrying out color enhancement treatment on the non-skin pixel points through the initial color enhancement factors. The method can effectively distinguish the skin pixel points and the non-skin pixel points, and color enhancement is carried out on the skin pixel points and the non-skin pixel points to different degrees, so that excessive enhancement of the color of the skin area is avoided, the skin area of a human body is in transition nature, and the whole color effect of the image is improved.
The embodiment of the invention also provides another image color enhancement method, which is realized on the basis of the method in the embodiment; the method mainly describes a specific process of determining the color enhancement factor of each pixel point in the skin area, namely the following steps S406 to S410; as shown in fig. 4, the color enhancement method includes the steps of:
in step S402, a human body region is detected from the image to be processed.
Step S404, according to the preset skin color information, determining a skin area from the human body area.
Step S406, calculating a distance value between the color information of the current pixel and the preset skin color information for each pixel in the skin area.
Step S408, determining the color enhancement factor of the current pixel point according to the distance value;
because the distance value represents the similarity between the color information of the current pixel point and the preset skin color information, in order to protect the color of the skin region, in one mode, the relationship between the color enhancement factor and the distance value can be set as a direct proportional relationship, and the relationship can also be understood as: the smaller the distance value between the color information of the current pixel point and the preset skin color information is, the smaller the obtained color enhancement factor is.
In specific implementation, for example, the color information and the skin color information of the current pixel point include a chrominance value and a saturation value in a YUV space, the step S408 may be implemented by the following steps 20 to 21:
step 20, calculating the distance value between the color information of the current pixel point and the skin color information
Figure BDA0002223895240000141
Wherein, U0Is a chromatic value in the skin color information; v0Is a saturation value in the skin color information; u is the chroma value of the current pixel point; v is the saturation value of the current pixel point; θ is a preset elliptical rotation angle; a is a preset value of the long half shaft; b is the preset value of the minor semi-axis.
And aiming at the chromatic values and saturation values of the current pixel points and the skin color information, the distance value d can be obtained through the formula, and the distance value represents the similarity degree of the color information of the current pixel points and the skin color information.
Step 21, determining the color enhancement factor of the current pixel point according to the distance value
Figure BDA0002223895240000151
Wherein p ═ max (1-d, 0); enhance0 is a preset initial color enhancement factor.
P in the above formula may also be referred to as a skin color probability value, and in general, the larger the distance value d is, the smaller the skin color probability value p is, and the value range of p is usually 0 to 1; according to the formula of the color enhancement factor, under the condition that the skin color probability value is 0, the color enhancement factor is equal to the initial color enhancement factor; under the condition that the skin color probability value is 1, the color enhancement factor is one third of the initial color enhancement factor; based on this, the larger the skin color probability value is, the smaller the color enhancement factor is, that is, the smaller the distance value between the color information of the current pixel point and the skin color information is, the smaller the color enhancement factor is, and it can also be understood that the more similar the color information of the pixel point and the skin color information is, the smaller the color enhancement factor is, thereby protecting the color of the skin region.
Step S410, color enhancement processing is carried out on the current pixel point according to the color enhancement factor.
In a specific implementation, in the YUV space, the step S410 can be implemented by the following steps 30 to 31:
step 30, performing color enhancement processing on the chromatic value of the current pixel point through the following formula:
Uenhance=(1+enhance)*U
step 31, performing color enhancement processing on the saturation value of the current pixel point through the following formula:
Venhance=(1+enhance)*V
the color information of each pixel point of the skin area comprises a chromatic value and a saturation value, and the chromatic value and the saturation value of the current pixel point can be respectively subjected to color enhancement to improve the overall color effect of the image.
The method comprises the steps of enhancing skin pixel points of a U channel and a V channel respectively through color enhancement factors, enhancing non-skin pixel points through preset initial color enhancement factors, and finally converting enhanced data of the U channel and the V channel and original data of a Y channel into RGB channels to obtain color-enhanced image data.
In the above mode, firstly, a human body region is detected from an image to be processed; determining a skin area from the human body area according to preset skin color information; then, for each pixel point in the skin area, calculating a distance value between the color information of the current pixel point and preset skin color information, and determining a color enhancement factor of the current pixel point according to the distance value; and finally, carrying out color enhancement processing on the current pixel point according to the color enhancement factor. The method can protect the color of the skin area, avoid the excessive enhancement of the color of the skin area and improve the overall color effect of the image.
Corresponding to the above method embodiment, an embodiment of the present invention provides a color enhancement apparatus for an image, as shown in fig. 5, the apparatus includes:
a human body region detection module 50, configured to detect a human body region from the image to be processed;
a skin region determining module 51, configured to determine a skin region from a human body region according to preset skin color information;
a color enhancement factor determining module 52, configured to determine, for each pixel point in the skin region, a color enhancement factor of the current pixel point according to a similarity between color information of the current pixel point and skin color information;
and the color enhancement module 53 is configured to perform color enhancement processing on the current pixel point according to the color enhancement factor.
The color enhancement device of the image detects a human body area from the image to be processed, and then determines a skin area from the human body area according to preset skin color information; further, aiming at each pixel point in the skin area, determining a color enhancement factor of the current pixel point according to the similarity degree of the color information of the current pixel point and the skin color information; and finally, carrying out color enhancement processing on the current pixel point according to the color enhancement factor. The mode determines the color enhancement factor of each pixel point according to the color information of each pixel point in the skin area, and the color enhancement factor is matched with the color information of the pixel points, so that reasonable color enhancement processing can be performed on each pixel point in the skin area, excessive enhancement of the skin area color in the image is avoided, and the overall ornamental effect of the image is improved.
Further, the skin region determination module is further configured to: judging whether the distance value between the color information of the current pixel point and the skin color information meets a preset threshold value or not for each pixel point in the human body area; if the preset threshold value is met, determining the current pixel point as a skin pixel point; and forming the determined all skin pixel points into a skin area.
Further, the color enhancement factor determining module is further configured to: calculating the distance value between the color information of the current pixel point and the skin color information; and determining the color enhancement factor of the current pixel point according to the distance value.
The color enhancement device for images provided by the embodiment of the present invention has the same implementation principle and technical effect as the foregoing method embodiments, and for brief description, reference may be made to the corresponding contents in the foregoing method embodiments for the parts of the embodiment of the device that are not mentioned.
The embodiment of the invention also provides a server for operating the color enhancement method of the image; referring to fig. 6, the server includes a processor 101 and a memory 100, the memory 100 stores machine executable instructions capable of being executed by the processor 101, and the processor 101 executes the machine executable instructions to implement the color enhancement method of the image.
Further, the server shown in fig. 6 further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103 and the memory 100 are connected through the bus 102.
The Memory 100 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 102 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 6, but that does not indicate only one bus or one type of bus.
The processor 101 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 101. The Processor 101 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100, and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The embodiment of the present invention further provides a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the color enhancement method for the image, and specific implementation may refer to method embodiments, and is not described herein again.
The color enhancement method and apparatus for an image and the computer program product of an electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (13)

1. A method of color enhancement of an image, the method comprising:
detecting a human body region from an image to be processed;
determining a skin area from the human body area according to preset skin color information;
aiming at each pixel point in the skin area, determining a color enhancement factor of the current pixel point according to the similarity degree of the color information of the current pixel point and the skin color information;
and carrying out color enhancement processing on the current pixel point according to the color enhancement factor.
2. The method according to claim 1, wherein the step of detecting a human body region from the image to be processed comprises:
extracting brightness channel data from the image to be processed;
inputting the brightness channel data into a human body detection model trained in advance, and outputting a human body region detection result of the image to be processed; the human body detection model is obtained by adopting deep learning network training.
3. The method according to claim 1, wherein the step of determining a skin region from the body region according to preset skin color information comprises:
judging whether the distance value between the color information of the current pixel point and the skin color information meets a preset threshold value or not aiming at each pixel point in the human body area;
if the current pixel point meets a preset threshold value, determining the current pixel point as a skin pixel point;
and forming the determined all skin pixel points into a skin area.
4. The method of claim 3, wherein the step of determining whether the distance between the color information of the current pixel and the skin color information satisfies a predetermined threshold comprises:
judging whether the color information of the current pixel point is located in a preset ellipse, and if so, determining that the distance value between the color information of the current pixel point and the skin color information meets a preset threshold value; the skin color information is used as a central point of the preset ellipse, and a long semi-axis and a short semi-axis of the preset ellipse are preset values;
or, judging whether the Euclidean distance between the color information of the current pixel point and the skin color information meets a preset Euclidean distance threshold, and if the Euclidean distance threshold is met, determining that the distance value between the color information of the current pixel point and the skin color information meets the preset threshold.
5. The method of claim 4, wherein the step of determining whether the color information of the current pixel point is located within the preset ellipse comprises:
judging whether the chromatic value and the saturation value of the current pixel point meet the following formula:
Figure FDA0002223895230000021
if the formula is met, determining that the color information of the current pixel point is located in a preset ellipse; wherein, U0Is a chrominance value in the skin color information; v0Is a saturation value in the skin color information; u is the chroma value of the current pixel point; v is the saturation value of the current pixel point; θ is a preset elliptical rotation angle; a is a preset value of the long half shaft; b is the preset value of the minor semi-axis.
6. The method of claim 1, wherein the step of determining the color enhancement factor of the current pixel according to the similarity between the color information of the current pixel and the skin color information comprises:
calculating the distance value between the color information of the current pixel point and the skin color information;
and determining the color enhancement factor of the current pixel point according to the distance value.
7. The method of claim 6, wherein the step of calculating the distance value between the color information of the current pixel and the skin color information comprises:
calculating the distance value between the color information of the current pixel point and the skin color information
Figure FDA0002223895230000022
Wherein, U0Is a chrominance value in the skin color information; v0Is a saturation value in the skin color information; u is the chroma value of the current pixel point; v is the saturation value of the current pixel point; θ is a preset elliptical rotation angle; a is a preset value of the long half shaft; b is a preset value of the minor semi-axis;
the step of determining the color enhancement factor of the current pixel point according to the distance value comprises the following steps:
determining a color enhancement factor for the current pixel point
Figure FDA0002223895230000031
Wherein p ═ max (1-d, 0); enhance0 is a preset initial color enhancement factor.
8. The method of claim 7, wherein the step of performing color enhancement processing on the current pixel according to the color enhancement factor comprises:
carrying out color enhancement processing on the chromatic value of the current pixel point by the following formula:
Uenhance=(1+enhance)*U;
carrying out color enhancement processing on the saturation value of the current pixel point by the following formula:
Venhance=(1+enhance)*V。
9. an apparatus for color enhancement of an image, the apparatus comprising:
the human body region detection module is used for detecting a human body region from the image to be processed;
the skin area determining module is used for determining a skin area from the human body area according to preset skin color information;
the color enhancement factor determining module is used for determining the color enhancement factor of the current pixel point according to the similarity degree of the color information of the current pixel point and the skin color information aiming at each pixel point in the skin area;
and the color enhancement module is used for carrying out color enhancement processing on the current pixel point according to the color enhancement factor.
10. The apparatus of claim 9, wherein the skin region determination module is further configured to:
judging whether the distance value between the color information of the current pixel point and the skin color information meets a preset threshold value or not aiming at each pixel point in the human body area;
if the current pixel point meets a preset threshold value, determining the current pixel point as a skin pixel point;
and forming the determined all skin pixel points into a skin area.
11. The apparatus of claim 9, wherein the color enhancement factor determination module is further configured to:
calculating the distance value between the color information of the current pixel point and the skin color information;
and determining the color enhancement factor of the current pixel point according to the distance value.
12. A server comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement a method of color enhancement of an image according to any one of claims 1 to 8.
13. A machine-readable storage medium having stored thereon machine-executable instructions which, when invoked and executed by a processor, cause the processor to implement a method of color enhancement of an image according to any one of claims 1 to 8.
CN201910947319.8A 2019-09-30 2019-09-30 Image color enhancement method and device and server Pending CN112581380A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910947319.8A CN112581380A (en) 2019-09-30 2019-09-30 Image color enhancement method and device and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910947319.8A CN112581380A (en) 2019-09-30 2019-09-30 Image color enhancement method and device and server

Publications (1)

Publication Number Publication Date
CN112581380A true CN112581380A (en) 2021-03-30

Family

ID=75117167

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910947319.8A Pending CN112581380A (en) 2019-09-30 2019-09-30 Image color enhancement method and device and server

Country Status (1)

Country Link
CN (1) CN112581380A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113947553A (en) * 2021-12-20 2022-01-18 山东信通电子股份有限公司 Image brightness enhancement method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050089220A1 (en) * 2003-09-01 2005-04-28 Samsung Electronics Co., Ltd. Method and apparatus for adjusting color of image
CN104767983A (en) * 2015-03-19 2015-07-08 华为技术有限公司 Picture processing method and device
CN106096588A (en) * 2016-07-06 2016-11-09 北京奇虎科技有限公司 The processing method of a kind of view data, device and mobile terminal
US20170213073A1 (en) * 2016-01-27 2017-07-27 Samsung Electronics Co., Ltd. Electronic apparatus and controlling method thereof
CN110009588A (en) * 2019-04-09 2019-07-12 成都品果科技有限公司 A kind of portrait image color enhancement method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050089220A1 (en) * 2003-09-01 2005-04-28 Samsung Electronics Co., Ltd. Method and apparatus for adjusting color of image
CN104767983A (en) * 2015-03-19 2015-07-08 华为技术有限公司 Picture processing method and device
US20170213073A1 (en) * 2016-01-27 2017-07-27 Samsung Electronics Co., Ltd. Electronic apparatus and controlling method thereof
CN106096588A (en) * 2016-07-06 2016-11-09 北京奇虎科技有限公司 The processing method of a kind of view data, device and mobile terminal
CN110009588A (en) * 2019-04-09 2019-07-12 成都品果科技有限公司 A kind of portrait image color enhancement method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113947553A (en) * 2021-12-20 2022-01-18 山东信通电子股份有限公司 Image brightness enhancement method and device
CN113947553B (en) * 2021-12-20 2022-03-18 山东信通电子股份有限公司 Image brightness enhancement method and device

Similar Documents

Publication Publication Date Title
CN107451969B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107424198B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
US20190130169A1 (en) Image processing method and device, readable storage medium and electronic device
CN108875619B (en) Video processing method and device, electronic equipment and computer readable storage medium
CN103973977B (en) Virtualization processing method, device and the electronic equipment of a kind of preview interface
WO2015070723A1 (en) Eye image processing method and apparatus
CN107507144B (en) Skin color enhancement processing method and device and image processing device
CN107993209B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN112819702B (en) Image enhancement method, image enhancement device, electronic equipment and computer readable storage medium
CN106611415B (en) Skin region detection method and device
CN105243371A (en) Human face beauty degree detection method and system and shooting terminal
CN111754528A (en) Portrait segmentation method, portrait segmentation device, electronic equipment and computer-readable storage medium
CN111627076B (en) Face changing method and device and electronic equipment
US8737762B2 (en) Method for enhancing image edge
US9378564B2 (en) Methods for color correcting digital images and devices thereof
TWI693576B (en) Method and system for image blurring processing
CN111368819B (en) Light spot detection method and device
CN112329851B (en) Icon detection method and device and computer readable storage medium
CN113301318B (en) Image white balance processing method and device, storage medium and terminal
CN111163301B (en) Color adjustment method, device and computer readable storage medium
CN111626967A (en) Image enhancement method, image enhancement device, computer device and readable storage medium
CN107564085B (en) Image warping processing method and device, computing equipment and computer storage medium
CN110175967B (en) Image defogging processing method, system, computer device and storage medium
JP2009038737A (en) Image processing apparatus
CN116263942A (en) Method for adjusting image contrast, storage medium and computer program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination