CN-122002142-A - Image blurring method, electronic device, and computer-readable storage medium
Abstract
The application discloses an image blurring method, electronic equipment and a computer readable storage medium, and relates to the technical field of image processing, wherein the image blurring method comprises the steps of obtaining pixel depth information of each pixel point in an image to be blurring and determining depth-of-field range parameters of a main body area in the image to be blurring; determining a first filter coefficient corresponding to each pixel point in the image to be virtualized according to the pixel depth information and the depth-of-field range parameter, wherein the farther the pixel point is from the focal plane of the main body area, the larger the first filter coefficient corresponding to the pixel point is; and carrying out pixel blurring processing on each pixel point in the image to be blurring based on a first filter coefficient corresponding to each pixel point, wherein the first filter coefficient and the pixel blurring degree are positively correlated. The application can effectively ensure the clear segmentation and reasonable coverage of the main body in the depth of field and the front and rear backgrounds outside the depth of field, and highlight the definition of the main body in the depth of field.
Inventors
- ZHANG HAOYUAN
- CHEN WEI
- LIU YUAN
Assignees
- 深圳市中兴微电子技术有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241029
Claims (10)
- 1. A method of image blurring, comprising: Acquiring pixel depth information of each pixel point in an image to be virtualized, and determining a depth-of-field range parameter of a main area in the image to be virtualized; Determining a first filter coefficient corresponding to each pixel point in the image to be virtualized according to the pixel depth information and the depth-of-field range parameter, wherein the farther the pixel point is from the focal plane of the main body area, the larger the first filter coefficient corresponding to the pixel point is; And carrying out pixel blurring processing on each pixel point in the image to be blurring based on a first filter coefficient corresponding to each pixel point, wherein the first filter coefficient and the pixel blurring degree are positively correlated.
- 2. The image blurring method of claim 1 wherein performing pixel blurring processing on each pixel point in the image to be blurred based on a first filter coefficient corresponding to each pixel point comprises: taking each pixel point in the image to be virtualized as a central pixel respectively, and determining a neighborhood pixel corresponding to each central pixel; Determining a second filter coefficient corresponding to each pixel point in the image to be blurred according to the pixel depth difference information between each center pixel and the corresponding neighborhood pixel; Performing pixel blurring processing on each pixel point in the image to be blurring based on a first filter coefficient and a second filter coefficient corresponding to each pixel point; The first filter coefficient is positively correlated with the pixel blurring degree under the condition that the second filter coefficient is unchanged, and the second filter coefficient is positively correlated with the pixel blurring degree under the condition that the first filter coefficient is unchanged.
- 3. The image blurring method of claim 2 wherein determining the second filter coefficients corresponding to each pixel point in the image to be blurring according to the pixel depth difference information between each center pixel and its corresponding neighborhood pixel comprises: Comparing the first depth value of the center pixel with the second depth value of the corresponding neighborhood pixel based on the pixel depth difference information; Under the condition that the first depth value is smaller than the second depth value, determining a second filter coefficient corresponding to each pixel point in the image to be blurred from a first preset table look-up function based on the first depth value and the second depth value; And under the condition that the first depth value is larger than or equal to the second depth value, determining a second filter coefficient corresponding to each pixel point in the image to be blurred from a second preset table look-up function based on the first depth value.
- 4. The image blurring method of claim 1 wherein the first filter coefficients corresponding to each pixel point comprise a first blurring coefficient for each pixel point in a foreground region and a second blurring coefficient for each pixel point in a background region; According to the pixel depth information and the depth range parameter, determining a first filter coefficient corresponding to each pixel point in the image to be blurred, including: Determining a foreground region and a background region in the image to be virtualized according to the pixel depth information and the depth range parameter; And determining a first blurring coefficient of each pixel point in the foreground region based on a first preset table look-up function, and determining a second blurring coefficient of each pixel point in the background region based on a second preset table look-up function, wherein the first blurring coefficient is positively correlated with the blurring degree of the pixel, and the second blurring coefficient is positively correlated with the blurring degree of the pixel.
- 5. The image blurring method of claim 4 wherein performing image blurring processing on each pixel point in the image to be blurred based on a first filter coefficient corresponding to each pixel point comprises: performing pixel blurring processing on each pixel point in the foreground region based on the first blurring coefficient to obtain a foreground region image after the pixel blurring processing, and Performing pixel blurring processing on each pixel point in the background area based on the second blurring coefficient to obtain a background area image after the pixel blurring processing; And acquiring a main body region image of a main body region in the image to be virtualized, and fusing the main body region image with the foreground region image and the background region image which are subjected to pixel blurring processing to obtain a target blurring image.
- 6. The image blurring method of claim 1 wherein prior to obtaining pixel depth information for each pixel point in the image to be blurring comprises: Acquiring an initial image, and performing image preprocessing on the initial image to obtain an image to be virtualized; Wherein the image preprocessing includes at least one of image smoothing processing, image noise reduction processing, up-sampling processing, and down-sampling processing.
- 7. The image blurring method of any of claims 1 to 6 wherein determining a depth of field range parameter for a subject region in the image to be blurring comprises: Acquiring a focusing area in the image to be virtualized, and determining a depth-of-field range parameter of a main area in the image to be virtualized according to the depth information of each pixel point in the focusing area, or And determining a main body region in the image to be virtualized according to the input parameters corresponding to the depth main body, and determining the depth range parameters of the main body region in the image to be virtualized according to the depth information of each pixel point in the main body region.
- 8. An electronic device comprising a memory, a processor and an image blurring program stored on the memory and executable on the processor, the image blurring program, when executed by the processor, implementing the steps of the image blurring method according to any of claims 1 to 7.
- 9. A computer-readable storage medium, on which an image blurring program is stored, which when executed by a processor implements the steps of the image blurring method according to any of claims 1 to 7.
- 10. A computer program product, characterized in that the computer program product comprises an image blurring program which, when executed by a processor, implements the steps of the image blurring method according to any of claims 1 to 7.
Description
Image blurring method, electronic device, and computer-readable storage medium Technical Field The present application relates to the field of image processing technologies, and in particular, to an image blurring method, an electronic device, and a computer readable storage medium. Background Background blurring is a process of blurring a background portion in an image to clearly display a foreground portion, and is a widely used photographing means capable of highlighting a subject and expressing visual aesthetic feeling. Some professional cameras can directly shoot images with virtual backgrounds, but the requirements on the aperture and zoom multiple of the camera lens are high. For a camera of an electronic device such as a mobile phone or a tablet computer, the lens performance of the camera cannot match with that of a professional camera due to the limitation of the volume, the thickness and other factors of the device, so that an image with a virtual background cannot be directly shot. For this reason, image processing software is required to implement background blurring of an image. Some ways of digital image blurring processing have been proposed in the related art, for example, real-time rendering (render) based on a digital image Processor (ISP, image Signal Processor) system to obtain an online image blurring function. However, in the digital image blurring mode, mutual halation (bleeding) between a main body and a blurring front and back background in the depth of field easily occurs, so that the edge definition of the main body is insufficient, and the front and back rendering hierarchical relationship of the distance from the shooting equipment in real optical imaging is usually ignored. That is, the blurred image in the related art is prone to the problems of blurring and unnatural transition of the boundary between the depth of field main body and the front and rear backgrounds, such as color leakage and blurring discontinuity of the front and rear backgrounds. Disclosure of Invention The application mainly aims to provide an image blurring method, electronic equipment and a computer readable storage medium, and aims to solve the technical problems that a blurring boundary between a depth of field main body and front and rear backgrounds and unnatural transition are easy to occur in a blurred image in the related technology. In order to achieve the above object, the present application provides an image blurring method, including: Acquiring pixel depth information of each pixel point in an image to be virtualized, and determining a depth-of-field range parameter of a main area in the image to be virtualized; Determining a first filter coefficient corresponding to each pixel point in the image to be virtualized according to the pixel depth information and the depth-of-field range parameter, wherein the farther the pixel point is from the focal plane of the main body area, the larger the first filter coefficient corresponding to the pixel point is; And carrying out pixel blurring processing on each pixel point in the image to be blurring based on a first filter coefficient corresponding to each pixel point, wherein the first filter coefficient and the pixel blurring degree are positively correlated. In addition, in order to achieve the above object, the present application also provides an electronic device including a memory, a processor, and an image blurring program stored on the memory and executable on the processor, the image blurring program implementing the steps of the image blurring method as described above when executed by the processor. In addition, in order to achieve the above object, the present application also provides a computer-readable storage medium having stored thereon an image blurring program which, when executed by a processor, implements the steps of the image blurring method as described above. Furthermore, to achieve the above object, the present application provides a computer program product comprising an image blurring program which, when executed by a processor, implements the steps of the image blurring method as described above. The embodiment of the application provides an image blurring method, electronic equipment and a computer readable storage medium, the technical scheme of the embodiment of the application is that pixel blurring processing is carried out on each pixel point in an image to be blurring by acquiring the pixel Depth information of each pixel point in the image to be blurring and determining the Depth of field range parameter of a main body area in the image to be blurring, and according to the pixel Depth information and the Depth of field range parameter, determining a first filter coefficient corresponding to each pixel point in the image to be blurring, wherein the farther the pixel point is from a focal plane of the main body area, the larger the first filter coefficient corresponding to the pixel point is, then the pixel blurring