Image blurring methods, computer devices, computer-readable storage media

By acquiring the parallax information of the target image and the reference image, and combining it with the luminance channel image and focus information, the problem of light spot color difference in RGB color space bokeh processing is solved, achieving a high-quality bokeh effect.

CN114693507BActive Publication Date: 2026-04-03WUHAN TCL CORP RES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-30
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing technologies, when performing image blurring based on the RGB color space, the brightness information of the image cannot be accurately reflected, resulting in light spots and color differences in the blurred image.

Method used

By acquiring the parallax information of the target image and the reference image, and combining it with the luminance channel image and focus information, the blurring information is determined, and the luminance channel image is used for blurring processing to avoid color difference.

Benefits of technology

This ensures that the light spots in the blurred image do not exhibit color differences, thus improving the quality of the blurred image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114693507B_ABST
    Figure CN114693507B_ABST
Patent Text Reader

Abstract

This application relates to an image blurring method, a computer device, and a computer-readable storage medium. The image blurring method includes: acquiring a target image, a reference image, and focus information; determining parallax information based on the target image and the reference image; determining blurring information based on the luminance channel image of the target image, the parallax information, and the focus information; and determining a blurred image based on the blurring information and the target image. First, the parallax information corresponding to the target image is determined based on the target image and the reference image. Then, the blurring information corresponding to the target image is determined based on the luminance channel image, the parallax information, and the focus information. Finally, the blurred image corresponding to the target image is determined based on the blurring information and the target image. Because a luminance channel image is used, which accurately reflects the luminance information of the image, the obtained blurring information is more accurate, thereby ensuring that the light spots in the blurred image do not exhibit color difference problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image blurring method, a computer device, and a computer-readable storage medium. Background Technology

[0002] Dual cameras are increasingly being used in mobile devices, such as dual-camera smartphones. The bokeh effect in dual-camera smartphones can produce blurred images. For example, by simulating the large aperture mode of a DSLR camera, dual-camera smartphones can make the foreground stand out more while blurring the background, creating a bokeh effect.

[0003] In existing technologies, when blurring images, brightness amplification transformation is used to achieve the spot effect during the blurring process based on the image's RGB color space. However, when performing brightness amplification transformation based on the RGB color space, the RGB color space of the image cannot accurately reflect the brightness information of the image, resulting in color difference in the spot in the blurred image.

[0004] Therefore, existing technologies need to be improved. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide an image blurring method, a computer device, and a computer-readable storage medium, in order to address the shortcomings of the prior art.

[0006] On one hand, embodiments of the present invention provide an image blurring method, including:

[0007] Acquire the target image, the reference image corresponding to the target image, and the focus information corresponding to the target image;

[0008] Based on the target image and the reference image, determine the disparity information corresponding to the target image;

[0009] Based on the luminance channel image of the target image, the parallax information, and the focus information, determine the blurring information corresponding to the target image;

[0010] Based on the blurring information and the target image, determine the blurring image corresponding to the target image.

[0011] In a second aspect, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0012] Acquire the target image, the reference image corresponding to the target image, and the focus information corresponding to the target image;

[0013] Based on the target image and the reference image, determine the disparity information corresponding to the target image;

[0014] Based on the luminance channel image of the target image, the parallax information, and the focus information, determine the blurring information corresponding to the target image;

[0015] Based on the blurring information and the target image, determine the blurring image corresponding to the target image.

[0016] Thirdly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the following steps:

[0017] Acquire the target image, the reference image corresponding to the target image, and the focus information corresponding to the target image;

[0018] Based on the target image and the reference image, determine the disparity information corresponding to the target image;

[0019] Based on the luminance channel image of the target image, the parallax information, and the focus information, determine the blurring information corresponding to the target image;

[0020] Based on the blurring information and the target image, determine the blurring image corresponding to the target image.

[0021] Compared with the prior art, the embodiments of the present invention have the following advantages: In this embodiment, the parallax information corresponding to the target image is first determined based on the target image and the reference image, and the bokeh information corresponding to the target image is determined based on the luminance channel image of the target image, the parallax information and the focus information. Then, the bokeh image corresponding to the target image is determined based on the bokeh information and the target image. Since the luminance channel image is used instead of the RGB channel image, the luminance channel image can accurately reflect the luminance information of the image. Therefore, the obtained bokeh information is more accurate, thereby ensuring that the light spots of the bokeh image will not have color difference problems. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a diagram illustrating the application environment of the image blurring method in this embodiment of the invention.

[0024] Figure 2 This is a schematic diagram of the fuzzy kernel in an embodiment of the present invention;

[0025] Figure 3 The image is a blurred image obtained by the image blurring method in this embodiment of the invention;

[0026] Figure 4 for Figure 3 Enlarged view of the area within the dashed box;

[0027] Figure 5 This refers to the blurred image obtained by existing image blurring methods.

[0028] Figure 6 for Figure 5 Enlarged view of the area within the dashed box;

[0029] Figure 7 This is a flowchart of the image blurring method in an embodiment of the present invention;

[0030] Figure 8 This is an internal structural diagram of a computer device in an embodiment of the present invention. Detailed Implementation

[0031] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0032] The inventors discovered through research that enabling the bokeh effect during photography in dual-camera mobile terminals can produce a blurred image. In existing technology, the bokeh process in dual-camera mobile terminals is based on the image's RGB color space. Since the RGB color space cannot accurately reflect the image's brightness information, the resulting light spots obtained by amplifying and transforming the image's brightness during bokeh processing exhibit color differences, thus reducing the bokeh effect of the blurred image.

[0033] To address the aforementioned issues, in this embodiment of the invention, firstly, based on the target image and the reference image, the parallax information corresponding to the target image is determined. Then, based on the luminance channel image of the target image, the parallax information, and the focus information, the bokeh information corresponding to the target image is determined. Finally, based on the bokeh information and the target image, the bokeh image corresponding to the target image is determined. Since a luminance channel image is used instead of an RGB channel image, the luminance channel image can accurately reflect the luminance information of the image. Therefore, the obtained bokeh information is more accurate, thereby ensuring that the light spots in the bokeh image do not exhibit color difference.

[0034] This invention can be applied to the following scenario: a terminal device captures a target image and a corresponding reference image, obtains focus information corresponding to the target image, and sends the target image, reference image, and focus information to a server. The server determines the parallax information corresponding to the target image based on the target image and the reference image, and determines the bokeh information corresponding to the target image based on the luminance channel image of the target image, the parallax information, and the focus information. The server returns the bokeh information to the terminal device, and the terminal device determines the bokeh image corresponding to the target image based on the bokeh information and the target image.

[0035] It is understandable that, such as Figure 1 As shown, in the above application scenario, although the actions of the embodiments of the present invention are described as being partially performed by the terminal device 10 and partially by the server 20, such actions can be performed entirely by the server 20 or entirely by the terminal device 10. The present invention is not limited in terms of the executing entity, as long as the actions disclosed in the embodiments of the present invention are performed. The terminal device 10 includes desktop terminals or mobile terminals, such as desktop computers, tablet computers, laptop computers, smartphones, etc. The server 20 includes independent physical servers, physical server clusters, or virtual servers.

[0036] It should be noted that the above application scenarios are shown only for the purpose of understanding the present invention, and the embodiments of the present invention are not limited in any way. On the contrary, the embodiments of the present invention can be applied to any applicable scenario.

[0037] Various non-limiting embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0038] See Figure 7 This illustration shows an image blurring method according to an embodiment of the present invention. In this embodiment, the image blurring method may include, for example, the following steps:

[0039] S1. Obtain the target image, the reference image corresponding to the target image, and the focus information corresponding to the target image.

[0040] Specifically, the target image refers to the image to be blurred, and the reference image refers to the image used to assist the target image in obtaining disparity information. Disparity information reflects the deviation between the position of the imaging target in the target image and the position of the imaging target in the reference image. The target image and the reference image are images acquired by the imager from two different positions. The disparity information may include several disparity values. In one implementation, the disparity values ​​in the disparity information can be arranged in a matrix to form the disparity information; that is, the disparity values ​​are used as elements of the matrix. The disparity value in the disparity information refers to the deviation between the position of a first pixel in the target image and the position of a second pixel in the reference image corresponding to the first pixel. The second pixel in the reference image corresponding to the first pixel refers to the pixel in the reference image projected from the physical point of the imaging target corresponding to the first pixel. For example, the imager in L... a Image A is obtained by acquiring an image of target P at location L. b Image B is obtained by acquiring an image of the imaging target P. A physical point p on the imaging target P is projected onto the first pixel a in the target image A. The position of the first pixel a is represented by coordinates, obtaining the coordinates (x, y). a y a The physical point p on the imaging target P is projected onto the second pixel point b in the reference image B. The position of the second pixel point b is also represented by coordinates, resulting in coordinates (x, y). b y b Since the second pixel b and the first pixel a are pixels projected from the same physical point p onto the reference image B and the target image A respectively, the second pixel b is the pixel in the reference image B corresponding to the first pixel a. The deviation between the position of the second pixel b and the position of the first pixel a is (x... a -x b y a -y b If ), then the disparity value corresponding to the first pixel a in the target image A is (x a -x b y a -y b By calculating the disparity values ​​corresponding to all first pixels in target image A, the disparity information of target image A can be obtained. Furthermore, if the imager only has displacement along the x-axis and no displacement along the y-axis when acquiring target image A and reference image B, then the y-axis...a =y b x a ≠x b Then the disparity value is x a -x b .

[0041] Therefore, in order to obtain the disparity information corresponding to the target image, it is necessary to use another image to assist the target image in obtaining the disparity information. In this application, a reference image is used to assist the target image in obtaining disparity information. Specifically, the reference image is an image whose imaging target is the same as the imaging target of the target image, but whose acquisition position is different from that of the target image. The acquisition position refers to the position where the imager acquires the image. That is, the imaging target of the reference image is the same as that of the target image, but the position where the reference image is acquired is different from the position where the target image is acquired. For example, the imaging target of the reference image is P, and the imaging target of the target image is also P. The position where the reference image is acquired is position A, and the position of the target image is position B. Positions A and B are two different positions, so the reference image can assist the target image in obtaining disparity information.

[0042] It is understandable that images with different acquisition locations and imaging targets compared to the target image cannot assist in obtaining disparity information for the target image. Similarly, images with the same acquisition location and imaging target compared to the target image also cannot assist in obtaining disparity information for the target image. Likewise, images with the same acquisition location but different imaging targets compared to the target image also cannot assist in obtaining disparity information for the target image.

[0043] In one implementation of this embodiment, the target image is an image acquired by a first imager in the imaging module, and the reference image is an image acquired by a second imager in the imaging module. For example, the imaging module includes at least two dual imagers, wherein the first imager and the second imager are two imagers in the imaging module. The first imager and the second imager are disposed on the same plane, and can be arranged horizontally adjacent to each other or vertically adjacent to each other. The first imager and the second imager can be dual cameras of a terminal device (e.g., a smartphone), meaning both the first imager and the second imager are cameras. For example, the first imager and the second imager can be dual rear cameras or dual front cameras, wherein one of the first imager and the second imager can be a color imager and the other a monochrome imager (e.g., the first imager is a color imager, and the second imager is a monochrome imager). The first imager and the second imager can also use imagers with different focal lengths; of course, the first imager and the second imager can also use the same imager. Furthermore, the target image and the reference image can be images acquired by the imaging module configured on the terminal device itself, or images acquired by the imaging module of other terminal devices through means such as network, Bluetooth, and infrared. Of course, the imaging module can also include three imagers (e.g., a smartphone with three cameras), or it can include four imagers, etc.

[0044] In one implementation of this embodiment, the target image and the reference image are images acquired by a first imager and a second imager configured on the terminal device itself. It is understood that the terminal device is configured with a first imager and a second imager, one of which is a primary imager and the other is an auxiliary imager, to acquire a primary image and an auxiliary image through the first and second imagers. The primary image is acquired by the primary imager, and the auxiliary image is acquired by the auxiliary imager. The auxiliary image is used to assist in calculating the disparity information of the primary image. In this embodiment, the first imager is the primary imager, used to acquire the primary image, and the second imager is the auxiliary imager, used to acquire the auxiliary image, which is used to assist in calculating the disparity information of the primary image. Therefore, the target image is the primary image acquired by the first imager, and the reference image is the auxiliary image acquired by the second imager, used to assist in calculating the depth information of the target image. In one implementation of this embodiment, both the first imager and the second imager are cameras.

[0045] In one implementation of this embodiment, the target image and the reference image are images acquired by the imaging module; that is, the target image is the image acquired by the first imager, and the reference image is the image acquired by the second imager. For example, when a mobile phone equipped with dual cameras starts up, the main camera acquires image A, and the auxiliary camera acquires image B. Then, image A is the target image, and image B is the reference image.

[0046] The focus information refers to the information of the focus selected by the user in the target image. The focus information can be the position information of the focus. The focus information can be generated based on the user's selection operation or sent by an external device. For example, when the imaging device displays the target image, it can receive the user's click operation on the target image, obtain the click point as the focus, and use the position information of the click point (e.g., the pixel position of the corresponding pixel on the display interface, such as (125, 150)) as the focus information.

[0047] S2. Determine the disparity information corresponding to the target image based on the target image and the reference image.

[0048] The disparity information is determined based on the target image and the corresponding reference image. The imaging target of the target image and the imaging target of the reference image are the same. When calculating the disparity information based on the target image and the reference image, for each first pixel in the target image, the difference between the position of the first pixel in the target image and the position of the corresponding second pixel in the reference image is calculated to obtain the disparity value corresponding to the first pixel, thereby obtaining the disparity information corresponding to the target image.

[0049] For example, taking poplar tree A as the imaging target, and vertex B of poplar tree A as a physical point on the imaging target, the pixel point of vertex B projected onto the target image is the first pixel point B', and the pixel point of vertex B projected onto the reference image is the second pixel point B'". Then, the second pixel point B' is the corresponding pixel point of the first pixel point B' in the reference image. The position of the second pixel point B' is (x... b' y b' The position of the first pixel B is (x b” y b” If ), then the disparity value corresponding to the first pixel B' in the target image is (x b' -x b” y b' -y b” ).

[0050] Understandably, different physical points in an image may receive different disparity values. For example, closer physical points receive larger disparity values, while farther physical points receive smaller disparity values.

[0051] S3. Determine the blurring information corresponding to the target image based on the brightness channel image of the target image, the parallax information, and the focus information.

[0052] Specifically, the blurring information refers to the information used to blur the target image to obtain a blurred image. The blurring information corresponding to the target image is determined based on the brightness channel image of the target image, the disparity information, and the focus information. The blurring information includes: blur kernel information and coefficient information. The blur kernel information reflects the neighborhood operation range when blurring the target image. The neighborhood operation range refers to the neighborhood range where each pixel in the blurred image is determined by the pixel at the same position in the target image and the pixels in its neighborhood. The coefficient information reflects the degree of blurring when blurring the target image. The blur kernel information includes a blur kernel, which is a matrix used for matrix multiplication with pixels in the target image and pixels within their neighborhood operation range.

[0053] Since the bokeh information in this application is obtained based on the luminance channel image of the target image, and since the luminance channel image can accurately reflect the luminance value of the target image, the obtained bokeh information is more accurate, especially for the luminance value at the spot. The luminance channel image can accurately reflect the luminance value at the spot in the target image. Therefore, no color difference will be generated at the spot in the obtained bokeh image.

[0054] In one implementation of this embodiment, step S3, determining the bokeh information corresponding to the target image based on the luminance channel image of the target image, the parallax information, and the focus information, includes:

[0055] S31. Determine the blur kernel information corresponding to the target image based on the disparity information and the focus information.

[0056] Specifically, based on the disparity information and the focus information, the blur kernel information corresponding to the target image is determined. The blur kernel information reflects the size of the neighborhood operation range when the target image is blurred. Specifically, the blur kernel information reflects the size of the neighborhood operation range when the target image is blurred through the blur kernel radius. The larger the blur kernel radius, the larger the neighborhood operation range of the pixel when the pixel performs matrix multiplication operation; the smaller the blur kernel radius, the smaller the neighborhood operation range of the pixel when the pixel performs matrix multiplication operation.

[0057] For example, a 5×5 matrix with a radius of 2 requires matrix multiplication across 25 pixels within the neighborhood of each pixel. A 7×7 matrix with a radius of 3 requires matrix multiplication across 49 pixels within the neighborhood of each pixel.

[0058] In one implementation of this embodiment, step S31, determining the blur kernel information corresponding to the target image based on the disparity information and the focus information, includes:

[0059] S311. For each pixel in the target image, determine the blur kernel corresponding to the pixel based on the disparity value corresponding to the pixel in the disparity information and the focus information.

[0060] Specifically, the blur kernel information may include a plurality of blur kernels. In one implementation, the blur kernels in the blur kernel information form a set, with the blur kernels as elements of the set. Each pixel in the target image corresponds to a blur kernel, and the blur kernels corresponding to each pixel in the target image respectively form the blur kernel information.

[0061] For example, based on the focus information and the disparity value corresponding to pixel A in the target image, the blur kernel corresponding to pixel A is obtained.

[0062] In one implementation of this embodiment, step S311, for each pixel in the target image, determines the blur kernel corresponding to the pixel based on the disparity value corresponding to the pixel in the disparity information and the focus information, including:

[0063] S3111. Determine the focal disparity value corresponding to the focal information based on the disparity information and the focal information; wherein, the focal disparity value is the average or median value of the disparity values ​​within the focal region in the disparity information, and the focal region is the region centered on the focal point corresponding to the focal information.

[0064] Specifically, the focus disparity value is the disparity value corresponding to the focus position selected by the user. The focus position can be the location of a single pixel in the target image, or it can be the location of multiple pixels in the target image (multiple pixels forming a focus area). When the focus position is a single pixel, the focus disparity value is the disparity value corresponding to that pixel. When the focus position is a focus area, the focus disparity value is the average or median value of the disparity values ​​corresponding to each pixel within that focus area. For example, the average disparity value of the focus area centered on the user-selected focus can be used as the focus disparity value. The size of the focus area can be set as needed; for example, the size of the focus area can be 3*3.

[0065] S3112. For each pixel in the target image, determine the blur kernel radius corresponding to the pixel based on the disparity value corresponding to the pixel in the disparity information and the focal disparity value; determine the blur kernel corresponding to the pixel based on the blur kernel radius; wherein, the weight value corresponding to each pixel inside the target circle in the blur kernel is not 0, the weight value corresponding to each pixel outside the target circle in the blur kernel is 0, and the target circle is a circle with the center of the blur kernel as the center and the radius of the blur kernel as the radius of the circle.

[0066] Specifically, for each pixel in the target image, the blur kernel radius corresponding to that pixel is determined based on the disparity value corresponding to that pixel in the disparity information and the focal disparity value, thereby determining the blur kernel radius corresponding to each pixel in the target image. Pixel A in the target image corresponds to one disparity value; therefore, the blur kernel radius corresponding to pixel A is obtained based on this disparity value and the focal disparity value. The blur kernel radius is:

[0067]

[0068] Where R represents the maximum fuzzy kernel radius, r i,j d represents the blur kernel radius corresponding to the pixel at coordinates (i, j) in the target image. i,j d_focus represents the disparity value corresponding to the pixel at coordinates (i, j) in the target image, d_focus represents the focal disparity value, and d_max represents the maximum disparity value.

[0069] Considering the inaccuracy caused at the focal point, the fuzzy kernel radius is set to:

[0070]

[0071] Where R represents the maximum fuzzy kernel radius, r i,j d represents the blur kernel radius corresponding to the pixel at coordinates (i, j) in the target image. i,jThis represents the disparity value corresponding to the pixel at coordinates (i, j) in the target image. `d_focus` represents the focus disparity value, `d_max` represents the maximum disparity value, `max(·)` represents the maximum value operation, and `Δd` represents the dynamic range of disparity at the focus, where `Δd = β * d_max`. `α` represents a coefficient controlling the dynamic range of disparity, with `β` ranging from 0.001 to 0.5 (e.g., `β = 0.05`). The dynamic range of disparity at the focus reflects the range of variation of the focus disparity value. Since the disparity values ​​in the neighborhood of the focus are not completely equal but fluctuate within a certain range, and this fluctuation is relatively small, the dynamic range of disparity at the focus can be represented by a difference, which is the difference between the maximum and minimum disparity values ​​in the neighborhood of the focus. Alternatively, it can be represented by a ratio, which is the ratio between the maximum and minimum disparity values ​​in the neighborhood of the focus.

[0072] If |d i,j -d_focus|-Δd≤0, then max(|d i,j -d_focus|-Δd,0)=0. If |d i,j -d_focus|-Δd>0, then max(|d i,j -d_focus|-Δd,0)=|d i,j -d_focus|-Δd.

[0073] As shown above, the larger the difference between the disparity value corresponding to a pixel and the focal disparity value, the larger the blur kernel radius corresponding to that pixel. Conversely, the smaller the difference between the disparity value corresponding to a pixel and the focal disparity value, the smaller the blur kernel radius corresponding to that pixel. For example, when the focal point is located in the background region of the target image, the blur kernel radius corresponding to pixels in the background region of the target image is smaller, while the blur kernel radius corresponding to pixels in the foreground region of the target image is larger. Similarly, when the focal point is located in the foreground region of the target image, the blur kernel radius corresponding to pixels in the foreground region of the target image is smaller, while the blur kernel radius corresponding to pixels in the background region of the target image is larger.

[0074] Specifically, the target circle refers to a circle with the center of the blur kernel as its center and the radius of the blur kernel as its radius. The weight value corresponding to each pixel within the target circle in the blur kernel is not 0. In one implementation of this embodiment, the weight value corresponding to each pixel within the target circle in the blur kernel is 1. Of course, the weight value corresponding to each pixel within the target circle in the blur kernel can also be set to other non-zero values ​​as needed, such as 2. The blur kernel is:

[0075]

[0076] Where K(i,j) represents the blur kernel corresponding to the pixel at coordinates (i,j) in the target image, p and q represent the x and y coordinates of the pixel in the blur kernel, respectively, and r i,j This represents the blur kernel radius corresponding to the pixel at coordinates (i, j) in the target image.

[0077] The fuzzy kernel is (2r i,j +1)×(2r i,j A matrix of +1), for example, when r i,j When = 1, the fuzzy kernel is represented by the following matrix:

[0078]

[0079] When r i,j When the value is 1, the blur kernel is a 3×3 matrix. The pixel at the center of the blur kernel has a weight of 1. Pixels within the blur kernel whose distance from the center is ≤1 also have a weight of 1. There are 5 pixels within the blur kernel whose distance from the center is ≤1. Pixels within the blur kernel whose distance from the center is >1 have a weight of 0. There are 4 pixels within the blur kernel whose distance from the center is >1.

[0080] For example, when r i,j When the value is 5, the fuzzy kernel is represented by the following matrix:

[0081]

[0082] When r i,j When the distance is 5, the blur kernel is an 11×11 matrix. The pixel at the center of the blur kernel has a weight of 1. Pixels within the blur kernel whose distance from the center is ≤5 also have a weight of 1. There are 73 pixels within the blur kernel whose distance from the center is ≤5. Pixels within the blur kernel whose distance from the center is >5 have a weight of 0. There are 48 pixels within the blur kernel whose distance from the center is >5.

[0083] When r is high, the fuzzy kernel is as follows: Figure 2 As shown, the weight value of pixels in the white area is 1, and the weight value of pixels in the black area is 0.

[0084] S312. Determine the blur kernel information corresponding to the target image based on the blur kernel corresponding to each pixel in the target image.

[0085] Specifically, the blur kernel information is determined based on the blur kernel corresponding to each pixel in the target image. Each pixel in the target image corresponds to a blur kernel. Since the blur kernel radius of each pixel in the target image is different, the blur kernels corresponding to each pixel in the target image are also different.

[0086] S32. Determine the coefficient information corresponding to the target image based on the brightness channel image of the target image.

[0087] Specifically, in this application, coefficient information corresponding to the target image is determined based on the luminance channel image of the target image. Since the luminance channel image can more accurately reflect the luminance value of the target image, the coefficient information obtained based on the luminance channel image is more accurate. In other words, the blurring information is more accurate, and the blurred image obtained based on the blurring information is also more accurate, without color difference.

[0088] In one implementation of this embodiment, step S32, determining the coefficient information corresponding to the target image based on the luminance channel image of the target image, includes:

[0089] S321. Determine the segmented image corresponding to the target image based on the luminance channel image of the target image; wherein, the segmented image is an image obtained by segmenting the luminance channel image according to the luminance value of each pixel in the luminance channel image.

[0090] Specifically, the luminance channel image refers to the luminance channel image of the target image, i.e., the Y channel image, where Y represents luminance (Luminance, Luma). In addition to the luminance channel image, the target image also has a chroma channel image (i.e., the U channel image) and a saturation channel image (i.e., the V channel image). The chroma channel image refers to the chroma channel image of the target image, and the saturation channel image refers to the saturation channel image of the target image, where U represents chroma and V represents saturation. Since YUV format image and video files occupy less bandwidth during transmission compared to the more common RGB three-channel image, YUV format image data is typically used during transmission instead of RGB format image data. Therefore, this application does not require converting the received YUV format image data into RGB format image data; the YUV format image data can be processed directly, reducing the processing steps and shortening the processing time.

[0091] Specifically, the range of luminance values ​​for pixels in the luminance channel image is [0, 255], meaning the luminance value (Y value) ∈ [0, 255]. Similarly, the range of chroma values ​​for pixels in the chroma channel image is [0, 255], meaning the chroma value (U value) ∈ [0, 255]. Likewise, the range of saturation values ​​for pixels in the saturation channel image is [0, 255], meaning the saturation value (V value) ∈ [0, 255]. A higher luminance value indicates higher brightness; similarly, a higher chroma value indicates higher chroma, and a higher saturation value indicates higher saturation.

[0092] The segmented image refers to an image obtained by segmenting the luminance channel image according to the luminance value corresponding to each pixel in the luminance channel image. In this application, in order to improve the color difference of the light spot, it is necessary to process the region corresponding to the light spot. Since the luminance value of the light spot is relatively large, the luminance channel image can be segmented by the luminance value to obtain the segmented image. Specifically, the luminance channel image is thresholded by setting a first preset luminance value. For example, in order to improve the distinguishability between the luminance values ​​corresponding to each pixel in the luminance channel image, when the luminance value corresponding to a certain pixel in the luminance channel image is less than or equal to the first preset luminance value, the luminance value corresponding to that pixel is configured as a second preset luminance value.

[0093] In one implementation of this embodiment, step S321, determining the segmented image corresponding to the target image based on the luminance channel image of the target image, includes:

[0094] S3211. For the brightness value corresponding to each pixel in the brightness channel image of the target image, when the brightness value is less than or equal to a first preset brightness value, the brightness value is configured as a second preset brightness value to obtain the segmented image corresponding to the target image; wherein, the second preset brightness value is less than or equal to the first preset brightness value.

[0095] Specifically, the first preset brightness value refers to a pre-set brightness value, which is used to determine the magnitude of the brightness value corresponding to each pixel in the brightness channel image. To increase the distinguishability of the brightness values ​​corresponding to each pixel in the brightness channel image relative to the first preset brightness value, when the brightness value of a pixel in the brightness channel image is less than or equal to the first preset brightness value, that brightness value is configured as the second preset brightness value. Of course, this brightness value can also be configured to other values, such as 1, 2, etc., which are less than the first preset brightness value. When the brightness value of a pixel in the brightness channel image is greater than the first preset brightness value, that brightness value remains unchanged. In other words, only brightness values ​​less than or equal to the first preset brightness value are configured as the second preset brightness value to achieve threshold segmentation of the brightness channel image.

[0096] For example, the first preset brightness value is set to 250, and the second preset brightness value is set to 0. If the brightness value of a pixel in the brightness channel image is one of [0, 250], then the brightness value of that pixel is configured to 0. If the brightness value of a pixel in the brightness channel image is one of (250, 255), then the brightness value of that pixel remains unchanged, thus obtaining a segmented image.

[0097] The purpose of thresholding the luminance channel image is to segment the regions with high luminance values ​​in the luminance channel image to obtain a segmented image, which is then used to determine coefficient information. For example, the regions with high luminance values ​​in the luminance channel image can be light spots in the target image.

[0098] Specifically, the brightness value corresponding to the pixel in the segmented image is:

[0099]

[0100] Among them, M i,j Y represents the brightness value corresponding to the pixel at coordinates (i, j) in the segmented image. i,j This represents the brightness value corresponding to the pixel at coordinates (i, j) in the brightness channel image, and T represents the first preset brightness value.

[0101] For example, if T is 250, when Y i,j When M is 251, 252, 253, 254, or 255, i,j =Y i,j When Y i,j When M is ≤250 i,j =0.

[0102] Specifically, the brightness value corresponding to each pixel in a certain region of the brightness channel image is represented as follows:

[0103]

[0104] The brightness value corresponding to each pixel in this region of the segmented image is represented as:

[0105]

[0106] The central part of this area represents the light spot.

[0107] S322. Determine the coefficient information corresponding to the target image based on the segmented image.

[0108] Specifically, the coefficient information refers to information reflecting the degree of blurring in the target image. The coefficient information includes weight coefficient values, which can be arranged in a matrix to form the coefficient information; that is, the weight coefficient values ​​are used as elements of the matrix. Each pixel in the segmented image corresponds to a weight coefficient value. The weight coefficient value is a value greater than or equal to 1. If the weight coefficient values ​​corresponding to pixels in a segmented image region A are all equal to 1, then region A in the target image will not be blurred. If the weight coefficient values ​​corresponding to pixels in a segmented image region B are all greater than 1, then region B in the target image needs to be blurred. A larger weight coefficient value indicates a higher degree of blurring, and a smaller weight coefficient value indicates a lower degree of blurring.

[0109] Based on the segmented image, the coefficient information corresponding to the target image is determined. The coefficient information of the target image can be determined based on the brightness values ​​corresponding to each pixel in the segmented image. Since regions with higher brightness values ​​are segmented in the segmented image, and the brightness values ​​of pixels in these regions are not 0, while the brightness values ​​of pixels in regions with lower brightness values ​​are 0, there are two types of regions in the segmented image: regions with non-zero brightness values ​​and regions with zero brightness values. Regions with zero brightness values ​​have the same weight coefficient value. For example, the weight coefficient value of these regions with lower brightness values ​​can be set to 1, meaning these regions with zero brightness values ​​are not blurred. Since the brightness values ​​of pixels in regions with non-zero brightness values ​​are different, the resulting weight coefficient values ​​are also different, and therefore the degree of blurring is also different.

[0110] In one implementation of this embodiment, step S322, determining the coefficient information corresponding to the target image based on the segmented image, includes:

[0111] S3221. For the brightness value corresponding to each pixel in the segmented image, determine the weight coefficient value corresponding to that pixel; wherein, the weight coefficient value corresponding to the pixel in the target area of ​​the segmented image is greater than a preset weight coefficient value, and the weight coefficient value corresponding to the pixel outside the target area in the segmented image is a preset weight coefficient value; the target area is the area formed by pixels in the segmented image whose brightness value is not the second preset brightness value and whose positions are adjacent, and the ratio of the area of ​​the target area to the area of ​​the smallest bounding rectangle of the target area is greater than a preset ratio.

[0112] Specifically, the minimum bounding rectangle refers to the maximum range of the target region represented by two-dimensional coordinates, that is, the rectangle whose lower boundary is marked by the maximum and minimum x-coordinates, maximum and minimum y-coordinates of each vertex of the target region. The preset ratio refers to a pre-set ratio used to determine the ratio between the area of ​​a region and the area of ​​its minimum bounding rectangle. For a single region in the segmented image whose brightness value is not the second preset brightness value, the brightness value of each pixel within that region is greater than the first preset brightness value, and these pixels are positionally adjacent. Since there can be multiple regions in the segmented image whose brightness value is not the second preset brightness value, it is necessary to determine the target region based on the regions in the segmented image whose brightness value is higher than the first preset brightness value. The ratio of the area of ​​the target region to the area of ​​its minimum bounding rectangle is greater than the preset ratio. In other words, when a region in the segmented image whose brightness value is not the second preset brightness value satisfies the condition that "the ratio of the area of ​​the region to the area of ​​the minimum bounding rectangle is greater than the preset ratio," then that region is the target region. The preset ratio can be in the range of 0.3-0.5.

[0113] For example, if the second preset brightness value is 0, and there exists a region in the segmented image with a non-zero brightness value, the area of ​​this region is 'a', and the area of ​​the smallest bounding rectangle of this region is 'b'. When a / b > a preset ratio, then this region with a non-zero brightness value is the target region. The preset ratio can be set to 0.35, or other values ​​can be set as needed.

[0114] For example, with a preset weight coefficient value of 1, for each pixel in the segmented image, the weight coefficient value corresponding to that pixel is determined. If the pixel is located within the target area, the weight coefficient value corresponding to that pixel is greater than 1; if the pixel is located outside the target area, the weight coefficient value corresponding to that pixel is equal to 1. Therefore, only pixels within a region where the brightness value is not 0 and the ratio of the region's area to the area of ​​its smallest bounding rectangle is greater than a preset ratio have a weight coefficient value greater than 1, i.e., pixels within the target area have a weight coefficient value greater than 1, will be blurred in the target area. Regions outside the target area include: regions with a brightness value of 0 and regions with a brightness value not of 0 but not meeting the condition that the ratio of the region's area to the area of ​​its smallest bounding rectangle is greater than a preset ratio. In regions outside the target area, pixels with a weight coefficient value equal to 1 will not be blurred.

[0115] Specifically, the weighting coefficient value is:

[0116]

[0117] Among them, W i,j M represents the weight coefficient value corresponding to the pixel at coordinates (i, j) in the segmented image. i,j α represents the brightness value corresponding to the pixel at coordinates (i, j) in the segmented image, α represents the preset brightness control parameter, α > 0, σ represents a constant, and Ω represents the set of coordinates of each pixel in the target area.

[0118] For example, if α is set to 4 and σ is set to 196, and the pixel at coordinates (100, 200) in the segmented image is pixel A... 100,200 If pixel A 100,200 If the pixel A is located within the target region, then (100, 200) ∈ Ω. 100,200 Corresponding brightness value M 100,200 If W is 251, then W 100,200 It is 5.

[0119] For example, if the pixel at coordinates (101, 201) in the segmented image is pixel A... 101,201 If pixel A 101,201 If the pixel A is located within the target region, then (101, 201) ∈ Ω. 101,201 Corresponding brightness value M 101,201 If W is 254, then W 101,201 It is 5.

[0120] For example, if the pixel at coordinates (99, 199) in the segmented image is pixel A 99,199 If pixel A 99,199 If located outside the target area, then Then W 101,201 The value is 1. It should be noted that regardless of pixel A... 99,199 Corresponding brightness value M 99,199 Why is it worth it, as long as pixel A is... 99,199 If it is located outside the target area, then W 101,201 The value is 1. Specifically, there are two cases: the first case involves pixel A. 99,199 Corresponding brightness value M 99,199 If the value is 0, then pixel A 99,199 It must be located outside the target area; the second case is pixel A. 99,199 Corresponding brightness value M 99,199 The value is 251, but pixel A... 99,199 The region does not meet the condition that "the ratio of the region's area to the area of ​​the region's smallest bounding rectangle is greater than a preset ratio," therefore, pixel A... 99,199 The region to which this pixel belongs is not the target region. 99,199If it is also located outside the target area, then W 101,201 The value is 1.

[0121] S3222. Determine the coefficient information corresponding to the target image based on the weight coefficient values ​​corresponding to each pixel in the segmented image.

[0122] Specifically, after determining the weight coefficient values ​​corresponding to each pixel in the segmented image, the coefficient information corresponding to the target image is determined based on the weight coefficient values ​​corresponding to each pixel in the segmented image.

[0123] For example, the brightness value corresponding to each pixel in a segmented region of an image is represented as follows:

[0124]

[0125] The weight coefficient values ​​corresponding to each pixel in this region of the segmented image are expressed as:

[0126]

[0127] In the coefficient information, the weight coefficient value corresponding to each pixel within the target area is greater than 1, and the weight coefficient value corresponding to each pixel outside the target area is equal to 1.

[0128] S4. Based on the blurring information and the target image, determine the blurring image corresponding to the target image.

[0129] Specifically, based on the blurring information and the target image, a blurred image is determined. Specifically, the target image is blurred according to the blurring information to obtain the blurred image corresponding to the target image. Since the blurring information differs in different regions, the degree of blurring in the blurred images varies, thus achieving region-specific blurring.

[0130] When blurring the target image based on the blurring information, the degree of blurring varies in different regions of the target image because the blur kernel information and coefficient information corresponding to the target image are different.

[0131] Specifically, the larger the difference between the disparity value corresponding to a pixel within a certain region of the target image and the focal disparity value, the larger the blur kernel radius, indicating a higher degree of blurring. Conversely, the smaller the difference between the disparity value corresponding to a pixel within a certain region of the target image and the focal disparity value, the smaller the blur kernel radius, indicating a lower degree of blurring. Furthermore, the larger the weight coefficient value corresponding to a pixel within a certain region of the target image, the higher the degree of blurring; conversely, the smaller the weight coefficient value, the lower the degree of blurring.

[0132] Specifically, the blurred image is:

[0133]

[0134] in, Let K(i,j) represent the blurred image, K(i,j) represent the weight value at coordinate (i,j) in the blur kernel information, W(i,j) represent the weight coefficient value at coordinate (i,j) in the coefficient information, and I(i,j) represent the pixel value corresponding to the pixel at coordinate (i,j) in the target image.

[0135] Step S4: Determine the blurred image corresponding to the target image based on the blurred information and the target image, including:

[0136] S41. Based on the blurring information, blurring processing is performed on the luminance channel image, the chroma channel image, and the saturation channel image of the target image, respectively, to obtain a luminance channel blurred image corresponding to the luminance channel image, a chroma channel blurred image corresponding to the chroma channel image, and a saturation channel blurred image corresponding to the saturation channel image; wherein, the luminance channel image, the chroma channel image, the saturation channel image, the luminance channel blurred image, the chroma channel blurred image, and the saturation channel blurred image are all YUV format images.

[0137] Specifically, when blurring the target image according to the blurring information, the luminance channel image, chroma channel image, and saturation channel image of the target image are blurred respectively according to the blurring information. That is, the channel images of different channels of the target image are blurred based on the same blurring information. Bluring the luminance channel image of the target image according to the blurring information yields the luminance channel blurred image corresponding to the luminance channel image; blurring the chroma channel image of the target image according to the blurring information yields the chroma channel blurred image corresponding to the chroma channel image; and blurring the saturation channel image of the target image according to the blurring information yields the saturation channel blurred image corresponding to the saturation channel image.

[0138] Specifically, the luminance channel blurred image is:

[0139]

[0140] in, Let K(i,j) represent the blurred image of the luminance channel, K(i,j) represent the weight value at coordinate (i,j) in the blur kernel information, W(i,j) represent the weight coefficient value at coordinate (i,j) in the coefficient information, and Y(i,j) represent the luminance value corresponding to the pixel at coordinate (i,j) in the luminance channel image of the target image.

[0141] The chroma channel blurred image is:

[0142]

[0143] in, Let K(i,j) represent the chroma channel blurred image, K(i,j) represent the weight value at coordinate (i,j) in the blur kernel information, W(i,j) represent the weight coefficient value at coordinate (i,j) in the coefficient information, and U(i,j) represent the chroma value corresponding to the pixel at coordinate (i,j) in the chroma channel image of the target image.

[0144] The blurred image of the saturation channel is:

[0145]

[0146] in, Let K(i,j) represent the blurred image of the saturation channel, K(i,j) represent the weight value at coordinate (i,j) in the blur kernel information, W(i,j) represent the weight coefficient value at coordinate (i,j) in the coefficient information, and V(i,j) represent the saturation value corresponding to the pixel at coordinate (i,j) in the saturation channel image of the target image.

[0147] The luminance channel image, chroma channel image, saturation channel image, luminance channel blurred image, chroma channel blurred image, and saturation channel blurred image are all YUV format images, meaning that blurring is performed in the YUV color space. Blurring in the YUV color space is equivalent to blurring in the RGB color space, and it can alleviate the color difference issues caused by the RGB color space in terms of light spot effects. Furthermore, data transmission within the terminal device itself uses YUV format; therefore, blurring in the YUV color space reduces the need for conversion between YUV and RGB formats, saving time.

[0148] S42. Based on the luminance channel blurred image, the chroma channel blurred image, and the luminance channel blurred image, obtain the blurred image corresponding to the target image.

[0149] Specifically, the blurred image is obtained based on the blurred image of the luminance channel, the blurred image of the chroma channel, and the blurred image of the luminance channel; that is, the blurred image is obtained based on the blurred images of each channel. Specifically, the blurred image is:

[0150]

[0151] in, Indicates a blurred image. This indicates a blurred image in the luminance channel. This represents a blurred image of the chroma channel. This represents an image with the saturation channel blurred.

[0152] The following conversion relationship exists between YUV channel images and RGB channel images:

[0153]

[0154] Where Y represents the luminance channel image, U represents the chroma channel image, V represents the saturation channel image, R represents the red channel image, G represents the green channel image, and B represents the blue channel image. This represents the transformation matrix.

[0155] Therefore, the blurred image of the YUV channel and the blurred image of the RGB channel have the following relationship:

[0156]

[0157] in, This indicates a blurred image in the luminance channel. This represents a blurred image of the chroma channel. This indicates a blurred image in the saturation channel. This indicates a blurred image of the red channel. This indicates a blurred image with the green channel. This indicates a blurred blue channel image. This represents the transformation matrix.

[0158] In one implementation of this embodiment, step S42, obtaining the blurred image corresponding to the target image based on the blurred image of the luminance channel, the blurred image of the chroma channel, and the blurred image of the luminance channel, includes:

[0159] S421. For each pixel in the luminance channel blurred image, determine the blurred pixel value corresponding to the pixel based on the first pixel value corresponding to the pixel, the second pixel value corresponding to the pixel in the chroma channel blurred image, and the third pixel value corresponding to the pixel in the saturation channel blurred image.

[0160] S422. Determine the blurred image corresponding to the target image based on all blurred pixel values.

[0161] Specifically, for each pixel in the luminance channel blurred image, based on the first pixel value Y of that pixel... i,j The second pixel value U corresponding to this pixel in the chroma channel blurred image. i,j And the third pixel value V corresponding to that pixel in the saturation channel blurred image. i,j Determine the bokeh pixel value [Y] corresponding to this pixel. i,j U i,j V i,j ].

[0162] After obtaining the bokeh pixel values ​​corresponding to each pixel in the luminance channel bokeh image, the bokeh image corresponding to the target image is determined based on all bokeh pixel values.

[0163] like Figure 3 and Figure 4 As shown, in the blurred image obtained using this application, the light spots in the blurred area do not produce color difference, the shape of the plants in the blurred area is preserved, and the light spot effect is better. Figure 5 and Figure 6 As shown, in the prior art, the bokeh image obtained using RGB channel images has color difference caused by light spots. The shape of the plant in the bokeh area is covered by the light spots, and the shape of the plant cannot be reflected, resulting in poor light spot effect.

[0164] In summary, this application first determines the disparity information corresponding to the target image based on the target image and the reference image, then determines the bokeh information corresponding to the target image based on the luminance channel image of the target image, the disparity information, and the focus information, and finally determines the bokeh image corresponding to the target image based on the bokeh information and the target image. Since a luminance channel image is used instead of an RGB channel image, the luminance channel image can accurately reflect the luminance information of the image. Therefore, the obtained bokeh information is more accurate, thereby ensuring that the light spots of the bokeh image will not have color difference problems.

[0165] In one embodiment, the present invention provides a computer device, which may be a terminal, with an internal structure as follows: Figure 8As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements an image blurring method. The display screen can be a liquid crystal display (LCD) or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0166] Those skilled in the art will understand that Figure 8 The diagram shown is merely a partial structural diagram related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. Specific computer devices may include more or fewer components than those shown in the diagram, or combine certain components, or have different component arrangements.

[0167] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to perform the following steps:

[0168] Acquire the target image, the reference image corresponding to the target image, and the focus information corresponding to the target image;

[0169] Based on the target image and the reference image, determine the disparity information corresponding to the target image;

[0170] Based on the luminance channel image of the target image, the parallax information, and the focus information, determine the blurring information corresponding to the target image;

[0171] Based on the blurring information and the target image, determine the blurring image corresponding to the target image.

[0172] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0173] Acquire the target image, the reference image corresponding to the target image, and the focus information corresponding to the target image;

[0174] Based on the target image and the reference image, determine the disparity information corresponding to the target image;

[0175] Based on the luminance channel image of the target image, the parallax information, and the focus information, determine the blurring information corresponding to the target image;

[0176] Based on the blurring information and the target image, determine the blurring image corresponding to the target image.

[0177] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. An image blurring method, characterized in that, The method includes: Acquire the target image, the reference image corresponding to the target image, and the focus information corresponding to the target image; Based on the target image and the reference image, determine the disparity information corresponding to the target image; Based on the luminance channel image of the target image, the parallax information, and the focus information, determine the blurring information corresponding to the target image; Based on the blurring information and the target image, determine the blurring image corresponding to the target image; The blurring information includes: blur kernel information of pixels in the target image; determining the blurring information corresponding to the target image based on the brightness channel image of the target image, the parallax information, and the focus information includes: Based on the disparity information and focus information of each pixel in the target image, determine the blur kernel information of the corresponding pixel in the target image; The blurring information includes: coefficient information; The step of determining the blurring information corresponding to the target image based on the luminance channel image of the target image, the parallax information, and the focus information includes: Based on the brightness channel image of the target image, determine the coefficient information corresponding to the target image.

2. The image blurring method according to claim 1, characterized in that, The step of determining the blur kernel information of the corresponding pixel in the target image based on the disparity information and focus information of each pixel in the target image includes: For each pixel in the target image, the blur kernel corresponding to the pixel is determined based on the disparity value of the pixel in the disparity information and the focus information. The blur kernel information corresponding to the target image is determined based on the blur kernel corresponding to each pixel in the target image.

3. The image blurring method according to claim 2, characterized in that, The step of determining the blur kernel corresponding to each pixel in the target image based on the disparity value corresponding to that pixel in the disparity information and the focus information includes: Based on the disparity information and the focus information, a focus disparity value corresponding to the focus information is determined; wherein, the focus disparity value is the average or median value of the disparity values ​​within the focus area in the disparity information, and the focus area is the area centered on the focus corresponding to the focus information; For each pixel in the target image, the blur kernel radius corresponding to the pixel is determined based on the disparity value corresponding to the pixel in the disparity information, the maximum disparity value in the disparity information, and the focal disparity value; the blur kernel corresponding to the pixel is determined based on the blur kernel radius; wherein, the weight value corresponding to each pixel inside the target circle in the blur kernel is not 0, the weight value corresponding to each pixel outside the target circle in the blur kernel is 0, and the target circle is a circle with the center of the blur kernel as the center and the radius of the blur kernel as the radius of the circle.

4. The image blurring method according to claim 1, characterized in that, The step of determining the coefficient information corresponding to the target image based on the brightness channel image of the target image includes: Based on the luminance channel image of the target image, a segmented image corresponding to the target image is determined; wherein, the segmented image is an image obtained by segmenting the luminance channel image according to the luminance value of each pixel in the luminance channel image; Based on the segmented image, determine the coefficient information corresponding to the target image.

5. The image blurring method according to claim 4, characterized in that, Determining the segmented image corresponding to the target image based on the luminance channel image of the target image includes: For each pixel in the brightness channel image of the target image, when the brightness value is less than or equal to a first preset brightness value, the brightness value is configured as a second preset brightness value to obtain the segmented image corresponding to the target image; wherein, the second preset brightness value is less than or equal to the first preset brightness value.

6. The image blurring method according to claim 5, characterized in that, The step of determining the coefficient information corresponding to the target image based on the segmented image includes: For each pixel in the segmented image, a weight coefficient value is determined based on the brightness value of that pixel and a preset brightness control parameter. Specifically, the weight coefficient value of pixels within the target region of the segmented image is greater than the preset weight coefficient value, and the weight coefficient value of pixels outside the target region in the segmented image is the preset weight coefficient value. The target region is the area formed by adjacent pixels in the segmented image whose brightness value is not the second preset brightness value, and the ratio of the area of ​​the target region to the area of ​​its smallest bounding rectangle is greater than a preset ratio. The coefficient information corresponding to the target image is determined based on the weight coefficient values ​​corresponding to each pixel in the segmented image.

7. The image blurring method according to claim 1, characterized in that, The step of determining the blurred image corresponding to the target image based on the blurring information and the target image includes: Based on the blurring information, the luminance channel image, chroma channel image, and saturation channel image of the target image are blurred respectively to obtain a luminance channel blurred image corresponding to the luminance channel image, a chroma channel blurred image corresponding to the chroma channel image, and a saturation channel blurred image corresponding to the saturation channel image; wherein, the luminance channel image, the chroma channel image, the saturation channel image, the luminance channel blurred image, the chroma channel blurred image, and the saturation channel blurred image are all YUV format images; The blurred image corresponding to the target image is obtained based on the blurred image of the luminance channel, the blurred image of the chroma channel, and the blurred image of the saturation channel.

8. The image blurring method according to claim 7, characterized in that, The step of obtaining the blurred image corresponding to the target image based on the blurred image of the luminance channel, the blurred image of the chroma channel, and the blurred image of the saturation channel includes: For each pixel in the luminance channel blurred image, the blurred pixel value corresponding to the pixel is determined based on the first pixel value corresponding to the pixel, the second pixel value corresponding to the pixel in the chroma channel blurred image, and the third pixel value corresponding to the pixel in the saturation channel blurred image. Based on all the blurred pixel values, determine the blurred image corresponding to the target image.

9. The image blurring method according to any one of claims 1-8, characterized in that, The target image is an image acquired by the first imager in the imaging module, and the reference image is an image acquired by the second imager in the imaging module.

10. The image blurring method according to claim 9, characterized in that, The first imager is the main imager, which is used to acquire the main image. The second imager is the auxiliary imager, which is used to acquire auxiliary images. The auxiliary images are used to assist in calculating the disparity information of the main image.

11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the image blurring method according to any one of claims 1 to 10.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the image blurring method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Image processing method, mobile terminal and computer readable storage medium

    CN107635093A

  • Image blurring method and device, mobile terminal and computer readable storage medium

    CN110022430A