CN111524076B - Image processing method, electronic device, and computer-readable storage medium - Google Patents
Image processing method, electronic device, and computer-readable storage medium Download PDFInfo
- Publication number
- CN111524076B CN111524076B CN202010265232.5A CN202010265232A CN111524076B CN 111524076 B CN111524076 B CN 111524076B CN 202010265232 A CN202010265232 A CN 202010265232A CN 111524076 B CN111524076 B CN 111524076B
- Authority
- CN
- China
- Prior art keywords
- image
- value
- processed
- color
- hue
- 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.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 25
- 238000002156 mixing Methods 0.000 claims abstract description 27
- 230000005764 inhibitory process Effects 0.000 claims description 25
- 238000000034 method Methods 0.000 claims description 17
- 230000001629 suppression Effects 0.000 claims description 12
- 230000008859 change Effects 0.000 claims description 11
- 238000004458 analytical method Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 5
- 230000004927 fusion Effects 0.000 claims description 3
- 238000006243 chemical reaction Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 6
- 239000000203 mixture Substances 0.000 description 4
- 230000011218 segmentation Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 239000010981 turquoise Substances 0.000 description 2
- 230000033228 biological regulation Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007500 overflow downdraw method Methods 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
- G06T5/94—Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/194—Segmentation; Edge detection involving foreground-background segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
- Facsimile Image Signal Circuits (AREA)
Abstract
The embodiment of the invention relates to the technical field of image processing, and discloses an image processing method, electronic equipment and a computer readable storage medium. In the present invention, the image processing method includes: determining a color overflow area in an image to be processed, and determining the confidence that pixels in the color overflow area are of a preset hue; the preset hue is the hue of a background color in the image to be processed; removing the background color in the image to be processed to obtain a first image; linearly mixing the first image and the image to be processed according to the confidence coefficient to obtain a second image; and correcting the brightness and the saturation of the second image to obtain a processed result image, so that the background color component reflected by the overflowed areas can be effectively restrained, and the color of some non-overflowed areas is not influenced.
Description
Technical Field
Embodiments of the present invention relate to the field of image processing technologies, and in particular, to an image processing method, an electronic device, and a computer readable storage medium.
Background
At present, a green screen matting technology plays an extremely important role in the film industry, front and rear scenery objects can be accurately separated through the green screen technology, and various special effects in the film can be realized through a later synthesis technology. In actual green curtain scene shooting, green components are easy to "spill" onto foreground objects due to the influence of scene lighting layout and foreground objects themselves, such as: 1) green curtain background reflection 2) foreground character wearing white clothes 3) foreground character hair and other hair edges 4) character body outline and edges and the like. In order to overcome the problem of "color spill", a number of color suppression methods have been proposed, and most of the main methods are RGB channel suppression, in which the main principle is to suppress the color component of the G channel or B channel (blue screen), and reduce the influence of the green or blue component
However, the inventors found that there are at least the following problems in the related art: the RGB channel suppression method can effectively suppress the background color component reflected by the color-overflowing region, but can affect the color of some non-color-overflowing regions.
Disclosure of Invention
An object of an embodiment of the present invention is to provide an image processing method, an electronic device, and a computer-readable storage medium, which make it possible to effectively suppress a background color component reflected by a color-overflowing region while not affecting the color of some non-overflowing regions.
To solve the above technical problem, an embodiment of the present invention provides an image processing method, including: determining a color overflow area in an image to be processed, and determining the confidence that pixels in the color overflow area are of a preset hue; the preset hue is the hue of a background color in the image to be processed; removing the background color in the image to be processed to obtain a first image; linearly mixing the first image and the image to be processed according to the confidence coefficient to obtain a second image; and correcting the brightness and saturation of the second image to obtain a processed result image.
The embodiment of the invention also provides electronic equipment, which comprises: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the image processing method described above.
The embodiment of the invention also provides a computer readable storage medium storing a computer program which when executed by a processor implements the image processing method described above.
Compared with the prior art, the method and the device for determining the color overflow area of the image to be processed determine the color overflow area of the image to be processed, namely distinguish the color overflow area from the non-color overflow area of the image to be processed. The confidence that the pixel in the overflow area in the image to be processed is a preset hue is determined, wherein the preset hue is the hue of the background color in the image to be processed, so that the proximity degree of the pixel to the hue of the background color can be obtained through the confidence of the pixel in the overflow area. The first image is obtained by removing the background color in the image to be processed, so that the background color component in the first image can be greatly reduced. And linearly mixing the first image and the image to be processed according to the confidence coefficient to obtain a second image, namely combining the proximity degree of the hue of the pixel in the color overflow area and the hue of the background color, and linearly mixing the first image with the background color removed and the image to be processed, namely the original image to obtain the second image, so that the background color component reflected by the second image compared with the color overflow area of the original image can be restrained to a certain degree. In addition, since the brightness and the saturation are affected to a certain extent by removing the background color in the image to be processed, the brightness and the saturation of the second image are corrected, and the processed result image is obtained, so that the brightness and the saturation affected by removing the background color can be restored by the processed result image, and the color of some non-overflow areas can be not affected while the background color component reflected by the overflow areas is inhibited.
In addition, the calculating the confidence that the pixel in the color overflow area is the preset color phase according to the HSL component value of the pixel in the color overflow area and the working interval related to the preset color phase includes: calculating the confidence that the pixels in the color overflow area are of a preset hue according to the following formula:
wherein, C is the calculated confidence, H is the hue component value of the pixel, L o ,L i ,R o ,R i And the head end gradual change starting value, the tail end gradual change ending value and the tail end gradual change ending value of the working interval on the hue circle are respectively obtained. The specific formula for calculating the confidence coefficient is provided, so that the confidence coefficient of the pixel in the color overflow area for a preset hue can be calculated accurately.
The hue estimation value is obtained as follows: acquiring an average value of H component values of pixels of a background area in the image to be processed under an HSL color space; and taking the average value of the H component values as the hue estimation value. The method for acquiring the hue estimation value is provided, the average value of the H component values of the pixels of the background area under the HSL color space is used as the hue estimation value, and the H component values of all the pixels of the background area are taken into consideration, so that the hue value of the background color is accurately estimated, and the deviation possibly caused by using the hue experience value of the background color in the prior art is avoided.
In addition, after the brightness and saturation of the second image are adjusted to obtain the processed result image, the method further includes: performing color component analysis on a background area of the image to be processed, and determining an overflow inhibition estimated value; and carrying out linear fusion on the image to be processed and the result image according to the overflow inhibition estimated value to obtain a target image. Considering that the background color of the lamplight material is often changed in the actual scene, the existing G channel overflow inhibition method does not analyze the real background color component, and overflow inhibition deficiency or overflow inhibition is easily led out. According to the embodiment of the invention, the overflow inhibition estimated value is determined by carrying out color component analysis on the background area of the image to be processed, and the image to be processed and the result image are linearly fused according to the overflow inhibition estimated value to obtain the target image, so that insufficient or excessive inhibition of overflow inhibition is avoided, and the background color component reflected by the overflow area is more accurately inhibited.
In addition, the performing color component analysis on the background area of the image to be processed to determine an overflow suppression estimated value includes: acquiring an average value of component values of pixels of a background area in the image to be processed under an HSL color space; wherein the average value of each component value comprises an average value of H component values, an average value of S component values and an average value of L component values; and calculating the overflow inhibition estimated value according to the average value of each component value in the HSL color space. The method for determining the overflow inhibition estimated value is beneficial to accurately analyzing the color components of the background area of the image to be processed by acquiring the average value of the component values of the pixels of the background area in the image to be processed under the HSL color space, and is beneficial to reasonably calculating the overflow inhibition estimated value according to the average value of the component values under the HSL color space.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings.
Fig. 1 is a flowchart of an image processing method in a first embodiment according to the present invention;
FIG. 2 is a diagram showing the relationship between the confidence of a pixel and the interval in which the H component value of the pixel is located in a first embodiment of the present invention;
fig. 3 is a flowchart of an image processing method in a second embodiment according to the present invention;
fig. 4 is a schematic structural view of an electronic device according to a third embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the following detailed description of the embodiments of the present invention will be given with reference to the accompanying drawings. However, those of ordinary skill in the art will understand that in various embodiments of the present invention, numerous technical details have been set forth in order to provide a better understanding of the present application. However, the technical solutions claimed in the present application can be implemented without these technical details and with various changes and modifications based on the following embodiments. The following embodiments are divided for convenience of description, and should not be construed as limiting the specific implementation of the present invention, and the embodiments can be mutually combined and referred to without contradiction.
A first embodiment of the present invention relates to an image processing method. Implementation details of the present embodiment are specifically described below, and the following description is provided only for facilitating understanding, and is not necessary for implementing the present embodiment. As shown in fig. 1, the flowchart of the image processing method in the present embodiment specifically includes:
step 101: and determining a color overflow area in the image to be processed, and determining the confidence that the pixels in the color overflow area are of a preset hue.
The preset hue is the hue of the background color in the image to be processed, namely the hue of the color of the background curtain in the image to be processed. For example, in a specific implementation, if the backdrop is a green curtain, the preset hue is a green hue, and if the backdrop is a blue curtain, the preset hue is a blue hue.
In one example, the manner of determining the color-spill region in the image to be processed may be: and determining a working interval with a preset hue according to the hue circle, acquiring the hue of the pixel in the image to be processed, and determining a color overflow area in the image to be processed according to whether the hue of the pixel in the image to be processed is in the working interval with the preset hue. For example, if the hue of a pixel is in a working interval associated with a preset hue, the region where the pixel is located is a color overflow region, otherwise, the region is a non-color overflow region. Taking a background curtain as a green curtain as an example, a working interval of green color correlation determined according to a hue circle can be [75 degrees, 165 degrees ], the working interval comprises hue values corresponding to greenish and green, and the greenish can comprise turquoise, turquoise and the like. The interval of the hue value corresponding to green is [105 DEG, 135 DEG ], and the rest is the interval of the hue value corresponding to greenish. In a specific implementation, the green, associated working interval may also be denoted as [75 °,105 °,135 °,165 ° ].
In one example, the manner of determining the confidence that the pixel in the overflow area is of the preset hue may be: firstly, converting RGB component values of pixels of an image to be processed into HSL component values; that is, the HSL color space conversion is performed on the image to be processed to obtain the HSL component values of the pixels of the image to be processed, and since the conversion between the RGB component values and the HSL component values belongs to the prior art, this embodiment will not be described in detail. And then, calculating the confidence that the pixel in the overflow area is the preset hue according to the HSL component value of the pixel in the overflow area and the working interval related to the preset hue. The confidence of a pixel can represent the proximity degree of the pixel and the hue of the background color, and the interval where the confidence is located is [0,1]. A confidence of 0 indicates that the pixel has no correlation with the hue of the background color; a confidence of 1 indicates that the pixel has the same hue as the background color; a confidence of (0, 1) indicates that the pixel is associated with but not the same as the hue of the background color, the closer the pixel is to the hue of the background color, the greater the confidence. It is understood that the confidence of a pixel in a color overflow area is in the range of (0, 1), and the confidence of the pixel in the color overflow area is 0, for example, taking a background screen as a green screen as an example, the working interval associated with the green color can be [75 °,165 ° ], if the hue of the pixel is between [105 °,135 ° ], the confidence of the pixel is 1, if the hue of the pixel is not between [75 °,165 ° ], the confidence of the pixel is 0, and if the hue of the pixel is between [75 °,105 ° ] or (135 °,165 ° ], the confidence can be determined according to the proximity of the hue of the pixel and the green hue.
In one example, the confidence that a pixel in a color-spill area is a preset hue can be calculated by the following formula:
wherein, C is the calculated confidence, H is the hue component value of the pixel, L o ,L i ,R o ,R i Respectively obtaining the head end gradual change start value of the working interval on the hue circle and the head end gradual change junctionBeam value, tail end gradual change start value, tail end gradual change end value. The preset hue is exemplified by a green hue, and the working interval associated with the green hue can be represented as [75 °,105 °,135 °,165 °]. For ease of understanding, reference may be made to fig. 2, which shows the relationship between the confidence of a pixel and the interval in which the H component value of that pixel lies. It is understood that each pixel in the overflow area may correspond to a confidence level.
Step 102: and removing the background color in the image to be processed to obtain a first image.
For example, if the background color in the image to be processed is the color of the green curtain, the G channel except the image to be processed may be filled with 0 value, so as to remove the green component in the image to be processed. For another example, if the background color in the image to be processed is the color of the blue curtain, the B channel except the image to be processed may be filled with 0 value, so as to remove the blue component in the image to be processed. Wherein the first image may be an image based on the HSL color space.
In one example, the background color in the image to be processed is the color of the green curtain, the G channel in the image to be processed may be first 0-value-filled, and then the image after 0-value-filling may be subjected to HSL color space conversion to obtain the first image.
Step 103: and linearly mixing the first image and the image to be processed according to the confidence coefficient to obtain a second image.
Specifically, the pixel values in the first image and the pixel values in the image to be processed can be linearly mixed according to the confidence of the pixels in the overflow area, so as to obtain the second image. It will be appreciated that the positions of the individual pixels in the first image and the image to be processed are the same, and therefore a preset region of the first image can be obtained, the relative position of the preset region in the first image being the same as the relative position of the overflow region in the image to be processed. And according to the confidence level of the pixels in the overflow area, linearly mixing the pixel values of the pixels in the preset area in the first image and the pixel values of the pixels in the overflow area in the image to be processed to obtain a second image.
In one example, the hue and saturation of the first image may be adjusted first to obtain a first adjusted image. For example, the current hue value and the current saturation value of the first image may be obtained respectively, the current hue value of the first image minus the preset hue value is used as the target hue value, and the current saturation value minus the preset saturation value is used as the target saturation value. And then respectively adjusting the hue and the saturation of the first image to the target hue value and the target saturation value to obtain a first adjusted image. The preset hue value and the preset saturation value may be set according to actual needs, for example, in this embodiment, the preset hue value may be set to 24++10°, and the preset saturation value may be set to-30++10°, but in specific implementation, the present invention is not limited thereto. After the first adjustment image is obtained, the first adjustment image and the image to be processed can be linearly mixed according to the confidence coefficient by the following formula, so as to obtain a second image:
I2=(1.0-C)*I+C*(I1_0)
wherein I2 is the pixel value of the second image, C is the confidence level, I is the pixel value of the image to be processed, and i1_0 is the pixel value of the first adjustment image. Linear blending may be understood as linear blending of pixel values of pixels in the image to be processed with pixel values of pixels in a preset area in the first adjustment image according to the confidence level of the pixels in the overflow area; the relative position of the preset area in the first adjustment image is the same as the relative position of the overflow area in the image to be processed. That is, in the present embodiment, only the pixel values of the pixels of the color overflow area in the image to be processed are adjusted.
Step 104: and correcting the brightness and saturation of the second image to obtain a processed result image.
In one example, the brightness and saturation of the second image may be modified based on empirical values of brightness and saturation to obtain a processed resultant image.
In another example, the brightness and saturation of the second image are modified, and the manner of obtaining the processed result image may be as follows:
firstly, the preset color based on HSL is emptyThe background color mixing factor between the two is converted into a background color mixing factor based on RGB color space; wherein, the background color mixing factor based on the HSL color space comprises: the hue estimation value H, the luminance estimation value L, and the saturation estimation value S, and the background color mixture factor may be expressed as (H, S, L). The luminance estimated value L and the saturation estimated value S may be set according to actual needs, in this embodiment, the luminance estimated value L may be set to 50±10, and the saturation estimated value S may be set to 50±10, but in specific implementation, the present invention is not limited thereto. RGB color space conversion of the background color mixing factor (H, S, L) based on the HSL color space to obtain a background color mixing factor (R) based on the RGB color space b ,G b ,B b ). In addition, since the conversion between the HSL color space and the RGB color space is the related art, the present embodiment does not describe the specific conversion process in detail.
In one example, the hue estimation value H in the background color mixing factor (H, S, L) may take an empirical value, such as a green shade background, and the hue estimation value H may take a green hue value, such as 120 °.
In another example, the hue estimation value in the background color mixture factor (H, S, L) is obtained as follows: acquiring an average value of H component values of pixels of a background area in an image to be processed under an HSL color space; and taking the average value of the H component values as the hue estimation value. For example, the foreground and background segmentation can be performed based on the existing segmentation technology to obtain the foreground mask image M, where the foreground and background segmentation can adopt the traditional matting technology, such as: shared-forming, close-forming, and the like. Then, according to the image to be processed and the foreground mask image, color component analysis is carried out on the background area to obtain an average value of RGB component values of pixels of the background area under the RGB color space, the average value of the RGB component values is converted into an average value of HSL component values under the HSL color space, and then the average value of the H component values is used as a hue estimation value in background color mixing factors (H, S, L). In addition, when the color component analysis is performed on the background area according to the to-be-processed image and the foreground mask image, the to-be-processed image and the foreground mask image can be firstly downsampled to obtain the to-be-processed image and the foreground mask image with preset resolution, and then the color component analysis is performed on the background area according to the to-be-processed image and the foreground mask image with preset resolution, so that the average value of H component values of pixels of the background area in the to-be-processed image under the HSL color space is obtained. Downsampling is understood to mean an equal scale reduction of the image, and the preset resolution may be smaller, for example, the longer side of the image does not exceed 320 pixels. The image to be processed and the foreground mask image are firstly downsampled, so that the execution time is shortened.
Next, the luminance and saturation of the background color mixture factor based on the RGB color space are acquired. For example, the luminance value L and the saturation value S of the background color mixture factor based on the RGB color space can be obtained by the following formula:
L=aR b +bG b +cB b
S=max(R b ,G b ,B b )-min(R b ,G b ,B b )
the specific values of a+b+c=1, a, b, and c may be set according to actual needs, and in an example, the values of a, b, and c may be as follows: a=0.3, b=0.59, c=0.11, however, in the specific implementation, this is not a limitation.
And then, respectively correcting the brightness and the saturation of the second image according to the acquired brightness value and the saturation value, and acquiring an acquired processed result image. For example, the brightness and saturation of the second image are corrected to the acquired brightness value L and saturation value S, respectively.
The above examples in this embodiment are all examples for easy understanding, and do not limit the technical configuration of the present invention.
Compared with the prior art, the method and the device for determining the color overflow area in the image to be processed determine the color overflow area in the image to be processed, namely distinguish the color overflow area and the non-color overflow area in the image to be processed. The confidence that the pixel in the overflow area in the image to be processed is a preset hue is determined, wherein the preset hue is the hue of the background color in the image to be processed, so that the proximity degree of the pixel to the hue of the background color can be obtained through the confidence of the pixel in the overflow area. The first image is obtained by removing the background color in the image to be processed, so that the background color component in the first image can be greatly reduced. And linearly mixing the first image and the image to be processed according to the confidence coefficient to obtain a second image, namely combining the proximity degree of the hue of the pixel in the color overflow area and the hue of the background color, and linearly mixing the first image with the background color removed and the image to be processed, namely the original image to obtain the second image, so that the background color component reflected by the second image compared with the color overflow area of the original image can be restrained to a certain degree. In addition, since the brightness and the saturation are affected to a certain extent by removing the background color in the image to be processed, the brightness and the saturation of the second image are corrected, and the processed result image is obtained, so that the brightness and the saturation affected by removing the background color can be restored by the processed result image, and the color of some non-overflow areas can be not affected while the background color component reflected by the overflow areas is inhibited.
A second embodiment of the present invention relates to an image processing method. The second embodiment is a further improvement of the first embodiment, and after the result image is obtained, the present embodiment further processes the result image to obtain a target image, so that insufficient or excessive suppression of overflow suppression can be avoided, thereby more accurately suppressing the background color component reflected by the overflow area. Implementation details of the present embodiment are specifically described below, and the following description is provided only for facilitating understanding, and is not necessary for implementing the present embodiment. As shown in fig. 2, the flowchart of the image processing method in the present embodiment specifically includes:
step 201: and determining a color overflow area in the image to be processed, and determining the confidence that the pixels in the color overflow area are of a preset hue.
Step 202: and removing the background color in the image to be processed to obtain a first image.
Step 203: and linearly mixing the first image and the image to be processed according to the confidence coefficient to obtain a second image.
Step 204: and correcting the brightness and saturation of the second image to obtain a processed result image.
The steps 201 to 204 are substantially the same as the steps 101 to 104 in the first embodiment, and are not repeated here.
Step 205: and carrying out color component analysis on a background area of the image to be processed, and determining an overflow inhibition estimated value.
Specifically, an average value of component values of pixels of a background area in an image to be processed in an HSL color space can be obtained; wherein the average value of each component value includes an average value of H component values, an average value of S component values, and an average value of L component values. Then, an overflow suppression estimated value is calculated from the average value of the component values in the HSL color space.
In one example, the manner of obtaining the average value of each component value in the HSL color space for the pixels of the background region in the image to be processed may be as follows: acquiring a foreground mask image corresponding to the image to be processed, and carrying out color statistics of a background area under an RGB color space according to the image to be processed and the foreground mask image to obtain the background average color of the background areaWill->Converting to HSL color space to obtain background average color +.>Wherein (1)>It can be understood that: average value of RGB component values of pixels of background area,/->It can be understood that: average value of HSL component values of pixels of the background area. In addition, at the acquisition standbyAfter the foreground mask image corresponding to the reason image, the image to be processed and the foreground mask image can be downsampled to obtain the image to be processed and the foreground mask image with preset resolution, and then the background average color of the background area is obtained by carrying out color statistics of the background area under RGB color space according to the image to be processed and the foreground mask image with preset resolution>Downsampling is understood to mean an equal scale reduction of the image, and the preset resolution may be smaller, for example, the longer side of the image does not exceed 320 pixels. The image to be processed and the foreground mask image are firstly downsampled, so that the execution time is shortened.
In one example, the overflow hold estimate may be calculated from the average of the component values in the HSL color space by: the overflow suppression estimate is calculated by the following formula:
where alpha is the calculated overflow suppression estimate,the average value of each component value in the HSL color space is respectively obtained. X is x 1 To x 7 Can be set according to actual needs, wherein x is 1 、x 2 、x 3 、x 5 Are natural numbers less than 1, x 7 A natural number greater than 1, x 5 And x 6 The value of (2) may be 50.+ -.20. In one example, x 1 To x 7 The values of (2) may be as follows: x is x 1 =0.8±0.1,x 2 =0.6±0.1,x 3 =0.35±0.1,x 4 =50±10,x 5 =0.5±0.2,x 6 =50±10,x 7 =1.767±0.2
Step 206: and linearly fusing the image to be processed and the result image according to the overflow inhibition estimated value to obtain a target image.
Specifically, the pixel value in the first image and the pixel value in the image to be processed may be linearly mixed according to the overflow suppression estimated value, so as to obtain the target image. In a specific implementation, an alpha fusion method can be used for completing the self-adaptive adjustment of overflow inhibition and obtaining a target image. For example, linear fusion may be performed according to the following formula:
I 4 =(1-α)I+αI 3
wherein I is 4 Pixel value of target image, pixel value of image to be processed, I 3 For the pixel values of the resulting image, α is the overflow suppression estimate. Linear blending can be understood as linear blending of pixel values of pixels in the same position in the image to be processed and the resulting image.
Compared with the prior art, in the embodiment, considering that the background color tends to change due to different lamplight materials in an actual scene, the existing G channel overflow inhibition method does not analyze the real background color component, and insufficient overflow inhibition or excessive overflow inhibition is easily derived. According to the embodiment of the invention, the overflow inhibition estimated value is determined by carrying out color component analysis on the background area of the image to be processed, and the image to be processed and the result image are linearly fused according to the overflow inhibition estimated value to obtain the target image, so that insufficient or excessive inhibition of overflow inhibition is avoided, and the background color component reflected by the overflow area is more accurately inhibited.
The above steps of the methods are divided, for clarity of description, and may be combined into one step or split into multiple steps when implemented, so long as they include the same logic relationship, and they are all within the protection scope of this patent; it is within the scope of this patent to add insignificant modifications to the algorithm or flow or introduce insignificant designs, but not to alter the core design of its algorithm and flow.
A third embodiment of the invention relates to an electronic device, as shown in fig. 3, comprising at least one processor 301; and a memory 302 communicatively coupled to the at least one processor 301; the memory 302 stores instructions executable by the at least one processor 301, and the instructions are executed by the at least one processor 301 to enable the at least one processor 301 to perform the image processing method according to the first or second embodiment.
Where the memory 302 and the processor 301 are connected by a bus, the bus may comprise any number of interconnected buses and bridges, the buses connecting the various circuits of the one or more processors 301 and the memory 302 together. The bus may also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or may be a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 301 is transmitted over a wireless medium via an antenna, which further receives the data and transmits the data to the processor 301.
The processor 301 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 302 may be used to store data used by processor 301 in performing operations.
A fourth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The computer program implements the above-described method embodiments when executed by a processor.
That is, it will be understood by those skilled in the art that all or part of the steps in implementing the methods of the embodiments described above may be implemented by a program stored in a storage medium, where the program includes several instructions for causing a device (which may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or part of the steps in the methods of the embodiments described herein. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples of carrying out the invention and that various changes in form and details may be made therein without departing from the spirit and scope of the invention.
Claims (9)
1. An image processing method, comprising:
determining a color overflow area in an image to be processed, and determining the confidence that pixels in the color overflow area are of a preset hue; the preset hue is the hue of a background color in the image to be processed;
removing the background color in the image to be processed to obtain a first image;
linearly mixing the first image and the image to be processed according to the confidence coefficient to obtain a second image;
correcting the brightness and saturation of the second image to obtain a processed result image;
wherein the determining the confidence that the pixel in the color overflow area is a preset hue includes: converting RGB component values of pixels of the image to be processed into HSL component values; and calculating the confidence that the pixel in the color overflow area is a preset hue according to the HSL component value of the pixel in the color overflow area and the working interval related to the preset hue.
2. The image processing method according to claim 1, wherein the calculating the confidence that the pixel in the overflow area is the preset hue according to the HSL component value of the pixel in the overflow area and the working interval associated with the preset hue includes:
calculating the confidence that the pixels in the color overflow area are of a preset hue according to the following formula:
wherein, C is the calculated confidence, H is the hue component value of the pixel, L o ,L i ,R i ,R o And the head end gradual change starting value, the tail end gradual change ending value and the tail end gradual change ending value of the working interval on the hue circle are respectively obtained.
3. The image processing method according to claim 1, wherein the linearly mixing the first image and the image to be processed according to the confidence coefficient, obtaining a second image, includes:
adjusting the hue and saturation of the first image to obtain a first adjustment image;
and linearly mixing the first adjustment image and the image to be processed according to the confidence coefficient by the following formula to obtain a second image:
I2=(1.0-C)*I+C*(I1_0)
wherein, I2 is the pixel value of the second image, C is the confidence, I is the pixel value of the image to be processed, and i1_0 is the pixel value of the first adjustment image.
4. The image processing method according to claim 1, wherein correcting the brightness and saturation of the second image to obtain a processed result image includes:
converting a preset background color mixing factor based on an HSL color space into a background color mixing factor based on an RGB color space; wherein the background color mixing factor based on the HSL color space comprises: hue estimation value, brightness estimation value and saturation estimation value;
acquiring a brightness value and a saturation value of the background color mixing factor based on the RGB color space;
and respectively correcting the brightness and the saturation of the second image according to the acquired brightness value and saturation value, and acquiring a processed result image.
5. The image processing method according to claim 4, wherein the hue estimation value is obtained by:
acquiring an average value of H component values of pixels of a background area in the image to be processed under an HSL color space;
and taking the average value of the H component values as the hue estimation value.
6. The image processing method according to claim 1, further comprising, after the adjustment of the brightness and saturation of the second image to obtain the processed result image:
performing color component analysis on a background area of the image to be processed, and determining an overflow inhibition estimated value;
and carrying out linear fusion on the image to be processed and the result image according to the overflow inhibition estimated value to obtain a target image.
7. The image processing method according to claim 6, wherein the performing color component analysis on the background area of the image to be processed to determine the overflow suppression estimate value includes:
acquiring an average value of component values of pixels of a background area in the image to be processed under an HSL color space; wherein the average value of each component value comprises an average value of H component values, an average value of S component values and an average value of L component values;
and calculating the overflow inhibition estimated value according to the average value of each component value in the HSL color space.
8. An electronic device, comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the image processing method of any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the image processing method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010265232.5A CN111524076B (en) | 2020-04-07 | 2020-04-07 | Image processing method, electronic device, and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010265232.5A CN111524076B (en) | 2020-04-07 | 2020-04-07 | Image processing method, electronic device, and computer-readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111524076A CN111524076A (en) | 2020-08-11 |
CN111524076B true CN111524076B (en) | 2023-07-21 |
Family
ID=71901261
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010265232.5A Active CN111524076B (en) | 2020-04-07 | 2020-04-07 | Image processing method, electronic device, and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111524076B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113763496B (en) * | 2021-03-19 | 2024-04-09 | 北京沃东天骏信息技术有限公司 | Method, apparatus and computer readable storage medium for image coloring |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH103549A (en) * | 1996-06-17 | 1998-01-06 | Hitachi Ltd | Device for supporting discrimination of sounding body |
US6122441A (en) * | 1994-03-31 | 2000-09-19 | Canon Kabushiki Kaisha | Image processing apparatus and method |
JP2004248020A (en) * | 2003-02-14 | 2004-09-02 | Fuji Photo Film Co Ltd | Image processor and image processing system |
CN102005060A (en) * | 2010-12-08 | 2011-04-06 | 上海杰图软件技术有限公司 | Method and device for automatically removing selected images in pictures |
CN102075666A (en) * | 2009-11-25 | 2011-05-25 | 惠普开发有限公司 | Method and device used for removing background colors from image |
AU2012203836A1 (en) * | 2011-07-05 | 2013-01-24 | Jostens, Inc | System and method for yearbook creation |
CN103177446A (en) * | 2013-03-13 | 2013-06-26 | 北京航空航天大学 | Image foreground matting method based on neighbourhood and non-neighbourhood smoothness prior |
CN103581571A (en) * | 2013-11-22 | 2014-02-12 | 北京中科大洋科技发展股份有限公司 | Video image matting method based on three elements of color |
CN105678724A (en) * | 2015-12-29 | 2016-06-15 | 北京奇艺世纪科技有限公司 | Background replacing method and apparatus for images |
CN107087123A (en) * | 2017-04-26 | 2017-08-22 | 杭州奥点科技股份有限公司 | It is a kind of that image space method is scratched based on the real-time high-definition that high in the clouds is handled |
CN110210532A (en) * | 2019-05-15 | 2019-09-06 | 北京字节跳动网络技术有限公司 | Background colour generation method, device and electronic equipment |
CN110703976A (en) * | 2019-08-28 | 2020-01-17 | 咪咕文化科技有限公司 | Clipping method, electronic device, and computer-readable storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB0220138D0 (en) * | 2002-08-30 | 2002-10-09 | Kaydara Inc | Matte extraction using fragment processors |
-
2020
- 2020-04-07 CN CN202010265232.5A patent/CN111524076B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6122441A (en) * | 1994-03-31 | 2000-09-19 | Canon Kabushiki Kaisha | Image processing apparatus and method |
JPH103549A (en) * | 1996-06-17 | 1998-01-06 | Hitachi Ltd | Device for supporting discrimination of sounding body |
JP2004248020A (en) * | 2003-02-14 | 2004-09-02 | Fuji Photo Film Co Ltd | Image processor and image processing system |
CN102075666A (en) * | 2009-11-25 | 2011-05-25 | 惠普开发有限公司 | Method and device used for removing background colors from image |
CN102005060A (en) * | 2010-12-08 | 2011-04-06 | 上海杰图软件技术有限公司 | Method and device for automatically removing selected images in pictures |
AU2012203836A1 (en) * | 2011-07-05 | 2013-01-24 | Jostens, Inc | System and method for yearbook creation |
CN103177446A (en) * | 2013-03-13 | 2013-06-26 | 北京航空航天大学 | Image foreground matting method based on neighbourhood and non-neighbourhood smoothness prior |
CN103581571A (en) * | 2013-11-22 | 2014-02-12 | 北京中科大洋科技发展股份有限公司 | Video image matting method based on three elements of color |
CN105678724A (en) * | 2015-12-29 | 2016-06-15 | 北京奇艺世纪科技有限公司 | Background replacing method and apparatus for images |
CN107087123A (en) * | 2017-04-26 | 2017-08-22 | 杭州奥点科技股份有限公司 | It is a kind of that image space method is scratched based on the real-time high-definition that high in the clouds is handled |
CN110210532A (en) * | 2019-05-15 | 2019-09-06 | 北京字节跳动网络技术有限公司 | Background colour generation method, device and electronic equipment |
CN110703976A (en) * | 2019-08-28 | 2020-01-17 | 咪咕文化科技有限公司 | Clipping method, electronic device, and computer-readable storage medium |
Non-Patent Citations (4)
Title |
---|
Dirac Quasinormal Modes of Reissner-Nodstrom Black Hole Surrounded by Quintessence;王春艳等;《Communications in Theoretical Physics》;20100515(第05期);全文 * |
一种融合图像合成的抠图算法;李闻等;《计算机应用研究》;20091215(第12期);全文 * |
基于采样抠图和自适应颜色的图像合成算法;李娜等;《液晶与显示》;20180215(第02期);全文 * |
对演播室图像质量的新认知――通过各工种合作呈现电视图像的高质量和艺术性;白宇;《现代电视技术》;20170615(第06期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111524076A (en) | 2020-08-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7057768B2 (en) | Automatic color balance | |
US8107123B2 (en) | Tone correction apparatus, mobile terminal, image capturing apparatus, mobile phone, tone correction method and program for improve local contrast in bright and dark regions | |
US8290259B2 (en) | Device adaptively switching color emphasis processing for image | |
US9055263B2 (en) | Apparatus, method and computer program for correcting an image using lookup tables generated by inputted image analysis | |
CN111062993B (en) | Color combined painting image processing method, device, equipment and storage medium | |
US9036205B2 (en) | Image processing apparatus and method for correcting luminance and saturation of a pixel in an image or of a target lattice point in a lookup table | |
CN110830778B (en) | Imaging device color correction method, imaging device color correction device, electronic device and storage medium | |
JP2003230160A (en) | Color picture saturation adjustment apparatus and method therefor | |
CN111861922A (en) | Method and device for adjusting color correction matrix and storage medium | |
JP2009290661A (en) | Image processing apparatus, image processing method, image processing program and printer | |
JP4232345B2 (en) | Program for correcting red eye in image, recording medium, and red eye correction method | |
JP2009290660A (en) | Image processing apparatus, image processing method, image processing program and printer | |
US7986833B2 (en) | Image processing method and apparatus for color enhancement and correction | |
CN109886885B (en) | Image enhancement method and system based on Lab color space and Retinex | |
JP2000224607A (en) | Image processor | |
CN111524076B (en) | Image processing method, electronic device, and computer-readable storage medium | |
US8180172B2 (en) | Image processing method | |
CN116228563A (en) | Image defogging correction method and device based on dark channel | |
CN105791710B (en) | A kind of signal lamp image enhancement processing method | |
JP2008048264A (en) | Image processing program, and image processing unit | |
JP5327766B2 (en) | Memory color correction in digital images | |
CN110086997B (en) | Face image exposure brightness compensation method and device | |
CN104681005B (en) | Color adjusting device and color adjusting method | |
TWI531246B (en) | Color adjustment method and its system | |
CN113409196B (en) | High-speed global chromatic aberration correction method for real-time video splicing |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |