Search

CN-121985086-A - Curtain matting method based on self-adaptive layering, electronic equipment and storage medium

CN121985086ACN 121985086 ACN121985086 ACN 121985086ACN-121985086-A

Abstract

The application relates to the technical field of image processing, and provides a curtain matting method based on self-adaptive layering, electronic equipment and a storage medium. The method comprises the steps of determining a pixel layering threshold of a curtain image, carrying out pixel layering on the curtain image according to the pixel layering threshold and a target color channel histogram of the curtain image, configuring layering weight values for pixels of different layers, adjusting initial distances between each pixel in the curtain image and the pixel layering threshold according to the layering weight values to obtain target distances, and carrying out image matting processing on the curtain image according to the target distances of each pixel. The application can effectively solve the problem of losing edge details in curtain matting and improves the retention of the edge details.

Inventors

  • MIN HENG
  • ZHANG YANYAN
  • KANG MIN

Assignees

  • 深圳市超像素智能科技有限公司

Dates

Publication Date
20260505
Application Date
20251219

Claims (10)

  1. 1. The curtain matting method based on the adaptive layering is characterized by comprising the following steps of: determining a pixel layering threshold of a curtain image; Performing pixel layering on the curtain image according to the pixel layering threshold and the target color channel histogram of the curtain image; Configuring layering weight values for pixels of different levels; Adjusting the initial distance between each pixel in the curtain image and the pixel layering threshold according to the layering weight value to obtain a target distance; and carrying out matting processing on the curtain image according to the target distance of each pixel.
  2. 2. The adaptive layering-based curtain matting method of claim 1 wherein determining a pixel layering threshold for a curtain image comprises: acquiring a curtain candidate region in the curtain image; Performing color depth correction on the curtain candidate region to obtain a curtain target region; and determining a pixel layering threshold according to the curtain target area.
  3. 3. The adaptive layering-based curtain matting method as claimed in claim 2, wherein said performing depth correction on the curtain candidate region to obtain a curtain target region includes: obtaining a target color channel value of each pixel in the curtain candidate area; calculating a target color channel mean value and a target color channel dispersion according to the target color channel value of each pixel; And correcting the color depth of the curtain candidate region according to the target color channel dispersion, so that the target color channel value of each pixel is adjusted to the target color channel mean value, and a curtain target region is obtained.
  4. 4. The adaptive layering-based curtain matting method as set forth in claim 3, wherein performing color depth correction on the curtain candidate region according to the target color channel dispersion, so that the target color channel value of each pixel is adjusted to the target color channel mean value, and obtaining the curtain target region includes: Determining a color depth correction coefficient according to the target color channel dispersion, wherein the color depth correction coefficient is positively correlated with the target color channel dispersion; And adjusting the target color channel value of each pixel in the curtain candidate region to the target color channel mean value according to the color depth correction coefficient to obtain a curtain target region.
  5. 5. The adaptive layering-based curtain matting method according to claim 4, wherein the adjusting the target color channel value of each pixel in the curtain candidate region toward the target color channel mean value according to the color depth correction coefficient to obtain a curtain target region includes: Acquiring a first channel difference value between a target color channel value of each pixel in the curtain candidate region and the target color channel mean value; adjusting the first channel difference value according to the color depth correction coefficient to obtain a channel adjustment value; and obtaining a curtain target area according to the target color channel value of each pixel in the curtain candidate area and the channel adjustment value.
  6. 6. The adaptive layering-based curtain matting method of any of claims 1 to 5 wherein the pixel layering threshold is determined from a target color channel mean of the curtain target region.
  7. 7. The adaptive layering-based curtain matting method of claim 1 wherein the pixel layering the curtain image according to the pixel layering threshold and a target color channel histogram of the curtain image comprises: Determining a transition interval between two peak intervals in the target color channel histogram; Judging whether the pixel layering threshold is positioned in the transition section or not; when the pixel layering threshold is positioned in the transition section, carrying out pixel layering on the curtain image according to the pixel layering threshold; And when the pixel layering threshold is not positioned in the transition section, updating the pixel layering threshold according to the transition section, and layering pixels of the curtain image according to the updated pixel layering threshold.
  8. 8. The adaptive hierarchical based curtain matting method as set forth in claim 1, wherein the matting the curtain image according to the target distance of each pixel includes: comparing the target distance of each pixel with a preset distance threshold; determining pixels corresponding to the target distance larger than the preset distance threshold as foreground pixels; and carrying out matting processing based on the foreground pixels.
  9. 9. An electronic device comprising a processor and a memory, wherein the processor is configured to implement the adaptive hierarchical based curtain matting method of any one of claims 1 to 7 when executing a computer program stored in the memory.
  10. 10. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the adaptive hierarchical based curtain matting method of any one of claims 1 to 7.

Description

Curtain matting method based on self-adaptive layering, electronic equipment and storage medium Technical Field The present application relates to the field of image processing technologies, and in particular, to a curtain matting method based on adaptive layering, an electronic device, and a storage medium. Background The curtain matting technology is used as a common image synthesis means, and is widely applied to multiple fields such as film and television production, live broadcast and commodity carrying, virtual performance and the like by separating a background from a foreground object in a shooting scene and replacing the background with a preset background to realize scene synthesis of images or videos. However, when shooting, the edge area of a foreground object is easily impregnated by the reflection of the curtain background, and the pixel classification is realized by the traditional matting technology based on the color cast distance calculation. Disclosure of Invention In view of the above, it is necessary to provide a curtain matting method, an electronic device and a storage medium based on adaptive layering, which aim to solve the technical problem that the thin edge is lost due to difficult distinction between the thin edge and the curtain caused by reflective dip dyeing of the curtain in the existing curtain matting technology. The first aspect of the application provides a curtain matting method based on adaptive layering, which comprises the following steps: determining a pixel layering threshold of a curtain image; Performing pixel layering on the curtain image according to the pixel layering threshold and the target color channel histogram of the curtain image; Configuring layering weight values for pixels of different levels; Adjusting the initial distance between each pixel in the curtain image and the pixel layering threshold according to the layering weight value to obtain a target distance; and carrying out matting processing on the curtain image according to the target distance of each pixel. Optionally, the determining the pixel layering threshold of the curtain image includes: acquiring a curtain candidate region in the curtain image; Performing color depth correction on the curtain candidate region to obtain a curtain target region; and determining a pixel layering threshold according to the curtain target area. Optionally, performing color depth correction on the curtain candidate region to obtain a curtain target region includes: obtaining a target color channel value of each pixel in the curtain candidate area; calculating a target color channel mean value and a target color channel dispersion according to the target color channel value of each pixel; And correcting the color depth of the curtain candidate region according to the target color channel dispersion, so that the target color channel value of each pixel is adjusted to the target color channel mean value, and a curtain target region is obtained. Optionally, the performing color depth correction on the curtain candidate area according to the target color channel dispersion, so that the target color channel value of each pixel is adjusted to the target color channel mean value, and obtaining the curtain target area includes: Determining a color depth correction coefficient according to the target color channel dispersion, wherein the color depth correction coefficient is positively correlated with the target color channel dispersion; And adjusting the target color channel value of each pixel in the curtain candidate region to the target color channel mean value according to the color depth correction coefficient to obtain a curtain target region. Optionally, the adjusting the target color channel value of each pixel in the curtain candidate area to the target color channel mean value according to the color depth correction coefficient, to obtain a curtain target area includes: Acquiring a first channel difference value between a target color channel value of each pixel in the curtain candidate region and the target color channel mean value; adjusting the first channel difference value according to the color depth correction coefficient to obtain a channel adjustment value; and obtaining a curtain target area according to the target color channel value of each pixel in the curtain candidate area and the channel adjustment value. Optionally, the pixel layering threshold is determined according to a target color channel mean value of the curtain target area. Optionally, the performing pixel layering on the curtain image according to the pixel layering threshold and the target color channel histogram of the curtain image includes: Determining a transition interval between two peak intervals in the target color channel histogram; Judging whether the pixel layering threshold is positioned in the transition section or not; when the pixel layering threshold is positioned in the transition section, carrying out pixel layer