Image processing method and device, storage medium and equipment

By introducing auxiliary texture recording preset transparent values, the problem of inefficient drawing of gradient color effect images in video synthesis is solved, and more efficient drawing of gradient color effect images is achieved, suitable for scenes such as game development, virtual reality and real-time special effects rendering.

CN120339447APending Publication Date: 2025-07-18BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410064639.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-16
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The prior art has low efficiency in drawing gradient color effect images in video synthesis, resulting in low processing efficiency.

Method used

Introduce auxiliary texture to record preset transparency values in the color gradient direction, and quickly position the direction and transparency values of the color gradient through auxiliary texture to accurately control the transparency of each pixel and improve drawing efficiency.

Benefits of technology

By assisting the use of textures, the drawing efficiency of gradient color effect images is significantly improved, and the difficulty and cost of technical implementation is reduced. It is suitable for various scenes that require simulating color gradients.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339447A_ABST
    Figure CN120339447A_ABST
Patent Text Reader

Abstract

The invention discloses an image processing method and apparatus, a storage medium and a device. The method comprises the steps of obtaining a to-be-processed image; acquiring an auxiliary texture, wherein the auxiliary texture is used for recording a preset transparency value in a color gradient direction; and drawing a gradient color effect image corresponding to the to-be-processed image based on the auxiliary texture. According to the method, the to-be-processed image and the auxiliary texture are acquired, and when the image with the gradient color effect is drawn, the color gradient direction and the transparency value can be quickly positioned by utilizing the auxiliary texture, so that the drawing efficiency is greatly improved, and the preset transparency value in the color gradient direction is recorded in the auxiliary texture; therefore, the transparency of each pixel can be accurately controlled in the drawing process, the gradient color effect image corresponding to the to-be-processed image is drawn based on the auxiliary texture, and the drawing efficiency of the gradient color effect image can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the field of video synthesis, the drawing of the edge gradient area is a key technology. However, the current technology has the problem of low drawing efficiency in practical applications. Summary of the Invention

[0003] Embodiments of this application provide an image processing method, apparatus, storage medium, and device, which can effectively improve the drawing efficiency of an image with a gradient color effect.

[0004] On the one hand, embodiments of this application provide an image processing method, and the method includes:

[0005] Obtain an image to be processed;

[0006] Obtain an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in the color gradient direction;

[0007] Based on the auxiliary texture, draw a gradient color effect image corresponding to the image to be processed.

[0008] On the other hand, embodiments of this application provide an image processing apparatus, and the apparatus includes:

[0009] A first obtaining unit, configured to obtain an image to be processed;

[0010] A second obtaining unit, configured to obtain an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in the color gradient direction;

[0011] A drawing unit, configured to draw a gradient color effect image corresponding to the image to be processed based on the auxiliary texture.

[0012] On the other hand, embodiments of this application provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the image processing method described in any of the foregoing embodiments.

[0013] On the other hand, embodiments of this application provide a computer device, and the computer device includes a processor and a memory. A computer program is stored in the memory, and the processor is configured to execute the image processing method described in any of the foregoing embodiments by invoking the computer program stored in the memory.

[0014] In the embodiments of the present application, a to-be-processed image is obtained; an auxiliary texture is obtained, and the auxiliary texture is used to record a preset transparency value in the color gradient direction; based on the auxiliary texture, a gradient color effect image corresponding to the to-be-processed image is drawn. In the embodiments of the present application, by obtaining the to-be-processed image and the auxiliary texture, when drawing the gradient color effect image, the direction and transparency value of the color gradient can be quickly located by using the auxiliary texture, thereby greatly improving the drawing efficiency. The auxiliary texture records the preset transparency value in the color gradient direction, which enables precise control of the transparency of each pixel during the drawing process. Based on the auxiliary texture, drawing the gradient color effect image corresponding to the to-be-processed image can effectively improve the drawing efficiency of the gradient color effect image and reduce the difficulty and cost of technical implementation. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0016] Figure 1 It is a schematic flowchart of the image processing method provided by the embodiments of the present application.

[0017] Figure 2 It is a schematic diagram of the first application scenario of the image processing method provided by the embodiments of the present application.

[0018] Figure 3 It is a schematic diagram of the second application scenario of the image processing method provided by the embodiments of the present application.

[0019] Figure 4 It is a schematic structural diagram of the image processing device provided by the embodiments of the present application.

[0020] Figure 5 It is a schematic structural diagram of the computer device provided by the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.

[0022] The embodiments of the present application provide an image processing method, apparatus, storage medium, and device. Specifically, the image processing method of the embodiments of the present application can be executed by a terminal device or a server. Among them, the computer device can be a terminal device or a server. The terminal device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, a smart speaker, a wearable smart device, a smart vehicle terminal, etc. The terminal device can also include a client, and the client can be a client of an application program capable of performing image processing. For example, the client includes at least one of a program client and a web client. For example, the application program can be a social application program, a video playback application program, an audio playback application program, etc. The server can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.

[0023] First, some nouns or terms that appear in the process of describing the embodiments of the present application are explained as follows:

[0024] A bitmap is a data structure used to represent and process binary images or graphics. Its function is to represent and store the pixel information of an image or graphic in a limited space. Each pixel is represented by one bit or several bits to represent its color or other attributes. A bitmap is composed of individual points called pixels (picture elements). These points can be arranged and colored differently to form patterns. When a bitmap is enlarged, countless individual squares that make up the entire image can be seen.

[0025] The alpha value generally refers to opacity. The alpha value is a parameter used to represent transparency or opacity, and its range is usually between 0 and 1. Among them, 0 means completely transparent, and 1 means completely opaque. In graphics and image processing, the alpha value is used to control the transparency of pixels or graphics, so as to achieve semi-transparent effects or overlay effects, etc.

[0026] For example, there are mainly two current drawing schemes for the edge gradient effect:

[0027] 1. The entire lyrics area uses a single bitmap, and a gradient mask with a clear blend mode is drawn in the bottom area using a paintbrush. However, this solution requires the Central Processing Unit (CPU) to pre-mix the lyrics text with the gradient mask to generate the entire bitmap, resulting in low efficiency.

[0028] 2. In the drawn fragment shader, the position of the vertex is judged in real time, and the alpha value of the position of the vertex is multiplied by a value. However, this solution requires judgment operations in the fragment shader, and the GPU has relatively low processing efficiency for judgment logic.

[0029] Therefore, in order to solve the problem of low drawing efficiency of the gradient color effect image in video synthesis, the embodiments of the present application can provide an image processing method to improve the drawing efficiency by introducing an auxiliary texture that additionally records the alpha channel.

[0030] The following will be described in detail respectively. It should be noted that the description order of the following embodiments does not limit the priority order of the embodiments.

[0031] Please refer to Figures 1 to 3 , Figure 1 which is a schematic flowchart of the image processing method provided by the embodiments of the present application, Figures 2 to 3 and

[0032] are all schematic diagrams of the application scenarios of the image processing method provided by the embodiments of the present application. The method includes the following steps 110 to step 130:

[0033] Step 110, obtain the image to be processed.

[0034] For example, the image to be processed can be obtained in various ways, such as extracting image frames from a video file. These video files can be music videos, movies, TV shows, or other types of video content. By extracting the image frames in the video, the image to be processed can be obtained, and the image to be processed can be further processed to achieve the desired visual effect.

[0035] ​Step 120, obtain an auxiliary texture, which is used to record a preset transparency value in the color gradient direction.

[0036] Among them, the auxiliary texture is a pre-processed image data, which contains transparency information in the color gradient direction. These transparency information are recorded in units of pixels, and each pixel contains transparency values of one or more channels. By using these transparency values, the effect of color gradient can be more precisely controlled during the drawing process.

[0037] Among them, the transparency value can be represented by an alpha value. The alpha value is a parameter used to represent transparency or opacity, and its range is usually between 0 and 1. Among them, 0 means completely transparent, and 1 means completely opaque. Values between 0 and 1 represent different degrees of semi-transparent effects.

[0038] For example, create an auxiliary texture in an image processing software or a dedicated graphics editing tool. The process of creating the auxiliary texture can perform a series of pre-processing operations on the original image, such as color space conversion, image scaling, noise removal, etc., to ensure the quality and accuracy of the auxiliary texture.

[0039] Among them, once the auxiliary texture is created and stored, it can be reused in subsequent image processing. The advantage of this is to avoid recalculating the transparency value every time the gradient effect is drawn, thus greatly improving the efficiency of image processing. In addition, since the auxiliary texture is independent of the image to be processed, the same gradient effect can be easily applied to different images without regenerating the auxiliary texture.

[0040] By obtaining the auxiliary texture and using it in the drawing process, the embodiments of the present application can more efficiently achieve the gradient color effect, while providing higher flexibility and reusability. This technology has important practical significance for applications that require fast rendering of high-quality images, such as game development, virtual reality, and real-time special effect rendering.

[0041] In some embodiments, the method further includes:

[0042] Based on the color gradient direction, determine the base region and the gradient region in the image to be processed.

[0043] Among them, determining the base region and the gradient region in the image to be processed based on the color gradient direction is to more precisely control the color gradient effect and apply different transparency settings to different regions of the image.

[0044] The base region generally refers to the region in the image where the color remains stable and there is no obvious change (for example, no change or the degree of change is less than a preset threshold). These base regions should maintain their original color and transparency in the final gradient effect image. The gradient region refers to the region in the image where the color changes significantly. These gradient regions will apply a transparency gradient effect to simulate the color transition in nature or create a specific artificial visual effect.

[0045] In actual operation, determining the base region and the gradient region can be achieved through image processing algorithms, such as edge detection, color analysis, etc. These algorithms can help identify the boundaries and trends of color changes in the image, thereby accurately dividing the base region and the gradient region.

[0046] In some embodiments, obtaining the auxiliary texture includes:

[0047] In the color gradient direction, set the preset transparency value corresponding to the base region in the auxiliary texture to 1, and set the preset transparency value corresponding to the gradient region in the auxiliary texture to a value that gradually changes from 1 to 0.

[0048] Among them, after determining the base region and the gradient region, the acquisition and setting of the auxiliary texture can be carried out. Specifically, in the color gradient direction, setting the preset transparency value corresponding to the base region in the auxiliary texture to 1 means that the pixels in these base regions will remain completely opaque. At the same time, setting the preset transparency value corresponding to the gradient region in the auxiliary texture to a value that gradually changes from 1 to 0 means that the pixels in these regions will gradually change from completely opaque to completely transparent, thereby achieving a smooth color transition.

[0049] In this way, the transparency settings of different regions can be more precisely controlled when drawing the gradient color effect image, thereby achieving a more natural and realistic visual effect. This technology can be applied to various scenarios that require simulating color gradients, such as the rendering of natural landscapes, the design of user interfaces, the construction of virtual reality environments, etc.

[0050] In some embodiments, for the obtained auxiliary texture, which is used to record the preset transparency value in the color gradient direction, it includes:

[0051] When the color gradient direction is vertical, obtain a vertical auxiliary texture, which is used to record the first preset transparency value in the vertical direction.

[0052] Among them, the process of obtaining the auxiliary texture can be customized according to the direction of color gradient. Specifically, when the color gradient direction is vertical, a vertical auxiliary texture is obtained. This vertical auxiliary texture is mainly used to record the first preset transparency value in the vertical direction. The creation of the vertical auxiliary texture is usually based on the analysis of the original image to identify the area where the color gradient occurs in the vertical direction. In this process, image processing algorithms such as edge detection or color analysis may be used to identify the boundaries and change trends of the vertical gradient. Once the area of the vertical gradient is identified, the transparency value of each pixel can be calculated based on this information. These transparency values can be calculated based on a certain algorithm, such as linear interpolation or spline interpolation. The calculated transparency values will be stored in the vertical auxiliary texture for subsequent image processing and rendering. By using the vertical auxiliary texture, the effect of vertical color gradient can be more precisely controlled during the rendering process.

[0053] In some embodiments, the image to be processed includes an image with a width of W pixels and a height of H pixels;

[0054] The vertical auxiliary texture includes a texture with a width of 1 pixel and a height of H pixels.

[0055] Among them, the method of obtaining the auxiliary texture can be further customized to adapt to different color gradient directions and image sizes. Specifically, when the color gradient direction is vertical, a vertical auxiliary texture is obtained. The size of this vertical auxiliary texture is related to the size of the image to be processed.

[0056] In the embodiments of the present application, the image to be processed is an image with a width of W pixels and a height of H pixels. The width of the vertical auxiliary texture is 1 pixel, and the height is the same as the height of the image, that is, H pixels. This design is to ensure that the vertical auxiliary texture can cover the entire gradient area along the height direction of the image, and each pixel can correspond to the corresponding position in the image.

[0057] By using the vertical auxiliary texture of this size, the effect of vertical color gradient can be more precisely controlled during the rendering process. During the rendering process, the first transparency value recorded in the vertical auxiliary texture is used to simulate or create a specific visual effect.

[0058] This technique is particularly suitable for scenarios that require simulating vertical color gradients, such as simulating the color changes when sunlight rises or sets from the horizon, simulating the vertical flow of water or smoke, simulating the color changes when lyrics scroll up or down, etc. By using a vertical auxiliary texture, these complex visual effects can be achieved more efficiently, while providing higher flexibility and reusability. This technique can be applied to game development, video production, film production, virtual reality, and various graphics rendering scenarios to meet specific visual requirements and artistic styles.

[0059] In some embodiments, obtaining the auxiliary texture, where the auxiliary texture is used to record a preset transparency value in the color gradient direction, includes:

[0060] When the color gradient direction is horizontal, obtain a horizontal auxiliary texture, where the horizontal auxiliary texture is used to record a second preset transparency value in the horizontal direction.

[0061] Among them, the method of obtaining the auxiliary texture can also be customized according to the color gradient direction. When the color gradient direction is horizontal, a horizontal auxiliary texture will be obtained. This horizontal auxiliary texture is mainly used to record the second preset transparency value in the horizontal direction. The creation process of the horizontal auxiliary texture is similar to that of the vertical auxiliary texture, and it is also based on the analysis of the original image to identify the color gradient area in the horizontal direction. By using image processing algorithms, such as edge detection or color analysis, the boundaries and change trends of the horizontal gradient can be identified. Once the horizontal gradient area is identified, the transparency value of each pixel can be calculated based on this information. These transparency values will be stored in the horizontal auxiliary texture for subsequent image processing and drawing. By using the horizontal auxiliary texture, the effect of the horizontal color gradient can be more precisely controlled during the drawing process.

[0062] In some embodiments, the image to be processed includes an image with a width of W pixels and a height of H pixels;

[0063] The horizontal auxiliary texture includes a texture with a width of W pixels and a height of 1 pixel.

[0064] Among them, the image to be processed is an image with a specific size, including a width of W pixels and a height of H pixels. This size setting is to ensure that the image to be processed has sufficient details and scope for subsequent image processing and drawing operations.

[0065] Similar to the vertical auxiliary texture, the horizontal auxiliary texture is also customized according to the direction of color gradient. The width of the horizontal auxiliary texture is the same as the width of the image to be processed, that is, W pixels, while the height is only 1 pixel. This design is to ensure that the horizontal auxiliary texture can cover the entire gradient area along the width direction of the image, and each pixel can correspond to the corresponding position in the image.

[0066] By using the horizontal auxiliary texture of this size, the effect of horizontal color gradient can be more precisely controlled during the drawing process. During the drawing process, the second transparency value recorded in the horizontal auxiliary texture is used to simulate or create a specific visual effect.

[0067] This technique is particularly suitable for scenarios that require simulating horizontal color gradients, such as simulating the horizontal expansion of clouds in the sky, simulating the horizontal spread of flames, etc. By using the horizontal auxiliary texture, these complex visual effects can be achieved more efficiently, while providing higher flexibility and reusability. This technique can be applied to game development, video production, film production, virtual reality, and various graphics rendering scenarios to meet specific visual requirements and artistic styles.

[0068] Step 130, draw the gradient color effect image corresponding to the image to be processed based on the auxiliary texture.

[0069] In some embodiments, the drawing of the gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes:

[0070] Obtain the transparency value corresponding to the current pixel point according to the color value of the current pixel point in the image to be processed and the preset transparency value in the color gradient direction recorded in the auxiliary texture;

[0071] Draw the gradient color effect image corresponding to the image to be processed according to the transparency values corresponding to each pixel point in the image to be processed.

[0072] Among them, each pixel point in the image to be processed is traversed. This is a necessary step because each pixel point needs to be processed individually to achieve fine color and transparency control.

[0073] Then, for the current pixel point being processed, obtain the color value of the current pixel point. This color value usually includes three components: red, green, and blue (RGB), which jointly determine the color of the pixel point.

[0074] Then, according to the position of the current pixel point, obtain the preset transparency value corresponding to the current pixel point from the auxiliary texture. This preset transparency value is preset according to the color gradient direction and represents the transparency of the pixel point during the gradient process.

[0075] Then, based on the color value of the current pixel point in the image to be processed and the preset transparency value recorded in the auxiliary texture in the color gradient direction, the transparency value corresponding to the current pixel point is obtained. For example, multiply the color value of the current pixel point by the preset transparency value recorded in the auxiliary texture to obtain the transparency value corresponding to the current pixel point. This multiplication operation will adjust the color intensity of the current pixel point to vary according to the preset transparency value. In this way, in the color gradient area, the color of the pixel points will gradually become transparent, thus achieving the gradient effect.

[0076] Then, use the calculated transparency value and the original color value to draw the current pixel point. This process may involve operations such as color blending to ensure that the drawn pixel points blend harmoniously with the surrounding pixel points. Repeat the above steps for all pixel points in the image to be processed until all pixel points have been traversed and processed.

[0077] This color process can also blend the colors of adjacent pixel points to different extents according to the size of the transparency value to achieve a smooth transition of colors. Common color blending algorithms include linear interpolation, bilinear interpolation, etc., and appropriate algorithms can be selected according to specific requirements. Through these algorithms, the direction, speed, and range of color gradients can be precisely controlled, thus creating a realistic visual effect.

[0078] Then, by processing all pixel points and adjusting the colors and transparencies of all pixel points, an image with a gradient color effect is finally generated. This gradient color effect image will present a smooth transition of colors in the color gradient direction.

[0079] This method can precisely control the color and transparency of each pixel point in the image, thus achieving a high-quality gradient color effect.

[0080] In some embodiments, drawing the gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes:

[0081] Multiply the color value of the current pixel point in the image to be processed by the first preset transparency value in the longitudinal direction recorded in the longitudinal auxiliary texture to obtain the first gradient color value corresponding to the current pixel point;

[0082] According to the first gradient color values corresponding to each pixel point in the image to be processed, draw the longitudinal gradient color effect image corresponding to the image to be processed.

[0083] Among them, for each pixel point in the image to be processed, first read its color value. These color values represent the original color information of the image. Then, obtain the first preset transparency value corresponding to the current pixel point from the longitudinal auxiliary texture. This first preset transparency value is preset in the longitudinal direction and is used to control the gradient effect of the color in this direction. Then, multiply the color value of the current pixel point by the first preset transparency value in the longitudinal auxiliary texture to obtain the first gradient color value corresponding to this pixel point. The purpose of this step is to combine the color with the transparency to provide a basis for subsequent color mixing.

[0084] Then, according to the first gradient color value corresponding to each pixel point, perform color mixing on all pixel points in the image to be processed. This process can mix the colors of adjacent pixels to different degrees according to the size of the transparency value to achieve the longitudinal gradient effect of the color. Commonly used color mixing algorithms include linear interpolation, bilinear interpolation, etc., and appropriate algorithms can be selected according to specific requirements. Through these algorithms, the longitudinal gradient effect of the color can be precisely controlled, such as the gradient direction, speed, and range. During the drawing process, other image processing techniques, such as anti-aliasing processing and detail enhancement, can also be combined to improve the clarity and texture of the image.

[0085] Finally, output the image with the longitudinal gradient color effect after drawing to a display device or save it to a file. The output image can be used in various application scenarios, such as game development, film production, digital media, etc.

[0086] If real-time rendering is required, the drawing process can also be embedded in a graphics rendering engine to improve the speed and efficiency of image rendering.

[0087] Through the above steps, a realistic longitudinal gradient color effect image can be drawn based on the longitudinal auxiliary texture.

[0088] Such as Figure 2As shown, the width of the image 20 to be processed is W pixels and the height is H pixels. Among them, the image 20 to be processed includes a base region 21 and a gradient region 22. For example, the height of the base region can be H1, and the height of the bottom gradient region can be H2. In the gradient region 22, it is necessary to draw a color gradient effect with the alpha value ranging from 1 to 0. For example, the texture to be drawn of the image to be processed is defined as texture1. For example, a longitudinal auxiliary texture with a width of 1 pixel and a height of H pixels is pre-generated. For example, the longitudinal auxiliary texture is defined as texture0, which is used to store the alpha value (the first preset transparency value) of the longitudinal gradient. When drawing the current pixel texutrue1[x,y], the color value of the current pixel can be multiplied by the alpha value (the first preset transparency value) recorded at the position of texture0[1,y] to obtain the gradient color alpha value (the first gradient color value) of the current pixel. That is, the finally drawn color value of the pixel at the [x,y] position is: color’[x,y]=color[x,y]*alpha[1,y].

[0089] In some embodiments, drawing the gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes:

[0090] Multiplying the color value of the current pixel in the image to be processed by the second preset transparency value in the horizontal direction recorded in the horizontal auxiliary texture to obtain the second gradient color value corresponding to the current pixel;

[0091] Drawing the horizontal gradient color effect image corresponding to the image to be processed according to the second gradient color values corresponding to the respective pixels in the image to be processed.

[0092] Among them, for each pixel in the image to be processed, its original color value is first read. These color values reflect the initial color state of the image. At the same time, the second preset transparency value corresponding to the current pixel is retrieved from the horizontal auxiliary texture. These second preset transparency values are preset in the horizontal direction and are used to regulate the horizontal gradient of the color. Then, the color value of the current pixel is multiplied by the second preset transparency value obtained from the horizontal auxiliary texture to obtain the second gradient color value corresponding to the current pixel. This multiplication operation is to combine the original color with the horizontal transparency information. The obtained second gradient color value corresponding to the current pixel represents the transparency degree of the current pixel in the horizontal gradient process.

[0093] Then, using the calculated second gradient color values of each pixel, color mixing is performed on all pixels in the image to be processed. This process takes into account the color information of adjacent pixels and realizes smooth color transition in the horizontal direction according to the second gradient color values.

[0094] Finally, the horizontally gradient color effect image that has been drawn is output to a display device or saved to a file. The output image can be used in various applications, such as games, movies, digital art, etc.

[0095] If real-time rendering is required, the entire processing flow can be integrated into a graphics rendering engine to achieve efficient and real-time image rendering.

[0096] For example, the embodiments of the present application not only support vertical gradients, but also support horizontal gradients. A horizontal auxiliary texture with a width of W pixels and a height of 1 pixel can be introduced to record the horizontal gradient alpha information.

[0097] As Figure 3 shown, the width of the image 30 to be processed is W pixels and the height is H pixels. Among them, the image 30 to be processed includes a base area 31 and a gradient area 32. In the gradient area 32, a color gradient effect with an alpha value ranging from 1 to 0 needs to be drawn. For example, the texture to be drawn of the image 30 to be processed is defined as texture1. For example, a horizontal auxiliary texture with a width of W pixels and a height of 1 pixel is pre-generated. For example, the horizontal auxiliary texture is defined as texture0 to store the alpha value (the second preset transparency value) of the horizontal gradient. When drawing the current pixel point Texutrue1[x,y], the color value of the current pixel point can be multiplied by the alpha value (the second preset transparency value) recorded at the position of texture0[x,1] to obtain the gradient color alpha value (the second gradient color value) of the current pixel point. That is, the finally drawn color value of the pixel point at the [x,y] position is: color’[x,y] = color[x,y] * alpha[x,1].

[0098] The embodiments of the present application introduce a vertical auxiliary texture with a width of 1 pixel and a height of H pixels, or introduce a horizontal auxiliary texture with a height of 1 pixel and a width of W pixels, and record the apha gradient information through the auxiliary texture (horizontal auxiliary texture or vertical auxiliary texture) to efficiently achieve the edge gradient effect of the image to be processed.

[0099] Through the above steps, an image with a horizontal gradient effect can be accurately drawn based on the horizontal auxiliary texture.

[0100] For example, during the process of drawing the gradient color effect image, other image processing techniques can also be applied according to needs to enhance the visual quality of the image, such as anti-aliasing processing, detail enhancement, sharpening processing, contrast adjustment, etc., to improve the clarity and texture of the gradient color effect image.

[0101] Among them, anti-aliasing is mainly used to smooth the edges of images and reduce or eliminate the jagged effect. In gradient color effect images, undesirable edges may destroy the overall visual effect. Therefore, after the gradient color effect image is anti-aliased, the edge of the image will appear smoother, the color transition will be more natural, and there will be no obvious color blocks or step-like effects.

[0102] Among them, detail enhancement technology can identify and enhance tiny details in an image, such as texture or color changes. When processing gradient color effect images, this technology can highlight the gradient layering. After the gradient color effect image is processed by detail enhancement, the color or texture changes in the image will be more obvious, making the entire gradient effect more vivid and three-dimensional.

[0103] Among them, sharpening mainly improves the clarity of the image by strengthening the edges and details in the image. In the gradient effect image, sharpening can enhance the area where the color or brightness changes. After the gradient color effect image is sharpened, the edges and details in the image will be more prominent, making the entire gradient effect more vivid and clear.

[0104] Among them, contrast adjustment mainly changes the overall effect of the image by adjusting the relationship between different color or brightness areas in the image. When processing gradient color effect images, you can adjust the contrast to better show the color changes. After adjusting the contrast of the gradient color effect image, the color changes can be more obvious and the visual impact of the gradient effect can be enhanced. At the same time, the details of the image can also be more prominent.

[0105] For example, you can also adjust the color balance of a gradient color effect image to change the relationship between colors, make the gradient effect more harmonious, or emphasize a certain hue.

[0106] For example, you can also use various filters to add special effects to the gradient color effect image, such as blurring, sharpening, distortion or glowing, to enhance the expression of the gradient.

[0107] For example, you can also create gradients of different shapes, such as radial gradients and angle gradients, and even adjust the size of the gradient to suit different needs.

[0108] All of the above technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described in detail here.

[0109] In the embodiments of the present application, a to-be-processed image is obtained; an auxiliary texture is obtained, and the auxiliary texture is used to record a preset transparency value in the color gradient direction; based on the auxiliary texture, a gradient color effect image corresponding to the to-be-processed image is drawn. In the embodiments of the present application, by obtaining the to-be-processed image and the auxiliary texture, when drawing the gradient color effect image, the direction and transparency value of the color gradient can be quickly located by using the auxiliary texture, thereby greatly improving the drawing efficiency. The auxiliary texture records the preset transparency value in the color gradient direction, which enables precise control of the transparency of each pixel during the drawing process. Based on the auxiliary texture, drawing the gradient color effect image corresponding to the to-be-processed image can effectively improve the drawing efficiency of the gradient color effect image and reduce the difficulty and cost of technical implementation.

[0110] To better implement the image processing method in the embodiments of the present application, an image processing device is further provided in the embodiments of the present application. Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of the image processing device provided in the embodiments of the present application. Among them, the image processing device 200 may include:

[0111] A first acquisition unit 210, configured to acquire a to-be-processed image;

[0112] A second acquisition unit 220, configured to acquire an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in the color gradient direction;

[0113] A drawing unit 230, configured to draw a gradient color effect image corresponding to the to-be-processed image based on the auxiliary texture.

[0114] In some embodiments, the drawing unit 230 may be configured to:

[0115] Obtain the transparency value corresponding to the current pixel point according to the color value of the current pixel point in the to-be-processed image and the preset transparency value recorded in the auxiliary texture in the color gradient direction;

[0116] Draw a gradient color effect image corresponding to the to-be-processed image according to the transparency values corresponding to the respective pixel points in the to-be-processed image.

[0117] In some embodiments, the second acquisition unit 220 may be configured to: when the color gradient direction is vertical, acquire a vertical auxiliary texture, and the vertical auxiliary texture is used to record a first preset transparency value in the vertical direction.

[0118] In some embodiments, the to-be-processed image includes an image with W pixel points in width and H pixel points in height; the vertical auxiliary texture includes a texture with 1 pixel point in width and H pixel points in height.

[0119] In some embodiments, the drawing unit 230 can be configured to: multiply the color value of the current pixel point in the to-be-processed image by the first preset transparency value in the longitudinal direction recorded in the longitudinal auxiliary texture to obtain a first gradient color value corresponding to the current pixel point; draw a longitudinal gradient color effect image corresponding to the to-be-processed image according to the first gradient color values corresponding to the respective pixel points in the to-be-processed image.

[0120] In some embodiments, the second obtaining unit 220 can be configured to: when the color gradient direction is horizontal, obtain a horizontal auxiliary texture, where the horizontal auxiliary texture is used to record a second preset transparency value in the horizontal direction.

[0121] In some embodiments, the to-be-processed image includes an image with W pixel points in width and H pixel points in height; the horizontal auxiliary texture includes a texture with W pixel points in width and 1 pixel point in height.

[0122] In some embodiments, the drawing unit 230 can be configured to: multiply the color value of the current pixel point in the to-be-processed image by the second preset transparency value in the horizontal direction recorded in the horizontal auxiliary texture to obtain a second gradient color value corresponding to the current pixel point; draw a horizontal gradient color effect image corresponding to the to-be-processed image according to the second gradient color values corresponding to the respective pixel points in the to-be-processed image.

[0123] In some embodiments, the second obtaining unit 220 can further be configured to: determine a base region and a gradient region in the to-be-processed image based on the color gradient direction.

[0124] In some embodiments, the second obtaining unit 220 can be configured to: in the color gradient direction, set the preset transparency value corresponding to the base region in the auxiliary texture to 1, and set the preset transparency value corresponding to the gradient region in the auxiliary texture to a value that gradually changes from 1 to 0.

[0125] The image processing device 200 can be integrated in a terminal device or a server that has a storage and is installed with a processor and has computing capabilities, or the image processing device 200 is the terminal device or the server.

[0126] In some embodiments, the present application further provides a computer device, including a memory and a processor, where a computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0127] In some embodiments, as Figure 5 shown Figure 5Another schematic structural diagram of the computer device provided by the embodiment of the present application. The computer device 300 further includes a processor 301 having one or more processing cores, a memory 302 having one or more computer-readable storage media, and a computer program stored on the memory 302 and executable on the processor. Among them, the processor 301 is electrically connected to the memory 302. Those skilled in the art can understand that the structural diagram of the computer device shown in the figure does not constitute a limitation on the computer device, and it may include more or fewer components than those shown, or combine certain components, or have different component arrangements.

[0128] The processor 301 is the control center of the computer device 300, connecting various parts of the entire computer device 300 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, it executes various functions of the computer device 300 and processes data.

[0129] Optionally, the computer device 300 may be a terminal device, and the processor 301 may call software programs and modules stored in the memory 302 to perform the following operations:

[0130] Obtain the image to be processed; obtain the auxiliary texture, where the auxiliary texture is used to record the preset transparency value in the color gradient direction; based on the auxiliary texture, draw the gradient color effect image corresponding to the image to be processed.

[0131] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, and details will not be elaborated here.

[0132] In some embodiments, as Figure 5 shown, the computer device 300 further includes: a touch display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. Among them, the processor 301 is electrically connected to the touch display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307 respectively. Those skilled in the art can understand that Figure 5 the structural diagram of the computer device shown in the figure does not constitute a limitation on the computer device, and it may include more or fewer components than those shown, or combine certain components, or have different component arrangements.

[0133] The touch display screen 303 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface.

[0134] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with a network device or other computer devices through wireless communication, and transmit and receive signals with the network device or other computer devices.

[0135] The audio circuit 305 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 305 can transmit the electrical signal converted from the received audio data to the speaker, which converts it into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 305 and then converted into audio data. After the audio data is output to the processor 301 for processing, it is sent through the radio frequency circuit 304 to, for example, another computer device, or the audio data is output to the memory for further processing. The audio circuit 305 may also include an earphone jack to provide communication between the peripheral earphone and the computer device.

[0136] The input unit 306 can be used to receive input digital, character information or object feature information (such as fingerprint, iris, face information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0137] The power supply 307 is used to supply power to each component of the computer device 300.

[0138] Although Figure 5 not shown in the figure, the computer device 300 may also include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.

[0139] In some embodiments, the present application also provides a computer-readable storage medium for storing a computer program. The computer-readable storage medium can be applied to a terminal device or a server, and the computer program causes the terminal device or the server to execute the corresponding process in the image processing method of the embodiments of the present application. For the sake of brevity, it will not be elaborated here.

[0140] In some embodiments, the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, causing the computer device to execute the corresponding process in the image processing method of the embodiments of the present application. For the sake of brevity, it will not be elaborated here.

[0141] The present application also provides a computer program, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, causing the computer device to execute the corresponding process in the image processing method of the embodiments of the present application. For the sake of brevity, it will not be elaborated here.

[0142] It should be understood that the processor in the embodiments of the present application may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiments can be completed by the integrated logic circuit in the hardware of the processor or instructions in software form. The above-mentioned processor may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method.

[0143] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchlink dynamic random access memory (SLDRAM), and direct rambus random access memory (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0144] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present application.

[0145] Those skilled in the art can 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 foregoing method embodiments, and will not be described herein again.

[0146] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0147] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0148] In addition, each functional unit in the embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0149] 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 application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer or a server) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0150] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An image processing method, characterized in that, The method includes: Obtain the image to be processed; Obtain an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in the color gradient direction; Based on the auxiliary texture, draw a gradient color effect image corresponding to the image to be processed.

2. The image processing method according to claim 1, wherein The step of drawing a gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes: Obtain the transparency value corresponding to the current pixel point according to the color value of the current pixel point in the image to be processed and the preset transparency value recorded in the auxiliary texture in the color gradient direction; Draw a gradient color effect image corresponding to the image to be processed according to the transparency values corresponding to the respective pixel points in the image to be processed.

3. The image processing method according to claim 2, wherein The step of obtaining an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in the color gradient direction, includes: When the color gradient direction is vertical, obtain a vertical auxiliary texture, where the vertical auxiliary texture is used to record a first preset transparency value in the vertical direction.

4. The image processing method according to claim 3, wherein The image to be processed includes an image with a width of W pixel points and a height of H pixel points; The vertical auxiliary texture includes a texture with a width of 1 pixel point and a height of H pixel points.

5. The image processing method according to claim 3 or 4, characterized in that, The step of drawing a gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes: Multiply the color value of the current pixel point in the image to be processed by the first preset transparency value recorded in the vertical auxiliary texture in the vertical direction to obtain a first gradient color value corresponding to the current pixel point; Draw a vertical gradient color effect image corresponding to the image to be processed according to the first gradient color values corresponding to the respective pixel points in the image to be processed.

6. The image processing method according to claim 2, wherein, The step of obtaining an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in the color gradient direction, includes: When the color gradient direction is horizontal, obtain a horizontal auxiliary texture, where the horizontal auxiliary texture is used to record a second preset transparency value in the horizontal direction.

7. The image processing method according to claim 6, wherein The image to be processed includes an image with a width of W pixel points and a height of H pixel points; The horizontal auxiliary texture includes a texture with a width of W pixel points and a height of 1 pixel point.

8. The image processing method according to claim 6 or 7, characterized in that The step of drawing a gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes: Multiply the color value of the current pixel point in the image to be processed by the second preset transparency value recorded in the horizontal auxiliary texture in the horizontal direction to obtain a second gradient color value corresponding to the current pixel point; Draw a horizontal gradient color effect image corresponding to the image to be processed according to the second gradient color values corresponding to the respective pixel points in the image to be processed.

9. The image processing method according to claim 1, wherein The method further includes: Based on the color gradient direction, determine a base region and a gradient region in the image to be processed.

10. The image processing method according to claim 9, wherein The step of obtaining the auxiliary texture includes: In the color gradient direction, set the preset transparency value corresponding to the base region in the auxiliary texture to 1, and set the preset transparency value corresponding to the gradient region in the auxiliary texture to a value that gradually changes from 1 to 0.

11. An image processing apparatus, characterized in that, The apparatus includes: A first acquisition unit for obtaining the image to be processed; A second acquisition unit, configured to acquire an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in a color gradient direction; A drawing unit, configured to draw a gradient color effect image corresponding to the image to be processed based on the auxiliary texture.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is adapted to be loaded by a processor to execute the image processing method according to any one of claims 1-10.

13. A computer device, characterized in that, The computer device includes a processor and a memory. A computer program is stored in the memory, and the processor is configured to execute the image processing method according to any one of claims 1-10 by calling the computer program stored in the memory.