An image processing method, apparatus, device and storage medium

By performing stylization processing on the object region and background region of the image to be processed separately, the problem of time-consuming and labor-intensive sample data collection and high computational resources in the existing technology is solved, and the effect of efficient conversion into stylized images is achieved.

CN115908116BActive Publication Date: 2026-01-23BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211517370.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-29
Publication Date
2026-01-23
Estimated Expiration
2042-11-29

AI Technical Summary

Technical Problem

Existing technologies require the collection of a large amount of sample data for training when converting real images into stylized images, which is time-consuming, labor-intensive, computationally resource-intensive, and inefficient.

Method used

By stylizing the object region and background region in the image to be processed separately, and using image segmentation and pixelation, the real image is directly converted into a stylized image.

Benefits of technology

This avoids the time-consuming and labor-intensive problem of collecting a large amount of sample data, reduces the consumption of computing resources, and improves the efficiency of generating stylized images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115908116B_ABST
    Figure CN115908116B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an image processing method and device, equipment and storage medium, and relates to the technical field of computer, which can efficiently convert a real image into a stylized image. The image processing method comprises: in the process of performing stylization processing on a to-be-processed image, displaying the to-be-processed image; the to-be-processed image comprises an object region and a background region; in response to a stylization operation performed by a user on the to-be-processed image, performing stylization processing on the object region and the background region in the to-be-processed image respectively to obtain a stylized image; the resolution of the object region in the stylized image is different from the resolution of the background region in the stylized image; and displaying the stylized image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Stylized images are images that have undergone stylization processing to obtain a unique artistic style. For example, people or objects in pixel-style stylized images can appear with a jagged, low-resolution style, creating a unique pixelated artistic effect.

[0003] In related technologies, when stylizing real images, the main approach is to directly convert real images into stylized images using a trained neural network model. This method typically requires collecting a large number of stylized and real images as sample data, and training the neural network model based on an unsupervised deep learning framework to achieve the conversion between real and stylized images.

[0004] However, collecting and training large amounts of sample data is often time-consuming and labor-intensive. Furthermore, generating images that include specific style features based on neural network models often requires significant computational resources and is inefficient. Summary of the Invention

[0005] This disclosure provides an image processing method, apparatus, device, and storage medium that can efficiently convert real images into stylized images.

[0006] The technical solution of this disclosure is as follows:

[0007] According to a first aspect of the present disclosure, an image processing method is provided, comprising: displaying an image to be processed during the process of stylizing an image to be processed; the image to be processed includes an object region and a background region; in response to a stylizing operation performed by a user on the image to be processed, stylizing the object region and the background region in the image to be processed respectively to obtain a stylized image; the resolution of the object region in the stylized image and the resolution of the background region in the stylized image are different; and displaying the stylized image.

[0008] Optionally, after obtaining the stylized image, the image processing method further includes: determining the outline of the object region in the stylized image; and displaying the outline in the stylized image.

[0009] Optionally, in response to a user's stylization operation on the image to be processed, a method for stylizing the object region and background region in the image to be processed to obtain a stylized image specifically includes: determining a first parameter and a second parameter based on the attribute information of each region in the image to be processed; stylizing the object region in the image to be processed based on the first parameter, and stylizing the background region in the image to be processed based on the second parameter to obtain a stylized image.

[0010] Optionally, the attribute information includes the area ratio information of the object region and the background region in the image to be processed; the method for determining the first parameter and the second parameter based on the attribute information of each region in the image to be processed specifically includes: determining the first parameter based on the area ratio information of the object region in the image to be processed; and determining the second parameter based on the area ratio information of the background region in the image to be processed.

[0011] Optionally, a specific method for stylizing the object region in the image to be processed based on a first parameter and the background region in the image to be processed based on a second parameter to obtain a stylized image includes: performing image segmentation on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed; performing pixelation on the first image based on the first parameter to obtain a processed first image; the processed first image includes the pixelated object region; performing pixelation on the second image based on the second parameter to obtain a processed second image; the processed second image includes the pixelated background region; and performing image fusion on the processed first image and the processed second image to obtain a stylized image including the pixelated object region and the pixelated background region.

[0012] Optionally, the specific method for determining the contour of an object region in a stylized image includes: sliding a preset sliding window in the stylized image according to a preset traversal direction to obtain multiple window regions; each window region includes multiple pixel values ​​within the stylized image; determining the window regions that meet preset conditions among the multiple window regions as target window regions to obtain a set of target window regions; the target window regions include pixel values ​​within the object region in the stylized image and pixel values ​​within the background region in the stylized image; filling the center point of each target window region in the set of target window regions with preset pixel values ​​to obtain the contour.

[0013] Optionally, before performing image segmentation on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed, the image processing method further includes: performing image smoothing on the image to be processed to obtain a smoothed image.

[0014] According to a second aspect of the present disclosure, an image processing apparatus is provided, comprising: a display unit and a processing unit; the display unit is configured to display the image to be processed during the process of stylizing the image to be processed; the image to be processed includes an object region and a background region; the processing unit is configured to stylize the object region and the background region in the image to be processed respectively in response to a stylization operation performed by a user on the image to be processed, thereby obtaining a stylized image; the resolution of the object region in the stylized image and the resolution of the background region in the stylized image are different; the display unit is further configured to display the stylized image.

[0015] Optionally, the image processing apparatus further includes: a determining unit; the determining unit is configured to determine the outline of an object region in the stylized image; and a display unit is further configured to display the outline in the stylized image.

[0016] Optionally, the processing unit is specifically configured to: determine a first parameter and a second parameter based on the attribute information of each region in the image to be processed; perform stylization processing on the object region in the image to be processed based on the first parameter, and perform stylization processing on the background region in the image to be processed based on the second parameter, to obtain a stylized image.

[0017] Optionally, the attribute information includes the area ratio information of the object region and the background region in the image to be processed; the processing unit is specifically configured to: determine a first parameter based on the area ratio information of the object region in the image to be processed; and determine a second parameter based on the area ratio information of the background region in the image to be processed.

[0018] Optionally, the processing unit is further configured to perform image segmentation processing on the image to be processed to obtain a first image including an object region in the image to be processed and a second image including a background region in the image to be processed; the processing unit is further configured to perform pixelation processing on the first image based on a first parameter to obtain a processed first image; the processed first image includes the pixelated object region; the processing unit is further configured to perform pixelation processing on the second image based on a second parameter to obtain a processed second image; the processed second image includes the pixelated background region; the processing unit is further configured to perform image fusion processing on the processed first image and the processed second image to obtain a stylized image including the pixelated object region and the pixelated background region.

[0019] Optionally, the determining unit is specifically configured to: slide a preset sliding window in the stylized image according to a preset traversal direction to obtain multiple window regions; each window region includes multiple pixel values ​​in the sampled mask image; determine the window regions that meet preset conditions among the multiple window regions as target window regions to obtain a set of target window regions; the target window regions include pixel values ​​in the object region of the stylized image and pixel values ​​in the background region of the stylized image; fill the center point of each target window region in the set of target window regions with preset pixel values ​​to obtain a contour.

[0020] Optionally, the processing unit is also configured to perform image smoothing on the image to be processed to obtain a smoothed image.

[0021] According to a third aspect of the present disclosure, an electronic device is provided, which may include: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement any of the optional image processing methods of the first aspect described above.

[0022] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored, such that when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform any of the optional image processing methods of the first aspect described above.

[0023] According to a fifth aspect of the present disclosure, a computer program product is provided, the computer program product including computer instructions that, when executed on a processor of an electronic device, cause the electronic device to perform an image processing method as described in any of the optional implementations of the first aspect.

[0024] 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.

[0025] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:

[0026] Based on any of the above, in this disclosure, when an electronic device displays the object region and background region in the image to be processed during the stylization process, it can respond to the stylization operation performed by the user on the image to be processed, and perform stylization processing on the object region and background region in the image to be processed respectively, thereby further obtaining a stylized image and displaying stylized images with different resolutions for the object region and the background region.

[0027] Compared to related technologies that require collecting large amounts of sample data to train a neural network model and then directly performing stylization transfer on the entire image based on the neural network model, this disclosure adopts a method that directly performs stylization processing on different regions of the image to be processed, thereby converting the image to a stylized image. For example, this disclosure can complete the stylization transfer of the image based on image segmentation and pixelation processing. Therefore, this disclosure not only avoids the time-consuming and labor-intensive problem caused by collecting large amounts of sample data and training, but also reduces the consumption of computing resources when generating stylized images, thus improving the efficiency of generating stylized images. Therefore, this disclosure can efficiently convert real images into stylized images. Attached Figure Description

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

[0029] Figure 1 A schematic diagram of the structure of an image processing system provided in an embodiment of this disclosure is shown;

[0030] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure is shown;

[0031] Figure 3 This illustration shows a flowchart of an image processing method provided by an embodiment of the present disclosure. Figure 1 ;

[0032] Figure 4 A schematic diagram of a stylized image provided in an embodiment of this disclosure is shown;

[0033] Figure 5 This illustration shows a flowchart of an image processing method provided by an embodiment of the present disclosure. Figure 2 ;

[0034] Figure 6 This illustration shows a flowchart of an image processing method provided by an embodiment of the present disclosure. Figure 3 ;

[0035] Figure 7 This illustration shows a flowchart of an image processing method provided by an embodiment of the present disclosure. Figure 4 ;

[0036] Figure 8 This illustration shows a flowchart of an image processing method provided by an embodiment of the present disclosure. Figure 5 ;

[0037] Figure 9This illustration shows a flowchart of an image processing method provided by an embodiment of the present disclosure. Figure 6 ;

[0038] Figure 10 This illustration shows a flowchart of an image processing method provided by an embodiment of the present disclosure. Figure 7 ;

[0039] Figure 11 A schematic diagram of the structure of an image processing apparatus provided in an embodiment of this disclosure is shown;

[0040] Figure 12 A schematic diagram of the structure of a terminal provided in an embodiment of this disclosure is shown;

[0041] Figure 13 A schematic diagram of the structure of a server provided in an embodiment of this disclosure is shown. Detailed Implementation

[0042] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0043] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0044] It should be noted that the user information (including but not limited to user device information, user personal information, user behavior information, etc.) and data involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0045] In general techniques, when stylizing real images, the primary method is to directly convert real images into stylized images using a trained neural network model. This approach typically requires collecting a large number of stylized and real images as sample data and training a neural network model based on an unsupervised deep learning framework to achieve the conversion between real and stylized images.

[0046] However, collecting and training large amounts of sample data is often time-consuming and labor-intensive. Furthermore, generating images that include specific style features based on neural network models often requires significant computational resources and is inefficient.

[0047] Based on this, this disclosure provides an image processing method. During the stylization process of an image to be processed, after displaying the object region and background region in the image to be processed, the electronic device can respond to the stylization operation performed by the user on the image to be processed, and perform stylization processing on the object region and background region in the image to be processed respectively, thereby further obtaining a stylized image and displaying stylized images with different resolutions for the object region and the background region.

[0048] Compared to related technologies that require collecting large amounts of sample data to train a neural network model and then directly performing stylization transfer on the entire image based on the neural network model, this disclosure adopts a method that directly performs stylization processing on different regions of the image to be processed, thereby converting the image to a stylized image. For example, this disclosure can complete the stylization transfer of the image based on image segmentation and pixelation processing. Therefore, this disclosure not only avoids the time-consuming and labor-intensive problem caused by collecting large amounts of sample data and training, but also reduces the consumption of computing resources when generating stylized images, thus improving the efficiency of generating stylized images. Therefore, this disclosure can efficiently convert real images into stylized images.

[0049] Figure 1 This is a schematic diagram of an image processing system provided in an embodiment of the present disclosure, such as... Figure 1 As shown, the image processing system 100 may include an electronic device 101 and a server 102. The electronic device 101 and the server 102 can establish a communication connection via wired or wireless networks.

[0050] The electronic device 101 can be configured with resource files for performing pixelation processing (such as upsampling and downsampling), image smoothing, image segmentation, and image fusion, and can also be configured with resource files containing preset parameters.

[0051] In one possible embodiment, the electronic device 101 may also include or be connected to a database, and the resource files used in this disclosure for operations such as scaling, smoothing and segmenting of images may be stored in the database.

[0052] Optionally, Figure 1The electronic device 101 can be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) / virtual reality (VR) device, etc., that can install and use content community applications. This disclosure does not impose any special restrictions on the specific form of the terminal. It can interact with users through one or more methods such as keyboard, touchpad, touch screen, remote control, voice interaction, or handwriting device.

[0053] Figure 1 The server 102 can also be configured with resource files for operations such as scaling, smoothing and segmenting of images, and can also be configured with resource files with preset parameters.

[0054] In one possible approach, when electronic device 101 needs to obtain a stylized image corresponding to the image to be processed, it can send a processing request message carrying the image to be processed to server 102. Correspondingly, server 102 can convert the image to be processed into a stylized image based on configured resource files and then send a processing response message carrying the stylized image to electronic device 101. Based on this, electronic device 101 can display the stylized image corresponding to the image to be processed.

[0055] Optionally, Figure 1 The server 102 can be a single server or a server cluster consisting of multiple servers. In some embodiments, the server cluster can also be a distributed cluster. This disclosure does not limit the specific implementation of the server.

[0056] Optionally, the above Figure 1 In the image processing system shown, electronic device 101 can communicate with at least one server 102. Server 102 can also communicate with at least one electronic device 101. This disclosure does not limit the number or type of electronic devices 101 and servers 102.

[0057] The image processing method provided in this disclosure can be applied to the aforementioned... Figure 1 Electronic device 101 in the application scenario shown.

[0058] Combination Figure 1 ,like Figure 2The diagram shown is a structural schematic of an electronic device 101 provided in an embodiment of this disclosure. The electronic device 101 may be configured with an input module 21, a display module 22, and a communication module 23. The input module 21 may be a computer external input device such as a mouse and keyboard, used for user-defined operations, etc. The display module 22 may be a device such as a liquid crystal display (LCD), used for displaying images, etc. The communication module 23 may be a transceiver or similar device, used for communication between the electronic device 101 and a server 102.

[0059] The image processing method provided in the embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.

[0060] like Figure 3 As shown, when an image processing method is applied to an electronic device, the image processing method may include:

[0061] S301. During the process of stylizing the image to be processed, the electronic device displays the image to be processed.

[0062] The image to be processed may include an object region and a background region.

[0063] In one possible approach, combining Figure 2 Before stylizing the image to be processed, the user can select the image through the input module configured on the electronic device. In response to this selection, the electronic device displays the image to be processed through the configured display module. Subsequently, the electronic device can also perform stylization processing on the image to be processed in response to the user's stylization operation. Furthermore, before completing the stylization processing of the image to be processed, that is, during the stylization process, the electronic device can continue to display the image to be processed so that the user can view it.

[0064] Optionally, the object region can be an area used to display a human image (e.g., a face), or an area used to display specific elements (e.g., cartoon elements, plants, and animals). Furthermore, the image to be processed may include one or more object regions. It should be understood that the background region can be any area in the image to be processed other than the object region. This disclosure does not limit this aspect.

[0065] S302. In response to the stylization operation performed by the user on the image to be processed, the electronic device performs stylization processing on the object region and the background region in the image to be processed respectively to obtain a stylized image.

[0066] The resolution of the object region in the stylized image is different from the resolution of the background region in the stylized image.

[0067] In one possible approach, combining Figure 2 Users can perform stylization operations on the image to be processed displayed by the electronic device through the display module via the input module (e.g., by clicking the stylization processing button). In response to this stylization operation, the electronic device can stylize the object region and the background region in the image to be processed separately to obtain a stylized image.

[0068] Specifically, the electronic device can first determine a first parameter based on the attribute information of the object region in the image to be processed, and then determine a second parameter based on the attribute information of the background region in the image to be processed. Next, the electronic device can perform stylization processing on the object region in the image to be processed based on the first parameter, and then perform stylization processing on the background region in the image to be processed based on the second parameter, thereby obtaining a stylized image.

[0069] Based on this, the object region in the stylized image can have a resolution corresponding to the first parameter, and the background region in the stylized image can have a resolution corresponding to the second parameter, so that both the object region and the background region in the stylized image can present different pixel art effects.

[0070] In one possible approach, stylization could be pixelation (e.g., downsampling).

[0071] S303, Stylized images displayed on electronic devices.

[0072] In one possible approach, combining Figure 2 Electronic devices can stylize images to be processed, and after obtaining stylized images, display the stylized images through a configured display module so that users can view the stylized images.

[0073] In one possible approach, the electronic device can display an object region with a resolution corresponding to a first parameter in a stylized image, while simultaneously displaying a background region with a resolution corresponding to a second parameter.

[0074] In one possible approach, the electronic device can also display the image to be processed and the stylized image simultaneously on the same interface, so that the user can understand the difference between the image to be processed and the stylized image.

[0075] In one possible example, such as Figure 4 As shown, Figure 4 In this context, 'a' represents the image to be processed. Figure 4 In this context, 'b' represents the stylized image corresponding to the image to be processed.

[0076] The technical solution provided by the above embodiments brings at least the following beneficial effects: As shown in S301-S303, during the stylization processing of the image to be processed, after displaying the object region and background region in the image to be processed, the electronic device can respond to the stylization operation performed by the user on the image to be processed, and perform stylization processing on the object region and background region in the image to be processed separately, thereby further obtaining a stylized image and displaying stylized images with different resolutions for the object region and the background region. Compared with the related technology, which requires collecting a large amount of sample data to train a neural network model and then directly performing stylization conversion on the entire image based on the neural network model, this disclosure adopts a method of directly performing stylization processing on different regions in the image to be processed to convert the image to be processed into a stylized image. For example, this disclosure can complete the stylization conversion of the image based on image segmentation processing and pixelation processing of the image to be processed. Therefore, this disclosure can not only avoid the time-consuming and labor-intensive problem caused by collecting a large amount of sample data and training, but also reduce the consumption of computing resources when generating stylized images and improve the efficiency of generating stylized images. Therefore, this disclosure can efficiently convert real images into stylized images.

[0077] In one embodiment, after obtaining the stylized image, such as Figure 5 As shown, the image processing method provided in this disclosure also includes: S401-S402.

[0078] S401. Electronic device determines the outline of an object region in a stylized image.

[0079] In one possible implementation, after obtaining the stylized image, the electronic device can determine the boundary pixel values ​​of the object region in the stylized image. Then, the electronic device can fill the boundary pixel values ​​of the object region with the same first pixel value to obtain the outline of the object region in the stylized image. Specifically, this process can be referred to in the descriptions of S901-S903 below, and will not be repeated here.

[0080] In one possible approach, the first pixel value can be pre-configured in the electronic device by the operator. For example, the first pixel value could be a pixel value used to represent black. Based on this, the outline of the object region in the stylized image could be a black wireframe surrounding the object region with a jagged effect.

[0081] S402. Electronic devices display outlines in stylized images.

[0082] In one possible approach, after determining the outline of the object region in the stylized image, the electronic device can superimpose the outline of the object region onto the stylized image through processing operations such as image multiplication and image addition.

[0083] In one possible approach, combining Figure 2 After determining the outline of the object region in a stylized image, the electronic device can simultaneously display the outline surrounding the object region in the stylized image while displaying the stylized image, in order to highlight the object region.

[0084] The technical solution provided by the above embodiments brings at least the following beneficial effects: As can be seen from S401-S402, after the electronic device obtains the stylized image, it can further determine the outline of the object region in the stylized image and display the outline surrounding the object region in the stylized image to indicate the difference between the object region and the background region in the stylized image and highlight the pixelation effect of the object region.

[0085] In one embodiment, combined with Figure 3 In S302 above, that is, in response to the stylization operation performed by the user on the image to be processed, the electronic device performs stylization processing on the object region and background region in the image to be processed respectively, and when a stylized image is obtained, as shown... Figure 6 As shown, this disclosure provides an optional implementation, including: S501-S502.

[0086] S501. The electronic device determines the first parameter and the second parameter based on the attribute information of each region in the image to be processed.

[0087] Optionally, the attribute information of each region in the image to be processed may include the area ratio information of the object region and the background region in the image to be processed, the saturation information of the object region and the background region in the image to be processed, and the contrast information of the object region and the background region in the image to be processed. This disclosure does not limit this aspect.

[0088] In one possible approach, when the attribute information of each region in the image to be processed includes the area ratio information of the object region and the background region in the image to be processed, the electronic device can determine the first parameter and the second parameter based on the area ratio information of each region in the image to be processed. Specifically, the electronic device can first determine the area ratio information of the object region in the image to be processed, and the area ratio information of the background region in the image to be processed. Then, the electronic device can determine the first parameter based on the area ratio information of the object region in the image to be processed. Furthermore, the electronic device can determine the second parameter based on the area ratio information of the background region in the image to be processed. The specific implementation process of this approach can be referred to in the following descriptions in S601-S602, and will not be repeated here.

[0089] In one possible approach, when the attribute information of each region in the image to be processed includes the saturation information of the object region and the background region in the image to be processed, the electronic device can determine a first parameter and a second parameter based on the saturation information of each region in the image to be processed. Specifically, the electronic device can first perform segmentation processing on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed. Then, the electronic device can determine the saturation information of the first image and the saturation information of the second image. Next, the electronic device can determine the first parameter based on the saturation information of the first image. And, the electronic device can determine the second parameter based on the saturation information of the second image.

[0090] Optionally, when determining the first parameter based on the saturation information of the first image, the electronic device can first determine the relationship between the saturation information of the first image and a preset saturation threshold. If the saturation information of the first image is greater than the preset saturation threshold, it indicates that the saturation of the object region is high, requiring the stylized object region to have a high resolution to ensure the display effect of the object region. In this case, the electronic device can determine the first candidate factor with the smaller value as the first parameter. If the saturation information of the first image is less than or equal to the preset saturation threshold, it indicates that the saturation of the object region is low. In this case, the electronic device can determine the second candidate factor with the larger value as the first parameter, so that the stylized object region has a more obvious stylization effect. The preset saturation threshold, the first candidate factor, and the second candidate factor can be preset in the electronic device by the operator. For example, the preset saturation threshold can be 50%, the first candidate factor can be 5, and the second candidate factor can be 10.

[0091] It should be understood that the way the electronic device determines the second parameter based on the saturation information of the second image can be referred to the specific description of how the electronic device determines the first parameter based on the saturation information of the first image, which will not be repeated here.

[0092] In one possible approach, when the attribute information of each region in the image to be processed includes contrast information of the object region and the background region in the image to be processed, the electronic device can determine a first parameter and a second parameter based on the contrast information of each region in the image to be processed. Specifically, the electronic device can first perform segmentation processing on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed. Then, the electronic device can determine the contrast information of the first image and the contrast information of the second image. Next, the electronic device can determine the first parameter based on the contrast information of the first image. And, the electronic device can determine the second parameter based on the contrast information of the second image.

[0093] Optionally, when determining the first parameter based on the contrast information of the first image, the electronic device can first determine the relationship between the contrast information of the first image and a preset contrast threshold. If the contrast information of the first image is greater than the preset contrast threshold, it indicates that the contrast of the object region is high, and the object region after stylization needs to have a high resolution to ensure the clarity and sharpness of the object region. In this case, the electronic device can determine the third candidate factor with a smaller value as the first parameter. If the contrast information of the first image is less than or equal to the preset contrast threshold, it indicates that the contrast of the object region is low. In this case, the electronic device can determine the fourth candidate factor with a larger value as the first parameter to make the object region after stylization have a more obvious stylization effect. The preset contrast threshold, the third candidate factor, and the fourth candidate factor can be preset in the electronic device by the operator. For example, the preset contrast threshold can be 120, the third candidate factor can be 3, and the fourth candidate factor can be 8.

[0094] It should be understood that the way the electronic device determines the second parameter based on the contrast information of the second image can be referred to the specific description of how the electronic device determines the first parameter based on the contrast information of the first image, and will not be repeated here.

[0095] S502, the electronic device performs stylization processing on the object region in the image to be processed based on the first parameter, and performs stylization processing on the background region in the image to be processed based on the second parameter, to obtain a stylized image.

[0096] In one possible implementation, after determining the first and second parameters, the electronic device can first perform segmentation processing on the image to be processed, obtaining a first image including the object region in the image to be processed, and a second image including the background region in the image to be processed. Next, the electronic device can perform stylization processing on the first image based on the first parameters, and on the second image based on the second parameters. Then, the electronic device can fuse the processed first and second images to obtain a stylized image.

[0097] The technical solution provided by the above embodiments brings at least the following beneficial effects: As shown in S501-S502, an implementation method is provided whereby an electronic device, in response to a user's stylization operation on an image to be processed, performs stylization processing on the object region and background region of the image to be processed respectively, thereby obtaining a stylized image. The electronic device can determine a first parameter and a second parameter based on the attribute information of each region in the image to be processed, then perform stylization processing on the object region of the image to be processed based on the first parameter, and perform stylization processing on the background region of the image to be processed based on the second parameter, thereby performing stylization processing on the object region and background region of the image to be processed separately, thus obtaining a stylized image. Based on this, the object region and background region in the stylized image can present different stylization effects.

[0098] In one embodiment, when the attribute information of each region in the image to be processed includes the area ratio information of the object region and the background region in the image to be processed, combined with Figure 6 In the above S501, when the electronic device determines the first parameter and the second parameter based on the attribute information of each region in the image to be processed, such as... Figure 7 As shown, this disclosure provides an optional implementation, including: S601-S602.

[0099] S601. The electronic device determines the first parameter based on the area ratio information of the object region in the image to be processed.

[0100] In one possible approach, when an electronic device performs stylization processing on an object region in an image to be processed, it can first determine the area ratio information of the object region in the image to be processed, and further determine a first parameter based on the area ratio information of the object region in the image to be processed, thereby performing stylization processing on the object region in the image to be processed based on the first parameter.

[0101] In one possible approach, when determining the area proportion of an object region within an image to be processed, the electronic device can first determine the number of pixels in the image and then perform image segmentation to obtain the object region. Next, the electronic device can determine the number of pixels within the object region. Based on this, the electronic device can determine the ratio of the number of pixels in the object region to the total number of pixels in the image to be processed as the area proportion of the object region within the image to be processed.

[0102] In one possible approach, when the electronic device determines the first parameter based on the area ratio of the object region in the image to be processed, it can first determine the product of the area ratio of the object region in the image to be processed and a first preset value, and then round the product to obtain the first parameter. The first preset value can be pre-set in the electronic device by the operator.

[0103] In one possible example, the area ratio of the object region in the image to be processed can be 0.65, and the first preset value can be 10. Then, the product of the area ratio of the object region in the image to be processed and the first preset value is 6.7, which, after rounding, yields the first parameter as 7.

[0104] It should be noted that when the object region occupies a small proportion of the image to be processed, a high resolution is required to ensure the clarity of the stylized object region. In this case, the value of the first parameter needs to be low. Since the first parameter value determined by the electronic device based on the object region's area proportion in the image to be processed is also low when the object region occupies a small proportion, it effectively guarantees the stylization effect of the object region in the image.

[0105] Optionally, when the electronic device determines the first parameter based on the area ratio information of the object region in the image to be processed, it can also first determine the relationship between the area ratio information of the object region in the image to be processed and a first preset threshold. If the area ratio information of the object region in the image to be processed is greater than the first preset threshold, the electronic device can determine the first candidate factor as the first parameter. If the area ratio information of the object region in the image to be processed is less than or equal to the first preset threshold, the electronic device can determine the second candidate factor as the first parameter. The first preset threshold, the first candidate factor, and the second candidate factor can be preset in the electronic device by the operator. For example, the first preset threshold can be 0.5, the first candidate factor can be 10, and the second candidate factor can be 5. In one possible approach, the area ratio of the object region in the image to be processed can be denoted as x_scale.

[0106] S602. The electronic device determines the second parameter based on the area ratio information of the background region in the image to be processed.

[0107] In one possible approach, when an electronic device performs stylization processing on the background region in an image to be processed, it can first determine the area ratio information of the background region in the image to be processed, and further determine a first parameter based on the area ratio information of the background region in the image to be processed, thereby performing stylization processing on the background region in the image to be processed based on the first parameter.

[0108] In one possible approach, when determining the area proportion of a background region in an image to be processed, the electronic device can first determine the number of pixels in the image and then perform image segmentation to obtain the background region. Next, the electronic device can determine the number of pixels in the background region. Based on this, the electronic device can determine the ratio of the number of pixels in the background region to the total number of pixels in the image to be processed as the area proportion of the background region in the image to be processed.

[0109] Optionally, based on the description in S601, the electronic device may also determine the difference between 1 and the area ratio information of the object region in the image to be processed as the area ratio information of the background region in the image to be processed.

[0110] It should be understood that the way the electronic device determines the second parameter based on the area ratio of the background region in the image to be processed can be referred to the specific description of how the electronic device determines the first parameter based on the area ratio of the object region in the image to be processed, which will not be repeated here.

[0111] The technical solution provided by the above embodiments brings at least the following beneficial effects: As can be seen from S601-S602 above, a specific implementation method for an electronic device to determine the first parameter and the second parameter based on the attribute information of each region in the image to be processed is given. Since the first parameter is the area ratio of the object region in the image to be processed to the area ratio of the background region in the image to be processed to the area ratio of the background region in the image to be processed, after stylizing the object region in the image to be processed based on the first parameter and stylizing the background region in the image to be processed based on the second parameter, it can be ensured that the pixelation degree and area size of each region in the stylized image have good adaptability, achieving a more visually appealing stylized effect.

[0112] In one embodiment, the image processing method provided in this disclosure further includes: S701.

[0113] S701, The electronic device sets the preset parameter as the second parameter.

[0114] It should be noted that, in order to highlight the stylization effect on the target area, it is possible to consider stylizing the background area in the image to be processed based on specific parameters, thereby weakening the stylization effect on the background area. In this case, the electronic device can set the preset parameter as the second parameter to stylize the background area in the image to be processed.

[0115] In one possible approach, the preset parameters can be pre-set in the electronic device by staff based on experience, and can be denoted as bg_scale.

[0116] In one embodiment, combined with Figure 6 In S502 above, when the electronic device performs stylization processing on the object region in the image to be processed based on the first parameter and on the background region in the image to be processed based on the second parameter to obtain the stylized image, as follows: Figure 8 As shown, this disclosure provides an optional implementation, including: S801-S804.

[0117] S801. The electronic device performs image segmentation processing on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed.

[0118] In one possible implementation, the electronic device performs image segmentation processing on the image to be processed according to a preset segmentation algorithm to obtain a mask image for the object region. The mask image can be used to divide the object region and the background region. Next, the electronic device can multiply the image to be processed and the mask image to obtain a first image including the object region in the image to be processed. Furthermore, the electronic device can multiply the image to be processed and the inverted mask image to obtain a second image including the background region in the image to be processed.

[0119] In one possible approach, the object region in the mask image can be represented by one type of pixel (e.g., 255 pixels) and the background region can be represented by another type of pixel (e.g., 0 pixels).

[0120] Optionally, the masked image can be named x_human_seg.

[0121] Optionally, the preset segmentation algorithm can be the mask-RCNN algorithm, the U-square net (U^2-Net) algorithm, or other segmentation algorithms. This disclosure does not limit the specific algorithm used.

[0122] Optionally, if the masking image is a masking image for a background region, the electronic device can multiply the image to be processed and the masking image to obtain a second image that includes the background region in the image to be processed. Furthermore, the electronic device can multiply the image to be processed and the inverted masking image to obtain a first image that includes the object region in the image to be processed.

[0123] Optionally, the first image can be named x_smooth_human. The second image can be named x_smooth_background. The inverted mask image can be named x_background_seg.

[0124] S802, The electronic device performs pixelation processing on the first image based on the first parameter to obtain the processed first image.

[0125] The first image after processing includes the pixelated object region.

[0126] In one possible approach, when the electronic device performs pixelation processing on the first image based on the first parameter, it can perform downsampling processing on the first image based on the first parameter to obtain the processed first image.

[0127] In one possible approach, when the electronic device performs pixelation processing on the first image based on the first parameter, it can first perform upsampling processing on the first image based on the first parameter, and then perform downsampling processing based on the first parameter to obtain the processed first image.

[0128] In one possible approach, when the electronic device performs pixelation processing on the first image based on the first parameter, it can first perform downsampling processing on the first image based on the first parameter, and then perform upsampling processing based on the first parameter to obtain the processed first image.

[0129] It should be noted that if the pixelation process includes both upsampling and downsampling, the processed first image will be the same size as the original first image because both processes use the same sampling factor (i.e., the first parameter). If the pixelation process only includes downsampling, the processed first image will be smaller than the original first image. Specifically, the resolution of the processed first image will be lower than the resolution of the original first image.

[0130] S803, the electronic device performs pixelation processing on the second image based on the second parameter to obtain the processed second image.

[0131] The processed second image includes the pixelated background area.

[0132] In one possible approach, the electronic device can employ the same pixelation process as the first image, and then pixelate the second image based on the second parameters to obtain the processed second image. Based on this, the processed first and processed second images can maintain the same size, facilitating image fusion to obtain a stylized image.

[0133] S804 The electronic device performs image fusion processing on the processed first image and the processed second image to obtain a stylized image including the pixelated object region and the pixelated background region.

[0134] In one possible approach, to facilitate image fusion processing of the processed first image and the processed second image, the electronic device can perform the same pixelation process on the mask image as on the first image based on the first parameter to obtain the processed mask image.

[0135] Based on this, after obtaining the processed mask image, the processed first image, and the processed second image, the electronic device can fuse the processed first image and the processed second image according to the processed mask image to obtain a stylized image including the pixelated object region and the pixelated background region. The processed mask image, the processed first image, the processed second image, and the stylized image satisfy a first formula. The first formula is:

[0136] x_pixelate_human_seg×x_pixelate_fg+(1-x_pixelate_human_seg)×x_pixelate_bg=x_stylization.

[0137] Where x_pixelate_human_seg is the processed mask image. 1-x_pixelate_human_seg indicates that the processed mask image is inverted. x_pixelate_fg is the first processed image. x_pixelate_bg is the second processed image. x_stylization is the stylized image.

[0138] The technical solution provided by the above embodiments brings at least the following beneficial effects: As shown in S801-S804, a specific implementation method is given for an electronic device to perform stylization processing on an object region in an image to be processed based on a first parameter, and on a background region in an image to be processed based on a second parameter, to obtain a stylized image. The electronic device can first perform image segmentation processing on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed. Then, the first image is pixelated based on the first parameter to obtain a processed first image, and the second image is pixelated based on the second parameter to obtain a processed second image. Thus, the processed first image and the processed second image can be fused to obtain a stylized image including the pixelated object region and the pixelated background region. In this way, the electronic device can scale different regions in the image to be processed to different degrees, thereby ensuring that the pixelation degree and the size of the scaled object region have good adaptability, achieving a more visually appealing stylization effect.

[0139] In one embodiment, combined with Figure 5 In step S401 above, when the electronic device determines the outline of the object region in the scaled image, such as Figure 9 As shown, this disclosure provides an optional implementation, including: S901-S903.

[0140] S901. The electronic device slides a preset sliding window in the stylized image according to a preset traversal direction to obtain multiple window areas.

[0141] Each window region includes multiple pixel values ​​within the stylized image.

[0142] In one possible approach, after obtaining the stylized image, the electronic device can slide a preset sliding window in the stylized image according to a preset traversal direction and a preset sliding speed, and after each slide, determine the area corresponding to the preset sliding window as a window region, thereby obtaining multiple window regions.

[0143] Optionally, the preset traversal direction may include at least one of the following: top to bottom, bottom to top, left to right, and right to left.

[0144] Optionally, a preset sliding speed can be used to represent sliding one or more pixels at a time.

[0145] Optionally, the preset sliding window can be a square window with a side length of S. For example, the side length S can be the length of two pixels.

[0146] S902, The electronic device determines the window regions that meet the preset conditions among multiple window regions as target window regions, and obtains a set of target window regions.

[0147] The target window region includes pixel values ​​within the object region of the stylized image and pixel values ​​outside the object region of the stylized image.

[0148] In one possible approach, the preset conditions could include pixel values ​​within the object region of the stylized image and pixel values ​​outside the object region of the stylized image.

[0149] Based on this, after obtaining multiple window regions, the electronic device can determine the window region that includes both pixel values ​​within the object region of the stylized image and pixel values ​​outside the object region of the stylized image as the target window region, thereby obtaining a set of target window regions that includes multiple window regions that meet preset conditions.

[0150] In one possible approach, in the processed masked image described above, pixels within the object region are identified as having the same pixel value (e.g., 255 pixels), while pixels outside the object region are identified as having a different pixel value (e.g., 0 pixels). Based on this, the electronic device can also slide a preset sliding window in the processed masked image according to a preset traversal direction to obtain multiple window regions, and further determine the window regions that meet preset conditions among the multiple window regions as target window regions, thus obtaining a set of target window regions.

[0151] S903, The electronic device fills the center point of each target window region in the target window region set with a preset pixel value to obtain the outline.

[0152] Specifically, after obtaining the set of target window regions, the electronic device can determine the center point of each target window region in the set of target window regions, and fill the center point of each target window region with a preset pixel value, thereby obtaining the outline of the object region in the stylized image.

[0153] Optionally, the preset pixel value can be a pixel value used to represent black.

[0154] For example, the outline image of the object region in the scaled image can be as follows: Figure 9 The outline image shown.

[0155] The technical solution provided by the above embodiments brings at least the following beneficial effects: As shown in S901-S903, a specific implementation method for an electronic device to determine the contour image of an object region in a scaled image is given. The electronic device can obtain multiple window regions based on a preset sliding window, and determine the window regions that meet the preset conditions among the multiple window regions as target window regions. Therefore, the center point of each target window region can be further filled with a preset pixel value to obtain the contour of the object region in the stylized image.

[0156] In one embodiment, combined with Figure 8 Before S801 above, that is, before the electronic device performs image segmentation processing on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed, as follows: Figure 10 As shown, the image processing method provided in this disclosure also includes: S1001.

[0157] S1001. The electronic device performs image smoothing processing on the image to be processed to obtain a smoothed image.

[0158] Understandably, the image to be processed may be affected by factors such as the camera sensor and atmospheric conditions during capture, resulting in areas with excessive brightness variations or high-brightness pixels (also known as noise). To reduce this impact and ensure the effect of the stylized image corresponding to the image to be processed, the electronic device can perform image smoothing to obtain a smoothed image with more even brightness. Subsequently, the electronic device can perform image matting on the smoothed image based on the mask image to obtain a first image including the object region in the smoothed image and a second image including the background region in the smoothed image.

[0159] The technical solution provided by the above embodiments brings at least the following beneficial effects: As can be seen from S1001, the electronic device can perform image smoothing processing on the image to be processed to obtain a smoothed image with a gradually flattened brightness, thereby ensuring the effect of the stylized image corresponding to the image to be processed.

[0160] It is understood that, in actual implementation, the terminal / server described in the embodiments of this disclosure may include one or more hardware structures and / or software modules for implementing the aforementioned corresponding image processing methods, and these hardware structures and / or software modules may constitute an electronic device. Those skilled in the art should readily recognize that, based on the algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is implemented in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.

[0161] Based on this understanding, the present disclosure also provides an image processing apparatus. Figure 11 A schematic diagram of the structure of an image processing apparatus provided in an embodiment of this disclosure is shown. For example... Figure 11 As shown, the image processing device may include: a display unit 1101 and a processing unit 1102;

[0162] The display unit 1101 is configured to display the image to be processed during the stylization process of the image to be processed; the image to be processed includes an object region and a background region.

[0163] The processing unit 1102 is configured to perform stylization processing on the object region and background region of the image to be processed in response to a stylization operation performed by the user on the image to be processed, thereby obtaining a stylized image; the resolution of the object region in the stylized image is different from the resolution of the background region in the stylized image.

[0164] The display unit 1101 is also configured to display stylized images.

[0165] Optionally, the image processing apparatus further includes: a determining unit 1103; the determining unit 1103 is configured to determine the outline of an object region in the stylized image; and a display unit 1101 is further configured to display the outline in the stylized image.

[0166] Optionally, the processing unit 1102 is specifically configured to: determine a first parameter and a second parameter based on the attribute information of each region in the image to be processed; perform stylization processing on the object region in the image to be processed based on the first parameter, and perform stylization processing on the background region in the image to be processed based on the second parameter, to obtain a stylized image.

[0167] Optionally, the attribute information includes the area ratio information of the object region and the background region in the image to be processed; the processing unit 1102 is specifically configured to: determine a first parameter based on the area ratio information of the object region in the image to be processed; and determine a second parameter based on the area ratio information of the background region in the image to be processed.

[0168] Optionally, the processing unit 1102 is further configured to perform image segmentation processing on the image to be processed to obtain a first image including an object region in the image to be processed and a second image including a background region in the image to be processed; the processing unit 1102 is further configured to perform pixelation processing on the first image based on a first parameter to obtain a processed first image; the processed first image includes the pixelated object region; the processing unit 1102 is further configured to perform pixelation processing on the second image based on a second parameter to obtain a processed second image; the processed second image includes the pixelated background region; the processing unit 1102 is further configured to perform image fusion processing on the processed first image and the processed second image to obtain a stylized image including the pixelated object region and the pixelated background region.

[0169] Optionally, the determining unit 1103 is specifically configured to: slide a preset sliding window in the stylized image according to a preset traversal direction to obtain multiple window regions; each window region includes multiple pixel values ​​in the sampled mask image; determine the window regions that meet preset conditions among the multiple window regions as target window regions to obtain a set of target window regions; the target window regions include pixel values ​​in the object region of the stylized image and pixel values ​​in the background region of the stylized image; fill the center point of each target window region in the set of target window regions with preset pixel values ​​to obtain a contour.

[0170] Optionally, the processing unit 1102 is also configured to perform image smoothing processing on the image to be processed to obtain a smoothed image.

[0171] As described above, the embodiments of this disclosure can divide the image processing apparatus into functional modules according to the above method examples. The integrated modules can be implemented in hardware or as software functional modules. Furthermore, it should be noted that the module division in these embodiments is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module.

[0172] The specific methods by which each module performs its operations and the beneficial effects of the image processing apparatus in the above embodiments have been described in detail in the foregoing method embodiments, and will not be repeated here.

[0173] This disclosure also provides a terminal, which may be a user terminal such as a mobile phone or a computer. Figure 12 A schematic diagram of the structure of a terminal provided in an embodiment of this disclosure is shown. The terminal may be an image processing device and may include at least one processor 61, a communication bus 62, a memory 63, and at least one communication interface 64.

[0174] Processor 61 may be a processor (central processing unit, CPU), microprocessor unit, ASIC, or one or more integrated circuits for controlling the execution of programs according to the present disclosure.

[0175] The communication bus 62 may include a path for transmitting information between the aforementioned components.

[0176] Communication interface 64 uses any transceiver-like device for communicating with other devices or communication networks, such as servers, Ethernet, radio access networks (RAN), wireless local area networks (WLAN), etc.

[0177] Memory 63 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. Memory may exist independently and be connected to the processing unit via a bus. Memory may also be integrated with the processing unit.

[0178] The memory 63 stores the application code that executes the present invention, and its execution is controlled by the processor 61. The processor 61 executes the application code stored in the memory 63 to implement the functions of the method of the present invention.

[0179] In a specific implementation, as one example, processor 61 may include one or more CPUs, for example... Figure 12 CPU0 and CPU1 in the CPU.

[0180] In a specific implementation, as one example, the terminal may include multiple processors, for example... Figure 12 Processors 61 and 65 are included. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor here may refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).

[0181] In a specific implementation, as one embodiment, the terminal may further include an input device 66 and an output device 67. The input device 66 and output device 67 communicate and can accept user input in various ways. For example, the input device 66 may be a mouse, keyboard, touchscreen device, or sensing device. The output device 67 communicates with the processor 61 and can display information in various ways. For example, the output device 61 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, etc.

[0182] Those skilled in the art will understand that Figure 12 The structure shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0183] This disclosure also provides a server. Figure 13 A schematic diagram of the server structure provided in an embodiment of this disclosure is shown. This server can be an image processing device. The server can vary significantly due to differences in configuration or performance, and may include one or more processors 71 and one or more memories 72. The memory 72 stores at least one instruction, which is loaded and executed by the processor 71 to implement the image processing methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.

[0184] This disclosure also provides a computer-readable storage medium including instructions stored thereon, which, when executed by a processor of a computer device, enable the computer to perform the image processing method provided in the embodiments shown above. For example, the computer-readable storage medium may be a memory 63 including instructions, which may be executed by a processor 61 of a terminal to complete the method. As another example, the computer-readable storage medium may be a memory 72 including instructions, which may be executed by a processor 71 of a server to complete the method. Optionally, the computer-readable storage medium may be a non-transitory computer-readable storage medium, such as a ROM, RAM, CD-ROM, magnetic tape, floppy disk, or optical data storage device.

[0185] This disclosure also provides a computer program product including computer instructions that, when executed on an electronic device, cause the electronic device to perform the above-described actions. Figure 3 ,as well as Figures 5 to 10 Image processing method shown in any of the accompanying figures.

[0186] 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.

[0187] 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: During the stylization process of the image to be processed, the image to be processed is displayed; The image to be processed includes an object region and a background region; In response to a stylization operation performed by the user on the image to be processed, a first parameter is determined based on the area ratio information of the object region in the image to be processed and a second parameter is determined based on the area ratio information of the background region in the image to be processed. The image to be processed is subjected to image segmentation processing to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed; The first image is pixelated based on the first parameter to obtain a processed first image; the processed first image includes the pixelated object region; The second image is pixelated based on the second parameter to obtain a processed second image; the processed second image includes a pixelated background area. The processed first image and the processed second image are subjected to image fusion processing to obtain a stylized image including the pixelated object region and the pixelated background region; The resolution of the object region in the stylized image is different from the resolution of the background region in the stylized image; The stylized image is displayed.

2. The image processing method according to claim 1, characterized in that, After obtaining the stylized image, the process further includes: Determine the outline of the object region in the stylized image; The outline is displayed in the stylized image.

3. The image processing method according to claim 2, characterized in that, Determining the contour of the object region in the stylized image includes: A preset sliding window is slid across the stylized image according to a preset traversal direction to obtain multiple window regions; each window region includes multiple pixel values ​​within the stylized image; Window regions that meet preset conditions among the multiple window regions are identified as target window regions, resulting in a set of target window regions; the target window regions include pixel values ​​within the object region of the stylized image and pixel values ​​within the background region of the stylized image; The center point of each target window region in the target window region set is filled with a preset pixel value to obtain the contour.

4. The image processing method according to claim 3, characterized in that, Before performing image segmentation processing on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed, the method further includes: The image to be processed is subjected to image smoothing processing to obtain a smoothed image.

5. An image processing apparatus, characterized in that, include: Display unit and processing unit; The display unit is configured to display the image to be processed during the stylization process of the image to be processed; The image to be processed includes an object region and a background region; The processing unit is configured to, in response to a stylization operation performed by a user on the image to be processed, determine a first parameter based on the area ratio information of the object region in the image to be processed in the image to be processed, and determine a second parameter based on the area ratio information of the background region in the image to be processed in the image to be processed. The processing unit is further configured to perform image segmentation processing on the image to be processed to obtain a first image including the object region in the image to be processed and a second image including the background region in the image to be processed. The processing unit is further configured to perform pixelation processing on the first image based on the first parameter to obtain a processed first image; the processed first image includes a pixelated object region; The processing unit is further configured to perform pixelation processing on the second image based on the second parameter to obtain a processed second image; the processed second image includes a pixelated background region; The processing unit is further configured to perform image fusion processing on the processed first image and the processed second image to obtain a stylized image including the pixelated object region and the pixelated background region; The resolution of the object region in the stylized image is different from the resolution of the background region in the stylized image; The display unit is also configured to display the stylized image.

6. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the image processing method as described in any one of claims 1-4.

7. A computer-readable storage medium storing instructions thereon, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the image processing method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Image stylization method and device, electronic equipment and storage medium

    CN115317900A