Image processing method, image processing device, server, and storage medium

By performing underexposure and contrast correction on the image to be processed, combined with color blending and blending weight adjustment, the problems of brightness enhancement and contrast reduction in image fusion are solved, thus improving the quality of soft focus blurring effect.

CN117391926BActive Publication Date: 2026-07-10BEIJING XIAOMI MOBILE SOFTWARE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING XIAOMI MOBILE SOFTWARE CO LTD
Filing Date
2022-06-30
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing technologies often lead to increased brightness and decreased contrast, as well as reduced resolution during image fusion, making it difficult to maintain the artistic quality of the image, especially when achieving soft-focus bokeh effects.

Method used

By underexposing and contrast-correcting the image to be processed, the overall brightness of the image is reduced and the contrast is increased. Then, image fusion is performed, and color fusion and fusion weight adjustment are used to optimize the bokeh effect of the image.

Benefits of technology

It effectively reduces the brightness increase and contrast decrease caused by image fusion, improves the quality of the bokeh effect, and enhances the artistic expressiveness of the soft focus effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117391926B_ABST
    Figure CN117391926B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an image processing method, an image processing device, a server and a storage medium. The image processing method comprises: obtaining a to-be-processed image; performing a preset blur processing on the to-be-processed image to obtain a blurred image; performing an underexposure processing on the to-be-processed image to obtain an underexposed image; performing a contrast correction on the obtained underexposed image to obtain a contrast corrected image; and performing image fusion on the blurred image and the contrast corrected image to obtain an output image with an optical effect. In the present application, the overall brightness of the to-be-processed image is reduced by performing underexposure and contrast correction processing on the to-be-processed image, and the contrast is improved, so that the output image after image fusion can effectively reduce the situation of brightness improvement and contrast reduction caused by color filter fusion compared with the fusion image obtained without underexposure processing, thereby improving the quality of the blurring effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of electronic technology, and in particular to an image processing method, an image processing apparatus, a server, and a storage medium. Background Technology

[0002] Soft focus effect refers to the use of soft focus lenses or soft focus filters in photography to achieve a highlight rendering effect. This is particularly useful in portrait photography, as it can conceal facial imperfections and enhance the artistic effect of the image. Soft focus blur is a special portrait blur rendering mode that produces a hazy, soft image with highlighted artistic effects. Summary of the Invention

[0003] This disclosure provides an image processing method, an image processing apparatus, a server, and a storage medium.

[0004] A first aspect of this disclosure provides an image processing method, comprising:

[0005] Obtain the image to be processed;

[0006] The image to be processed is subjected to a preset blurring process to obtain a blurred image;

[0007] The image to be processed is underexposed to obtain an underexposed image;

[0008] The underexposed image is contrast-corrected to obtain a contrast-corrected image;

[0009] The blurred image and the contrast-corrected image are fused to obtain an output image with optical effects.

[0010] In some embodiments, the step of image fusion of the blurred image and the contrast-corrected image to obtain an output image with optical effects includes:

[0011] The blurred image and the contrast-corrected image are subjected to color filtering and fusion to obtain an intermediate image;

[0012] The intermediate image is used as the output image;

[0013] or,

[0014] The intermediate image is fused with the image to be processed according to the fusion weights to obtain the output image;

[0015] The fusion weight is used to allocate pixel brightness values ​​when the intermediate image and the image to be processed are fused.

[0016] In some embodiments, the underexposure processing of the image to be processed to obtain an underexposure image includes:

[0017] Determine the exposure correction coefficient for underexposure processing of the image to be processed;

[0018] Based on the exposure correction coefficient, the pixel brightness of the image to be processed is reduced to obtain the underexposed image.

[0019] In some embodiments, the exposure correction coefficient is determined as a value between 0 and 1 obtained by taking the value of an exponential function with a predetermined base;

[0020] The step of reducing the pixel brightness of the image to be processed based on the exposure correction coefficient to obtain the underexposed image includes:

[0021] The pixel brightness value of the image to be processed is multiplied by the exposure correction coefficient to obtain the pixel brightness value of the underexposed image.

[0022] In some embodiments, performing contrast correction on the obtained underexposed image to obtain a contrast-corrected image includes:

[0023] Determine the contrast correction method;

[0024] Based on the contrast correction method, the underexposed image is contrast corrected to obtain the contrast-corrected image; wherein, when the underexposed image is contrast corrected by the contrast correction method, the smaller the pixel brightness in a region, the greater the reduction in image grayscale.

[0025] In some embodiments, the intermediate image is fused with the image to be processed according to fusion weights to obtain the output image, including:

[0026] Obtain the pixel brightness value of each pixel in the intermediate image;

[0027] Based on the pixel brightness values ​​of each pixel in the intermediate image, a fusion weight corresponding to each pixel in the intermediate image is determined; wherein the fusion weight is related to the pixel brightness values ​​of the pixels in the intermediate image and is determined by the pixel brightness values; wherein different pixel brightness values ​​correspond to different fusion weights.

[0028] In some embodiments, determining the fusion weights corresponding to each pixel of the intermediate image based on the pixel brightness values ​​of each pixel of the intermediate image includes:

[0029] Based on the pixel brightness value of each pixel and the weight determination method, the fusion weight corresponding to each pixel is obtained; wherein, the weight determination method is used to characterize the correspondence between the pixel brightness value and the fusion weight, and the correspondence includes at least: positive correlation.

[0030] In some embodiments, the positive correlation between the pixel brightness value and the fusion weight includes at least the following: the fusion weight corresponding to the pixel has a power-law relationship with the pixel brightness value.

[0031] A second aspect of this disclosure provides an image processing apparatus, comprising:

[0032] The first processing unit is used to acquire the image to be processed;

[0033] The second processing unit is used to perform a preset blurring process on the image to be processed to obtain a blurred image.

[0034] The third processing unit is used to perform underexposure processing on the image to be processed to obtain an underexposure image;

[0035] The fourth processing unit is used to perform contrast correction on the obtained underexposed image to obtain a contrast-corrected image;

[0036] The fifth processing unit is used to perform image fusion on the blurred image and the contrast-corrected image to obtain an output image with optical effects.

[0037] In some embodiments, the fifth processing unit is used for

[0038] The blurred image and the contrast-corrected image are subjected to color filtering and fusion to obtain an intermediate image;

[0039] The intermediate image is used as the output image;

[0040] or,

[0041] The intermediate image is fused with the image to be processed according to the fusion weights to obtain the output image;

[0042] The fusion weight is used to allocate pixel brightness values ​​when the intermediate image and the image to be processed are fused.

[0043] In some embodiments, the third processing unit is used for

[0044] Determine the exposure correction coefficient for underexposure processing of the image to be processed;

[0045] Based on the exposure correction coefficient, the pixel brightness of the image to be processed is reduced to obtain the underexposed image.

[0046] In some embodiments, the exposure correction coefficient is determined as a value between 0 and 1 obtained by taking the value of an exponential function with a predetermined base;

[0047] The third processing unit is used for

[0048] The pixel brightness value of the image to be processed is multiplied by the exposure correction coefficient to obtain the pixel brightness value of the underexposed image.

[0049] In some embodiments, the fourth processing unit is used for

[0050] Determine the contrast correction method;

[0051] Based on the contrast correction method, the underexposed image is contrast corrected to obtain the contrast-corrected image; wherein, when the underexposed image is contrast corrected by the contrast correction method, the smaller the pixel brightness in a region, the greater the reduction in image grayscale.

[0052] In some embodiments, the fifth processing unit is used for

[0053] Based on the pixel brightness value of each pixel and the weight determination method, the fusion weight corresponding to each pixel is obtained; wherein, the weight determination method is used to characterize the correspondence between the pixel brightness value and the fusion weight, and the correspondence includes at least: positive correlation.

[0054] In some embodiments, the positive correlation between the pixel brightness value and the fusion weight includes at least the following: the fusion weight corresponding to the pixel has a power-law relationship with the pixel brightness value.

[0055] A third aspect of this disclosure provides a server, including:

[0056] A processor and a memory for storing a computer program capable of running on the processor, wherein the processor, when running the computer program, performs the steps of the method described in the first aspect.

[0057] A fourth aspect of this disclosure provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the steps of the method described in the first aspect.

[0058] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0059] The image processing method in this embodiment reduces the overall brightness and increases the contrast of the image to be processed by performing underexposure and contrast correction processing. This effectively reduces the increase in brightness and decrease in contrast caused by image fusion compared to the fused image obtained without underexposure processing, thereby improving the quality of the bokeh effect.

[0060] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0061] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0062] Figure 1 This is a flowchart illustrating an image processing method according to an exemplary embodiment.

[0063] Figure 2-a This is a graph of a power function illustrated according to an exemplary embodiment.

[0064] Figure 2-b This is a fusion weight curve diagram illustrated according to an exemplary embodiment.

[0065] Figure 3 This is an image processing flowchart illustrated according to an exemplary embodiment.

[0066] Figure 4 This is a schematic diagram of an image processing apparatus structure according to an exemplary embodiment.

[0067] Figure 5 This is a schematic diagram illustrating an application scenario of an electronic device with a shooting function according to an exemplary embodiment.

[0068] Figure 6 This is a device block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0069] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses consistent with some aspects of this disclosure as detailed in the appended claims.

[0070] Soft focus effect refers to the use of soft focus lenses or soft focus filters in photography to achieve a highlight rendering effect, especially in portrait photography, where it can conceal facial imperfections and enhance the artistic effect of the image. Soft focus blur is a special portrait blur rendering mode that presents a hazy, soft image with an artistic highlight rendering effect. To achieve a soft focus effect, a common image processing method is to blend a Gaussian blurred image with the original sharp image using color filtering. However, this color filtering blending method can lead to a significant increase in brightness, a decrease in contrast, and a reduction in resolution in the resulting image.

[0071] This disclosure provides an image processing method. Figure 1 This is a flowchart illustrating an image processing method according to an exemplary embodiment. Figure 1 As shown, the image processing methods include:

[0072] Step 10: Obtain the image to be processed;

[0073] Step 12: Perform a preset blurring process on the image to be processed to obtain a blurred image;

[0074] Step 13: Perform underexposure processing on the image to be processed to obtain an underexposure image;

[0075] Step 14: Perform contrast correction on the obtained underexposed image to obtain a contrast-corrected image;

[0076] Step 15: Perform image fusion on the blurred image and the contrast-corrected image to obtain an output image with optical effects.

[0077] In this embodiment, the present disclosure is mainly applied to the bokeh rendering processing of object (such as portrait) photography. When an image acquisition device (such as a camera) captures an image in portrait mode, and a clear image is input, the present disclosure will render a soft-focus bokeh image on the clear image through color fusion. The image to be processed is a clear image, which refers to a normally captured image, such as an image captured by the image acquisition device (such as a camera) in a shake-free state or in a shake-compensated state.

[0078] In this embodiment of the disclosure, the preset blur processing may include Gaussian blur processing or other blur processing methods; Gaussian blur processing refers to blurring an underexposed image. The Gaussian blur process of processing an image is to convolve the image with a Gaussian distribution, which can reduce image noise and reduce the level of detail.

[0079] In this embodiment of the disclosure, to overcome the problems of increased image brightness and decreased contrast and resolution introduced by color filtering, exposure correction and contrast correction are performed on the clear image before color filtering fusion. Exposure correction mainly solves the overexposure problem caused by color filtering fusion, while contrast correction improves image contrast and alleviates the problem of low resolution in the fusion result.

[0080] In this embodiment of the disclosure, underexposure processing refers to reducing the overall exposure brightness of the image to be processed. An underexposure image is obtained by optimizing the overall image to be processed with an underexposure coefficient.

[0081] In this embodiment of the disclosure, the contrast correction process reduces the grayscale of pixels in dark areas of the image and improves the image contrast.

[0082] In this embodiment of the disclosure, image fusion may include color filter fusion; color filter fusion refers to performing color filter fusion on the RGB channels of an underexposed image and a Gaussian blurred underexposed image respectively to simulate optical effects (such as soft focus or bokeh effects). Taking soft focus as an example, the soft focus fusion method can be as follows:

[0083] R = 1 - (1 - I) * (1 - B); where R is the fusion result (intermediate image or output image), I is the input original image (here, the contrast-corrected image), and B is the blurred image of the image to be processed. In the specific fusion process, the pixel brightness values ​​of each image are normalized to between 0 and 1 for fusion calculation, resulting in the fused intermediate image.

[0084] In this embodiment of the disclosure, the output image has optical effects, wherein the optical effects may include a soft-focus effect obtained by color filtering fusion.

[0085] The image processing method in this embodiment includes: acquiring an image to be processed; performing a preset blurring process on the image to be processed to obtain a blurred image; performing an underexposure process on the image to be processed to obtain an underexposed image; performing contrast correction on the obtained underexposed image to obtain a contrast-corrected image; and performing image fusion on the blurred image and the contrast-corrected image to obtain an output image with optical effects. In this application, by performing underexposure and contrast correction processing on the image to be processed to reduce the overall brightness and increase the contrast, the output image after image fusion, compared to the fused image obtained without underexposure processing, can effectively reduce the increase in brightness and decrease in contrast caused by image fusion, thereby improving the quality of the bokeh effect.

[0086] In some embodiments, the step of image fusion of the blurred image and the contrast-corrected image to obtain an output image with optical effects includes:

[0087] The blurred image and the contrast-corrected image are subjected to color filtering and fusion to obtain an intermediate image;

[0088] The intermediate image is used as the output image;

[0089] or,

[0090] The intermediate image is fused with the image to be processed according to the fusion weights to obtain the output image;

[0091] The fusion weight is used to allocate pixel brightness values ​​when the intermediate image and the image to be processed are fused.

[0092] In one embodiment of this disclosure, image fusion can be color filtering fusion, that is, the intermediate image obtained by color filtering fusion of the underexposed image and the underexposed blurred image is used as the output image, thereby effectively reducing the brightness increase caused by image fusion and improving the quality of the bokeh effect.

[0093] In one embodiment of this disclosure, to improve the contrast and resolution of the output image, a weighted fusion method can be used to fuse a clear image to be processed. This involves weighting the intermediate image obtained through color filtering fusion and then fusing it with the image to be processed to obtain the output image. By allocating pixel brightness values ​​during the fusion of the intermediate image and the image to be processed using fusion weights, the bright areas of the intermediate image maintain a soft-focus effect, while the dark areas maintain resolution. Specifically, the bright areas of the intermediate image have larger fusion weight values, while the dark areas have smaller fusion weight values. Similarly, the bright areas of the image to be processed have smaller fusion weight values, while the dark areas have larger fusion weight values, thus fusing them to obtain the output image. The resulting output image exhibits significantly improved contrast and resolution compared to the intermediate image obtained through color filtering fusion.

[0094] In some embodiments, the underexposure processing of the image to be processed to obtain an underexposure image includes:

[0095] Determine the exposure correction coefficient for underexposure processing of the image to be processed;

[0096] Based on the exposure correction coefficient, the pixel brightness of the image to be processed is reduced to obtain the underexposed image.

[0097] In this embodiment of the disclosure, the exposure correction coefficient is determined to be a value between 0 and 1 obtained by taking the value of an exponential function with a predetermined base;

[0098] The step of reducing the pixel brightness of the image to be processed based on the exposure correction coefficient to obtain the underexposed image includes:

[0099] The pixel brightness value of the image to be processed is multiplied by the exposure correction coefficient to obtain the pixel brightness value of the underexposed image.

[0100] In this embodiment of the disclosure, to overcome the problem of significantly increased image brightness introduced by color filter fusion, underexposure processing is performed on the input image to be processed. The exposure correction coefficient is a value less than 1, used to reduce the pixel brightness of the image to be processed. The brightness value of each pixel of the image to be processed is multiplied by the exposure correction coefficient to obtain the brightness value of each pixel of the underexposed image, thereby obtaining an underexposed image with reduced exposure brightness. The underexposed image processing method is as follows:

[0101] Irever = Iorig * 2 EV .

[0102] Where Irever represents the underexposed image after underexposure processing, Iorig represents the original clear image to be processed, and EV is the exposure correction factor. When EV = 0, the image is not corrected for exposure; when EV > 0, the image exposure is increased; when EV < 0, the image exposure is decreased. To achieve image underexposure processing, typical EV values ​​are -0.75 or -0.5.

[0103] In some embodiments, performing contrast correction on the obtained underexposed image to obtain a contrast-corrected image includes:

[0104] Determine the contrast correction method;

[0105] Based on the contrast correction method, the underexposed image is contrast corrected to obtain the contrast-corrected image; wherein, when the underexposed image is contrast corrected by the contrast correction method, the smaller the pixel brightness in a region, the greater the reduction in image grayscale, and the greater the improvement in contrast.

[0106] To overcome the issues of increased image brightness and decreased contrast and resolution introduced by color filtering, exposure and contrast corrections are performed on the clear image before color filtering. Exposure correction primarily addresses the overexposure problem caused by color filtering, while contrast correction improves image contrast and alleviates the low resolution of the fused image.

[0107] Contrast correction methods are as follows:

[0108] Irever=pow(Iorig, 1 / sigma);

[0109] Where Irever is the contrast-corrected image, Iorig is the underexposed image (0-1 distribution), pow(*,*) is the power operation, and sigma is the correction coefficient. When sigma = 1, the image remains unchanged; when sigma < 1, the grayscale of dark pixels in the image is reduced, increasing the image contrast; when sigma > 1, the grayscale of dark pixels in the image is brightened, reducing the image contrast. To improve image contrast, a typical value for sigma is 0.5. Changing sigma can alter the degree of brightness reduction in different dark areas. The specific sigma correction coefficient is determined by the image captured by the camera.

[0110] In some embodiments, the intermediate image is fused with the image to be processed according to fusion weights to obtain the output image, including:

[0111] Obtain the pixel brightness value of each pixel in the intermediate image;

[0112] Based on the pixel brightness values ​​of each pixel in the intermediate image, a fusion weight corresponding to each pixel in the intermediate image is determined; wherein the fusion weight is related to the pixel brightness values ​​of the pixels in the intermediate image and is determined by the pixel brightness values; wherein different pixel brightness values ​​correspond to different fusion weights.

[0113] In this embodiment of the disclosure, determining the fusion weight corresponding to the pixel based on the pixel brightness value includes:

[0114] Based on the pixel brightness value of each pixel, the fusion weight corresponding to each pixel is determined.

[0115] Based on the fusion weights corresponding to each pixel, the intermediate image and the image to be processed are fused to obtain the output image.

[0116] In this embodiment of the disclosure, determining the fusion weight corresponding to each pixel of the intermediate image based on the pixel brightness value of each pixel of the intermediate image includes:

[0117] Based on the pixel brightness value of each pixel and the weight determination method, the fusion weight corresponding to each pixel is obtained; wherein, the weight determination method is used to characterize the correspondence between the pixel brightness value and the fusion weight, and the correspondence includes at least: positive correlation.

[0118] In this embodiment of the disclosure, the positive correlation between the pixel brightness value and the fusion weight includes at least the following: the fusion weight corresponding to the pixel has a power-law relationship with the pixel brightness value.

[0119] In this embodiment of the disclosure, when obtaining the output fused image by fusing a clear intermediate image with the image to be processed, it can be achieved by weighted fusion based on fusion weights.

[0120] To address the issue of reduced image resolution caused by color filter blending, the result of the color filter blending and the sharp image are mixed according to alpha weights. An example implementation is as follows:

[0121] Ralpha=R*alpha+I*(1-alpha);

[0122] Where Ralpha is the output image after alpha weighted fusion, R is the intermediate image after color filter fusion, and I is the original sharp image. alpha is the fusion weight, which enhances image contrast and preserves soft-focus highlights. The alpha weight is related to the pixel brightness value. For example, alpha is an image with the same resolution as the input image, and its pixel values ​​are determined by the pixel values ​​of the color filter fused image R.

[0123] alphai = s1 * pow(Ri, e) + s2;

[0124] Where i is the pixel coordinate index, alphai represents the pixel value of the alpha image at index i, i.e., the fusion weight, and similarly, Ri is the pixel value of the R image at index i. pow(*,*) is the exponentiation operation. s1, s2, and e are all constants, typically s1 and s2 are both 0.5, and e is 1.3. Figure 2-a This is a graph of a power function illustrated according to an exemplary embodiment. Figure 2-b This is a fusion weight curve diagram illustrated according to an exemplary embodiment. The power function curve is shown below. Figure 2-a As shown, the function curve of the above formula is as follows: Figure 2-b As shown, by using alpha blending, the larger the pixel brightness value in the intermediate image, the greater the corresponding blending weight; the smaller the pixel brightness value, the smaller the corresponding blending weight. This results in the color filter blending result in mixing more clear image dark textures and retaining more highlight rendering content from the color filter blending.

[0125] Figure 3 This is a flowchart illustrating an image processing procedure according to an exemplary embodiment. For example... Figure 3 As shown, it includes:

[0126] Step 30: Perform a preset blurring process on the image to be processed to obtain a blurred image;

[0127] Step 31: Perform underexposure and contrast correction processing on the image to be processed to obtain an underexposure-corrected contrast-corrected image.

[0128] Step 32: Perform color filtering fusion on the underexposed contrast-corrected image and the blurred image to obtain an intermediate image;

[0129] Step 34: Perform weighted fusion processing on the intermediate image to obtain the output image.

[0130] This disclosure provides an image processing apparatus. Figure 4 This is a schematic diagram illustrating the structure of an image processing apparatus according to an exemplary embodiment. Figure 4 As shown, it includes:

[0131] The first processing unit 41 is used to acquire the image to be processed;

[0132] The second processing unit 42 is used to perform preset blurring processing on the image to be processed to obtain a blurred image;

[0133] The third processing unit 43 is used to perform underexposure processing on the image to be processed to obtain an underexposure image;

[0134] The fourth processing unit 44 is used to perform contrast correction on the obtained underexposed image to obtain a contrast-corrected image;

[0135] The fifth processing unit 45 is used to perform image fusion on the blurred image and the contrast-corrected image to obtain an output image with optical effects.

[0136] In this embodiment, the present disclosure is mainly applied to the blurring rendering process of photographs of objects (such as portraits). When an image acquisition device (such as a camera) captures an image in portrait mode, and a clear image is input, this application will render a soft-focus blurred image on the clear image using a color filter fusion method. The image to be processed is a clear image, which refers to a normally captured image, such as an image captured by the image acquisition device (such as a camera) in a shake-free state or in a shake-compensated state.

[0137] In this embodiment of the disclosure, the preset blur processing may include Gaussian blur processing or other blur processing methods; Gaussian blur processing refers to blurring an underexposed image. The Gaussian blur process of processing an image is to convolve the image with a Gaussian distribution, which can reduce image noise and reduce the level of detail.

[0138] In this embodiment of the disclosure, to overcome the problems of increased image brightness and decreased contrast and resolution introduced by color filtering, exposure correction and contrast correction are performed on the clear image before color filtering fusion. Exposure correction mainly solves the overexposure problem caused by color filtering fusion, while contrast correction improves image contrast and alleviates the problem of low resolution in the fusion result.

[0139] In this embodiment of the disclosure, underexposure processing refers to reducing the overall exposure brightness of the image to be processed. An underexposure image is obtained by optimizing the overall image to be processed with an underexposure coefficient.

[0140] In this embodiment of the disclosure, the contrast correction process reduces the grayscale of pixels in dark areas of the image and improves the image contrast.

[0141] In this embodiment of the disclosure, image fusion may include color filtering fusion; color filtering fusion refers to performing color filtering fusion on the RGB channels of an underexposed image and a Gaussian blurred underexposed image respectively to achieve a soft focus effect. Color filtering fusion performs color filtering fusion on the RGB channels of a contrast-corrected image and a Gaussian blurred image respectively to achieve a soft focus effect. The soft focus fusion method is as follows:

[0142] R = 1 - (1 - I) * (1 - B); where R is the fusion result (intermediate image), I is the input original image (here, the contrast-corrected image), and B is the blurred image of the image to be processed. In the specific fusion process, the pixel brightness values ​​of each image are normalized to between 0 and 1 for fusion calculation, resulting in the fused intermediate image.

[0143] In this embodiment of the disclosure, the output image has optical effects, wherein the optical effects may include a soft-focus effect obtained by color filtering fusion.

[0144] The image processing apparatus in this embodiment is used to: acquire an image to be processed; perform preset blur processing on the image to be processed to obtain a blurred image; perform underexposure processing on the image to be processed to obtain an underexposed image; perform contrast correction on the obtained underexposed image to obtain a contrast-corrected image; and perform image fusion on the blurred image and the contrast-corrected image to obtain an output image with optical effects. In this application, by performing underexposure and contrast correction processing on the image to be processed to reduce the overall brightness and increase the contrast, the output image after image fusion, compared to the fused image obtained without underexposure processing, can effectively reduce the increase in brightness and decrease in contrast caused by image fusion, thereby improving the quality of the bokeh effect.

[0145] In some embodiments, the fifth processing unit is used for

[0146] The blurred image and the contrast-corrected image are subjected to color filtering and fusion to obtain an intermediate image;

[0147] The intermediate image is used as the output image;

[0148] or,

[0149] The intermediate image is fused with the image to be processed according to the fusion weights to obtain the output image;

[0150] The fusion weight is used to allocate pixel brightness values ​​when the intermediate image and the image to be processed are fused.

[0151] In this embodiment, to improve the contrast and resolution of the output image, a weighted fusion method is used to fuse a clear image to be processed. The intermediate image obtained through color filtering is then weighted and fused with the image to be processed to obtain the output image. By allocating pixel brightness values ​​during the fusion of the intermediate image and the image to be processed using fusion weights, the bright areas of the intermediate image maintain a soft-focus effect, while the dark areas maintain resolution. Specifically, the bright areas of the intermediate image have larger fusion weight values, and the dark areas have smaller fusion weight values. Similarly, the bright areas of the image to be processed have smaller fusion weight values, and the dark areas have larger fusion weight values, thus fusing to obtain the output image. The resulting output image exhibits significantly improved contrast and resolution compared to the intermediate image obtained through color filtering.

[0152] In some embodiments, the third processing unit is used for

[0153] Determine the exposure correction coefficient for underexposure processing of the image to be processed;

[0154] Based on the exposure correction coefficient, the pixel brightness of the image to be processed is reduced to obtain the underexposed image.

[0155] In some embodiments, the exposure correction coefficient is determined as a value between 0 and 1 obtained by taking the value of an exponential function with a predetermined base;

[0156] The third processing unit is used for

[0157] The pixel brightness value of the image to be processed is multiplied by the exposure correction coefficient to obtain the pixel brightness value of the underexposed image.

[0158] In this embodiment of the disclosure, to overcome the problem of significantly increased image brightness introduced by color filter fusion, underexposure processing is performed on the input image to be processed. The exposure correction coefficient is a value less than 1, used to reduce the pixel brightness of the image to be processed. The brightness value of each pixel of the image to be processed is multiplied by the exposure correction coefficient to obtain the brightness value of each pixel of the underexposed image, thereby obtaining an underexposed image with reduced exposure brightness. The underexposed image processing method is as follows:

[0159] Irever = Iorig * 2 EV .

[0160] Where Irever represents the underexposed image after underexposure processing, Iorig represents the original clear image to be processed, and EV is the exposure correction factor. When EV = 0, the image is not corrected for exposure; when EV > 0, the image exposure is increased; when EV < 0, the image exposure is decreased. To achieve image underexposure processing, typical EV values ​​are -0.75 or -0.5.

[0161] In some embodiments, the fourth processing unit is used for

[0162] Determine the contrast correction method;

[0163] Based on the contrast correction method, the underexposed image is contrast corrected to obtain the contrast-corrected image; wherein, when the underexposed image is contrast corrected by the contrast correction method, the smaller the pixel brightness in a region, the greater the reduction in image grayscale, and the greater the improvement in contrast.

[0164] To overcome the issues of increased image brightness and decreased contrast and resolution introduced by color filtering, exposure and contrast corrections are performed on the clear image before color filtering. Exposure correction primarily addresses the overexposure problem caused by color filtering, while contrast correction improves image contrast and alleviates the low resolution of the fused image.

[0165] Contrast correction methods are as follows:

[0166] Irever=pow(Iorig, 1 / sigma);

[0167] Where Irever is the contrast-corrected image, Iorig is the underexposed image (0-1 distribution), pow(*,*) is the power operation, and sigma is the correction coefficient. When sigma = 1, the image remains unchanged; when sigma < 1, the grayscale of dark pixels in the image is reduced, increasing the image contrast; when sigma > 1, the grayscale of dark pixels in the image is brightened, reducing the image contrast. To improve image contrast, a typical value for sigma is 0.5. Changing sigma can alter the degree of brightness reduction in different dark areas. The specific sigma correction coefficient is determined by the image captured by the camera.

[0168] In some embodiments, the fifth processing unit is used for

[0169] Based on the pixel brightness value of each pixel and the weight determination method, the fusion weight corresponding to each pixel is obtained; wherein, the weight determination method is used to characterize the correspondence between the pixel brightness value and the fusion weight, and the correspondence includes at least: positive correlation.

[0170] In some embodiments, the positive correlation between the pixel brightness value and the fusion weight includes at least the following: the fusion weight corresponding to the pixel has a power-law relationship with the pixel brightness value.

[0171] In this embodiment of the disclosure, when obtaining the output fused image by fusing a clear intermediate image with the image to be processed, it can be achieved by weighted fusion based on fusion weights.

[0172] To address the issue of reduced image resolution caused by color filter blending, the result of the color filter blending and the sharp image are mixed according to alpha weights. An example implementation is as follows:

[0173] Ralpha=R*alpha+I*(1-alpha);

[0174] Where Ralpha is the output image after alpha weighted fusion, R is the intermediate image after color filter fusion, and I is the original sharp image. alpha is the fusion weight, which enhances image contrast and preserves soft-focus highlights. The alpha weight is related to the pixel brightness value. For example, alpha is an image with the same resolution as the input image, and its pixel values ​​are determined by the pixel values ​​of the color filter fused image R.

[0175] alphai = s1 * pow(Ri, e) + s2;

[0176] Where i is the pixel coordinate index, alphai represents the pixel value of the alpha image at index i, i.e., the fusion weight, and similarly, Ri is the pixel value of the R image at index i. pow(*,*) is the exponentiation operation. s1, s2, and e are all constants, typically s1 and s2 are both 0.5, and e is 1.3. Figure 2-a This is a graph of a power function illustrated according to an exemplary embodiment. Figure 2-b This is a fusion weight curve diagram illustrated according to an exemplary embodiment. The power function curve is shown below. Figure 2-a As shown, the function curve of the above formula is as follows: Figure 2-b As shown, by using alpha blending, the larger the pixel brightness value in the intermediate image, the greater the corresponding blending weight; the smaller the pixel brightness value, the smaller the corresponding blending weight. This results in the color filter blending result in mixing more clear image dark textures and retaining more highlight rendering content from the color filter blending.

[0177] This disclosure also provides a server, including:

[0178] A processor and a memory, wherein the memory stores a computer program capable of running on the processor, and the processor, when running the computer program, performs the steps of the methods described in the various embodiments.

[0179] This disclosure also provides a computer-readable storage medium storing a computer program thereon, characterized in that the computer program, when executed by a processor, implements the steps of the methods described in the various embodiments.

[0180] Figure 5 This is a schematic diagram illustrating an application scenario of an electronic device with a camera function, according to an exemplary embodiment. For example... Figure 4 As shown, electronic devices 101 and 102 with camera functionality can be used in a cellular network. Upon receiving an instruction to use cellular circuitry for wireless transmission, the Wi-Fi connection is stopped; upon receiving an instruction to stop using cellular circuitry for wireless transmission, the Wi-Fi connection is restored. The network environment includes electronic devices 101 and 102, a Wi-Fi access point 103, a cellular base station 104, and a network 105.

[0181] Figure 6 This is a device block diagram illustrating an electronic device according to an exemplary embodiment. For example, the electronic device may be a mobile phone, computer, digital broadcasting electronic device, messaging transceiver, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0182] Reference Figure 6 The electronic device may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input / output (I / O) interface 812, sensor component 814, and communication component 816.

[0183] Processing component 802 typically controls the overall operation of an electronic device, such as operations associated with touch, telephone calls, data communication, camera operation, and recording. Processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.

[0184] Memory 804 is configured to store various types of data to support the operation of an electronic device. Examples of this data include instructions for any application or method operating on the electronic device, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 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.

[0185] Power component 806 provides power to various components of the electronic device. Power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device.

[0186] Multimedia component 808 includes a screen that provides an output interface between the electronic device 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 touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the electronic device 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.

[0187] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when the electronic device 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 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.

[0188] I / O interface 812 provides an interface between processing component 802 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.

[0189] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of the electronic device. For example, sensor assembly 814 can detect the on / off state of the electronic device, the relative positioning of components such as the display and keypad of the electronic device, changes in the position of the electronic device or a component of the electronic device, the presence or absence of user contact with the electronic device, orientation or acceleration / deceleration of the electronic device, and temperature changes of the electronic device. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.

[0190] Communication component 816 is configured to facilitate wired or wireless communication between electronic devices and other devices. The electronic devices can access wireless networks based on communication standards, such as WiFi, 4G, or 5G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 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.

[0191] In an exemplary embodiment, the electronic device 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.

[0192] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure 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 this disclosure are indicated by the following claims.

[0193] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. An image processing method, characterized in that, include: Obtain the image to be processed; The image to be processed is subjected to a preset blurring process to obtain a blurred image; The image to be processed is underexposed to obtain an underexposed image; The underexposed image is contrast-corrected to obtain a contrast-corrected image; The blurred image and the contrast-corrected image are subjected to color filtering and fusion to obtain an output image with optical effects; The optical effects include: soft focus bokeh effect; The step of performing contrast correction on the obtained underexposed image to obtain a contrast-corrected image includes: Determine the contrast correction method; Based on the contrast correction method, the underexposed image is contrast corrected to obtain the contrast-corrected image; wherein, when the underexposed image is contrast corrected by the contrast correction method, the smaller the pixel brightness in a region, the greater the reduction in image grayscale.

2. The image processing method according to claim 1, characterized in that, The step of performing color filtering fusion on the blurred image and the contrast-corrected image to obtain an output image with optical effects includes: The blurred image and the contrast-corrected image are subjected to color filtering and fusion to obtain an intermediate image; The intermediate image is used as the output image; or, The intermediate image is fused with the image to be processed according to the fusion weights to obtain the output image; The fusion weight is used to allocate pixel brightness values ​​when the intermediate image and the image to be processed are fused.

3. The image processing method according to claim 1, characterized in that, The process of underexposing the image to be processed to obtain an underexposed image includes: Determine the exposure correction coefficient for underexposure processing of the image to be processed; Based on the exposure correction coefficient, the pixel brightness of the image to be processed is reduced to obtain the underexposed image.

4. The image processing method according to claim 3, characterized in that, The exposure correction coefficient is determined as a value between 0 and 1 obtained by taking the value of an exponential function with a predetermined base. The step of reducing the pixel brightness of the image to be processed based on the exposure correction coefficient to obtain the underexposed image includes: The pixel brightness value of the image to be processed is multiplied by the exposure correction coefficient to obtain the pixel brightness value of the underexposed image.

5. The image processing method according to claim 2, characterized in that, The intermediate image is fused with the image to be processed according to the fusion weights to obtain the output image, including: Obtain the pixel brightness value of each pixel in the intermediate image; Based on the pixel brightness values ​​of each pixel in the intermediate image, a fusion weight corresponding to each pixel in the intermediate image is determined; wherein the fusion weight is related to the pixel brightness values ​​of the pixels in the intermediate image and is determined by the pixel brightness values; wherein different pixel brightness values ​​correspond to different fusion weights.

6. The image processing method according to claim 2, characterized in that, The step of determining the fusion weights corresponding to each pixel in the intermediate image based on the pixel brightness values ​​of each pixel in the intermediate image includes: Based on the pixel brightness value of each pixel and the weight determination method, the fusion weight corresponding to each pixel is obtained; wherein, the weight determination method is used to characterize the correspondence between the pixel brightness value and the fusion weight, and the correspondence includes at least: positive correlation.

7. The image processing method according to claim 6, characterized in that, The positive correlation between the pixel brightness value and the fusion weight includes at least the following: the fusion weight corresponding to the pixel has a power-law relationship with the pixel brightness value.

8. An image processing apparatus, characterized in that, include: The first processing unit is used to acquire the image to be processed; The second processing unit is used to perform a preset blurring process on the image to be processed to obtain a blurred image. The third processing unit is used to perform underexposure processing on the image to be processed to obtain an underexposure image; The fourth processing unit is used to perform contrast correction on the obtained underexposed image to obtain a contrast-corrected image; The fifth processing unit is used to perform color filtering and fusion on the blurred image and the contrast-corrected image to obtain an output image with optical effects; the optical effects include: soft focus blurring effect; The fourth processing unit is specifically used to determine the contrast correction method; based on the contrast correction method, to perform contrast correction on the underexposed image to obtain the contrast-corrected image; wherein, when the underexposed image is contrast-corrected by the contrast correction method, the area with smaller pixel brightness has a greater degree of grayscale reduction.

9. The image processing apparatus according to claim 8, characterized in that, The fifth processing unit is used to perform color filtering and fusion on the blurred image and the contrast-corrected image to obtain an intermediate image; and to use the intermediate image as the output image. or, The intermediate image is fused with the image to be processed according to the fusion weights to obtain the output image; The fusion weight is used to allocate pixel brightness values ​​when the intermediate image and the image to be processed are fused.

10. The image processing apparatus according to claim 8, characterized in that, The third processing unit is used to determine the exposure correction coefficient for underexposing the image to be processed; based on the exposure correction coefficient, the brightness of the pixels of the image to be processed is reduced to obtain the underexposed image.

11. The image processing apparatus according to claim 10, characterized in that, The exposure correction coefficient is determined as a value between 0 and 1 obtained by taking the value of an exponential function with a predetermined base. The third processing unit is used to multiply the pixel brightness value of the image to be processed by the exposure correction coefficient to obtain the pixel brightness value of the underexposed image.

12. The image processing apparatus according to claim 8, characterized in that, The fifth processing unit is used to obtain the fusion weight corresponding to each pixel based on the pixel brightness value and the weight determination method; wherein, the weight determination method is used to characterize the correspondence between the pixel brightness value and the fusion weight, and the correspondence includes at least: positive correlation.

13. The image processing apparatus according to claim 12, characterized in that, The positive correlation between the pixel brightness value and the fusion weight includes at least the following: the fusion weight corresponding to the pixel has a power-law relationship with the pixel brightness value.

14. A server, characterized in that, include: A processor and a memory for storing a computer program capable of running on the processor, wherein the processor, when running the computer program, performs the steps of the method according to any one of claims 1 to 7.

15. 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 method according to any one of claims 1 to 7.