Image processing method, image processing apparatus, medium, and device

By generating weighted masks through multi-channel preprocessing and blurred image processing, the problem of low image clarity is solved, and higher quality image optimization effect is achieved.

CN118469861BActive Publication Date: 2026-08-04GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2023-02-06
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing technologies suffer from low image clarity in image processing, resulting in unsatisfactory image optimization results.

Method used

Multiple weighted masks are generated through multi-channel preprocessing, and a target blurred image is generated based on the multi-channel blurred image of the image to be processed. The target blurred image and multiple weighted masks are used to generate an image optimization result with higher clarity.

Benefits of technology

The quality of the image optimization results has been improved, achieving effects such as distinct layers, clear subjects, and blurred backgrounds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118469861B_ABST
    Figure CN118469861B_ABST
Patent Text Reader

Abstract

The application provides an image processing method, an image processing device, a computer readable storage medium and an electronic device, relates to the technical field of image processing, and the method can obtain a plurality of weight masks through multi-channel preprocessing, generate a target blurred image based on a multi-channel blurred image of a to-be-processed image, and generate an image optimization result with higher definition based on the target blurred image and the plurality of weight masks. Compared with related art, the quality of the image optimization result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and more specifically, to an image processing method, an image processing apparatus, a computer-readable storage medium, and an electronic device. Background Technology

[0002] Portrait processing refers to the techniques used to process and embellish facial images. It can encompass image enhancement, beautification, blemish removal, and retouching, resulting in images with higher quality and aesthetic appeal.

[0003] In related technologies, different image channels are typically processed to obtain the final optimized image result. However, images obtained in this way often suffer from low sharpness.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute related technology known to those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide an image processing method, an image processing apparatus, a computer-readable storage medium, and an electronic device, which can obtain multiple weighted masks through multi-channel preprocessing, and generate a target blurred image based on the multi-channel blurred image of the image to be processed. Based on the target blurred image and multiple weighted masks, a higher-resolution image optimization result can be generated. Compared with related technologies, this application improves the quality of the image optimization result.

[0006] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.

[0007] According to one aspect of this application, an image processing method is provided, the method comprising:

[0008] Multi-channel preprocessing is performed on the image to be processed to obtain multiple weighted masks;

[0009] Generate a target blurred image based on the multi-channel blurred image of the image to be processed;

[0010] Image optimization results corresponding to the image to be processed are generated based on the target blurred image and multiple weighted masks.

[0011] According to one aspect of this application, an image processing apparatus is provided, the apparatus comprising:

[0012] The weighted mask acquisition unit is used to perform multi-channel preprocessing on the image to be processed to obtain multiple weighted masks.

[0013] The blurred image acquisition unit is used to generate a target blurred image based on the multi-channel blurred image of the image to be processed;

[0014] The image generation unit is used to generate image optimization results corresponding to the image to be processed based on the target blurred image and multiple weighted masks.

[0015] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.

[0016] According to one aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the method of any one of the above.

[0017] According to one aspect of this application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any of the above by executing the executable instructions.

[0018] The exemplary embodiments of this application may have some or all of the following beneficial effects:

[0019] In an example embodiment of the image processing method provided in this application, multiple weighted masks can be obtained through multi-channel preprocessing, and a target blurred image can be generated based on the multi-channel blurred image of the image to be processed. Based on the target blurred image and the multiple weighted masks, a higher-resolution image optimization result can be generated. Compared with related technologies, this application improves the quality of the image optimization result. Furthermore, since this application can generate the image optimization result based on the target blurred image and the multiple weighted masks, an image optimization result with distinct layers, a clear subject, and a blurred background can be obtained.

[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0022] Figure 1A flowchart illustrating an image processing method according to an embodiment of this application is shown schematically;

[0023] Figure 2 A schematic diagram illustrating gradient information according to an embodiment of this application is shown.

[0024] Figure 3 This illustration schematically shows a result after gradient averaging according to one embodiment of the present application;

[0025] Figure 4 A schematic diagram of a planar mask according to an embodiment of this application is shown.

[0026] Figure 5 This illustration schematically shows an image effect after removing highlight areas according to an embodiment of this application;

[0027] Figure 6 A blurred edge map according to one embodiment of this application is illustrated schematically;

[0028] Figure 7 This illustration schematically shows a processing result diagram according to an embodiment of the present application;

[0029] Figure 8 A schematic diagram of a reference weight mask according to an embodiment of this application is shown.

[0030] Figure 9 A schematic diagram of a first intermediate mask according to an embodiment of this application is shown;

[0031] Figure 10 A schematic diagram of a UV channel blurred image according to an embodiment of this application is shown.

[0032] Figure 11 A schematic diagram of a second intermediate mask according to an embodiment of this application is shown;

[0033] Figure 12 This illustration schematically shows an image processing procedure according to an embodiment of the present application;

[0034] Figure 13 A flowchart illustrating another embodiment of an image processing method according to this application is shown schematically;

[0035] Figure 14 The schematic diagram illustrates the structure of an image processing apparatus according to an embodiment of this application;

[0036] Figure 15 The schematic diagram illustrates the structure of a computer system suitable for implementing the electronic devices of the present application. Detailed Implementation

[0037] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of the embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this application.

[0038] Please see Figure 1 , Figure 1 A flowchart illustrating an image processing method according to an embodiment of this application is shown schematically. Figure 1 As shown, the method includes the following steps.

[0039] Step S110: Perform multi-channel preprocessing on the image to be processed to obtain multiple weighted masks.

[0040] Step S120: Generate a target blurred image based on the multi-channel blurred image of the image to be processed.

[0041] Step S130: Generate image optimization results corresponding to the image to be processed based on the target blurred image and multiple weighted masks.

[0042] Implementation Figure 1 The method described herein can obtain multiple weighted masks through multi-channel preprocessing, and generate a target blurred image based on the multi-channel blurred image of the image to be processed. Based on the target blurred image and multiple weighted masks, a higher-resolution image optimization result can be generated. Compared with related technologies, this application improves the quality of the image optimization result. Furthermore, since this application can generate the image optimization result based on the target blurred image and multiple weighted masks, it can obtain an image optimization result with distinct layers, a clear subject, and a blurred background.

[0043] The steps described above in this example implementation will now be explained in more detail.

[0044] In step S110, the image to be processed is subjected to multi-channel preprocessing to obtain multiple weighted masks.

[0045] Specifically, the image to be processed can be an image containing a human figure. For example, the image to be processed could be a neon figure, which refers to a special photographic style that typically uses neon lights as the main lighting source and uses vibrant colors to render the human figure. By performing multi-channel preprocessing on the image to be processed, weighted masks corresponding to each channel can be obtained, i.e., multiple weighted masks. The image to be processed can be identified using YUV, a color space format that separates the color information in an image into luminance and chrominance. The Y channel represents luminance information, used to characterize the brightness value in the image; the U and V channels store chrominance information. Specifically, the U channel represents the difference between the blue channel and the luminance channel, and the V channel represents the difference between the red channel and the luminance channel.

[0046] As an optional embodiment, the multiple weighted masks include a first weighted mask and a second weighted mask. Multi-channel preprocessing is performed on the image to be processed to obtain multiple weighted masks, including: blurring the Y channel of the image to be processed to obtain the first weighted mask; and performing color enhancement processing on the UV channels of the image to be processed to obtain the second weighted mask. This enables multi-channel image processing, improving the precision of image processing. The blurring of the Y channel and the color enhancement processing of the UV channels provide weighted masks to improve image optimization results, thereby enhancing the accuracy of image optimization.

[0047] Specifically, blurring can highlight the subject (e.g., a person) in the image to be processed. Color enhancement can restore the colors of the image to be processed. The first weighted mask can represent the weight value corresponding to each pixel position on the Y component, and the second weighted mask can represent the weight value corresponding to each pixel position on the UV components.

[0048] As an optional embodiment, blurring the Y channel of the image to be processed to obtain a first weighted mask includes: scaling down the Y channel of the image to be processed to obtain a preliminary image; performing Gaussian blurring on the preliminary image to obtain a blurred Y channel image; and reducing the weight of the in-focus region of the blurred Y channel image to obtain the first weighted mask. This processing of the Y channel can improve subsequent background blurring and highlighting effects.

[0049] Specifically, the Y channel of the image to be processed is scaled down to obtain a preprocessed image, including: scaling down the Y channel of the image to be processed to a preprocessed image by a preset scaling size (e.g., 1 / 8). For example, the size of the preprocessed image can be 1 / 8 of the size of the image to be processed.

[0050] Next, Gaussian blurring is applied to the prepared image to obtain a blurred Y-channel image. This includes: performing nearest-neighbor sampling on the prepared image to preserve highlight energy, and approximating Gaussian blur using stacked boxes based on the integral image to eliminate moiré patterns, thereby obtaining a Y-channel reference image. The blurred Y-channel image is obtained by fusing the result of nearest-neighbor sampling and the Y-channel reference image. Nearest-neighbor downsampling refers to a method of image downscaling in image processing, which maps pixels from one image to a smaller image. Furthermore, each stacked box blur level corresponds to a different number of boxes and their weights, and the integral image can refer to the first-weighted mask integral image.

[0051] Furthermore, the gradient information |G| of the Y-channel reference image can also be calculated using an image gradient calculation algorithm (i.e., the Sobel operator). Figure 2 , Figure 2 The gradient information |G| is represented by |G|=|Gx|+|Gy|, and thus, the flat region (e.g., NxN gradient mean) can be used to determine the flat region. Figure 3 , Figure 3 The result after averaging the gradient is represented, and the Y-channel reference image is converted into a flat mask based on this flat region (e.g., Figure 4 , Figure 4 Characterized by a planar mask), removing the highlight areas (such as...) from the planar mask. Figure 5 , Figure 5 (This characterizes the image effect after removing highlight areas) and blurs the edges of the Y-channel reference image to obtain a blurred edge map (e.g. Figure 6 , Figure 6 The image represents a blurred edge map; where the Sobel operator is used to detect the edges of the image, Gx and Gy represent the parameter values ​​corresponding to the pixels indicated by the x and y coordinates, respectively, and N is a positive integer. Based on this, the blurred Y-channel image can be obtained by fusing the result of nearest neighbor sampling and the Y-channel reference image, including: the blurred Y-channel image can be obtained by fusing the result of nearest neighbor sampling and the blurred edge map.

[0052] As an optional embodiment, the in-focus region weights of the Y-channel blurred image are reduced to obtain a first weight mask. This includes: scaling down the Y-channel blurred image to obtain a reference blurred image; reducing the in-focus region weights of the reference blurred image to obtain a reference weight mask; and fusing the reference weight mask with the image to be processed to obtain the first weight mask. This method, by reducing the in-focus region weights of the reference blurred image, improves edge sharpness and accuracy, resulting in a more natural transition between the blurred background and the sharp foreground.

[0053] Specifically, the Y-channel blurred image is scaled down to obtain a reference blurred image. This includes: scaling down the Y-channel blurred image to the size of the reference blurred image by a preset scaling size (e.g., 1 / 4). For example, the size of the reference blurred image can be 1 / 4 of the size of the Y-channel blurred image. Then, the in-focus region weights of the reference blurred image are reduced to obtain a reference weight mask. This includes: determining the in-focus region of the reference blurred image (i.e., the region containing the subject), and reducing the weights of the in-focus region (e.g., ...). Figure 7 , Figure 7 The processing result is characterized, and the edge masking range is expanded to obtain the reference weight mask (e.g., ...). Figure 8 , Figure 8 A reference weight mask is used to avoid the hair edges being mistakenly blurred. Blurring based on the reference weight mask allows the edges of the subject to be blurred relative to the background pixels. Then, the reference weight mask is fused with the image to be processed to obtain the first weight mask.

[0054] As an optional embodiment, color enhancement processing is performed on the UV channels of the image to be processed to obtain a second weighted mask, including: applying a mean filter to the UV channels of the image to be processed using a first color enhancement filter to obtain a first intermediate mask; performing foreground and background segmentation processing on the first intermediate mask to obtain a blurred UV channel image; applying a mean filter to the blurred UV channel image using a second color enhancement filter to obtain a second intermediate mask; and performing foreground and background segmentation processing on the second intermediate mask to obtain a second weighted mask. This second weighted mask allows the optimized image obtained through subsequent processing to have rich colors, abundant light spots, and distinct layers.

[0055] The first and second color enhancement filters can correspond to different filtering parameters; both are filters, which are commonly used tools in image processing to extract features from images, such as edges, colors, and textures. Filters can be divided into linear filters and nonlinear filters. Linear filters are calculated based on the image's grayscale values, such as mean filters and Gaussian filters, which can be used to remove noise from images. Nonlinear filters consider not only the image's grayscale values ​​but also its structural information, such as edge detection filters and sharpening filters. Using filters allows for image preprocessing, specifically extracting edge information to facilitate precise edge alignment.

[0056] Specifically, a first intermediate mask is obtained by performing mean filtering on the UV channels of the image to be processed using a first color enhancement filter. This includes: performing mean filtering on the UV channels of the image to be processed using the first color enhancement filter based on a preset size (3x3) and a mean filtering rule for reinforcing the light-colored areas of neighboring pixels, and filling the original colorless areas with preset parameter values ​​(e.g., 128) to obtain the first intermediate mask (e.g., ...). Figure 9 , Figure 9 This represents the first intermediate mask; where the color enhancement parameters corresponding to the light-colored areas reinforced by neighboring pixels are adjusted according to adaptive rules. Furthermore, the first intermediate mask can be segmented into foreground and background based on a segmentation hole-filling algorithm to obtain a UV-channel blurred image (e.g., Figure 10 , Figure 10 (Characterizing the blurred image of the UV channel). Furthermore, a second intermediate mask is obtained by performing mean filtering on the blurred image of the UV channel using a second color enhancement filter, including: performing mean filtering on the blurred image of the UV channel using a second color enhancement filter based on a preset size (3x3) and a mean filtering rule for enhancing the light color regions of neighboring pixels to obtain the second intermediate mask (e.g., Figure 11 , Figure 11 This represents the second intermediate mask. Furthermore, the second intermediate mask can be segmented into foreground and background based on a segmentation hole-filling algorithm to obtain a second weight mask.

[0057] In step S120, a target blurred image is generated based on the multi-channel blurred image of the image to be processed.

[0058] Specifically, a multi-channel blurred image of the image to be processed refers to the blurred images corresponding to different channels of the image. A target blurred image refers to an image that has been smoothed to make it appear more blurred. The purpose of blurring an image can be to highlight its main features, hide unimportant details, or reduce noise. Common methods for blurring images include Gaussian blur, median blur, and bilateral blur. Gaussian blur and mean blur are the two most commonly used blurring methods, both based on local average values. Median blur is a median-based blurring method used to remove noise. Bilateral blur is an advanced blurring method that considers the texture and edge information of the image.

[0059] As an optional embodiment, generating a target blurred image based on a multi-channel blurred image of the image to be processed includes: performing foreground and background segmentation processing on the image to be processed to obtain a blur weight map; obtaining a diffusion mask map of a preliminary image; and generating the target blurred image based on the blur weight map, the diffusion mask map, and the multi-channel blurred image of the image to be processed. This can blur the background and sharpen the foreground, which is beneficial for obtaining better image enhancement results.

[0060] Specifically, a foreground-background segmentation process can be performed on the image to be processed based on a segmentation hole-filling algorithm to obtain a blurred weight map. Furthermore, performing foreground-background segmentation on the preparatory image based on the segmentation hole-filling algorithm can also yield a diffusion mask map. Finally, by fusing and blurring the blurred weight map, diffusion mask map, and the multi-channel blurred image of the image to be processed, the target blurred image can be obtained.

[0061] In step S130, an image optimization result corresponding to the image to be processed is generated based on the target blurred image and multiple weighted masks.

[0062] Specifically, the image optimization result is consistent with the size of the image to be processed.

[0063] As an optional embodiment, an image optimization result corresponding to the image to be processed is generated based on the target blurred image and multiple weighted masks. This includes: generating a reference optimized image based on a blur weight map, a diffusion mask map, the target blurred image, and multiple weighted masks; and scaling up the reference optimized image to obtain an image optimization result with the same size as the image to be processed. This can highlight the main subject of the image, enhance the image's sense of depth and transparency, and simulate lighting effects to give the image a better texture.

[0064] Please refer to details. Figure 12 , Figure 12 The illustration shows a schematic diagram of an image processing procedure according to an embodiment of this application. Figure 2As shown, when the image to be processed (src image) 1200 is detected, the Y channel of the image to be processed can be scaled down to obtain a preprocess image 1202. The preprocess image is then Gaussian blurred to obtain a Y channel blurred image 1203. Furthermore, the in-focus region weights of the Y channel blurred image are reduced to obtain a first weight mask 1204. In addition, the UV channels of the image to be processed can be mean-filtered using a first color enhancement filter to obtain a first intermediate mask 1207. Foreground and background segmentation processing is then performed on the first intermediate mask 1207 to obtain a UV channel blurred image 1208. The UV channel blurred image 1208 is then mean-filtered using a second color enhancement filter to obtain a second intermediate mask 1209. Foreground and background segmentation processing is then performed on the second intermediate mask 1209 to obtain a second weight mask 1210. Furthermore, foreground and background segmentation processing can be performed on the image to be processed to obtain a blur weight map 1201, and a spread mask 1205 of the preprocess image 1202 can be obtained. Further, a target blurred image 1206 can be generated based on the blur weight map 1201, the spread mask 1205, the Y-channel blurred image 1203, and the UV-channel blurred image 1208. Furthermore, a reference optimized image (spot results) 1211 can be generated based on the blur weight image 1203, the spread mask image 1205, the target blurred image (blur results) 1206, the first weight mask 1204, and the second weight mask 1210. By scaling up the reference optimized image (spot results) 1211, an image optimization result (add lut) 1212 with the same size as the image to be processed can be obtained.

[0065] As an optional embodiment, the method further includes: correcting image jaggedness in the reference optimized image. This reduces jaggedness in the image and improves anti-aliasing capabilities.

[0066] Specifically, the data parameters of the image processing model can be adjusted to correct jagged edges in the reference optimized image. Additionally, optional improvements can be made to image parameters to enhance the presentation of the optimized image; these image parameters may include parameters for enhancing overall color contrast, saturation for improving skin tone and uniformity, exposure parameters for reducing background brightness, DRC parameters for improving overall dynamic range, LLHDR noise reduction parameters for improving sharpness, and light spot weight curve parameters, etc.

[0067] Please see Figure 13 , Figure 13 A flowchart illustrating another embodiment of an image processing method according to this application is shown schematically. Figure 13 As shown, the image processing method includes steps S1310 to S1326.

[0068] Step S1310: Scale down the Y channel of the image to be processed to obtain a preliminary image, and then perform Gaussian blur processing on the preliminary image to obtain a blurred Y channel image.

[0069] Step S1312: Scale down the Y-channel blurred image to obtain a reference blurred image, and reduce the weight of the in-focus region of the reference blurred image to obtain a reference weight mask. Then, fuse the reference weight mask with the image to be processed to obtain the first weight mask.

[0070] Step S1314: The UV channel of the image to be processed is subjected to mean filtering through the first color enhancement filter to obtain the first intermediate mask, and the foreground and background segmentation processing is performed on the first intermediate mask to obtain the UV channel blurred image.

[0071] Step S1316: Perform mean filtering on the blurred UV channel image using the second color enhancement filter to obtain the second intermediate mask, and perform foreground and background segmentation processing on the second intermediate mask to obtain the second weighted mask.

[0072] Step S1318: Perform foreground and background segmentation on the image to be processed to obtain a blurred weight map.

[0073] Step S1320: Obtain the diffusion mask map of the prepared image.

[0074] Step S1322: Generate the target blurred image based on the blurred weight map, diffusion mask map, and multi-channel blurred image of the image to be processed.

[0075] Step S1324: Generate a reference optimized image based on the blur weight map, diffusion mask map, target blurred image and multiple weight masks.

[0076] Step S1326: Scale up the reference optimized image to obtain an image optimization result with the same size as the image to be processed.

[0077] It should be noted that steps S1310 to S1326 are related to... Figure 1 For the specific implementation details of steps S1310 to S1326, please refer to the examples shown. Figure 1 The steps and their embodiments shown are not repeated here.

[0078] It is evident that implementation Figure 13 The method described herein can obtain multiple weighted masks through multi-channel preprocessing, and generate a target blurred image based on the multi-channel blurred image of the image to be processed. Based on the target blurred image and multiple weighted masks, a higher-resolution image optimization result can be generated. Compared with related technologies, this application improves the quality of the image optimization result. Furthermore, since this application can generate the image optimization result based on the target blurred image and multiple weighted masks, it can obtain an image optimization result with distinct layers, a clear subject, and a blurred background.

[0079] Please see Figure 14 , Figure 14 A schematic block diagram of an image processing apparatus according to one embodiment of this application is shown. Figure 14 As shown, the image processing apparatus 1400 may include the following units.

[0080] The weighted mask acquisition unit 1401 is used to perform multi-channel preprocessing on the image to be processed to obtain multiple weighted masks.

[0081] The blurred image acquisition unit 1402 is used to generate a target blurred image based on the multi-channel blurred image of the image to be processed;

[0082] The image generation unit 1403 is used to generate an image optimization result corresponding to the image to be processed based on the target blurred image and multiple weighted masks.

[0083] It is evident that implementation Figure 14 The apparatus shown can obtain multiple weighted masks through multi-channel preprocessing, and generate a target blurred image based on the multi-channel blurred image of the image to be processed. Based on the target blurred image and multiple weighted masks, a clearer image optimization result can be generated. Compared with related technologies, this application improves the quality of the image optimization result. In addition, since this application can generate the image optimization result based on the target blurred image and multiple weighted masks, it can obtain an image optimization result with distinct layers, clear subject, and blurred background.

[0084] As an optional embodiment, the multiple weighted masks include a first weighted mask and a second weighted mask. The weighted mask acquisition unit 1401 performs multi-channel preprocessing on the image to be processed to obtain multiple weighted masks, including:

[0085] The Y channel of the image to be processed is blurred to obtain the first weighted mask;

[0086] Color enhancement processing is performed on the UV channels of the image to be processed to obtain a second weighted mask.

[0087] As can be seen, implementing this optional embodiment can achieve multi-channel image processing, improve the fineness of image processing, and obtain weighted masking to improve image optimization effect through blurring of Y channel and color enhancement of UV channel, thereby improving image optimization accuracy.

[0088] As an optional embodiment, the weighted mask acquisition unit 1401 performs blurring processing on the Y channel of the image to be processed to obtain a first weighted mask, including:

[0089] The Y channel of the image to be processed is scaled down to obtain a preliminary image;

[0090] The prepared image is subjected to Gaussian blurring to obtain a blurred image of the Y channel;

[0091] The in-focus region weights of the blurred Y-channel image are reduced to obtain the first weighted mask.

[0092] As can be seen, by implementing this optional embodiment, the subsequent background blurring effect and task brightening effect can be improved through the processing of the Y channel.

[0093] As an optional embodiment, the weighted mask acquisition unit 1401 reduces the weight of the in-focus region of the blurred Y-channel image to obtain a first weighted mask, including:

[0094] The Y-channel blurred image is scaled down to obtain a reference blurred image;

[0095] The in-focus region weights of the reference blurred image are reduced to obtain the reference weight mask;

[0096] The reference weight mask and the image to be processed are fused to obtain the first weight mask.

[0097] As can be seen, by implementing this optional embodiment, edge sharpness and accuracy can be improved by reducing the weight of the in-focus area of ​​the reference blurred image, and the transition between the blurred background and the sharp foreground can be made more natural.

[0098] As an optional embodiment, the weighted mask acquisition unit 1401 performs color enhancement processing on the UV channels of the image to be processed to obtain a second weighted mask, including:

[0099] The first intermediate mask is obtained by applying mean filtering to the UV channels of the image to be processed using the first color enhancement filter.

[0100] Perform foreground and background segmentation on the first intermediate mask to obtain a blurred UV channel image;

[0101] The second intermediate mask is obtained by applying mean filtering to the blurred UV channel image using a second color enhancement filter.

[0102] The second intermediate mask is subjected to foreground and background segmentation to obtain the second weighted mask.

[0103] As can be seen, by implementing this optional embodiment, the resulting second weighted mask can make the image optimization results obtained by subsequent processing have rich colors, abundant light spots, and distinct layers.

[0104] As an optional embodiment, the blurred image acquisition unit 1402 generates a target blurred image based on the multi-channel blurred image of the image to be processed, including:

[0105] The image to be processed is segmented into foreground and background to obtain a blurred weight map;

[0106] Obtain the diffusion mask image of the prepared image;

[0107] Generate a target blurred image based on a blurred weight map, a diffusion mask map, and a multi-channel blurred image of the image to be processed.

[0108] As can be seen, implementing this optional embodiment can blur the background and sharpen the foreground, which is beneficial for obtaining better image enhancement results.

[0109] As an optional embodiment, the image generation unit 1403 generates an image optimization result corresponding to the image to be processed based on the target blurred image and multiple weighted masks, including:

[0110] A reference optimized image is generated based on the blur weight map, diffusion mask map, target blurred image, and multiple weight masks;

[0111] The reference optimized image is scaled up to obtain an image optimization result with the same size as the image to be processed.

[0112] As can be seen, implementing this optional embodiment can highlight the main subject of the image, enhance the image's sense of depth and transparency, and simulate lighting effects to give the image a better texture.

[0113] As an optional embodiment, it also includes:

[0114] The aliasing unit is used to correct aliasing in the reference optimized image.

[0115] As can be seen, implementing this optional embodiment can reduce jagged edges in images and improve anti-aliasing capabilities.

[0116] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0117] Since the functional modules of the image processing apparatus in the example embodiments of this application correspond to the steps of the example embodiments of the image processing apparatus described above, for details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the image processing apparatus described above.

[0118] Please see Figure 15 , Figure 15 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.

[0119] It should be noted that, Figure 15 The computer system 1500 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0120] like Figure 15 As shown, the computer system 1500 includes a central processing unit (CPU) 1501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1502 or programs loaded from storage portion 1508 into random access memory (RAM) 1503. The RAM 1503 also stores various programs and data required for system operation. The CPU 1501, ROM 1502, and RAM 1503 are interconnected via a bus 1504. An input / output (I / O) interface 1505 is also connected to the bus 1504.

[0121] The following components are connected to I / O interface 1505: an input section 1506 including a keyboard, mouse, etc.; an output section 1507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1508 including a hard disk, etc.; and a communication section 1509 including a network interface card such as a LAN card, modem, etc. The communication section 1509 performs communication processing via a network such as the Internet. A drive 1510 is also connected to I / O interface 1505 as needed. Removable media 1511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1510 as needed so that computer programs read from them can be installed into storage section 1508 as needed.

[0122] In particular, according to embodiments of this application, the processes described below with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1509, and / or installed from removable medium 1511. When the computer program is executed by central processing unit (CPU) 1501, it performs the various functions defined in the methods and apparatus of this application.

[0123] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to implement the methods described in the above embodiments.

[0124] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0125] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0126] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0127] Other embodiments of this application 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 this application that follow the general principles of this application 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 application are indicated by the claims.

Claims

1. An image processing method, characterized in that, include: Multi-channel preprocessing is performed on the image to be processed to obtain multiple weighted masks; The plurality of weighted masks includes a first weighted mask and a second weighted mask; Generate a target blurred image based on the multi-channel blurred image of the image to be processed; Based on the target blurred image and the multiple weighted masks, an image optimization result corresponding to the image to be processed is generated; The image to be processed undergoes multi-channel preprocessing to obtain multiple weighted masks, including: The Y channel of the image to be processed is blurred to obtain the first weighted mask; Color enhancement processing is performed on the UV channels of the image to be processed to obtain a second weighted mask.

2. The method according to claim 1, characterized in that, The Y channel of the image to be processed is blurred to obtain the first weighted mask, which includes: The Y channel of the image to be processed is scaled down to obtain a preliminary image; The prepared image is subjected to Gaussian blurring to obtain a blurred image of the Y channel; The in-focus region weights of the blurred Y-channel image are reduced to obtain a first weighted mask.

3. The method according to claim 2, characterized in that, The in-focus region weights of the blurred Y-channel image are reduced to obtain a first weighted mask, including: The Y-channel blurred image is scaled down to obtain a reference blurred image; The in-focus region weights of the reference blurred image are reduced to obtain a reference weight mask; The reference weight mask is fused with the image to be processed to obtain a first weight mask.

4. The method according to claim 1, characterized in that, The UV channels of the image to be processed are subjected to color enhancement processing to obtain a second weighted mask, including: The UV channel of the image to be processed is mean filtered by the first color enhancement filter to obtain the first intermediate mask. Perform foreground-background segmentation on the first intermediate mask to obtain a blurred UV channel image; The second intermediate mask is obtained by applying mean filtering to the blurred UV channel image using a second color enhancement filter. The second intermediate mask is subjected to foreground and background segmentation to obtain the second weighted mask.

5. The method according to claim 2, characterized in that, Generating a target blurred image based on the multi-channel blurred image of the image to be processed includes: The image to be processed is subjected to foreground and background segmentation to obtain a blurred weight map; Obtain the diffusion mask image of the prepared image; A target blurred image is generated based on the blurred weight map, the diffusion mask map, and the multi-channel blurred image of the image to be processed.

6. The method according to claim 5, characterized in that, Based on the target blurred image and the multiple weighted masks, an image optimization result corresponding to the image to be processed is generated, including: A reference optimized image is generated based on the blur weight map, the diffusion mask map, the target blurred image, and the multiple weight masks; The reference optimized image is scaled up to obtain an image optimization result with the same size as the image to be processed.

7. The method according to claim 6, characterized in that, Also includes: The jagged edges in the reference optimized image are corrected.

8. An image processing apparatus, characterized in that, include: The weighted mask acquisition unit is used to perform multi-channel preprocessing on the image to be processed to obtain multiple weighted masks. The plurality of weighted masks includes a first weighted mask and a second weighted mask; A blurred image acquisition unit is used to generate a target blurred image based on the multi-channel blurred image of the image to be processed; An image generation unit is configured to generate an image optimization result corresponding to the image to be processed based on the target blurred image and the multiple weighted masks; The image to be processed undergoes multi-channel preprocessing to obtain multiple weighted masks, including: The Y channel of the image to be processed is blurred to obtain the first weighted mask; Color enhancement processing is performed on the UV channels of the image to be processed to obtain a second weighted mask.

9. 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 method of any one of claims 1-7.

10. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to perform the method of any one of claims 1-7 by executing the executable instructions.