Image processing method and apparatus, storage medium, and device
By introducing auxiliary textures to record transparent values in the color gradient direction, 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.
Patent Information
- Application Number
- PCT/CN2025/072737
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-16
- Filing Date
- 2025-01-16
- Publication Date
- 2025-07-24
AI Technical Summary
The prior art is inefficient in drawing gradient color effect images in video synthesis, especially in the drawing process of edge gradient areas.
Introduce auxiliary texture to record preset transparency values in the color gradient direction, and draw gradient color effect images by obtaining the pending image and auxiliary texture, using portrait or horizontal auxiliary texture to accurately control the transparency of each pixel.
It improves the drawing efficiency of gradient color effect images, reduces the difficulty and cost of technical implementation, provides higher flexibility and reusability, and is suitable for various scenarios that require simulating color gradients.
Smart Images

Figure CN2025072737_24072025_PF_FP_ABST
Abstract
Description
Image processing method, device, storage medium and equipment
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese Patent Application No. 202410064639.X, filed on January 16, 2024, entitled “Image Processing Method, Device, Storage Medium and Equipment,” the disclosure of which is incorporated herein by reference in its entirety. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to an image processing method, apparatus, storage medium, and device. Background Art
[0004] In the field of video synthesis, edge gradient region rendering is a key technology. However, current technologies suffer from low rendering efficiency in practical applications. Summary of the Invention
[0005] In one aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0006] Get the image to be processed;
[0007] Obtaining an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in a color gradient direction;
[0008] Based on the auxiliary texture, a gradient color effect image corresponding to the image to be processed is drawn.
[0009] In another aspect, an embodiment of the present application provides an image processing device, comprising:
[0010] A first acquiring unit, configured to acquire an image to be processed;
[0011] A second acquiring unit is configured to acquire an auxiliary texture, where the auxiliary texture is configured to record a preset transparency value in a color gradient direction;
[0012] A drawing unit is used to draw a gradient color effect image corresponding to the image to be processed based on the auxiliary texture.
[0013] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein 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 above embodiments.
[0014] On the other hand, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein a computer program is stored in the memory, and the processor is used to execute the image processing method described in any of the above embodiments by calling the computer program stored in the memory.
[0015] On the other hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the image processing method described in any of the above embodiments when executed by a processor.
[0016] On the other hand, an embodiment of the present application provides a computer program, which, when executed by a processor, implements the image processing method described in any of the above embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. It is clear that the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0018] FIG1 is a flow chart of an image processing method according to an embodiment of the present application.
[0019] FIG2 is a schematic diagram of a first application scenario of the image processing method provided in an embodiment of the present application.
[0020] FIG3 is a schematic diagram of a second application scenario of the image processing method provided in an embodiment of the present application.
[0021] FIG4 is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application.
[0022] FIG5 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0024] The embodiments of the present application provide an image processing method, apparatus, storage medium, and device, which can effectively improve the efficiency of drawing images with gradient color effects.
[0025] The embodiment of the present application obtains an image to be processed; obtains an auxiliary texture, the auxiliary texture is used to record a preset transparency value in the color gradient direction; and based on the auxiliary texture, draws a gradient color effect image corresponding to the image to be processed. The embodiment of the present application obtains the image to be processed and the auxiliary texture. When drawing the gradient color effect image, the auxiliary texture can be used to quickly locate the color gradient direction and transparency value, thereby greatly improving the drawing efficiency. The preset transparency value in the color gradient direction is recorded in the auxiliary texture, which makes it possible to accurately control the transparency of each pixel during the drawing process. Based on the auxiliary texture, the gradient color effect image corresponding to the image to be processed is drawn, which can effectively improve the drawing efficiency of the gradient color effect image and reduce the difficulty and cost of technical implementation.
[0026] 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 by 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 car terminal and other devices. The terminal device can also include a client, which can be a client of an application capable of image processing. For example, the client includes at least one of a program client and a web client. For example, the application can be a social application, a video playback application, an audio playback application, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms.
[0027] First, some nouns or terms that appear in the description of the embodiments of this application are explained as follows:
[0028] A bitmap is a data structure used to represent and manipulate binary images or graphics. It represents and stores pixel information for an image or graphic in a limited space. Each pixel is represented by one or more bits, representing its color or other attributes. A bitmap is composed of individual dots called pixels (picture elements). These dots can be arranged and colored in different ways to create a pattern. When a bitmap is magnified, the countless individual blocks that make up the entire image can be seen.
[0029] Alpha values, often referred to as opacity, are parameters used to indicate transparency or opacity, typically ranging from 0 to 1. 0 represents complete transparency, while 1 represents complete opacity. In graphics and image processing, alpha values are used to control the transparency of pixels or graphics, achieving effects such as semi-transparency and overlays.
[0030] For example, there are two main approaches to drawing edge gradient effects:
[0031] 1. Use a single bitmap for the entire lyrics area, and use a brush to draw a gradient mask with a clear blend mode for the bottom area. However, this solution requires the central processing unit (CPU) to pre-blend the lyrics text with the gradient mask to generate the entire bitmap, resulting in low efficiency.
[0032] 2. Determine the vertex position in real time in the fragment shader during drawing, and multiply the alpha value of the vertex position by a value. However, this solution requires performing the judgment operation in the fragment shader, and the GPU's processing efficiency for this judgment logic is relatively low.
[0033] Therefore, in order to solve the problem of low drawing efficiency of gradient color effect images in video synthesis, an embodiment of the present application can provide an image processing method to improve drawing efficiency by introducing an auxiliary texture that additionally records an alpha channel.
[0034] It should be noted that the order of description of the following embodiments does not limit the priority order of the embodiments.
[0035] Please refer to Figures 1 to 3. Figure 1 is a flow chart of the image processing method provided in the embodiment of the present application, and Figures 2 to 3 are schematic diagrams of application scenarios of the image processing method provided in the embodiment of the present application. The method includes the following steps 110 to 130:
[0036] Step 110: Acquire the image to be processed.
[0037] For example, the image to be processed can be obtained in a variety of ways, such as extracting image frames from video files. These video files can be music videos, movies, television programs, or other types of video content. By extracting image frames from the video, the image to be processed can be obtained, and the processed image can be further processed and manipulated to achieve the desired visual effect.
[0038] For example, music videos often feature numerous visual elements and dynamic effects to complement the music and lyrics. Therefore, when processing image frames from a music video, representative frames can be selected based on the music and lyrics to enhance visual prominence or create a specific visual effect. For example, certain frames can be rendered with gradient edges to create a gradient color effect.
[0039] Step 120: Obtain an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in the color gradient direction.
[0040] The auxiliary texture is pre-processed image data that contains transparency information along the color gradient. This transparency information is recorded on a pixel-by-pixel basis, with each pixel containing transparency values for one or more channels. By using these transparency values, you can more precisely control the color gradient during the drawing process.
[0041] The transparency value can be represented by an alpha value. The alpha value is a parameter used to represent transparency or opacity, and generally ranges from 0 to 1. 0 represents complete transparency, and 1 represents complete opacity. Values between 0 and 1 represent varying degrees of translucency.
[0042] For example, auxiliary textures can be created in image processing software or specialized graphics editing tools. The process of creating auxiliary textures 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 textures.
[0043] The auxiliary texture is created and stored, allowing it to be reused in subsequent image processing steps. This avoids recalculating the transparency value each time a gradient effect is drawn, greatly improving image processing efficiency. Furthermore, since the auxiliary texture is independent of the image being processed, the same gradient effect can be easily applied to different images without regenerating the auxiliary texture.
[0044] By acquiring and using auxiliary textures during the rendering process, embodiments of the present application can more efficiently achieve gradient color effects while providing greater 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 effects rendering.
[0045] In some embodiments, the method further comprises:
[0046] Based on the color gradient direction, a basic area and a gradient area in the image to be processed are determined.
[0047] The purpose of determining the base area and the gradient area in the image to be processed based on the color gradient direction is to more accurately control the color gradient effect and apply different transparency settings to different areas of the image.
[0048] Base regions typically refer to areas in an image where color remains stable and doesn't change significantly (e.g., no change or a change less than a preset threshold). These base regions should maintain their original color and transparency in the final gradient image. Gradient regions, on the other hand, are areas in an image where color changes significantly. These gradient regions will have transparency gradients applied to them, either to simulate natural color transitions or to create specific artificial visual effects.
[0049] In practice, determining the base region and gradient region can be achieved through image processing algorithms, such as edge detection and color analysis. These algorithms can help identify the boundaries and trends of color changes in the image, thereby accurately dividing the base region and gradient region.
[0050] In some embodiments, obtaining the auxiliary texture includes:
[0051] In the color gradient direction, the preset transparency value corresponding to the base area in the auxiliary texture is set to 1, and the preset transparency value corresponding to the gradient area in the auxiliary texture is set to a value gradually varying from 1 to 0.
[0052] After determining the base area and the gradient area, the auxiliary texture can be obtained and set. Specifically, in the color gradient direction, the preset transparency value corresponding to the base area in the auxiliary texture is set to 1, which means that the pixels in these base areas will remain completely opaque. At the same time, the preset transparency value corresponding to the gradient area in the auxiliary texture is set to a value that gradually changes from 1 to 0, which means that the pixels in these areas will gradually change from completely opaque to completely transparent, thereby achieving a smooth transition of color.
[0053] This allows for more precise control of the transparency of different areas when rendering gradient color effects, resulting in a more natural and realistic visual effect. This technology can be applied to a variety of scenarios requiring simulated color gradients, such as rendering natural landscapes, designing user interfaces, and building virtual reality environments.
[0054] In some embodiments, obtaining an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in a color gradient direction, includes:
[0055] When the color gradient direction is vertical, a vertical auxiliary texture is acquired, where the vertical auxiliary texture is used to record a first preset transparency value in the vertical direction.
[0056] Among them, the process of obtaining the auxiliary texture can be customized according to the direction of the color gradient. Specifically, when the color gradient direction is vertical, a vertical auxiliary texture will be 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 with color gradient 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 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 drawing. By using the vertical auxiliary texture, the effect of the vertical color gradient can be more accurately controlled during the drawing process.
[0057] In some embodiments, the image to be processed includes an image with a width of W pixels and a height of H pixels;
[0058] The vertical auxiliary texture includes a texture with a width of 1 pixel and a height of H pixels.
[0059] The method for obtaining auxiliary textures can be further customized to accommodate 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 being processed.
[0060] In this embodiment 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 ensures that the vertical auxiliary texture can cover the entire gradient area along the height direction of the image, and each pixel can be mapped to a corresponding position in the image.
[0061] By using a vertical auxiliary texture of this size, the effect of the vertical color gradient can be more accurately controlled during the drawing process. During the drawing process, the first transparency value recorded in the vertical auxiliary texture is used to simulate or create a specific visual effect.
[0062] This technique is particularly useful for scenarios requiring the simulation of vertical color gradients, such as the color change of sunlight rising or setting from the horizon, the vertical flow of water or smoke, or the color change of lyrics scrolling from top to bottom or bottom to top. Using vertical auxiliary textures allows for more efficient implementation of these complex visual effects, while providing greater flexibility and reusability. This technique can be applied to game development, video production, filmmaking, virtual reality, and various graphics rendering scenarios to meet specific visual requirements and artistic styles.
[0063] In some embodiments, obtaining an auxiliary texture, where the auxiliary texture is used to record a preset transparency value in a color gradient direction, includes:
[0064] When the color gradient direction is horizontal, a horizontal auxiliary texture is acquired, where the horizontal auxiliary texture is used to record a second preset transparency value in the horizontal direction.
[0065] Among them, the method of obtaining the auxiliary texture can also be customized according to the direction of the color gradient. 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. It is also based on the analysis of the original image to identify the area with color gradient 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 area of horizontal gradient 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 accurately controlled during the drawing process.
[0066] In some embodiments, the image to be processed includes an image with a width of W pixels and a height of H pixels;
[0067] The horizontal auxiliary texture includes a texture with a width of W pixels and a height of 1 pixel.
[0068] 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 is set to ensure that the image to be processed has sufficient details and range for subsequent image processing and rendering operations.
[0069] Similar to the vertical auxiliary texture, the horizontal auxiliary texture is also customized based on the direction of the color gradient. The width of the horizontal auxiliary texture is the same as the width of the image being processed, that is, W pixels, and the height is only 1 pixel. This design ensures that the horizontal auxiliary texture covers the entire gradient area along the width of the image and that each pixel corresponds to a corresponding position in the image.
[0070] By using a horizontal auxiliary texture of this size, the effect of the horizontal color gradient can be more accurately controlled during the painting process. During the painting process, the second transparency value recorded in the horizontal auxiliary texture is used to simulate or create a specific visual effect.
[0071] This technique is particularly useful for scenes requiring simulating horizontal color gradients, such as the horizontal expansion of clouds across the sky or the lateral spread of fire. By using horizontal auxiliary textures, these complex visual effects can be achieved more efficiently, while providing greater flexibility and reusability. This technique can be applied to game development, video production, filmmaking, virtual reality, and various graphics rendering scenarios to meet specific visual requirements and artistic styles.
[0072] Step 130: Draw a gradient color effect image corresponding to the image to be processed based on the auxiliary texture.
[0073] In some embodiments, drawing the gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes:
[0074] Obtaining a 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;
[0075] According to the transparency value corresponding to each pixel point in the image to be processed, a gradient color effect image corresponding to the image to be processed is drawn.
[0076] Among them, each pixel in the image to be processed is traversed. This is a necessary step because each pixel needs to be processed individually to achieve fine color and transparency control.
[0077] Then, for the current pixel being processed, the color value of the current pixel is obtained. This color value usually includes three components: red, green, and blue (RGB), which together determine the color of the pixel.
[0078] Then, based on the position of the current pixel, the preset transparency value corresponding to the current pixel is obtained from the auxiliary texture. This preset transparency value is preset according to the color gradient direction and represents the transparency of the pixel during the gradient process.
[0079] Next, the transparency value corresponding to the current pixel is determined based on the color value of the current pixel in the image being processed and the preset transparency value in the color gradient direction recorded in the auxiliary texture. For example, the transparency value corresponding to the current pixel is obtained by multiplying the color value of the current pixel by the preset transparency value recorded in the auxiliary texture. This multiplication operation adjusts the color intensity of the current pixel so that it changes according to the preset transparency value. In this way, the color of the pixel in the color gradient area will gradually become transparent, thus achieving a gradient effect.
[0080] Next, the calculated transparency value and the original color value are used to paint the current pixel. This process may involve color blending to ensure that the painted pixel blends harmoniously with the surrounding pixels. Repeat these steps for all pixels in the image to be processed until all pixels have been processed.
[0081] This color process can also blend the colors of adjacent pixels to varying degrees based on the transparency value, achieving a smooth color transition. Common color blending algorithms include linear interpolation and bilinear interpolation, and the appropriate algorithm can be selected based on specific needs. These algorithms can precisely control the direction, speed, and range of color gradients, creating realistic visual effects.
[0082] Then, by processing all pixels and adjusting the color and transparency of all pixels, an image with a gradient color effect is finally generated. This gradient color effect image will present a color effect with a smooth transition in the color gradient direction.
[0083] This method can precisely control the color and transparency of each pixel in the image, thereby achieving high-quality gradient color effects.
[0084] In some embodiments, drawing the gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes:
[0085] Multiplying the color value of a current pixel in the image to be processed by a first preset transparency value in the vertical direction recorded in the vertical auxiliary texture to obtain a first gradient color value corresponding to the current pixel;
[0086] A vertical gradient color effect image corresponding to the image to be processed is drawn according to the first gradient color value corresponding to each pixel point in the image to be processed.
[0087] For each pixel in the image to be processed, its color value is first read. These color values represent the original color information of the image. Then, the first preset transparency value corresponding to the current pixel is obtained from the vertical auxiliary texture. This first preset transparency value is preset in the vertical direction and is used to control the color gradient effect in this direction. Then, the color value of the current pixel is multiplied by the first preset transparency value in the vertical auxiliary texture to obtain the first gradient color value corresponding to the pixel. The purpose of this step is to combine color and transparency to provide a basis for subsequent color mixing.
[0088] Then, based on the first gradient color value corresponding to each pixel, all pixels in the image to be processed are blended. This process can achieve a vertical gradient effect by blending the colors of adjacent pixels to varying degrees, depending on the transparency value. Common color blending algorithms include linear interpolation and bilinear interpolation, and the appropriate algorithm can be selected based on specific needs. These algorithms can precisely control the vertical gradient effect of colors, such as the direction, speed, and range of the gradient. During the rendering process, other image processing techniques, such as anti-aliasing and detail enhancement, can also be combined to improve the clarity and texture of the image.
[0089] Finally, the finished vertical gradient color effect image is output to a display device or saved to a file. The output image can be used in various application scenarios, such as game development, film production, digital media, etc.
[0090] If real-time rendering is required, the drawing process can also be embedded in the graphics rendering engine to improve the speed and efficiency of image rendering.
[0091] Through the above steps, a realistic vertical gradient color effect image can be drawn based on the vertical auxiliary texture.
[0092] As shown in Figure 2, the image to be processed 20 has a width of W pixels and a height of H pixels. The image to be processed 20 includes a base region 21 and a gradient region 22. For example, the base region may have a height of H1, and the gradient region at the bottom may have a height of H2. In gradient region 22, a color gradient effect with an alpha value from 1 to 0 needs to be drawn. For example, the texture to be drawn for the image to be processed is defined as texture1. For example, a vertical auxiliary texture with a width of 1 pixel and a height of H pixels is pre-generated, such as texture0, to store the alpha value (first preset transparency value) for the vertical gradient. When drawing the current pixel, texture1[x,y], the color value of the current pixel can be multiplied by the alpha value (first preset transparency value) recorded at the location of texture0[1,y] to obtain the gradient color alpha value (first gradient color value) for the current pixel. That is, the final drawn color value for the pixel at position [x,y] is: color'[x,y] = color[x,y] * alpha[1,y].
[0093] In some embodiments, drawing the gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes:
[0094] Multiplying the color value of a current pixel in the image to be processed by a 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;
[0095] According to the second gradient color value corresponding to each pixel point in the image to be processed, a horizontal gradient color effect image corresponding to the image to be processed is drawn.
[0096] 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 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 second gradient color value corresponding to the current pixel obtained represents the degree of transparency of the current pixel during the horizontal gradient process.
[0097] Then, the second gradient color value of each pixel is calculated and used to perform color blending on all pixels in the image to be processed. This process takes into account the color information of adjacent pixels and achieves a smooth horizontal transition of colors based on the second gradient color value.
[0098] Finally, the finished horizontal gradient color effect image 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.
[0099] 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.
[0100] For example, the embodiment of the present application supports not only vertical gradients but also horizontal gradients, and can record horizontal gradient alpha information by introducing a horizontal auxiliary texture with a width of W pixels and a height of 1 pixel.
[0101] As shown in FIG3 , the image 30 to be processed has a width of W pixels and a height of H pixels, wherein 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 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, such as the horizontal auxiliary texture is defined as texture0, which is used to store the alpha value of the horizontal gradient (the second preset transparency value). When drawing the current pixel Texutrue1[x,y], the color value of the current pixel 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, that is, the final drawn color value of the pixel at the [x,y] position is: color'[x,y]=color[x,y]*alpha[x,1].
[0102] The embodiment of the present application introduces a vertical auxiliary texture with a width of 1 pixel and a height of H pixels, or introduces a horizontal auxiliary texture with a height of 1 pixel and a width of W pixels, and records 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.
[0103] Through the above steps, an image with a horizontal gradient effect can be accurately drawn based on the horizontal auxiliary texture.
[0104] For example, in the process of drawing a gradient color effect image, other image processing technologies can be applied as needed to enhance the visual quality of the image, such as anti-aliasing, detail enhancement, sharpening, contrast adjustment, etc., to improve the clarity and texture of the gradient color effect image.
[0105] Anti-aliasing is primarily used to smooth edges in images, reducing or eliminating jagged effects. In gradient images, undesirable edges can disrupt the overall visual effect. Therefore, anti-aliasing can smooth edges and create more natural color transitions, eliminating noticeable color blocks or stair-stepping.
[0106] Detail enhancement technology can identify and enhance minute details in an image, such as texture or color variations. When processing gradient color effect images, this technology can highlight the layering of the gradient. After detail enhancement processing, the color or texture changes in the gradient effect are more pronounced, making the overall gradient effect more vivid and three-dimensional.
[0107] Sharpening primarily enhances image clarity by enhancing edges and details. In gradient images, sharpening can enhance areas of color or brightness change. Sharpening a gradient image will make edges and details stand out more clearly, making the gradient appear more distinct and clear.
[0108] Contrast adjustment primarily alters the overall effect of an image by adjusting the relationship between different color or brightness areas. When working with gradient color effects, contrast can be adjusted to better illustrate color variations. Adjusting contrast in a gradient color effect can make color changes more pronounced, enhancing the visual impact of the gradient. It can also make image details stand out more clearly.
[0109] For example, you can adjust the color balance of a gradient color effect image to change the relationship between colors, making the gradient effect more harmonious or emphasizing a certain hue.
[0110] 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 expressiveness of the gradient.
[0111] 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.
[0112] All of the above technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here.
[0113] The embodiment of the present application obtains an image to be processed; obtains an auxiliary texture, the auxiliary texture is used to record a preset transparency value in the color gradient direction; and based on the auxiliary texture, draws a gradient color effect image corresponding to the image to be processed. The embodiment of the present application obtains the image to be processed and the auxiliary texture. When drawing the gradient color effect image, the auxiliary texture can be used to quickly locate the color gradient direction and transparency value, thereby greatly improving the drawing efficiency. The preset transparency value in the color gradient direction is recorded in the auxiliary texture, which makes it possible to accurately control the transparency of each pixel during the drawing process. Based on the auxiliary texture, the gradient color effect image corresponding to the image to be processed is drawn, which can effectively improve the drawing efficiency of the gradient color effect image and reduce the difficulty and cost of technical implementation.
[0114] To facilitate better implementation of the image processing method of the present embodiment, the present embodiment further provides an image processing device. Please refer to FIG4 , which is a schematic diagram of the structure of the image processing device provided by the present embodiment. The image processing device 200 may include:
[0115] A first acquiring unit 210 is configured to acquire an image to be processed;
[0116] A second acquiring unit 220 is configured to acquire an auxiliary texture, where the auxiliary texture is configured to record a preset transparency value in a color gradient direction;
[0117] The drawing unit 230 is configured to draw a gradient color effect image corresponding to the image to be processed based on the auxiliary texture.
[0118] In some embodiments, the drawing unit 230 may be used to:
[0119] Obtaining a 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;
[0120] According to the transparency value corresponding to each pixel point in the image to be processed, a gradient color effect image corresponding to the image to be processed is drawn.
[0121] In some embodiments, the second acquiring unit 220 may be configured to: when the color gradient direction is vertical, acquire a vertical auxiliary texture, wherein the vertical auxiliary texture is used to record a first preset transparency value in the vertical direction.
[0122] In some embodiments, the image to be processed includes an image with a width of W pixels and a height of H pixels; the vertical auxiliary texture includes a texture with a width of 1 pixel and a height of H pixels.
[0123] In some embodiments, the drawing unit 230 can be used to: multiply the color value of the current pixel in the image to be processed by the first preset transparency value in the vertical direction recorded in the vertical auxiliary texture to obtain the first gradient color value corresponding to the current pixel; and draw the vertical gradient color effect image corresponding to the image to be processed according to the first gradient color value corresponding to each pixel in the image to be processed.
[0124] In some embodiments, the second acquiring unit 220 may be configured to: when the color gradient direction is horizontal, acquire a horizontal auxiliary texture, wherein the horizontal auxiliary texture is used to record a second preset transparency value in the horizontal direction.
[0125] In some embodiments, the image to be processed includes an image with a width of W pixels and a height of H pixels; the horizontal auxiliary texture includes a texture with a width of W pixels and a height of 1 pixel.
[0126] In some embodiments, the drawing unit 230 can be used to: multiply 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; and draw the horizontal gradient color effect image corresponding to the image to be processed according to the second gradient color value corresponding to each pixel in the image to be processed.
[0127] In some embodiments, the second acquiring unit 220 may further be configured to determine a base area and a gradient area in the image to be processed based on the color gradient direction.
[0128] In some embodiments, the second acquisition unit 220 can be used to: set the preset transparency value corresponding to the basic area in the auxiliary texture to 1 in the color gradient direction, and set the preset transparency value corresponding to the gradient area in the auxiliary texture to a value gradient from 1 to 0.
[0129] The image processing apparatus 200 may be integrated into a terminal device or a server that has a storage device and a processor and has computing capabilities, or the image processing apparatus 200 may be the terminal device or the server.
[0130] In some embodiments, the present application further provides a computer device including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0131] In some embodiments, as shown in FIG5 , FIG5 is another structural diagram of a computer device provided in an 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 in the memory 302 and executable on the processor. The processor 301 is electrically connected to the memory 302. Those skilled in the art will appreciate that the computer device structure shown in the figure does not constitute a limitation of the computer device, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0132] The processor 301 is the control center of the computer device 300. It uses various interfaces and lines to connect the various parts of the entire computer device 300. It executes various functions of the computer device 300 and processes data by running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302.
[0133] 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:
[0134] Acquire an image to be processed; acquire an auxiliary texture, wherein the auxiliary texture is used to record a preset transparency value in a color gradient direction; and draw a gradient color effect image corresponding to the image to be processed based on the auxiliary texture.
[0135] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0136] In some embodiments, as shown in FIG5 , the computer device 300 further includes: a touch screen display 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch screen display 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will appreciate that the computer device structure shown in FIG5 does not limit the computer device, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0137] The touch screen display 303 may be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface.
[0138] The RF circuit 304 may be used to transmit and receive RF signals, thereby establishing wireless communication with a network device or other computer device through wireless communication, and transmitting and receiving signals between the network device or other computer device.
[0139] Audio circuit 305 can be used to provide an audio interface between the user and the computer device through a speaker and microphone. Audio circuit 305 can convert received audio data into electrical signals and transmit them to the speaker, which then converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuit 305 and converted into audio data. The audio data is then output to processor 301 for processing, and then sent to, for example, another computer device via RF circuit 304. Alternatively, the audio data can be stored in a memory for further processing. Audio circuit 305 may also include an earphone jack to allow communication between external headphones and the computer device.
[0140] The input unit 306 may be configured to receive input digital, character information, or object feature information (such as fingerprint, iris, or facial information), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0141] The power supply 307 is used to supply power to various components of the computer device 300 .
[0142] Although not shown in FIG. 5 , the computer device 300 may further include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0143] In some embodiments, the present application further 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 server to execute the corresponding processes in the image processing method in the embodiments of the present application. For the sake of brevity, the details are not repeated here.
[0144] In some embodiments, the present application further 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, so that the computer device performs the corresponding process in the image processing method in the embodiment of the present application. For the sake of brevity, it is not described here in detail. In some embodiments, the present application further provides a computer program product, which includes a computer program. When the computer program is executed by the processor, it performs the corresponding process in the image processing method in the embodiment of the present application.
[0145] This application also provides a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the corresponding processes in the image processing method in the embodiments of this application. For the sake of brevity, this is not described in detail here. In some embodiments, this application also provides a computer program that, when executed by the processor, performs the corresponding processes in the image processing method in the embodiments of this application.
[0146] It should be understood that the processor of the embodiments of the present application may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiment can be completed by hardware integrated logic circuits in the processor or software instructions. The above processor can 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, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0147] It is understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may 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 may be a random access memory (RAM), which is used as an external cache. By way of example and 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), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus 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.
[0148] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0149] 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.
[0150] In the several embodiments provided in this 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 schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0151] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0152] In addition, each functional unit in the embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0153] 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, or the part that contributes to the relevant technology 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) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk.
[0154] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An image processing method, comprising: Obtaining an image to be processed; Obtaining 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, drawing 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: Obtaining a 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; Drawing 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, obtaining 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, wherein, The step of drawing a gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes: Multiplying 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; Drawing 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, obtaining 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, wherein, The step of drawing a gradient color effect image corresponding to the image to be processed based on the auxiliary texture includes: Multiplying 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; Drawing 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 any one of claims 1-8, further comprising: Based on the color gradient direction, determining 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, setting the preset transparency value corresponding to the base region in the auxiliary texture to 1, and setting 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, comprising: A first acquisition unit, configured to acquire an 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 storing a computer program, the computer program being 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 including a processor and a memory, where 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.
14. A computer program product including a computer program, where the computer program, when executed by a processor, implements the image processing method according to any one of claims 1-10.
15. A computer program, where the computer program, when executed by a processor, implements the image processing method according to any one of claims 1-10.
Citation Information
Patent Citations
Image synthesis method and device
CN107958449A
Device and method for rendering vegetation objects in game scenes
CN110115841A
Character light-emitting effect processing method and device, equipment and storage medium
CN114820877A
Gradient texture pattern generation method and etching method
CN115713570A
Conical gradient texture generation method, equipment and medium
CN116630510A