Image stylization method and device, electronic equipment and storage medium
By dividing and stylizing the blurred image of the game introduction interface, and combining it with different style maps and rendering technologies, the problem of low compatibility between UI animation and game was solved, achieving higher consistency and display effect between the interface and game style.
Patent Information
- Application Number
- CN202210708734.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-21
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-06-21
AI Technical Summary
In the prior art, the UI animation of the game introduction interface does not fit the game itself well, resulting in the interface appearing monotonous.
By obtaining a blurred image and dividing it into object and background areas, different style maps are used for mixed sampling and rendering. Combining the screen resolution and preset style maps, the object and background areas are stylized separately, and finally merged to obtain a stylized image.
The style fit between the introduced object and the game is improved, the overall fit between the introduction interface and the game is enhanced, and on this basis, UI or UI animation is added to improve the interface display effect.
Smart Images

Figure CN115317900B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game image processing technology, and in particular to an image stylization method, device, electronic device and storage medium. Background Art
[0002] The introduction interface in the game mainly introduces the object being introduced in the middle of the screen and adds a user interface UI around the object to enhance the introduction effect.
[0003] If the introduction interface only has UI, it will look very monotonous. So the solution of improving the display effect of UI in the introduction interface through UI animation has been widely used.
[0004] However, since UI animation is a universal solution, it is not highly compatible with the game itself. Summary of the Invention
[0005] The present invention provides an image stylization method, device, electronic device and storage medium for stylizing an introduced object according to a game style, thereby improving the compatibility between the introduction interface and the game.
[0006] A first aspect of an embodiment of the present invention provides an image stylization method, comprising: obtaining a blurred image of an introduction interface, the blurred image including an object area image and a background area image, the object area image being used to indicate an introduced object in the introduction interface; performing mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result; performing rendering according to the background area image and the first sampling result to obtain a background rendering result; performing sampling according to the screen resolution and a preset second style map to obtain a second sampling result; performing rendering according to the object area image and the second sampling result to obtain an object rendering result; and merging the background rendering result and the object rendering result to obtain a stylized image.
[0007] In a feasible implementation, the mixed sampling according to the preset screen resolution, the preset initial style map and the preset first style map to obtain the first sampling result includes: determining a first scaling factor of the UV coordinate according to the preset screen resolution; sampling the preset initial style map and the preset first style map respectively according to the first scaling factor to obtain a first intermediate sampling result and a second intermediate sampling result; and performing weighted optimization on the first intermediate sampling result and the second intermediate sampling result to obtain the first sampling result.
[0008] In a feasible implementation, the weighted optimization of the first intermediate sampling result and the second intermediate sampling result to obtain the first sampling result includes: performing weighted averaging on the first intermediate sampling result and the second intermediate sampling result to obtain an average sampling result; and optimizing the average sampling result according to preset color parameters to obtain the first sampling result.
[0009] In a feasible embodiment, the rendering according to the background area image and the first sampling result to obtain a background rendering result includes: optimizing the parameters of the background area image to obtain an optimized background area image, the parameters including color, contrast and saturation; and interpolating the optimized background area image and the first sampling result based on a preset first intensity parameter to obtain a background rendering result.
[0010] In a feasible implementation, the sampling according to the screen resolution and the preset second style map to obtain the second sampling result includes: determining a second scaling factor of the UV coordinate according to the screen resolution; and sampling the preset second style map according to the second scaling factor to obtain the second sampling result.
[0011] In a feasible embodiment, rendering according to the object area image and the second sampling result to obtain the object rendering result includes: optimizing parameters of the object area image to obtain an optimized object area image, the parameters including color, contrast, and saturation; and interpolating the optimized object area image and the second sampling result based on a preset second intensity parameter to obtain the object rendering result.
[0012] In a feasible implementation manner, before obtaining the blurred image of the introduction interface, the method further includes: obtaining an initial style map, wherein the initial style map is an image with a game stroke style.
[0013] In a feasible embodiment, obtaining the initial style map includes: drawing an original image with directional brushstrokes; grayscale processing the original image and adjusting the value range to obtain a grayscale image; absorbing a preset area in the grayscale image as a first drawing style; repeatedly tiling the grayscale image and filling the tiled joints with the first drawing style to obtain the initial style map.
[0014] In a feasible implementation, after obtaining the initial style map and before obtaining the blurred image of the introduction interface, the method further includes: rotating the initial style map according to a preset angle to obtain a first style map.
[0015] In a feasible implementation, after rotating the initial style map according to a preset angle to obtain the first style map, and before obtaining the blurred image of the introduction interface, the method further includes: grayscale conversion and mapping the first style map to obtain a second style map.
[0016] In a feasible implementation, the method of obtaining a blurred image of the introduction interface, wherein the blurred image includes an object area image and a background area image, and the object area image is used to indicate an introduced object in the introduction interface, includes: obtaining an initial image of the introduction interface, wherein the initial image includes the introduced object; blurring the initial image to obtain a blurred image of the introduction interface; and dividing the blurred image into regions to obtain an object area image and a background area image.
[0017] In a feasible implementation, blurring the initial image to obtain a blurred image of the introduction interface includes: determining four neighboring pixels corresponding to each pixel in the initial image according to a preset blur intensity parameter; calculating the pixel average of the four neighboring pixels corresponding to each pixel, and using the pixel average corresponding to each pixel as an updated pixel value to obtain a blurred image of the introduction interface.
[0018] In a feasible implementation manner, the region division of the blurred image to obtain the object region image and the background region image includes: marking the introduced object in the initial image and drawing a template image of the introduced object; determining the region corresponding to the template image in the blurred image as the object region image, and determining the remaining region in the blurred image as the background region image.
[0019] In a feasible implementation, after merging the background rendering result and the object rendering result to obtain a stylized image, the method further includes: adding a corresponding user interface UI to the stylized image, or adding a corresponding user interface UI and UI animation to the stylized image.
[0020] A second aspect of an embodiment of the present invention provides an image stylization device, including: a first acquisition module, used to acquire a blurred image of an introduction interface, the blurred image including an object area image and a background area image, the object area image being used to indicate the introduced object in the introduction interface; a first sampling module, used to perform mixed sampling according to a preset screen resolution, a preset initial style map and a preset first style map to obtain a first sampling result; a first rendering module, used to perform rendering according to the background area image and the first sampling result to obtain a background rendering result; a second sampling module, used to perform sampling according to the screen resolution and a preset second style map to obtain a second sampling result; a second rendering module, used to perform rendering according to the object area image and the second sampling result to obtain an object rendering result; and a merging module, used to merge the background rendering result and the object rendering result to obtain a stylized image.
[0021] In a feasible embodiment, the first sampling module includes: a first determination submodule, used to determine a first scaling factor of the UV coordinate according to the preset screen resolution; a first sampling submodule, used to sample the preset initial style map and the preset first style map according to the first scaling factor, respectively, to obtain a first intermediate sampling result and a second intermediate sampling result; an optimization submodule, used to perform weighted optimization on the first intermediate sampling result and the second intermediate sampling result to obtain a first sampling result.
[0022] In a feasible implementation, the optimization submodule is specifically configured to: perform weighted averaging on the first intermediate sampling result and the second intermediate sampling result to obtain an average sampling result; and optimize the average sampling result according to preset color parameters to obtain a first sampling result.
[0023] In a feasible embodiment, the first rendering module is specifically used to: optimize the parameters of the background area image to obtain an optimized background area image, the parameters including color, contrast and saturation; interpolate the optimized background area image and the first sampling result based on a preset first intensity parameter to obtain a background rendering result.
[0024] In a feasible implementation, the second sampling module is specifically configured to: determine a second scaling factor of UV coordinates according to the screen resolution; and sample the second style map according to the second scaling factor to obtain a second sampling result.
[0025] In a feasible embodiment, the second rendering module is specifically used to: optimize the parameters of the object area image to obtain an optimized object area image, the parameters including color, contrast and saturation; and interpolate the optimized object area image and the second sampling result based on a preset second intensity parameter to obtain an object rendering result.
[0026] In a feasible implementation, the image stylization apparatus further includes: a second acquisition module, configured to acquire an initial style map, wherein the initial style map is an image having a game stroke style.
[0027] In a feasible embodiment, the second acquisition module is specifically used to: draw an original image with directional brushstrokes; grayscale process the original image and adjust the value range to obtain a grayscale image; absorb a preset area in the grayscale image as a first drawing style; repeatedly tile the grayscale image and fill the tiled areas with the first drawing style to obtain an initial style map.
[0028] In a feasible implementation manner, the image stylization apparatus further includes: a rotation module, configured to rotate the initial style map according to a preset angle to obtain a first style map.
[0029] In a feasible implementation manner, the image stylization apparatus further includes: a conversion mapping module, configured to perform grayscale conversion and mapping on the first style map to obtain a second style map.
[0030] In a feasible embodiment, the first acquisition module includes: an acquisition submodule, used to acquire an initial image of the introduction interface, wherein the initial image includes the introduced object; a blurring submodule, used to blur the initial image to obtain a blurred image of the introduction interface; and a division submodule, used to divide the blurred image into regions to obtain an object region image and a background region image.
[0031] In a feasible embodiment, the blur submodule is specifically used to: determine the four neighboring pixels corresponding to each pixel in the initial image according to a preset blur intensity parameter; calculate the pixel average of the four neighboring pixels corresponding to each pixel, and use the pixel average corresponding to each pixel as the updated pixel value to obtain a blurred image of the introduction interface.
[0032] In a feasible embodiment, the division submodule is specifically used to: mark the introduced object in the initial image and draw a template image of the introduced object; determine the area corresponding to the template image in the blurred image as the object area image, and determine the remaining area in the blurred image as the background area image.
[0033] In a feasible implementation manner, the image stylization apparatus further includes: an adding module, configured to add a corresponding user interface UI to the stylized image, or to add a corresponding user interface UI and UI motion effects to the stylized image.
[0034] A third aspect of an embodiment of the present invention provides an electronic device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the electronic device executes the above-mentioned image stylization method.
[0035] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned image stylization method.
[0036] In the technical solution provided by the embodiment of the present invention, a blurred image of the introduction interface is obtained, the blurred image including an object area image and a background area image, the object area image being used to indicate the introduced object in the introduction interface; mixed sampling is performed according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result; rendering is performed according to the background area image and the first sampling result to obtain a background rendering result; sampling is performed according to the screen resolution and the preset second style map to obtain a second sampling result; rendering is performed according to the object area image and the second sampling result to obtain an object rendering result; the background rendering result and the object rendering result are merged to obtain a stylized image. In the embodiment of the present invention, the introduction interface is divided into an object area and a background area, the background area is sampled with a mixed style of two styles, the object area where the introduced object is located is sampled according to a single style, and the object area and the background area are rendered separately according to the different sampling results corresponding to the object area and the background area, thereby improving the style fit between the introduced object and the game, thereby improving the fit between the introduction interface and the game. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is a schematic diagram of a first embodiment of an image stylization method according to an embodiment of the present invention;
[0038] Figure 2 2 is a schematic diagram of a second embodiment of the image stylization method according to an embodiment of the present invention;
[0039] Figure 3 2 is a schematic diagram of a third embodiment of the image stylization method according to an embodiment of the present invention;
[0040] Figure 4 2 is a schematic diagram of a fourth embodiment of the image stylization method according to an embodiment of the present invention;
[0041] Figure 5This is a schematic diagram of an unprocessed introduction interface in an embodiment of the present invention;
[0042] Figure 6 A schematic diagram of a stylized introduction interface in an embodiment of the present invention;
[0043] Figure 7 Schematic diagram of an embodiment of an image stylization device according to an embodiment of the present invention;
[0044] Figure 8 FIG. 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The present invention provides an image stylization method, device, electronic device and storage medium for stylizing an introduced object according to a game style, thereby improving the compatibility between the introduction interface and the game.
[0046] It is understandable that the present invention can be applied to electronic devices. As an example but not a limitation, the electronic device can be a server or a terminal. This application is described using a server as an example.
[0047] The terms "first," "second," "third," "fourth," and the like (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the invention described herein can, for example, be implemented in orders other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0048] In existing solutions, the appearance of the introduction interface is generally improved by adding UI and UI animation to the introduction interface. However, the UI animation is generally set in advance and has no connection with the game itself to which the introduction interface belongs, resulting in a low degree of fit. The present invention improves the fit between the introduction interface and the game by providing an image stylization method.
[0049] See also Figure 1 , the first flowchart of the image stylization method provided by the embodiment of the present invention specifically includes:
[0050] 101. Obtain a blurred image of an introduction interface, where the blurred image includes an object area image and a background area image. The object area image is used to indicate an introduced object in the introduction interface.
[0051] When a target object in the game needs to be introduced, the server generates an introduction interface for the object. The image of this introduction interface is blurred to produce a blurred image. Based on the blurred image, the object area corresponding to the introduced object and the background area are distinguished. This embodiment of the present invention can be implemented on a terminal or a server. The present invention will be described using a server as an example.
[0052] Among them, the target object is generally a non-player character (NPC), which can be a biological object in the game scene, such as a humanoid character, a wolf, a tree, etc., or a non-biological object in the game scene, such as a telescope, a weapon, a stone tablet, etc., which has certain game functions. As long as the target object is encountered for the first time in the game and needs to be introduced, the target object can be used as the introduced object. There is no specific limitation here.
[0053] 102. Perform mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result.
[0054] The server performs mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result.
[0055] It should be noted that the styles of the initial style map and the first style map are different. The first style map is obtained after adjustment and optimization on the basis of the initial style map. When the initial style map and the first style map are mixed and sampled, the first style map is used as the main method and the initial style map is used as the auxiliary method. The weighted average value is calculated according to different weights to obtain the mixed sampling result, that is, the first sampling result.
[0056] 103. Rendering is performed according to the background area image and the first sampling result to obtain a background rendering result.
[0057] The server renders the background area image based on the first sampling result to obtain a background rendering result. The server adjusts the color, contrast, and saturation of the background area image according to a preset art configuration to obtain an adjusted background area image, wherein the preset art configuration also includes a first intensity parameter. The server then renders the adjusted background area image according to the first intensity parameter and the first sampling result to obtain a background rendering result.
[0058] 104. Sampling is performed according to the screen resolution and a preset second style map to obtain a second sampling result.
[0059] The server samples the image based on the screen resolution and a preset second style map, obtaining a second sampling result. The second style map is a grayscale image obtained by grayscale conversion and mapping adjustments based on the first style map. During grayscale conversion, different weighting coefficients can be set for the three RGB channels. This embodiment of the present invention uses three parameters based on human eye perception standards: 0.299, 0.587, and 0.114. These three parameters are adjusted based on the human eye's brightness perception system.
[0060] 105. Rendering is performed according to the object area image and the second sampling result to obtain an object rendering result.
[0061] The server renders the object area image based on the second sampling result to obtain an object rendering result. Specifically, the server adjusts the color, contrast, and saturation of the object area image according to a pre-set art configuration to obtain an adjusted object area image, wherein the pre-set art configuration also includes a second intensity parameter. The server then renders the adjusted object area image according to the set second intensity parameter and the second sampling result to obtain an object rendering result. The second intensity parameter can be the same as or different from the first intensity parameter.
[0062] 106. Merge the background rendering result and the object rendering result to obtain a stylized image.
[0063] Specifically, the server merges the background rendering result and the object rendering result according to their respective corresponding areas to obtain a stylized image.
[0064] In an embodiment of the present invention, the introduction interface is divided into an object area and a background area, the background area is sampled in a mixed style of two styles, the object area where the introduced object is located is sampled according to a single style, and the object area and the background area are rendered separately according to the different sampling results corresponding to the object area and the background area, thereby improving the style fit between the introduced object and the game, and further improving the fit between the introduction interface and the game.
[0065] See also Figure 2 , a second flowchart of the image stylization method provided by an embodiment of the present invention specifically includes:
[0066] 201. Obtain a blurred image of an introduction interface, where the blurred image includes an object area image and a background area image. The object area image is used to indicate an introduced object in the introduction interface.
[0067] For example, the server obtains a blurred image R1 of the introduction interface, where the blurred image includes an object area image T0 and a background area image T1 . The object area image T0 is used to indicate the introduced object in the introduction interface.
[0068] Step 201 is similar to step 101 and will not be described again here.
[0069] 202. Perform mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result.
[0070] The server determines a first scaling factor for the UV coordinates based on a preset screen resolution; the server samples the preset initial style map and the preset first style map based on the first scaling factor, respectively, to obtain a first intermediate sampling result and a second intermediate sampling result; the server performs weighted optimization on the first intermediate sampling result and the second intermediate sampling result to obtain a first sampling result. For example, the server samples the initial style map R0 to obtain a first intermediate sampling result S0, samples the first style map G1 to obtain a second intermediate sampling result S1, and performs weighted optimization on the first intermediate sampling result S0 and the second intermediate sampling result S1 to obtain a first sampling result R1.
[0071] It should be noted that the first scaling factor Tiling1 is manually set according to the screen resolution. For example, when the screen resolution is 1336x920, the first scaling factors Tiling1 in the U and V directions are 9.0 and 6.0 respectively.
[0072] In a feasible implementation, the server performs weighted optimization on the first intermediate sampling result and the second intermediate sampling result to obtain the first sampling result, which may include:
[0073] The server performs a weighted average on the first intermediate sampling result and the second intermediate sampling result to obtain an average sampling result; the server optimizes the average sampling result according to a preset color parameter to obtain a first sampling result.
[0074] 203. Rendering is performed according to the background area image and the first sampling result to obtain a background rendering result.
[0075] The server optimizes the parameters of the background region image T1 to obtain an optimized background region image, including parameters such as color, contrast, and saturation. The server then interpolates the optimized background region image and the first sampling result based on a preset first intensity parameter to obtain a background rendering result. For example, the server optimizes the parameters of the background region image to obtain an optimized background region image R2, including parameters such as color, contrast, and saturation. The server then interpolates the optimized background region image R2 and the first sampling result R1 based on a preset first intensity parameter I1 to obtain a background rendering result lerp(R1, R2, I1).
[0076] 204. Sampling is performed according to the screen resolution and the preset second style map to obtain a second sampling result.
[0077] The server determines a second scaling factor for the UV coordinates based on the screen resolution; samples the preset second style map based on the second scaling factor to obtain a second sampling result. For example, the server determines a second scaling factor, Tiling2, for the UV coordinates based on the screen resolution; samples the preset second style map Gray1 based on the second scaling factor, to obtain a second sampling result R4.
[0078] It should be noted that the second scaling factor Tiling2 here is also manually set according to the screen resolution. For example, when the screen resolution is 1336x920, the second scaling factors Tiling2 in the U and V directions are 24.0 and 16.0 respectively.
[0079] 205. Rendering is performed according to the object region image and the second sampling result to obtain an object rendering result.
[0080] The server optimizes the parameters of the object area image to obtain an optimized object area image, including color, contrast, and saturation. The server interpolates the optimized object area image and the second sampling result based on a preset second intensity parameter to obtain an object rendering result. For example, the server adjusts the color, contrast, and saturation of the object area image according to a preset art configuration to obtain an adjusted object area image R3, where the preset art configuration also includes a second intensity parameter I2. The server then renders the adjusted object area image according to the set second intensity parameter I2 and the second sampling result R4 to obtain an object rendering result lerp(R3, R4, I2). The second intensity parameter can be the same as or different from the first intensity parameter.
[0081] 206. Merge the background rendering result and the object rendering result to obtain a stylized image.
[0082] Specifically, the server merges the background rendering result and the object rendering result according to their respective corresponding areas to obtain a stylized image.
[0083] 207. Add a corresponding user interface UI to the stylized image, or add a corresponding user interface UI and UI motion effects to the stylized image.
[0084] The server adds a corresponding user interface (UI) to the stylized image, or adds a corresponding UI and UI animation to the stylized image. For example, the UI could be a text introduction, and the corresponding UI animation could be displaying each introductory text one by one or paragraph by paragraph on the introduction interface.
[0085] In an embodiment of the present invention, the introduction interface is divided into an object area and a background area, the background area is sampled in a mixed style of two styles, the object area where the introduced object is located is sampled according to a single style, and the object area and the background area are rendered separately according to the different sampling results corresponding to the object area and the background area. On the basis of better rendering effect, corresponding UI and / or UI animation are added, thereby improving the style fit between the introduced object and the game, and further improving the fit between the introduction interface and the game.
[0086] See also Figure 3 , a third flowchart of the image stylization method provided by an embodiment of the present invention specifically includes:
[0087] 301. Obtain an initial style map, where the initial style map is an image with a game stroke style.
[0088] Specifically, the server draws an original image with directional strokes; the server grayscales the original image and adjusts the value range to obtain a grayscale image; the server absorbs a preset area in the grayscale image as a first drawing style; the server repeatedly tiles the grayscale image and fills the tiled joints with the first drawing style to obtain an initial style map.
[0089] 302. Rotate the initial style map according to a preset angle to obtain a first style map.
[0090] The server rotates the initial style map according to a preset angle to obtain a first style map.
[0091] It should be noted that in this embodiment, the initial style map is rotated 45 degrees counterclockwise so that the brushstrokes in the first style map tilt from the lower left corner to the upper right corner. It is understood that the angle does not have to be 45 degrees, and there is no specific restriction on the rotation direction. However, 45 degrees, with a direction from the lower left to the upper right, is more consistent with the human eye's common visual preferences and produces good results. This rotation direction and angle are generally used. This method provides a way to adjust the style map, making the sampled first style map more consistent with the human eye's visual preferences, and improving the quality of the stylized map to be transferred.
[0092] 303. Perform grayscale conversion and mapping on the first style map to obtain a second style map.
[0093] The server performs grayscale conversion and mapping on the first style map according to a preset conversion and mapping formula to obtain a second style map. Specifically, the server first performs grayscale conversion on the first style map according to the conversion formula: dot(G1, float3(0.299, 0.587, 0.114)) to obtain the grayscale values of the first style map. The server then adjusts and maps the grayscale values of the first style map according to the mapping formula: power(A, g1), where g1 is a preset control parameter used to change the grayscale curve of A. Combining the conversion and mapping formulas yields the conversion and mapping formula: Gray1 = power(dot(G1, float3(0.299, 0.587, 0.114)), g1), where g1 is a preset control parameter used to change the grayscale curve of the first style map G1 to produce a different texture effect than G1. This method provides a grayscale conversion and mapping method that enhances the stylistic difference between the second style map and the first style map.
[0094] 304. Obtain a blurred image of the introduction interface, where the blurred image includes an object area image and a background area image. The object area image is used to indicate the introduced object in the introduction interface.
[0095] Specifically, the server obtains an initial image of the introduction interface, which includes the introduced object; the server blurs the initial image to obtain a blurred image of the introduction interface; the server divides the blurred image into regions to obtain an object region image and a background region image.
[0096] 305 . Perform mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result.
[0097] 306. Rendering is performed according to the background area image and the first sampling result to obtain a background rendering result.
[0098] 307. Sampling is performed according to the screen resolution and the preset second style map to obtain a second sampling result.
[0099] 308. Rendering is performed according to the object area image and the second sampling result to obtain an object rendering result.
[0100] 309. Merge the background rendering result and the object rendering result to obtain a stylized image.
[0101] 310. Add a corresponding user interface UI to the stylized image, or add a corresponding user interface UI and UI motion effects to the stylized image.
[0102] Steps 305-310 are similar to steps 202-207 and are not described again here.
[0103] In an embodiment of the present invention, the introduction interface is divided into an object area and a background area, the background area is sampled in a mixed style of two styles, the object area where the introduced object is located is sampled according to a single style, and the object area and the background area are rendered separately according to the different sampling results corresponding to the object area and the background area. On the basis of better rendering effect, corresponding UI and / or UI animation are added, thereby improving the style fit between the introduced object and the game, and further improving the fit between the introduction interface and the game.
[0104] See also Figure 4 , the fourth flow chart of the image stylization method provided by the embodiment of the present invention specifically includes:
[0105] 401. Obtain an initial style map, where the initial style map is an image with a game stroke style.
[0106] 402. Rotate the initial style map according to a preset angle to obtain a first style map.
[0107] 403. Perform grayscale conversion and mapping on the first style map to obtain a second style map.
[0108] Steps 401-403 are similar to steps 301-303 and are not described again here.
[0109] 404. Obtain an initial image of the introduction interface, where the initial image includes the introduced object.
[0110] The server obtains the initial image of the introduction interface, which includes the introduced object. For example, Figure 5 As shown, the initial image includes the introduced object: the telescope, and other objects serve as the background of the telescope.
[0111] 405. Blur the initial image to obtain a blurred image of the introduction interface.
[0112] The server determines the four neighboring pixels corresponding to each pixel in the initial image according to a preset blur strength parameter; the server calculates the pixel average of the four neighboring pixels corresponding to each pixel, and uses the pixel average corresponding to each pixel as the updated pixel value to obtain a blurred image of the introduction interface.
[0113] For example, the server determines a blur intensity parameter b, where b represents the number of units between the four pixels in the upper, lower, left, and right directions and the current pixel. For each pixel in the introduction interface at its current coordinates (x, y), the server takes the b adjacent pixels above, below, left, and right, i.e., the pixels at positions (xb, y), (x+b, y), (x, yb), and (x, y+b), denoted as t0, t1, t2, and t3, respectively. If the pixels are outside the image boundary, they are taken to be 0. The pixel values at t0, t1, t2, and t3 are summed and averaged, and the calculated result for each pixel in the introduction interface is used as the updated pixel value at the current position (x, y) to obtain a blurred image of the introduction interface. This method provides a specific blurring process that reduces the realism and clarity of the image while enhancing the comic-like effect of the image.
[0114] 406. Divide the blurred image into regions to obtain an object region image and a background region image.
[0115] The server marks the object being introduced in the initial image and draws a template image of the object. The server then identifies the area of the blurred image corresponding to the template image as the object region image, and the remaining area of the blurred image as the background region image. This partitioning of the blurred image facilitates subsequent rendering of the object region image and background region image in different styles, highlighting the introduced object and enhancing the presentation effect.
[0116] 407 : Perform mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result.
[0117] 408. Rendering is performed according to the background area image and the first sampling result to obtain a background rendering result.
[0118] 409. Sampling is performed according to the screen resolution and the preset second style map to obtain a second sampling result.
[0119] 410. Rendering is performed according to the object region image and the second sampling result to obtain an object rendering result.
[0120] 411. Merge the background rendering result and the object rendering result to obtain a stylized image.
[0121] For example, Figure 6 As shown, the merged stylized image includes a stylized telescope and a stylized background, and the stylization of the background and the telescope are somewhat different.
[0122] 412. Add a corresponding user interface UI to the stylized image, or add a corresponding user interface UI and UI animation to the stylized image.
[0123] Steps 407-412 are similar to steps 202-207 and are not described again here.
[0124] In an embodiment of the present invention, the introduction interface is blurred, and the blurred image is divided into an object area and a background area. The background area is sampled in a mixed style of two styles, and the object area where the introduced object is located is sampled according to a single style. The object area and the background area are rendered separately according to the different sampling results corresponding to the object area and the background area. On the basis of better rendering effects, corresponding UI and / or UI animations are added, thereby improving the style fit between the introduced object and the game, and thereby improving the fit between the introduction interface and the game.
[0125] The above describes the image stylization method in the embodiment of the present invention. The following describes the image stylization device in the embodiment of the present invention. Figure 7 An embodiment of the image stylization device in the embodiment of the present invention includes:
[0126] A first acquisition module 701 is configured to acquire a blurred image of the introduction interface, wherein the blurred image includes an object region image and a background region image, and the object region image is used to indicate an introduced object in the introduction interface;
[0127] A first sampling module 702 is configured to perform mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result;
[0128] A first rendering module 703 is configured to perform rendering according to the background area image and the first sampling result to obtain a background rendering result;
[0129] A second sampling module 704 is configured to perform sampling according to the screen resolution and a preset second style map to obtain a second sampling result;
[0130] A second rendering module 705 is configured to perform rendering according to the object region image and the second sampling result to obtain an object rendering result;
[0131] The merging module 706 is configured to merge the background rendering result and the object rendering result to obtain a stylized image.
[0132] In a feasible implementation, the first sampling module 702 includes:
[0133] A first determining submodule 7021 is configured to determine a first scaling factor of the UV coordinates according to the preset screen resolution;
[0134] A first sampling submodule 7022 is configured to sample the preset initial style map and the preset first style map according to the first zoom factor, respectively, to obtain a first intermediate sampling result and a second intermediate sampling result;
[0135] The optimization submodule 7023 is configured to perform weighted optimization on the first intermediate sampling result and the second intermediate sampling result to obtain a first sampling result.
[0136] In a feasible implementation manner, the optimization submodule 7023 is specifically configured to:
[0137] Performing a weighted average on the first intermediate sampling result and the second intermediate sampling result to obtain an average sampling result;
[0138] The average sampling result is optimized according to preset color parameters to obtain a first sampling result.
[0139] In a feasible implementation manner, the first rendering module 703 is specifically configured to:
[0140] Optimizing parameters of the background region image to obtain an optimized background region image, wherein the parameters include color, contrast, and saturation;
[0141] The optimized background area image and the first sampling result are interpolated based on a preset first intensity parameter to obtain a background rendering result.
[0142] In a feasible implementation manner, the second sampling module 704 is specifically configured to:
[0143] Determining a second scaling factor for the UV coordinates according to the screen resolution;
[0144] The second style map is sampled according to the second scaling factor to obtain a second sampling result.
[0145] In a feasible implementation manner, the second rendering module 705 is specifically configured to:
[0146] Optimizing parameters of the object region image to obtain an optimized object region image, wherein the parameters include color, contrast, and saturation;
[0147] The optimized object area image and the second sampling result are interpolated based on a preset second intensity parameter to obtain an object rendering result.
[0148] In a feasible implementation manner, the image stylization device further includes:
[0149] The second acquisition module 707 is used to acquire an initial style map, where the initial style map is an image with a game brushstroke style.
[0150] In a feasible implementation manner, the second acquisition module 707 is specifically configured to:
[0151] Draw the original image with directional brushstrokes;
[0152] Performing grayscale processing on the original image and adjusting the value range to obtain a grayscale image;
[0153] Absorbing a preset area in the grayscale image as a first drawing style;
[0154] The grayscale image is repeatedly tiled, and the first drawing style is used to fill in the tiled joints to obtain an initial style map.
[0155] In a feasible implementation manner, the image stylization device further includes:
[0156] The rotation module 708 is configured to rotate the initial style map according to a preset angle to obtain a first style map.
[0157] In a feasible implementation manner, the image stylization device further includes:
[0158] The conversion and mapping module 709 is configured to perform grayscale conversion and mapping on the first style map to obtain a second style map.
[0159] In a feasible implementation manner, the first acquisition module 701 includes:
[0160] The acquisition submodule 7011 is used to acquire an initial image of the introduction interface, wherein the initial image includes the introduced object;
[0161] A blur submodule 7012 is used to blur the initial image to obtain a blurred image of the introduction interface;
[0162] The division submodule 7013 is used to divide the blurred image into regions to obtain an object region image and a background region image.
[0163] In a feasible implementation manner, the fuzzy submodule 7012 is specifically configured to:
[0164] Determining four neighboring pixels corresponding to each pixel in the initial image according to a preset blur strength parameter;
[0165] The pixel average of the four neighboring pixels corresponding to each pixel is calculated, and the pixel average corresponding to each pixel is used as the updated pixel value to obtain a blurred image of the introduction interface.
[0166] In a feasible implementation manner, the division submodule 7013 is specifically configured to:
[0167] Marking the introduced object in the initial image and drawing a template image of the introduced object;
[0168] An area corresponding to the template image in the blurred image is determined as an object area image, and a remaining area in the blurred image is determined as a background area image.
[0169] In a feasible implementation manner, the image stylization device further includes:
[0170] The adding module 710 is configured to add a corresponding user interface UI to the stylized image, or to add a corresponding user interface UI and UI motion effects to the stylized image.
[0171] In an embodiment of the present invention, the introduction interface is blurred, and the blurred image is divided into an object area and a background area. The background area is sampled in a mixed style of two styles, and the object area where the introduced object is located is sampled according to a single style. The object area and the background area are rendered separately according to the different sampling results corresponding to the object area and the background area. On the basis of better rendering effects, corresponding UI and / or UI animations are added, thereby improving the style fit between the introduced object and the game, and thereby improving the fit between the introduction interface and the game.
[0172] Figure 8 : is a structural diagram of an electronic device provided by an embodiment of the present invention. The electronic device 800 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 810 (for example, one or more processors) and a memory 820, and one or more storage media 830 (for example, one or more mass storage devices) storing application programs 833 or data 832. Among them, the memory 820 and the storage medium 830 can be temporary storage or permanent storage. The program stored in the storage medium 830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the electronic device 800. Furthermore, the processor 810 can be configured to communicate with the storage medium 830 to execute a series of instruction operations in the storage medium 830 on the electronic device 800.
[0173] The electronic device 800 may further include one or more power supplies 840, one or more wired or wireless network interfaces 850, one or more input and output interfaces 860, and / or one or more operating devices 831, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be understood by those skilled in the art that Figure 8 The illustrated structure of the electronic device does not limit the electronic device and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0174] By way of example and not limitation, electronic device 800 may be a server or a terminal.
[0175] An embodiment of the present invention provides an electronic device, including: a memory and at least one processor, wherein the memory stores instructions; the at least one processor invokes the instructions in the memory to cause the electronic device to perform the above-mentioned image stylization method, wherein the method specifically includes the following steps:
[0176] Obtain a blurred image of the introduction interface, the blurred image including an object area image and a background area image, the object area image being used to indicate the introduced object in the introduction interface; perform mixed sampling based on a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result; render based on the background area image and the first sampling result to obtain a background rendering result; perform sampling based on the screen resolution and a preset second style map to obtain a second sampling result; render based on the object area image and the second sampling result to obtain an object rendering result; and merge the background rendering result and the object rendering result to obtain a stylized image. The introduction interface is divided into an object area and a background area, and the background area is sampled using a mixed sampling of two styles. The object area containing the introduced object is sampled using a single style, and rendered separately based on the different sampling results corresponding to the object area and background area, thereby improving the style fit between the introduced object and the game, thereby improving the fit between the introduction interface and the game.
[0177] The above-mentioned mixed sampling based on the preset screen resolution, the preset initial style map, and the preset first style map to obtain the first sampling result includes: determining a first scaling factor for the UV coordinates based on the preset screen resolution; sampling the preset initial style map and the preset first style map based on the first scaling factor to obtain a first intermediate sampling result and a second intermediate sampling result; and performing weighted optimization on the first intermediate sampling result and the second intermediate sampling result to obtain the first sampling result. This method completes the mixed sampling by determining the first scaling factor, performing mixed sampling based on the first scaling factor, and then weighting the two obtained intermediate sampling results. The style of the mixed sampling result is adjusted by setting different weights.
[0178] The weighted optimization of the first and second intermediate sampling results to obtain the first sampling result includes: performing a weighted average of the first and second intermediate sampling results to obtain an average sampling result; and optimizing the average sampling result based on preset color parameters to obtain the first sampling result. This method introduces color parameters to adjust the color of the sampling result, thereby improving sampling quality.
[0179] The rendering process based on the background area image and the first sampling result to obtain the background rendering result includes: optimizing parameters of the background area image to obtain an optimized background area image, including parameters such as color, contrast, and saturation; and interpolating the optimized background area image and the first sampling result based on a preset first intensity parameter to obtain the background rendering result. This method improves rendering quality by performing artistic configuration adjustments on the blurred image and then performing interpolation optimization based on the intensity parameter.
[0180] The above-described method of sampling based on the screen resolution and a preset second style map to obtain a second sampling result includes: determining a second scaling factor for UV coordinates based on the screen resolution; and sampling the preset second style map based on the second scaling factor to obtain the second sampling result. This method introduces a second scaling factor, samples the second style map based on the second scaling factor, and performs adaptive sampling based on the screen resolution, thereby improving sampling quality and reducing computing resource consumption.
[0181] The above rendering method based on the object region image and the second sampling result to obtain the object rendering result includes: optimizing the parameters of the object region image to obtain an optimized object region image, including parameters such as color, contrast, and saturation; and interpolating the optimized object region image and the second sampling result based on a preset second intensity parameter to obtain the object rendering result. This method improves rendering quality by performing artistic configuration adjustments on the blurred image and then combining interpolation optimization with the intensity parameter.
[0182] Before obtaining the blurred image of the introduction interface, the process also includes obtaining an initial style map, which is an image with the game's brushstroke style. This method improves the compatibility of the initial style map with the game's style by obtaining the initial style map to be migrated.
[0183] The above-mentioned method for obtaining the initial style map includes: drawing an original image with directional brushstrokes; grayscale processing the original image and adjusting the value range to obtain a grayscale image; extracting a predetermined area from the grayscale image as a first drawing style; repeatedly tiling the grayscale image and filling the intersections of the tiles with the first drawing style to obtain the initial style map. This method refines the specific process of generating the initial style map, provides a specific implementation method, and increases feasibility.
[0184] After obtaining the initial style map and before obtaining the blurred image of the introduction interface, the method further includes rotating the initial style map by a preset angle to obtain a first style map. This method provides a method for adjusting the style map, making the sampled first style map more responsive to human visual preferences and improving the quality of the stylized map to be transferred. This method also refines the specific process of generating the initial style map, provides a specific implementation method, and increases feasibility.
[0185] After rotating the initial style map by a preset angle to obtain a first style map, and before obtaining a blurred image of the introduction interface, the method further includes grayscale conversion and mapping the first style map to obtain a second style map. This method provides a grayscale conversion and mapping method that enhances the stylistic difference between the second style map and the first style map.
[0186] The aforementioned method of obtaining a blurred image of the introduction interface, comprising an object region image and a background region image, wherein the object region image is used to indicate the introduced object in the introduction interface, includes: obtaining an initial image of the introduction interface, wherein the initial image includes the introduced object; blurring the initial image to obtain a blurred image of the introduction interface; and dividing the blurred image into regions to obtain an object region image and a background region image. This method refines the blurred image acquisition process and provides a specific implementation method.
[0187] The aforementioned blurring of the initial image to produce the blurred image of the introduction interface includes: determining the four neighboring pixels corresponding to each pixel in the initial image based on a preset blur strength parameter; calculating the average of the four neighboring pixels corresponding to each pixel; and using the average as the updated pixel value to produce the blurred image of the introduction interface. This method provides a specific blurring process that reduces the image's realism and clarity while enhancing the image's comic book-style effect.
[0188] The aforementioned segmentation of the blurred image to obtain the object region image and the background region image includes: marking the introduced object in the initial image and drawing a template image of the introduced object; determining the area in the blurred image corresponding to the template image as the object region image, and determining the remaining area in the blurred image as the background region image. This segmentation of the blurred image facilitates subsequent rendering of the object region image and the background region image in different styles, highlighting the introduced object and enhancing the introduction effect.
[0189] After the background rendering result and the object rendering result are merged to obtain a stylized image, the method further includes: adding a corresponding user interface UI on the stylized image, or adding a corresponding user interface UI and UI motion effects on the stylized image.
[0190] The present invention further provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the steps of the image stylization method, which specifically include:
[0191] Obtain a blurred image of the introduction interface, the blurred image including an object area image and a background area image, the object area image being used to indicate the introduced object in the introduction interface; perform mixed sampling based on a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result; render based on the background area image and the first sampling result to obtain a background rendering result; perform sampling based on the screen resolution and a preset second style map to obtain a second sampling result; render based on the object area image and the second sampling result to obtain an object rendering result; and merge the background rendering result and the object rendering result to obtain a stylized image. The introduction interface is divided into an object area and a background area, and the background area is sampled using a mixed sampling of two styles. The object area containing the introduced object is sampled using a single style, and rendered separately based on the different sampling results corresponding to the object area and background area, thereby improving the style fit between the introduced object and the game, thereby improving the fit between the introduction interface and the game.
[0192] The above-mentioned mixed sampling based on the preset screen resolution, the preset initial style map, and the preset first style map to obtain the first sampling result includes: determining a first scaling factor for the UV coordinates based on the preset screen resolution; sampling the preset initial style map and the preset first style map based on the first scaling factor to obtain a first intermediate sampling result and a second intermediate sampling result; and performing weighted optimization on the first intermediate sampling result and the second intermediate sampling result to obtain the first sampling result. This method completes the mixed sampling by determining the first scaling factor, performing mixed sampling based on the first scaling factor, and then weighting the two obtained intermediate sampling results. The style of the mixed sampling result is adjusted by setting different weights.
[0193] The weighted optimization of the first and second intermediate sampling results to obtain the first sampling result includes: performing a weighted average of the first and second intermediate sampling results to obtain an average sampling result; and optimizing the average sampling result based on preset color parameters to obtain the first sampling result. This method introduces color parameters to adjust the color of the sampling result, thereby improving sampling quality.
[0194] The rendering process based on the background area image and the first sampling result to obtain the background rendering result includes: optimizing parameters of the background area image to obtain an optimized background area image, including parameters such as color, contrast, and saturation; and interpolating the optimized background area image and the first sampling result based on a preset first intensity parameter to obtain the background rendering result. This method improves rendering quality by performing artistic configuration adjustments on the blurred image and then performing interpolation optimization based on the intensity parameter.
[0195] The above-described method of sampling based on the screen resolution and a preset second style map to obtain a second sampling result includes: determining a second scaling factor for UV coordinates based on the screen resolution; and sampling the preset second style map based on the second scaling factor to obtain the second sampling result. This method introduces a second scaling factor, samples the second style map based on the second scaling factor, and performs adaptive sampling based on the screen resolution, thereby improving sampling quality and reducing computing resource consumption.
[0196] The above rendering method based on the object region image and the second sampling result to obtain the object rendering result includes: optimizing the parameters of the object region image to obtain an optimized object region image, including parameters such as color, contrast, and saturation; and interpolating the optimized object region image and the second sampling result based on a preset second intensity parameter to obtain the object rendering result. This method improves rendering quality by performing artistic configuration adjustments on the blurred image and then combining interpolation optimization with the intensity parameter.
[0197] Before obtaining the blurred image of the introduction interface, the process also includes obtaining an initial style map, which is an image with the game's brushstroke style. This method improves the compatibility of the initial style map with the game's style by obtaining the initial style map to be migrated.
[0198] The above-mentioned method for obtaining the initial style map includes: drawing an original image with directional brushstrokes; grayscale processing the original image and adjusting the value range to obtain a grayscale image; extracting a predetermined area from the grayscale image as a first drawing style; repeatedly tiling the grayscale image and filling the intersections of the tiles with the first drawing style to obtain the initial style map. This method refines the specific process of generating the initial style map, provides a specific implementation method, and increases feasibility.
[0199] After obtaining the initial style map and before obtaining the blurred image of the introduction interface, the method further includes rotating the initial style map by a preset angle to obtain a first style map. This method provides a method for adjusting the style map, making the sampled first style map more responsive to human visual preferences and improving the quality of the stylized map to be transferred. This method also refines the specific process of generating the initial style map, provides a specific implementation method, and increases feasibility.
[0200] After rotating the initial style map by a preset angle to obtain a first style map, and before obtaining a blurred image of the introduction interface, the method further includes grayscale conversion and mapping the first style map to obtain a second style map. This method provides a grayscale conversion and mapping method that enhances the stylistic difference between the second style map and the first style map.
[0201] The aforementioned method of obtaining a blurred image of the introduction interface, comprising an object region image and a background region image, wherein the object region image is used to indicate the introduced object in the introduction interface, includes: obtaining an initial image of the introduction interface, wherein the initial image includes the introduced object; blurring the initial image to obtain a blurred image of the introduction interface; and dividing the blurred image into regions to obtain an object region image and a background region image. This method refines the blurred image acquisition process and provides a specific implementation method.
[0202] The aforementioned blurring of the initial image to produce the blurred image of the introduction interface includes: determining the four neighboring pixels corresponding to each pixel in the initial image based on a preset blur strength parameter; calculating the average of the four neighboring pixels corresponding to each pixel; and using the average as the updated pixel value to produce the blurred image of the introduction interface. This method provides a specific blurring process that reduces the image's realism and clarity while enhancing the image's comic book-style effect.
[0203] The aforementioned segmentation of the blurred image to obtain the object region image and the background region image includes: marking the introduced object in the initial image and drawing a template image of the introduced object; determining the area in the blurred image corresponding to the template image as the object region image, and determining the remaining area in the blurred image as the background region image. This segmentation of the blurred image facilitates subsequent rendering of the object region image and the background region image in different styles, highlighting the introduced object and enhancing the introduction effect.
[0204] After the background rendering result and the object rendering result are merged to obtain a stylized image, the method further includes: adding a corresponding user interface UI on the stylized image, or adding a corresponding user interface UI and UI motion effects on the stylized image.
[0205] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0206] In addition, in the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0207] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0208] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0209] Finally, it should be noted that the above embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. An image stylization method, characterized in that: include: Acquire a blurred image of the introduction interface, the blurred image including an object area image and a background area image, the object area image being used to indicate an introduced object in the introduction interface; Perform mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result; Rendering is performed according to the background area image and the first sampling result to obtain a background rendering result; Sampling is performed according to the screen resolution and a preset second style map to obtain a second sampling result; Rendering is performed according to the object area image and the second sampling result to obtain an object rendering result; The background rendering result and the object rendering result are combined to obtain a stylized image.
2. The image stylization method according to claim 1, characterized in that: The performing mixed sampling according to the preset screen resolution, the preset initial style map, and the preset first style map to obtain a first sampling result includes: Determining a first scaling factor of the UV coordinates according to the preset screen resolution; Sampling the preset initial style map and the preset first style map respectively according to the first scaling factor to obtain a first intermediate sampling result and a second intermediate sampling result; Weighted optimization is performed on the first intermediate sampling result and the second intermediate sampling result to obtain a first sampling result.
3. The image stylization method according to claim 2, characterized in that: The performing weighted optimization on the first intermediate sampling result and the second intermediate sampling result to obtain the first sampling result includes: Performing a weighted average on the first intermediate sampling result and the second intermediate sampling result to obtain an average sampling result; The average sampling result is optimized according to preset color parameters to obtain a first sampling result.
4. The image stylization method according to claim 1, wherein: The rendering according to the background area image and the first sampling result to obtain a background rendering result includes: Optimizing parameters of the background region image to obtain an optimized background region image, wherein the parameters include color, contrast, and saturation; The optimized background area image and the first sampling result are interpolated based on a preset first intensity parameter to obtain a background rendering result.
5. The image stylization method according to claim 1, characterized in that: The sampling according to the screen resolution and the preset second style map to obtain a second sampling result includes: Determining a second scaling factor for the UV coordinates according to the screen resolution; The preset second style map is sampled according to the second zoom factor to obtain a second sampling result.
6. The image stylization method according to claim 1, characterized in that: The rendering according to the object area image and the second sampling result to obtain an object rendering result includes: Optimizing parameters of the object region image to obtain an optimized object region image, wherein the parameters include color, contrast, and saturation; The optimized object area image and the second sampling result are interpolated based on a preset second intensity parameter to obtain an object rendering result.
7. The image stylization method according to claim 1, characterized in that: Before obtaining the blurred image of the introduction interface, the method further includes: An initial style map is obtained, where the initial style map is an image with a game brushstroke style.
8. The image stylization method according to claim 7, characterized in that: The obtaining of the initial style map includes: Draw the original image with directional brushstrokes; Performing grayscale processing on the original image and adjusting the value range to obtain a grayscale image; Absorbing a preset area in the grayscale image as a first drawing style; The grayscale image is repeatedly tiled, and the first drawing style is used to fill in the tiled joints to obtain an initial style map.
9. The image stylization method according to claim 7, characterized in that: After obtaining the initial style map and before obtaining the blurred image of the introduction interface, the method further includes: The initial style map is rotated according to a preset angle to obtain a first style map.
10. The image stylization method according to claim 9, characterized in that: After rotating the initial style map according to a preset angle to obtain the first style map, and before obtaining the blurred image of the introduction interface, the method further includes: Grayscale conversion and mapping are performed on the first style map to obtain a second style map.
11. The image stylization method according to claim 1, characterized in that: The acquiring of a blurred image of the introduction interface, wherein the blurred image includes an object area image and a background area image, and the object area image is used to indicate an introduced object in the introduction interface, includes: Acquire an initial image of the introduction interface, wherein the initial image includes the introduced object; Performing blur processing on the initial image to obtain a blurred image of the introduction interface; The blurred image is divided into regions to obtain an object region image and a background region image.
12. The image stylization method according to claim 11, characterized in that: The blurring of the initial image to obtain a blurred image of the introduction interface includes: Determining four neighboring pixels corresponding to each pixel in the initial image according to a preset blur strength parameter; The pixel average of the four neighboring pixels corresponding to each pixel is calculated, and the pixel average corresponding to each pixel is used as the updated pixel value to obtain a blurred image of the introduction interface.
13. The image stylization method according to claim 11, characterized in that: The step of dividing the blurred image into regions to obtain an object region image and a background region image includes: Marking the introduced object in the initial image and drawing a template image of the introduced object; An area corresponding to the template image in the blurred image is determined as an object area image, and a remaining area in the blurred image is determined as a background area image.
14. The image stylization method according to any one of claims 1 to 13, characterized in that: After merging the background rendering result and the object rendering result to obtain a stylized image, the method further includes: Adding a corresponding user interface UI to the stylized image, or adding a corresponding user interface UI and UI motion effects to the stylized image.
15. An image stylization device, characterized in that: include: an acquisition module, configured to acquire a blurred image of the introduction interface, the blurred image comprising an object region image and a background region image, the object region image being used to indicate an introduced object in the introduction interface; A first sampling module is configured to perform mixed sampling according to a preset screen resolution, a preset initial style map, and a preset first style map to obtain a first sampling result; A first rendering module, configured to perform rendering according to the background area image and the first sampling result to obtain a background rendering result; A second sampling module, configured to perform sampling according to the screen resolution and a preset second style map to obtain a second sampling result; A second rendering module, configured to perform rendering according to the object area image and the second sampling result to obtain an object rendering result; A merging module is used to merge the background rendering result and the object rendering result to obtain a stylized image.
16. An electronic device, characterized in that: The electronic device includes: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory to enable the electronic device to execute the image stylization method according to any one of claims 1 to 14.
17. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the image stylization method according to any one of claims 1 to 14 is implemented.
Citation Information
Patent Citations
Image processing method and device, interactive display device and electronic equipment
CN111986076A
Image processing method and device and storage medium
CN112402958A