Image processing method and device, electronic equipment and storage medium
By adding noise, especially Gaussian noise, to images captured by electronic devices, the blurring layer boundaries are disrupted, thus solving the problem of blurring layering in images captured by electronic devices and improving the visual effect of the images.
Patent Information
- Application Number
- CN202410627732.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2025-11-21
AI Technical Summary
Electronic devices struggle to capture images with a blurred effect, especially when dealing with large areas of similar colors. The blurred image often exhibits layering issues, resulting in a poor visual effect.
By blurring images captured by electronic devices and then adding preset noise, especially Gaussian noise, to the images, the boundaries of the blurred layers are broken, thus achieving image fusion and improving the visual effect.
It effectively weakens the blurring and layering phenomenon, improves the visual effect of the final processed image, and avoids excessive interference of noise on the background.
Smart Images

Figure CN120997052A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of image processing, and particularly relates to an image processing method and device, electronic equipment and storage medium. BACKGROUND
[0002] When an image is captured by using a professional camera, if a long-focus lens or a large-aperture lens is used, an image with a small depth of field can be captured, the focused object and other objects at the depth of the focused object are kept clear, and the foreground and the background are blurred and defocused to different degrees, thereby highlighting the photographic subject. However, for electronic equipment with a photographing function, since the electronic equipment is not a professional camera, the volume of the electronic equipment has requirements on portability and cost, so that the electronic equipment is difficult to directly capture an image with a defocusing effect.
[0003] In the related art, an algorithm is introduced to simulate physical defocusing, that is, the image captured by the electronic equipment is defocused to generate an image with a defocusing effect. However, when there is a large area of color similar regions in the image, the defocused image has a defocusing layering phenomenon, so that the defocusing effect of the image is poor in vision. SUMMARY
[0004] To overcome the problems in the related art, the present disclosure provides an image processing method and device, electronic equipment and storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, an image processing method is provided, and the method comprises:
[0006] defocusing processing is performed on a first image to obtain a second image;
[0007] obtaining preset noise;
[0008] adding the preset noise to the second image to obtain a target image.
[0009] In some embodiments, the obtaining of the preset noise comprises:
[0010] obtaining a noise image containing the preset noise;
[0011] The adding of the preset noise to the second image to obtain the target image comprises:
[0012] fusing the second image and the noise image to obtain the target image.
[0013] In some embodiments, the fusing of the second image and the noise image to obtain the target image comprises:
[0014] determine image information of the first image, the image information comprising at least one of: brightness of each region in the first image, blur degree of each region in the first image;
[0015] adjust, based on the image information, noise parameter of each region in the noise image, to obtain an adjusted noise image, the noise parameter of each region in the noise image being used to represent noise intensity of the region, the regions in the noise image corresponding to the regions in the first image one by one;
[0016] fuse, based on the second image and the adjusted noise image, to obtain the target image.
[0017] In some embodiments, before the adjusting, based on the image information, noise parameter of each region in the noise image, to obtain an adjusted noise image, the method further comprises:
[0018] determine shooting scene of the first image, the shooting scene comprising a first shooting scene or a second shooting scene, the ambient light brightness in the first shooting scene being greater than the ambient light brightness in the second shooting scene;
[0019] when the shooting scene of the first image is the first shooting scene, determine the noise parameter of each region in the noise image as a first noise parameter;
[0020] when the shooting scene of the first image is the second shooting scene, the noise parameter of each region in the noise image is a second noise parameter; wherein the noise intensity represented by the first noise parameter is less than the noise intensity represented by the second noise parameter.
[0021] In some embodiments, the adjusting, based on the image information, noise parameter of each region in the noise image, to obtain an adjusted noise image, comprises:
[0022] adjust, based on the brightness of each region in the first image, noise parameter of each region in the noise image, to obtain an adjusted noise image, the noise parameter of each region in the adjusted noise image being a third noise parameter;
[0023] wherein the first region in the first image corresponds to the second region in the adjusted noise image, the third region in the first image corresponds to the fourth region in the adjusted noise image, the brightness of the first region is greater than the brightness of the third region, and the noise intensity represented by the third noise parameter of the second region is less than the noise intensity represented by the third noise parameter of the fourth region.
[0024] In some embodiments, the adjusting, based on the image information, the noise parameter of each region in the noise image, to obtain an adjusted noise image, comprises:
[0025] adjusting, based on the blur degree of each region in the first image, the noise parameter of each region in the noise image, to obtain an adjusted noise image, wherein the noise parameter of each region in the adjusted noise image is a fourth noise parameter;
[0026] wherein the fifth region in the first image corresponds to a sixth region in the adjusted noise image, and a seventh region in the first image corresponds to an eighth region in the adjusted noise image, the brightness of the fifth region is greater than the brightness of the seventh region, and the noise intensity represented by the fourth noise parameter of the sixth region is greater than the noise intensity represented by the fourth noise parameter of the eighth region.
[0027] In some embodiments, the fusing, based on the second image and the adjusted noise image, to obtain the target image, comprises:
[0028] performing blur processing on the adjusted noise image to obtain a blurred noise image;
[0029] fusing the second image and the blurred noise image to obtain the target image.
[0030] In some embodiments, the obtaining the noise image comprises:
[0031] generating random numbers with uniform distribution;
[0032] converting the random numbers with uniform distribution into random numbers with normal distribution based on a preset conversion manner;
[0033] generating Gaussian random numbers based on the random numbers with normal distribution and a perturbation factor;
[0034] generating the noise image based on the Gaussian random numbers.
[0035] According to a second aspect of the embodiments of the present disclosure, an image processing apparatus is provided, and the apparatus comprises:
[0036] an image blurring module configured to perform blurring processing on a first image to obtain a second image;
[0037] a noise obtaining module configured to obtain a preset noise;
[0038] a noise adding module configured to add the preset noise in the second image to obtain a target image.
[0039] In some embodiments, the noise obtaining module is configured to obtain a noise image, the noise image containing the preset noise.
[0040] The noise adding module is configured to fuse the second image and the noise image to obtain the target image.
[0041] In some embodiments, the noise adding module is configured to:
[0042] determine image information of the first image, the image information including at least one of the following: brightness of each region in the first image, and blur degree of each region in the first image;
[0043] adjust noise parameters of each region in the noise image based on the image information, to obtain an adjusted noise image, the noise parameters of each region in the noise image being used to represent noise intensity of the region, and the regions in the noise image corresponding to the regions in the first image one by one;
[0044] fuse the second image and the adjusted noise image to obtain the target image.
[0045] In some embodiments, the apparatus further includes:
[0046] a shooting scene determining module configured to determine a shooting scene of the first image, the shooting scene including a first shooting scene or a second shooting scene, and an ambient light brightness in the first shooting scene being greater than an ambient light brightness in the second shooting scene;
[0047] a noise parameter determining module configured to, when the shooting scene of the first image is the first shooting scene, determine the noise parameters of each region in the noise image as first noise parameters;
[0048] a noise parameter determining module configured to, when the shooting scene of the first image is the second shooting scene, determine the noise parameters of each region in the noise image as second noise parameters; and wherein the noise intensity represented by the first noise parameters is less than the noise intensity represented by the second noise parameters.
[0049] In some embodiments, the noise adding module is configured to:
[0050] adjust the noise parameters of each region in the noise image based on the brightness of each region in the first image, to obtain an adjusted noise image, the noise parameters of each region in the adjusted noise image being third noise parameters;
[0051] The first region in the first image corresponds to a second region in the adjusted noise image, a third region in the first image corresponds to a fourth region in the adjusted noise image, the brightness of the first region is greater than the brightness of the third region, and the noise intensity represented by the third noise parameter of the second region is less than the noise intensity represented by the third noise parameter of the fourth region.
[0052] In some embodiments, the noise adding module is configured to:
[0053] adjust the noise parameter of each region in the noise image based on the blur degree of each region in the first image, to obtain an adjusted noise image, the noise parameter of each region in the adjusted noise image being a fourth noise parameter;
[0054] The fifth region in the first image corresponds to a sixth region in the adjusted noise image, a seventh region in the first image corresponds to an eighth region in the adjusted noise image, the brightness of the fifth region is greater than the brightness of the seventh region, and the noise intensity represented by the fourth noise parameter of the sixth region is greater than the noise intensity represented by the fourth noise parameter of the eighth region.
[0055] In some embodiments, the noise adding module is configured to:
[0056] perform blur processing on the adjusted noise image to obtain a blurred noise image;
[0057] fuse the second image and the blurred noise image to obtain the target image.
[0058] In some embodiments, the noise obtaining module is configured to:
[0059] generate uniformly distributed random numbers;
[0060] convert the uniformly distributed random numbers into normally distributed random numbers based on a preset conversion manner;
[0061] generate Gaussian random numbers based on the normally distributed random numbers and a perturbation factor;
[0062] generate the noise image based on the Gaussian random numbers.
[0063] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, comprising:
[0064] a processor;
[0065] a memory for storing processor-executable instructions;
[0066] The processor is configured to perform the method in the first aspect of the embodiments of the present disclosure.
[0067] According to a fourth aspect of the embodiments of the present disclosure, a non-transitory computer-readable storage medium is provided, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method in the first aspect of the embodiments of the present disclosure.
[0068] The above method of the present disclosure has the following beneficial effects:
[0069] The method provided by the embodiments of the present disclosure, after performing the blurring processing on the first image to obtain the second image, adds noise in the second image to destroy the boundary of the blurred layered phenomenon in the second image, thereby weakening the blurred layered phenomenon in the second image visually, and improving the visual effect of the target image obtained by the final processing.
[0070] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0071] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure.
[0072] Figure 1 is a schematic diagram of a sky region according to an exemplary embodiment;
[0073] Figure 2 is a schematic diagram of a sky region according to an exemplary embodiment;
[0074] Figure 3 is a schematic diagram of a solid color wall region according to an exemplary embodiment;
[0075] Figure 4 is a flowchart of an image processing method according to an exemplary embodiment;
[0076] Figure 5 is a flowchart of an image processing method according to an exemplary embodiment;
[0077] Figure 6 is a flowchart of an image processing method according to an exemplary embodiment;
[0078] Figure 7 is a schematic diagram of an image according to an exemplary embodiment;
[0079] Figure 8 is a schematic diagram of an image according to an exemplary embodiment;
[0080] Figure 9 is a schematic diagram of an image according to an example embodiment;
[0081] Figure 10 is a schematic diagram of an image according to an example embodiment;
[0082] Figure 11 is a schematic diagram of an image according to an example embodiment;
[0083] Figure 12 is a schematic diagram of an image according to an example embodiment;
[0084] Figure 13 is a block diagram of an image processing apparatus according to an example embodiment;
[0085] Figure 14 is a block diagram of an electronic device according to an example embodiment. DETAILED DESCRIPTION
[0086] The example embodiments will be described in detail herein with reference to the attached drawings. In the following description, like reference numerals refer to like elements, unless the context clearly dictates otherwise. The following description of example embodiments is not representative of all possible embodiments consistent with the present application. Rather, it is merely an example of apparatus and methods consistent with some aspects of the present application as detailed in the appended claims.
[0087] The process of generating an image with a bokeh effect: the depth information of the current imaging scene is calculated by a multi-camera system or a deep learning algorithm in an electronic device, then the blur radius corresponding to the out-of-focus plane pixel points is calculated according to different depth information, and finally the image with a bokeh effect is generated according to the blur radius corresponding to each pixel point, that is, a bokeh image is generated.
[0088] In related art, when there is a large area of color similar region in the image, for example, the sky, the pure color wall surface, etc., the bokeh image after the bokeh exists the bokeh layering position. In an example, referring to the schematic diagram of the sky region shown in Figure 1 , the brightness distribution of the sky region in the clear image Figure 1 a) is not uniform, showing a gradual slow change, and the image itself has a large noise, which not only removes the noise of the sky region, but also compresses the gray scale range of the sky region when implementing the image bokeh, resulting in the bokeh layering phenomenon in the bokeh image Figure 1 b). In another example, referring to the schematic diagram of the sky region shown in Figure 2 Figure 2 Image a is an unblurred image taken by an electronic device. Figure 2 b represents the blurred image. See another example. Figure 3 The diagram shows a solid-color wall area. Figure 3 Image a is an unblurred image taken by an electronic device. Figure 3 b represents the blurred image. From the example above, it can be seen that the blurred image exhibits a layered blurring effect.
[0089] The method provided in this disclosure weakens the blurring layers visually by adding noise to the blurred image and disrupting the boundaries of the blurring layers.
[0090] The method provided in this disclosure is executed by an electronic device, which may be a mobile phone, tablet computer, laptop computer, desktop computer, wearable device, or other device with image processing capabilities.
[0091] Figure 4 This is a flowchart illustrating an image processing method according to an exemplary embodiment, executed by an electronic device, see [link to flowchart]. Figure 4 The method includes the following steps:
[0092] Step S401: Blur the first image to obtain the second image.
[0093] The first image is either the original image captured by an electronic device, or the original image processed by an image algorithm. The second image is the blurred image corresponding to the first image.
[0094] Step S402: Obtain the preset noise.
[0095] The preset noise can be Gaussian noise, Laplace noise, or other noise.
[0096] Step S403: Add preset noise to the second image to obtain the target image.
[0097] The second image contains a blurring and layering phenomenon. By adding preset noise to the second image, the boundaries of the blurring and layering in the second image are destroyed, thereby weakening the blurring and layering phenomenon in the second image and obtaining the target image, which is an image containing preset noise and having a blurring effect.
[0098] The method provided in this embodiment of the present disclosure, after blurring the first image to obtain the second image, adds noise to the second image to destroy the boundaries of the blurring layers in the second image, thereby visually weakening the blurring layer phenomenon in the second image and improving the visual effect of the final processed target image.
[0099] Figure 5This is a flowchart illustrating an image processing method according to an exemplary embodiment, executed by an electronic device, see [link to flowchart]. Figure 5 The method includes the following steps:
[0100] Step S501: Blur the first image to obtain the second image.
[0101] In some embodiments, depth information of the imaging scene of the first image is calculated using a deep learning algorithm. Then, the blur radius corresponding to the pixel point outside the focal plane is calculated based on the different depth information. Finally, a second image is generated based on the blur radius corresponding to each pixel point. Of course, other methods can also be used to blur the first image. This disclosure does not limit the specific implementation of the blurring process.
[0102] Step S502: Obtain a noise image, which contains preset noise.
[0103] The preset noise can be Gaussian noise, Laplace noise, or other noise.
[0104] In some embodiments, when the preset noise is Gaussian noise, acquiring a noise image includes: generating uniformly distributed random numbers; converting the uniformly distributed random numbers into normally distributed random numbers based on a preset transformation method; generating Gaussian random numbers based on the normally distributed random numbers and a perturbation factor; and generating a noise image based on the Gaussian random numbers.
[0105] Optionally, the default transformation method is Box-Muller transformation. The process of generating Gaussian random numbers includes: generating two uniformly distributed random numbers U and V between 0 and 1; then using U and V as inputs to Box-Muller transformation; using Box-Muller transformation to output random numbers Z0 and Z1 that satisfy the standard normal distribution; then, in order to increase randomness, randomly selecting a random number from Z0 and Z1; and multiplying the selected random number by the perturbation factor K to obtain Gaussian random numbers.
[0106] The Box-Muller transform can be expressed by the following formula:
[0107]
[0108]
[0109] Where Z0 and Z1 are two random numbers that satisfy a standard normal distribution, and U and V are two random numbers that satisfy a uniform distribution.
[0110] Optionally, generating a noisy image based on a Gaussian random number includes: determining Gaussian noise based on the Gaussian random number, and then adding the Gaussian noise to a blank image to obtain a noisy image. The blank image is a completely blank image that does not contain any noise.
[0111] Step S503: The target image is obtained by fusing the second image and the noisy image.
[0112] In some embodiments, the second image and the noisy image are weighted to obtain the target image. For example, for each pixel value in the second image and the noisy image, the weighted pixel value is determined using the following formula:
[0113]
[0114] Where x represents the pixel value in the target image after fusion, x1 represents the pixel value in the second image, x2 represents the pixel value in the noisy image, w1 represents the fusion weight of the second image, and w2 represents the fusion weight of the noisy image.
[0115] The fusion weights of the second image and the noisy image can be preset values based on experience.
[0116] Of course, in some embodiments, other methods can be used to fuse the second image and the noise image, for example, by directly superimposing the second image and the noise image to obtain the target image.
[0117] The method provided in this embodiment of the present disclosure, after blurring the first image to obtain the second image, breaks the boundary of the blurring layer in the second image by fusing the second image and the noisy image, thereby visually weakening the blurring layer phenomenon in the second image and improving the visual effect of the final processed target image.
[0118] Figure 6 This is a flowchart illustrating an image processing method according to an exemplary embodiment, executed by an electronic device, see [link to flowchart]. Figure 6 The method includes the following steps:
[0119] Step S601: Blur the first image to obtain the second image.
[0120] Step S602: Obtain a noise image, which contains preset noise.
[0121] Step S603: Based on the shooting scene of the first image, determine the noise parameters of each region in the noisy image.
[0122] The shooting scene includes either a first shooting scene or a second shooting scene, where the ambient light intensity in the first shooting scene is greater than that in the second shooting scene. For example, the first shooting scene is a daytime scene, and the second shooting scene is a nighttime scene. The noise parameters for each area determined based on the shooting scene are the same.
[0123] In some embodiments, determining noise parameters for each region in a noisy image based on the shooting scene of the first image includes: determining the shooting scene of the first image; when the shooting scene of the first image is a first shooting scene, determining the noise parameters for each region in the noisy image as a first noise parameter; when the shooting scene of the first image is a second shooting scene, determining the noise parameters for each region in the noisy image as a second noise parameter; wherein the noise intensity represented by the first noise parameter is less than the noise intensity represented by the second noise parameter. That is, the brighter the ambient light, the smaller the noise intensity represented by the determined noise parameter; the darker the ambient light, the greater the noise intensity represented by the determined noise parameter.
[0124] In one example, taking the first shooting scene as a daytime scene and the second shooting scene as a nighttime scene, see [link / reference]. Figure 7 The image shown is a schematic diagram. Figure 7 Image 'a' is the first image taken during the daytime scene. Figure 7 b is the first image taken in a nighttime scene, from... Figure 7 a and Figure 7 As can be seen from b, the noise in the first image taken during the daytime scene is weaker, while the noise in the first image taken at nighttime is stronger. If the same noise parameters are used for both daytime and nighttime scenes, if the noise intensity represented by the noise parameters is too small, the blurring and layering phenomenon in the image taken at nighttime will be difficult to resolve; if the noise intensity represented by the noise parameters is too large, the noise in the image taken during the daytime scene will be excessive, affecting the visual effect of the final target image. Therefore, different noise parameters are configured for daytime and nighttime scenes, so that the noise intensity represented by the noise parameters in the nighttime scene is greater than that represented by the noise parameters in the daytime scene.
[0125] Step S604: Determine the image information of the first image, which includes at least one of the following: the brightness of each region in the first image, and the blur level of each region in the first image.
[0126] In some embodiments, the first image is identified to determine the brightness of each region in the first image and the degree of blur in each region.
[0127] Step S605: Based on the image information, adjust the noise parameters of each region in the noise image to obtain the adjusted noise image. The noise parameters of each region in the noise image are used to characterize the noise intensity of the region. The regions in the noise image correspond one-to-one with the regions in the first image.
[0128] In this embodiment of the disclosure, since the image information indicates the brightness and / or blur level of each region in the first image, and the regions in the noise image are one-to-one with the regions in the first image, for a target region in the noise image, the noise parameters of the target region are adjusted according to the brightness and / or blur level of the region in the first image corresponding to the target region. The target region can be any region in the noise image.
[0129] In some embodiments, based on the brightness of each region in the first image, the noise parameter of each region in the noise image is adjusted to obtain an adjusted noise image. The noise parameter of each region in the adjusted noise image is a third noise parameter. Specifically, the first region in the first image corresponds to the second region in the adjusted noise image, and the third region in the first image corresponds to the fourth region in the adjusted noise image. The brightness of the first region is greater than the brightness of the third region, and the noise intensity represented by the third noise parameter of the second region is less than the noise intensity represented by the third noise parameter of the fourth region. That is, brightness and the noise intensity represented by the noise parameter are negatively correlated; the brighter the brightness, the smaller the noise intensity represented by the adjusted noise parameter, and the darker the brightness, the greater the noise intensity represented by the adjusted noise parameter.
[0130] Optionally, when the first image is captured in a first shooting scene, the first noise parameter of each region in the noise image is adjusted based on the brightness of each region in the first image to obtain the adjusted noise image; when the first image is captured in a second shooting scene, the second noise parameter of each region in the noise image is adjusted based on the brightness of each region in the first image to obtain the adjusted noise image.
[0131] See one example. Figure 8 The illustrated image shows that in the first image, the noise in the darker areas is greater than that in the brighter areas. If the same noise parameters are used for both the bright and dark areas, if the noise intensity represented by the noise parameters is too low, the blurring and layering phenomenon in the darker areas of the second image will be difficult to resolve. If the noise intensity represented by the noise parameters is too high, the noise in the brighter areas of the second image will be excessive, affecting the visual effect of the final target image. Therefore, different noise parameters are configured for the brighter and darker areas.
[0132] In this embodiment of the disclosure, the noise parameters are adjusted according to the brightness of each region, thereby configuring a more suitable noise intensity for each region, so that the final target image can weaken the blurring and layering phenomenon without letting noise affect the visual effect.
[0133] In some embodiments, based on the blur level of each region in the first image, the noise parameter of each region in the noise image is adjusted to obtain an adjusted noise image. The noise parameter of each region in the adjusted noise image is a fourth noise parameter. Specifically, the fifth region in the first image corresponds to the sixth region in the adjusted noise image, and the seventh region in the first image corresponds to the eighth region in the adjusted noise image. The brightness of the fifth region is greater than that of the seventh region, and the noise intensity represented by the fourth noise parameter of the sixth region is greater than that represented by the fourth noise parameter of the eighth region. That is, the blur level is positively correlated with the noise intensity represented by the noise parameter; the greater the blur level, the greater the noise intensity represented by the adjusted noise parameter, and vice versa.
[0134] Optionally, when the first image is captured in the first shooting scene, the first noise parameter of each region in the noise image is adjusted based on the blur level of each region in the first image to obtain the adjusted noise image; when the first image is captured in the second shooting scene, the second noise parameter of each region in the noise image is adjusted based on the blur level of each region in the first image to obtain the adjusted noise image.
[0135] See one example. Figure 9 The image shown is a schematic diagram. Figure 9 a and Figure 9 b represents two different regions within the same second image. Figure 9 'a' represents a region with a high degree of ambiguity. Figure 9 b represents the region with less ambiguity, from Figure 9 It can be seen that the more blurred the areas in the second image, the more severe the blurring and layering phenomenon. If the same noise parameters are used for both the more blurred and less blurred areas, if the noise intensity represented by the noise parameters is too small, the blurring and layering phenomenon in the more blurred areas of the second image will be difficult to resolve. If the noise intensity represented by the noise parameters is too large, the noise in the less blurred areas of the second image will be too heavy, affecting the visual effect of the final target image. Therefore, different noise parameters should be configured for the more blurred and less blurred areas.
[0136] It should be noted that the above implementation adjusts the noise parameters based on brightness and blur level respectively. In another embodiment, the noise parameters of each region in the noisy image can be adjusted based on the brightness and blur level of each region in the first image. Optionally, for any region in the first image, when the region is brighter and less blurry, the noise parameters of that region are adjusted to reduce the noise intensity represented by the adjusted noise parameters; when the region is darker and more blurry, the noise parameters of that region are adjusted to increase the noise intensity represented by the adjusted noise parameters; when the region is brighter and more blurry, the noise parameters of that region are adjusted to increase the noise intensity represented by the adjusted noise parameters, but the noise intensity is still less than the noise intensity when the brightness is darker at the same blur level; when the region is darker and less blurry, the noise parameters of that region are adjusted to reduce the noise intensity represented by the adjusted noise parameters, but the noise intensity is still greater than the noise intensity when the brightness is brighter at the same blur level.
[0137] Step S606: Blur the adjusted noise image to obtain a blurred noise image.
[0138] In this embodiment of the disclosure, in order to reduce the interference of noise on the background of the second image, the adjusted noisy image is first blurred. Optionally, the adjusted noisy image may be subjected to Gaussian blurring or other blurring processing. This embodiment of the disclosure does not limit the specific implementation of the blurring processing.
[0139] Step S607: The second image and the blurred noisy image are fused to obtain the target image.
[0140] The fusion method of the second image and the blurred noise image is the same as the fusion method of the second image and the noise image in the above embodiment, and will not be repeated here.
[0141] It should be noted that, in another embodiment, step S606 may be omitted, and the target image may be obtained by directly fusing the second image and the adjusted noisy image.
[0142] See one example. Figure 10 The image shown is a schematic diagram. Figure 10 a is a schematic diagram of the region with a high degree of blurring when no noise is added. Figure 10 b is a schematic diagram of the region with a high degree of blurring after adding noise. Figure 10 It can be seen that the blurring and layering phenomenon is significantly weakened in the area after adding noise.
[0143] See one example. Figure 11 The image shown is a schematic diagram. Figure 11a is a schematic diagram of the sky region without added noise. Figure 11 b is a schematic diagram of the sky region after adding noise, from... Figure 11 It can be seen that the blurring and layering phenomenon in the sky region is significantly weakened after adding noise.
[0144] See one example. Figure 12 The image shown is a schematic diagram. Figure 12 a is a schematic diagram of a solid-color wall area without added noise. Figure 12 b is a schematic diagram of the solid-color wall area after noise has been added. Figure 12 It can be seen that the addition of noise significantly weakens the blurring and layering effect in the solid-color wall areas.
[0145] The method provided in this embodiment of the present disclosure, after blurring the first image to obtain the second image, breaks the boundary of the blurring layer in the second image by fusing the second image and the noisy image, thereby visually weakening the blurring layer phenomenon in the second image. At the same time, it can avoid excessive interference with the background in the second image and improve the visual effect of the final processed target image.
[0146] Figure 13 This is a block diagram illustrating an image processing apparatus according to an exemplary embodiment, configured in an electronic device, see [link to relevant documentation]. Figure 13 The device includes:
[0147] The image blurring module 1301 is configured to blur the first image to obtain the second image;
[0148] The noise acquisition module 1302 is configured to acquire a preset noise.
[0149] The noise addition module 1303 is configured to add preset noise to the second image to obtain the target image.
[0150] In some embodiments, the noise acquisition module 1302 is configured to acquire a noise image, the noise image containing preset noise;
[0151] The noise addition module 1303 is configured to fuse the second image and the noise image to obtain the target image.
[0152] In some embodiments, the noise addition module 1303 is configured to:
[0153] Determine the image information of the first image, which includes at least one of the following: the brightness of each region in the first image, and the blur level of each region in the first image;
[0154] Based on image information, the noise parameters of each region in the noisy image are adjusted to obtain the adjusted noisy image. The noise parameters of each region in the noisy image are used to characterize the noise intensity of the region. The regions in the noisy image correspond one-to-one with the regions in the first image.
[0155] The target image is obtained by fusing the second image and the adjusted noisy image.
[0156] In some embodiments, the apparatus further includes:
[0157] The shooting scene determination module is configured to determine the shooting scene of the first image. The shooting scene includes a first shooting scene or a second shooting scene, and the ambient light brightness in the first shooting scene is greater than the ambient light brightness in the second shooting scene.
[0158] The noise parameter determination module is configured to determine the noise parameter of each region in the noisy image as the first noise parameter when the shooting scene of the first image is the first shooting scene;
[0159] The noise parameter determination module is configured such that when the shooting scene of the first image is the second shooting scene, the noise parameter of each region in the noisy image is the second noise parameter; wherein the noise intensity represented by the first noise parameter is less than the noise intensity represented by the second noise parameter.
[0160] In some embodiments, the noise addition module 1303 is configured to:
[0161] Based on the brightness of each region in the first image, the noise parameters of each region in the noisy image are adjusted to obtain the adjusted noisy image. The noise parameters of each region in the adjusted noisy image are the third noise parameters.
[0162] The first region in the first image corresponds to the second region in the adjusted noisy image, the third region in the first image corresponds to the fourth region in the adjusted noisy image, the brightness of the first region is greater than the brightness of the third region, and the noise intensity represented by the third noise parameter of the second region is less than the noise intensity represented by the third noise parameter of the fourth region.
[0163] In some embodiments, the noise addition module 1303 is configured to:
[0164] Based on the blur level of each region in the first image, the noise parameters of each region in the noisy image are adjusted to obtain the adjusted noisy image. The noise parameters of each region in the adjusted noisy image are the fourth noise parameters.
[0165] The fifth region in the first image corresponds to the sixth region in the adjusted noisy image, and the seventh region in the first image corresponds to the eighth region in the adjusted noisy image. The brightness of the fifth region is greater than that of the seventh region, and the noise intensity represented by the fourth noise parameter of the sixth region is greater than that represented by the fourth noise parameter of the eighth region.
[0166] In some embodiments, the noise addition module 1303 is configured to:
[0167] The adjusted noisy image is blurred to obtain a blurred noisy image.
[0168] The second image and the blurred noisy image are fused to obtain the target image.
[0169] In some embodiments, the noise acquisition module 1302 is configured to:
[0170] Generate uniformly distributed random numbers;
[0171] Based on a preset transformation method, uniformly distributed random numbers are converted into normally distributed random numbers;
[0172] Generate Gaussian random numbers based on normally distributed random numbers and perturbation factors;
[0173] Noisy images are generated based on Gaussian random numbers.
[0174] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0175] This disclosure also provides an electronic device, including: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the image processing method described above.
[0176] Figure 14 This is a block diagram of an electronic device 1400 according to an exemplary embodiment.
[0177] Reference Figure 14 The electronic device 1400 may include one or more of the following components: a processing component 1402, a memory 1404, a power supply component 1406, a multimedia component 1408, an audio component 1410, an input / output (I / O) interface 1412, a sensor component 1414, and a communication component 1416.
[0178] Processing component 1402 typically controls the overall operation of electronic device 1400, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1402 may include one or more processors 1420 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 1402 may include one or more modules to facilitate interaction between processing component 1402 and other components. For example, processing component 1402 may include a multimedia module to facilitate interaction between multimedia component 1408 and processing component 1402.
[0179] Memory 1404 is configured to store various types of data to support the operation of electronic device 1400. Examples of this data include instructions for any application or method operating on electronic device 1400, contact data, phonebook data, messages, pictures, videos, etc. Memory 1404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0180] Power supply component 1406 provides power to various components of electronic device 1400. Power supply component 1406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 1400.
[0181] Multimedia component 1408 includes a screen that provides an output interface between the electronic device 1400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 1408 includes a front-facing camera and / or a rear-facing camera. When the electronic device 1400 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0182] Audio component 1410 is configured to output and / or input audio signals. For example, audio component 1410 includes a microphone (MIC) configured to receive external audio signals when electronic device 1400 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1404 or transmitted via communication component 1416. In some embodiments, audio component 1410 also includes a speaker for outputting audio signals.
[0183] I / O interface 1412 provides an interface between processing component 1402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0184] Sensor assembly 1414 includes one or more sensors for providing state assessments of various aspects of electronic device 1400. For example, sensor assembly 1414 may detect the on / off state of electronic device 1400, the relative positioning of components such as the display and keypad of electronic device 1400, changes in position of electronic device 1400 or a component of electronic device 1400, the presence or absence of user contact with electronic device 1400, orientation or acceleration / deceleration of electronic device 1400, and temperature changes of electronic device 1400. Sensor assembly 1414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 1414 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0185] Communication component 1416 is configured to facilitate wired or wireless communication between electronic device 1400 and other devices. Electronic device 1400 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 1416 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1416 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0186] In an exemplary embodiment, the electronic device 1400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0187] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1404 including instructions, which can be executed by a processor 1420 of an electronic device 1400 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0188] This disclosure also provides a non-transitory computer-readable storage medium, wherein when the instructions in the storage medium are executed by the processor of an electronic device, the electronic device is able to perform the image processing method described above.
[0189] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.
[0190] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. An image processing method, characterized in that, The method includes: The first image is blurred to obtain the second image; Obtain the preset noise; The preset noise is added to the second image to obtain the target image.
2. The method according to claim 1, characterized in that, The acquisition of preset noise includes: Acquire a noise image, the noise image containing the preset noise; The step of adding the preset noise to the second image to obtain the target image includes: The target image is obtained by fusing the second image and the noisy image.
3. The method according to claim 2, characterized in that, The process of fusing the second image and the noisy image to obtain the target image includes: Determine the image information of the first image, wherein the image information includes at least one of the following: the brightness of each region in the first image, and the blur level of each region in the first image; Based on the image information, the noise parameters of each region in the noise image are adjusted to obtain the adjusted noise image. The noise parameters of each region in the noise image are used to characterize the noise intensity of the region. The regions in the noise image correspond one-to-one with the regions in the first image. The target image is obtained by fusing the second image and the adjusted noisy image.
4. The method according to claim 3, characterized in that, Before adjusting the noise parameters of each region in the noisy image based on the image information to obtain the adjusted noisy image, the method further includes: The shooting scene of the first image is determined, and the shooting scene includes a first shooting scene or a second shooting scene, wherein the ambient light brightness in the first shooting scene is greater than the ambient light brightness in the second shooting scene; When the shooting scene of the first image is the first shooting scene, the noise parameter of each region in the noisy image is determined as the first noise parameter; When the shooting scene of the first image is the second shooting scene, the noise parameter of each region in the noisy image is the second noise parameter; wherein, the noise intensity represented by the first noise parameter is less than the noise intensity represented by the second noise parameter.
5. The method according to claim 3, characterized in that, The step of adjusting the noise parameters of each region in the noisy image based on the image information to obtain the adjusted noisy image includes: Based on the brightness of each region in the first image, the noise parameters of each region in the noisy image are adjusted to obtain an adjusted noisy image, wherein the noise parameters of each region in the adjusted noisy image are the third noise parameters; Wherein, the first region in the first image corresponds to the second region in the adjusted noise image, the third region in the first image corresponds to the fourth region in the adjusted noise image, the brightness of the first region is greater than the brightness of the third region, and the noise intensity represented by the third noise parameter of the second region is less than the noise intensity represented by the third noise parameter of the fourth region.
6. The method according to claim 3, characterized in that, The step of adjusting the noise parameters of each region in the noisy image based on the image information to obtain the adjusted noisy image includes: Based on the blur level of each region in the first image, the noise parameters of each region in the noisy image are adjusted to obtain an adjusted noisy image. The noise parameters of each region in the adjusted noisy image are the fourth noise parameters. Wherein, the fifth region in the first image corresponds to the sixth region in the adjusted noise image, the seventh region in the first image corresponds to the eighth region in the adjusted noise image, the brightness of the fifth region is greater than the brightness of the seventh region, and the noise intensity represented by the fourth noise parameter of the sixth region is greater than the noise intensity represented by the fourth noise parameter of the eighth region.
7. The method according to claim 3, characterized in that, The process of fusing the second image and the adjusted noisy image to obtain the target image includes: The adjusted noise image is blurred to obtain a blurred noise image; The second image and the blurred noisy image are fused to obtain the target image.
8. The method according to claim 2, characterized in that, The acquisition of the noisy image includes: Generate uniformly distributed random numbers; Based on a preset transformation method, the uniformly distributed random numbers are converted into normally distributed random numbers; Gaussian random numbers are generated based on the normally distributed random numbers and the perturbation factor. The noisy image is generated based on the Gaussian random number.
9. An image processing apparatus, characterized in that, The device includes: The image blurring module is configured to blur the first image to obtain the second image; The noise acquisition module is configured to acquire a preset noise. The noise addition module is configured to add the preset noise to the second image to obtain the target image.
10. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to perform the method as described in any one of claims 1-8.
11. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the method as described in any one of claims 1-8.