Image processing method
By calculating and applying target pixel parameters to adjust and compress the texture image, the storage and performance problems of excessively large texture images are solved, and more efficient storage and performance improvements are achieved.
Patent Information
- Application Number
- CN202510277707.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-06-24
AI Technical Summary
The files of existing texture images are large in size and occupy more storage resources, resulting in storage and performance problems.
By determining the initial image pixels in the initial texture image, calculating the target pixel parameters, and using these parameters to generate a parameter texture image, adjusting the initial image pixels parameters, and finally compressing the target texture image to generate a compressed texture image.
It effectively reduces the size of texture images, reduces the use of storage resources, and improves performance, especially in environments with limited memory or memory.
Smart Images

Figure CN120198281A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and more particularly to an image processing method. One or more embodiments of this specification also relate to another image processing method, a computing device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the development of computer technology, some computer applications need to use texture images to save data. For example, some game scenes in the game process need to use rendering texture images to save the data generated during the runtime. However, currently the file size of texture images is relatively large, and a large amount of storage resources are required to store the texture images; therefore, how to reduce the size of texture images has become an issue that needs to be urgently addressed. Summary of the invention
[0003] In view of this, an embodiment of the present specification provides an image processing method. One or more embodiments of the present specification also relate to another image processing method, an image processing device, another image processing device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, there is provided an image processing method, including: Determining initial image pixels in an initial texture image, and determining target pixel parameters corresponding to the initial texture image according to the initial image pixels; Generate a parameter texture image according to the target pixel parameters, and use the parameter texture image to perform parameter adjustment processing on the initial image pixels to obtain target image pixels; A target texture image is generated according to the target image pixels, and image compression processing is performed on the target texture image to obtain a compressed texture image.
[0005] According to a second aspect of the embodiments of this specification, there is provided an image processing apparatus, including: a parameter determination module, configured to determine initial image pixels in an initial texture image, and determine target pixel parameters corresponding to the initial texture image according to the initial image pixels; A pixel processing module is configured to generate a parameter texture image according to the target pixel parameters, and use the parameter texture image to perform parameter adjustment processing on the initial image pixels to obtain target image pixels; The image compression module generates a target texture image according to the target image pixels, and performs image compression processing on the target texture image to obtain a compressed texture image.
[0006] According to a third aspect of the embodiments of the present specification, there is provided an image processing method, including: Performing image decompression processing on a compressed texture image to obtain a target texture image, and acquiring target image pixels in the target texture image, wherein the compressed texture image is generated by using the above-mentioned image processing method; Performing parameter restoration processing on the target image pixels by using a parameter texture image corresponding to an initial texture image to obtain initial image pixels, wherein the parameter texture image is generated according to target pixel parameters corresponding to the initial image pixels in the initial texture image; Generating the initial texture image based on the initial image pixels.
[0007] According to a fourth aspect of the embodiments of the present specification, there is provided an image processing apparatus, including: An image decompression module, configured to perform image decompression processing on a compressed texture image to obtain a target texture image, and acquire target image pixels in the target texture image, wherein the compressed texture image is generated by using the above-mentioned image processing method; A pixel processing module, configured to perform parameter restoration processing on the target image pixels by using a parameter texture image corresponding to an initial texture image to obtain initial image pixels, wherein the parameter texture image is generated according to target pixel parameters corresponding to the initial image pixels in the initial texture image; An image generation module, configured to generate the initial texture image based on the initial image pixels.
[0008] According to a fifth aspect of the embodiments of the present specification, there is provided a computing device, including: A memory and a processor; The memory is used for storing computer programs / instructions, and the processor is used for executing the computer programs / instructions, and when the computer programs / instructions are executed by the processor, the steps of any of the above-mentioned image processing methods are implemented.
[0009] According to a sixth aspect of the embodiments of the present specification, there is provided a computer-readable storage medium, which stores computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of any of the above-mentioned image processing methods are implemented.
[0010] According to a seventh aspect of the embodiments of the present specification, there is provided a computer program product, including computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of any of the above-mentioned image processing methods are implemented.
[0011] One or more embodiments of this specification provide an image processing method. This image processing method can determine target pixel parameters corresponding to an initial texture image according to the initial image pixels in the initial texture image, and use the target pixel parameters to adjust the initial texture image to obtain a target texture image that is convenient for compression. Finally, image compression processing is performed on the target texture image to obtain a compressed texture image, thereby reducing the volume of the texture image and avoiding the problem of occupying a large amount of storage resources for storing the texture image due to its large file volume. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a flowchart of an image processing method provided by an embodiment of this specification; Figure 2 is a flowchart of another image processing method provided by an embodiment of this specification; Figure 3 is a flowchart of the processing process of an image processing method provided by an embodiment of this specification; Figure 4 is a schematic structural diagram of an image processing apparatus provided by an embodiment of this specification; Figure 5 is a schematic structural diagram of another image processing apparatus provided by an embodiment of this specification; Figure 6 is a block diagram of the structure of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0013] Many specific details are set forth in the following description in order to provide a thorough understanding of this specification. However, this specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the connotation of this specification. Therefore, this specification is not limited by the specific implementations disclosed below.
[0014] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the", and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more of the associated listed items.
[0015] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".
[0016] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data that have been authorized by the user or fully authorized by all parties. And the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or reject.
[0017] First, the noun terms involved in one or more embodiments of this specification are explained.
[0018] BC4 (Block Compression 4): It is an algorithm specifically used for compressing single-channel (grayscale) image data and is part of the S3TC (S3 Texture Compression) series. It is suitable for textures that only need to store the information of one color channel, such as the height information of normal maps, grayscale images, etc.
[0019] BC5 (Block Compression 5): It is a type of DirectX texture compression format, specifically used for compressing data of two color channels and is often used in occasions that require dual-channel data such as storing normal maps. It is actually a combination of two BC4s (each processing one channel), compressing the two independent channels of the image respectively.
[0020] BC7 (Block Compression 7): It is a type of DirectX texture compression format, designed specifically for high-quality RGB and RGBA textures. It provides higher image quality and more complex compression algorithms than earlier formats (such as BC1 to BC3). BC7 supports multiple different modes to adapt to various types of image data and allows independent encoding of each 4x4 pixel block.
[0021] With the development of computer technology, some computer applications need to use texture images to store data. However, currently, the file size of texture images is relatively large, and more storage resources are required to store such texture images. For example, during the operation of a game, some scenes need to use render textures (i.e., render texture images) to store the data generated during operation. However, uncompressed render textures will occupy a large amount of video memory or memory resources. For example, a render texture with a resolution of 3960×2180 and 32 bits per pixel occupies nearly 32MB of video memory. If a large number of such render textures are needed in a scene, it will occupy a large amount of video memory or memory resources, thus imposing significant pressure on the overall performance and being extremely unfriendly to graphics cards with low video memory or memory cards with low memory.
[0022] To address the above problems, this specification provides a GPU real-time compression texture mapping technology, which can compress texture images and reduce the video memory occupied by render textures. However, most of the block compression algorithms used in this technology are only applicable to normalized floating-point textures. These algorithms perform well when processing standard color data, but for some textures with high-precision and non-normalized floating-point formats (such as single-channel textures in Float32 format), they do not support compression. This means that when texture data with higher floating-point precision is needed, there is still a problem of excessive video memory or memory occupation.
[0023] Based on this, in this specification, an image processing method is provided. One or more embodiments of this specification are also related to another image processing method, an image processing device, another image processing device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail one by one in the following embodiments.
[0024] See Figure 1 , Figure 1 which shows a flowchart of an image processing method provided according to an embodiment of this specification, specifically including the following steps.
[0025] Step 102: Determine the initial image pixels in the initial texture image, and determine the target pixel parameters corresponding to the initial texture image according to the initial image pixels.
[0026] Among them, the initial texture image can be understood as the texture image to be compressed; the initial texture image can be a single-channel texture image or a multi-channel texture image; the multi-channel texture image can be a two-channel texture image, a three-channel texture image, a four-channel texture image, or other texture images with multiple channels, and no specific limitation is made here.
[0027] The initial image pixels can be understood as the pixels in the initial texture image; there can be one or more of these initial image pixels; the initial texture image can be a high-precision texture image. This high precision means that the initial texture pixels in the texture image are represented by multiple bytes; multiple bytes can be understood as at least two bytes. For example, the pixel value or brightness information of one initial texture pixel can be represented by a numerical value (such as a floating-point number) of 16-bit or 32-bit bytes.
[0028] The target pixel parameter can be understood as a parameter for adjusting the pixel value or brightness information included in the initial image pixels; in the case where the initial texture image is a color image, the color (pixel value) can be represented by multiple channels (such as red, green, and blue); in the case where the initial texture image is a grayscale image, the brightness information (or intensity) of the pixel can be represented by a single pixel value.
[0029] In one or more embodiments provided in this specification, there are multiple initial image pixels; Determining the target pixel parameter corresponding to the initial texture image according to the initial image pixels includes: Determining the pixel value corresponding to each initial image pixel among the multiple initial image pixels, and determining the maximum pixel value and the minimum pixel value among the multiple pixel values as the target pixel parameter corresponding to the initial texture image.
[0030] Among them, the pixel value can be understood as a numerical value representing the initial image pixel; in the case where the initial texture image is a color image, the color of the initial image pixel can be represented by multiple channels; for example, the color representation of the initial image pixel can be represented by a three-channel image (such as an RGB image), and each initial image pixel includes pixel values (16-bit or 32-bit bytes) of the red, green, and blue color channels; the pixel values of these three channels together determine the color of the pixel. In the case where the initial texture image is a grayscale image, each pixel point of the grayscale image has only one pixel value, and the brightness information (or intensity) of the pixel can be represented by a single pixel value (16-bit or 32-bit bytes).
[0031] Specifically, this method can determine the multiple initial image pixels included in the initial texture image and determine the pixel value corresponding to each initial pixel image (one initial image pixel can correspond to one or more pixel values); Select the maximum pixel value and the minimum pixel value from the multiple pixel values, and determine the maximum pixel value and the minimum pixel value as the target pixel parameter corresponding to the initial texture image.
[0032] Taking the application of the image processing method provided in this specification in the texture image compression scenario as an example, the image processing method will be described. Among them, the initial texture image is a single-channel texture image; the initial image pixels are pixel values represented by 16-bit or 32-bit bytes.
[0033] Based on this, for a single-channel texture map, each pixel in the single-channel texture map (i.e., the initial image pixel) represents the color through 16-bit or 32-bit bytes; based on this, this method can calculate the maximum pixel value or the minimum pixel value from multiple pixel values.
[0034] In the case where the initial texture image is a multi-channel texture image, each pixel has multiple pixel values, and each pixel value is represented by a 16-bit or 32-bit floating-point number; based on this, this method can determine multiple pixel values corresponding to each pixel; and calculate the maximum pixel value or the minimum pixel value from multiple pixel values.
[0035] It should be noted that the maximum value (i.e., the maximum pixel value) and the minimum value (i.e., the minimum pixel value) in this method are 16-bit or 32-bit floating-point numbers with high precision.
[0036] Based on the above embodiments, it can be seen that this method can determine the maximum value and the minimum value of each pixel in the high-precision texture image (i.e., the initial texture image), which is convenient for subsequent compression of the high-precision texture image, thus solving the problem of high-precision floating-point number compression.
[0037] In one or more embodiments provided in the specification, there are multiple initial image pixels; Determining the target pixel parameters corresponding to the initial texture image according to the initial image pixels includes: Determining the pixel values corresponding to each initial image pixel among multiple initial image pixels, and calculating the average value and the standard deviation of the multiple pixel values; Determining the average value and the standard deviation as the target pixel parameters corresponding to the initial texture image.
[0038] Following the above example, in addition to using the maximum value and the minimum value to normalize the pixel values, this method can also use the average value and the standard deviation to normalize the pixel values; based on this, for a single-channel texture map or a multi-channel texture image, this method can calculate the average value and the standard deviation of multiple pixel values. Subsequently, the average value and the standard deviation can be used to normalize multiple pixel values.
[0039] In one or more embodiments provided in the specification, there are multiple initial texture images; Determining the initial image pixels in the initial texture image includes: Performing image segmentation on the texture image to be compressed to obtain multiple texture image blocks; Determine the multiple texture image blocks as multiple initial texture images, and determine the initial image pixels included in each initial texture image.
[0040] Among them, the texture image to be compressed can be understood as the texture image that needs to be compressed; the texture image to be compressed can be a high-precision texture image; the texture image to be compressed can be a single-channel texture image or a multi-channel texture image. For example, the texture image to be compressed can be non-normalized floating-point rendering texture data.
[0041] The texture image block can be understood as the image area or sub-image obtained by slicing the texture image to be compressed; the initial image pixel can be the texture image block.
[0042] Continuing with the above example, in the process of compressing the texture image by this method, first, the texture image to be compressed that needs to be compressed is obtained; second, the non-normalized floating-point rendering texture data (i.e., the texture image to be compressed) that needs to be compressed is divided into several texture blocks of 4×4 size (i.e., texture image blocks); finally, for each 4×4 texture block, it is necessary to determine the multiple pixels included in the texture block for subsequent calculation of the maximum and minimum values therein.
[0043] Step 104: Generate a parameter texture image according to the target pixel parameters, and use the parameter texture image to perform parameter adjustment processing on the initial image pixels to obtain target image pixels.
[0044] The parameter texture image can be understood as the texture image used to contain the target pixel parameters; the parameter texture image can be a two-channel texture image; the two channels in the two-channel texture image are used to save the maximum pixel value and the minimum pixel value; or the two channels in the two-channel texture image are used to save the average value and the standard deviation.
[0045] The performing parameter adjustment processing on the initial image pixels can be understood as performing normalization processing on the pixel values of the initial image pixels; the target image pixels are the image pixels after normalization processing.
[0046] In one or more embodiments provided in this specification, the generating a parameter texture image according to the target pixel parameters includes: Determine the blank texture images corresponding to the respective initial texture images, where the number of pixels in the blank texture images is the same as the number of images of the multiple initial texture images; Determine the target pixel parameters corresponding to the respective initial texture images as pixel values, and save the multiple pixel values to the blank texture images to obtain the parameter texture images.
[0047] Among them, the blank texture image can be understood as a texture image template with pixel values of 0.
[0048] Continuing with the above example, after determining the maximum value and the minimum value, this method can first determine a blank dual-channel texture with pixel values of 0 (i.e., the blank texture image), and the number of pixels in this blank dual-channel texture is the same as the number of texture blocks. Secondly, take the maximum value and the minimum value of each texture map block (i.e., the initial texture image) as the pixel values of the dual-channel, and save them separately to a dual-channel texture in a high-precision format.
[0049] Since only one pixel in the extreme value texture needs to record the maximum value and the minimum value in one block, the occupied video memory size or memory size is 1 / 8 of the original rendered texture; thus saving storage space.
[0050] In one or more embodiments provided in this specification, the using the parameter texture image to perform parameter adjustment processing on the initial image pixels to obtain target image pixels includes: Determine a texture image to be processed from the multiple initial texture images, and determine the target pixel parameters corresponding to the texture image to be processed from the parameter texture image, where the texture image to be processed is any one of the multiple initial texture images; Use the target pixel parameters to perform normalization processing on the initial image pixels in the texture image to be processed to obtain the target image pixels.
[0051] Among them, the texture image to be processed can be understood as an initial texture image that needs to be normalized among the multiple initial texture images.
[0052] Continuing with the above example, use the maximum value and the minimum value calculated in the above embodiment to perform normalization processing on the data (i.e., pixel values) in each texture block to obtain the normalized pixel values.
[0053] Among them, this normalization operation is to transform the value range of floating-point numbers in the texture block to the interval [0, 1]. The specific normalization operation can refer to the following formula: Xnorm = (X - Xmin) / (Xmax - Xmin) Among them, Xnorm is the pixel value after normalization processing; X is the pixel value before normalization processing, Xmax is the maximum value; Xmin is the minimum value.
[0054] Based on the above embodiments, it can be seen that this method can perform normalization processing on the initial image pixels, thereby facilitating the compression processing of the initial texture image and improving the image compression efficiency.
[0055] Step 106: Generate a target texture image based on the target image pixels, and perform image compression processing on the target texture image to obtain a compressed texture image.
[0056] Among them, the target texture image can be understood as a normalized floating-point format.
[0057] Continuing with the above example, after normalizing the pixel values of the pixels in the texture block, since the difference between the maximum and minimum values in a 4x4 texture block is usually not large, 8-bit floating-point numbers (i.e., the pixel value range) can be used to save the normalized result (i.e., the normalized pixel value), obtaining a normalized floating-point format texture image (i.e., the target texture image). Then, this part of the data (i.e., the normalized floating-point format texture image) can be compressed using a mainstream compression algorithm to obtain a compressed texture image.
[0058] Among them, for the compression algorithm of the normalized floating-point format texture image, a block compression algorithm can be used, such as the compression algorithms of the BC series; for single-channel floating-point numbers, the BC4 algorithm can be used, for two-channel floating-point numbers, the BC5 algorithm can be used, and for three-channel or four-channel floating-point numbers, the BC7 algorithm can be used.
[0059] In one or more embodiments provided in this specification, there are multiple initial texture images, multiple target texture images, and the multiple target texture images correspond one-to-one with the multiple initial texture images; Performing image compression processing on the target texture image to obtain a compressed texture image includes: Performing image compression processing on each target texture image to obtain multiple to-be-combined compressed images, and combining the multiple to-be-combined compressed images to obtain a compressed texture image.
[0060] Continuing with the above example, for the normalized floating-point format texture image (i.e., the target texture image), a mainstream compression algorithm can be used for compression to obtain compressed data corresponding to multiple texture blocks (i.e., multiple to-be-combined compressed images). Then, the compressed data corresponding to the multiple texture blocks are spliced to obtain a compressed texture image.
[0061] In one or more embodiments provided in this specification, after generating the target texture image based on the target image pixels and performing image compression processing on the target texture image to obtain a compressed texture image, it further includes: Saving the compressed texture image and the parameter texture image to the data storage unit; or In the case of receiving an image acquisition request sent by the image acquisition end, sending the compressed texture image and the parameter texture image to the image acquisition end.
[0062] Among them, the data storage unit can be understood as a unit for storing compressed texture images and parameter texture images. For example, the data storage unit can be a memory, a video memory, a local disk, a local database, etc., and no specific limitation is made here.
[0063] The image acquisition end can be understood as a server that needs to acquire compressed texture images and parameter texture images. For example, the image acquisition end can be a server, a client, a cloud server, etc. The image acquisition end can acquire the compressed texture images and parameter texture images; and, the image acquisition end can also perform image rendering, image decompression, image storage, etc. on the compressed texture images and parameter texture images, and no specific limitation is made here.
[0064] Continuing with the above example, after compressing the normalized floating-point format texture image to obtain a compressed texture image, the compressed texture image and the texture image storing the maximum value and the minimum value can be stored in the video memory; this saves video memory space; alternatively, these data with relatively small data volumes, such as the compressed texture image and the texture image storing the maximum value and the minimum value, can be quickly sent to the client, so that the client can perform texture rendering.
[0065] In one or more embodiments provided in this specification, after performing image compression processing on the target texture image to obtain a compressed texture image, it further includes: Performing image decompression processing on the compressed texture image to obtain a target texture image, and acquiring target image pixels in the target texture image; Using the parameter texture image corresponding to the initial texture image to perform parameter recovery processing on the target image pixels to obtain initial image pixels, where the parameter texture image is generated according to target pixel parameters corresponding to the initial image pixels in the initial texture image; Generating the initial texture image based on the initial image pixels.
[0066] For the explanation of this embodiment, reference can be made to the content of the following another image processing method, and no further elaboration is made here.
[0067] One or more embodiments of this specification provide an image processing method. This image processing method can determine target pixel parameters corresponding to an initial texture image according to initial image pixels in the initial texture image, and use the target pixel parameters to adjust the initial texture image to obtain a target texture image that is convenient for compression; finally, perform image compression processing on the target texture image to obtain a compressed texture image, thereby reducing the volume of the texture image and avoiding the problem of occupying a large amount of storage resources for storing the texture image due to the large file volume of the texture image.
[0068] See Figure 2 ,Figure 2 The flowchart of another image processing method provided according to an embodiment of this specification is shown, which specifically includes the following steps.
[0069] Step 202: Perform image decompression processing on the compressed texture image to obtain a target texture image, and obtain the target image pixels in the target texture image, where the compressed texture image is generated by using the above image processing method.
[0070] Taking the application of the image processing method provided in this specification in the texture image decompression scenario as an example, this image processing method will be described. During the actual rendering process, it is necessary to perform decompression processing on the compressed texture image; the method of this decompression processing is as follows: First, determine the compression algorithm corresponding to the compressed texture image (such as BC4 algorithm, BC5 algorithm); Secondly, use the decompression method corresponding to the compression algorithm to perform decompression processing on the compressed texture image, so as to obtain a normalized floating-point format texture image (i.e., the target texture image).
[0071] Finally, determine the normalized pixel values included in the normalized floating-point format texture image for subsequent image restoration.
[0072] Step 204: Use the parameter texture image corresponding to the initial texture image to perform parameter restoration processing on the target image pixels to obtain initial image pixels, where the parameter texture image is generated according to the target pixel parameters corresponding to the initial image pixels in the initial texture image.
[0073] Among them, performing parameter restoration processing on the target image pixels can be understood as performing inverse calculation on the target image pixels obtained after normalization processing, so as to restore the target image pixels to the initial image pixels.
[0074] In one or more embodiments provided in this specification, there are multiple initial image pixels, and the target pixel parameters are the maximum pixel value and the minimum pixel value among the pixel values corresponding to each initial image pixel; The using the parameter texture image corresponding to the initial texture image to perform parameter restoration processing on the target image pixels to obtain initial image pixels includes: Determine the parameter texture image corresponding to the initial texture image, and determine the maximum pixel value and the minimum pixel value corresponding to multiple initial image pixels in the initial texture image from the parameter texture image; Determine multiple target image pixels in the target image pixels, where the multiple target image pixels are obtained by normalizing the multiple initial image pixels by using the maximum pixel value and the minimum pixel value; Using the maximum pixel value and the minimum pixel value, perform inverse normalization processing on the target image pixels to obtain the multiple initial image pixels.
[0075] Continuing with the previous example, during the actual rendering process, it is necessary to read two texture images generated in the above-mentioned image processing method simultaneously. Then perform the following steps: 1. Read the texture in high-precision format (i.e., the parameter texture image) and obtain the maximum and minimum values of each block.
[0076] 2. Read the normalized data (i.e., the pixel values after normalization processing) included in the normalized floating-point format texture image.
[0077] 3. Perform back-calculation based on the previous extreme values (i.e., the maximum and minimum values), so as to restore the normalized data to the pixel values before normalization processing.
[0078] Specifically, use the extreme values to perform inverse normalization processing on the normalized data, and obtain the pixel values of the original data through the process of inverse normalization.
[0079] Step 206: Generate the initial texture image based on the initial image pixels.
[0080] Continuing with the previous example, use the pixels after restoring the pixel values to generate the initial texture image, thereby realizing the rendering process of the initial texture image.
[0081] One or more embodiments of this specification provide another image processing method. This image processing method can perform restoration processing on the compressed texture image after image compression processing. The compression method of the compressed texture image is: according to the initial image pixels in the initial texture image, determine the target pixel parameters corresponding to the initial texture image, and use the target pixel parameters to adjust the initial texture image to obtain a target texture image that is convenient for compression; finally, perform image compression processing on the target texture image to obtain the compressed texture image.
[0082] After obtaining the compressed texture image, the compressed texture image can be decompressed to obtain the target texture image, and the parameter texture image is used to perform parameter restoration processing on the target image pixels in the target texture image to obtain the initial texture image, thereby realizing the restoration of the compressed texture image and ensuring that after compressing the initial texture image into the compressed texture image, accurate image restoration can be performed.
[0083] The following combines the attached Figure 3 , taking the application of the image processing method provided in this specification in the texture image compression scenario as an example, to further illustrate the image processing method. Among them, Figure 3The flowchart of the processing procedure of an image processing method provided by an embodiment of this specification is shown, which specifically includes the following steps.
[0084] Step 302: Texture block segmentation.
[0085] In the process of compressing the texture image by this method, it is necessary to segment to obtain texture blocks. The specific method is as follows: 1. Obtain the texture image to be compressed that needs to be compressed; 2. Divide the non-normalized floating-point rendering texture data that needs to be compressed into several texture blocks of 4×4 size.
[0086] Step 304: Take the extreme values of the texture blocks.
[0087] The specific execution method is as follows: 1. For each 4×4 texture block, it is necessary to determine the multiple pixels included in the texture block to facilitate subsequent calculation of the maximum and minimum values therein; 2. In the case where the original texture image is a single-channel texture map, each pixel in the single-channel texture map represents the color through 16-bit or 32-bit bytes; based on this, this method can calculate the maximum pixel value or the minimum pixel value from multiple pixel values.
[0088] 3. In the case where the original texture image is a multi-channel texture image, each pixel has multiple pixel values, and each pixel value is represented by a floating-point number of 16-bit or 32-bit bytes; based on this, this method can determine the multiple pixel values corresponding to each pixel; and calculate the maximum pixel value or the minimum pixel value from multiple pixel values.
[0089] It should be noted that the maximum value (i.e., the maximum pixel value) and the minimum value (i.e., the minimum pixel value) in this method are 16-bit or 32-bit floating-point numbers with high precision.
[0090] Step 306: Save the extreme values to the texture image.
[0091] Specifically, after this method determines the maximum value and the minimum value, it can first determine the blank dual-channel texture with a pixel value of 0, and the number of pixels in this blank dual-channel texture is the same as the number of texture blocks; Secondly, take the maximum value and the minimum value of each texture block as the pixel values of the dual-channel, and save them into a high-precision format dual-channel texture (i.e., the extreme value texture) respectively.
[0092] Since one pixel of the extreme value texture only needs to record the maximum value and the minimum value in one block, its occupied video memory size or memory size is 1 / 8 of the original rendering texture; thus saving storage space.
[0093] Step 308: Normalization.
[0094] Using the maximum and minimum values calculated in the above steps, normalize the data (i.e., pixel values) within each texture block to obtain normalized data (i.e., pixel values after normalization).
[0095] Step 310: Compress the texture.
[0096] Specifically, after normalizing the pixel values of the pixels in the texture block, since the difference between the maximum and minimum values within a 4x4 texture block is usually small, 8-bit floating-point numbers (i.e., the pixel value range) can be used to save the normalized result (i.e., the normalized pixel values) to obtain a texture image in normalized floating-point format; Then, this part of the data (i.e., the texture image in normalized floating-point format) can be compressed using a mainstream compression algorithm to obtain compressed data corresponding to multiple texture blocks.
[0097] Step 312: Generate a compressed texture image.
[0098] Specifically, splice the compressed data corresponding to multiple texture blocks to obtain a compressed texture image.
[0099] It should be noted that after compressing the rendered texture into a compressed texture, during the actual rendering process, the compressed texture also needs to be decompressed to restore the compressed texture to the rendered texture; the specific implementation steps are as follows: 1. Decompress the compressed texture image; the method of this decompression process is: First, read two texture images generated in the above-mentioned image processing method simultaneously.
[0100] Second, determine the compression algorithm (such as BC4 algorithm, BC5 algorithm) corresponding to the compressed texture image.
[0101] Finally, use the decompression method corresponding to the compression algorithm to decompress the compressed texture image to obtain a texture image in normalized floating-point format (i.e., the target texture image).
[0102] 2. Read the texture in high-precision format to obtain the maximum and minimum values of each block.
[0103] 3. Read the normalized data (i.e., pixel values after normalization) contained in the texture image in normalized floating-point format.
[0104] 4. Perform inverse calculation according to the previous extreme values (i.e., maximum value, minimum value) to restore the normalized data to the pixel values before normalization.
[0105] Specifically, use the extreme values to perform inverse normalization processing on the normalized data, and obtain the pixel values of the original data again through the inverse normalization process.
[0106] 5. Generate the original texture image using the pixels after restoring the pixel values, thereby implementing the rendering process for the original texture image.
[0107] Based on the above steps, it can be seen that the image processing method in this specification provides a real-time compression scheme for non-normalized floating-point textures. This method optimizes the traditional compression algorithm and splits the non-normalized floating-point texture into a design of dual-texture compressed storage; by adopting the split dual-texture compressed storage strategy, the video memory occupancy of non-normalized floating-point textures in the scene is greatly reduced, and the problem of precision loss is avoided.
[0108] Corresponding to the above method embodiment, this specification also provides an embodiment of an image processing device. Figure 4 The structural schematic diagram of an image processing device provided by an embodiment of this specification is shown. As Figure 4 shown, the device includes: A parameter determination module 402, configured to determine the initial image pixels in the initial texture image and determine the target pixel parameters corresponding to the initial texture image according to the initial image pixels; A pixel processing module 404, configured to generate a parameter texture image according to the target pixel parameters, and use the parameter texture image to perform parameter adjustment processing on the initial image pixels to obtain target image pixels; An image compression module 406, generating a target texture image according to the target image pixels and performing image compression processing on the target texture image to obtain a compressed texture image.
[0109] Optionally, there are multiple initial image pixels; The parameter determination module 402 is further configured to: Determine the pixel values corresponding to each initial image pixel among the multiple initial image pixels, and determine the maximum pixel value and the minimum pixel value among the multiple pixel values as the target pixel parameters corresponding to the initial texture image.
[0110] Optionally, there are multiple initial texture images; The parameter determination module 402 is further configured to: Perform image segmentation on the texture image to be compressed to obtain multiple texture image blocks; Determine the multiple texture image blocks as multiple initial texture images and determine the initial image pixels included in each initial texture image.
[0111] Optionally, the pixel processing module 404 is further configured to: Determine the blank texture images corresponding to the respective initial texture images, where the number of pixels in the blank texture images is the same as the number of images of the multiple initial texture images; Determine the target pixel parameters corresponding to the respective initial texture images as pixel values, and save the multiple pixel values to the blank texture images to obtain the parameter texture images.
[0112] Optionally, the pixel processing module 404 is further configured to: Determine a texture image to be processed from the multiple initial texture images, and determine the target pixel parameters corresponding to the texture image to be processed from the parameter texture images, where the texture image to be processed is any one of the multiple initial texture images; Use the target pixel parameters to perform normalization processing on the initial image pixels in the texture image to be processed to obtain the target image pixels.
[0113] Optionally, the image processing device further includes a compressed texture image processing module, configured to: Save the compressed texture image and the parameter texture image to the data storage unit; or In the case of receiving an image acquisition request sent by an image acquisition end, send the compressed texture image and the parameter texture image to the image acquisition end.
[0114] One or more embodiments of this specification provide an image processing device. The image processing device can determine the target pixel parameters corresponding to an initial texture image according to the initial image pixels in the initial texture image, and use the target pixel parameters to adjust the initial texture image to obtain a target texture image that is convenient for compression; finally, perform image compression processing on the target texture image to obtain a compressed texture image, thereby reducing the volume of the texture image and avoiding the problem of occupying a large amount of storage resources for storing the texture image due to the large file volume of the texture image.
[0115] The above is a schematic solution of an image processing device according to this embodiment. It should be noted that the technical solution of this image processing device and the technical solution of the above image processing method belong to the same concept. For the details not described in the technical solution of this image processing device, reference can be made to the description of the technical solution of the above image processing method.
[0116] Corresponding to the above method embodiment, this specification also provides another embodiment of an image processing device, Figure 5 showing a structural schematic diagram of another image processing device provided by an embodiment of this specification. As Figure 5 shown, the device includes: An image decompression module 502 is configured to perform image decompression processing on a compressed texture image to obtain a target texture image, and acquire target image pixels in the target texture image, where the compressed texture image is generated by using the above-mentioned image processing method; A pixel processing module 504 is configured to perform parameter restoration processing on the target image pixels by using a parameter texture image corresponding to an initial texture image to obtain initial image pixels, where the parameter texture image is generated according to target pixel parameters corresponding to the initial image pixels in the initial texture image; An image generation module 506 is configured to generate the initial texture image based on the initial image pixels.
[0117] Optionally, there are multiple initial image pixels, and the target pixel parameters are the maximum pixel value and the minimum pixel value among the pixel values corresponding to the respective initial image pixels; The pixel processing module 504 is further configured to: Determine a parameter texture image corresponding to the initial texture image, and determine the maximum pixel value and the minimum pixel value corresponding to multiple initial image pixels in the initial texture image from the parameter texture image; Determine multiple target image pixels in the target image pixels, where the multiple target image pixels are obtained by normalizing the multiple initial image pixels by using the maximum pixel value and the minimum pixel value; Perform inverse normalization processing on the target image pixels by using the maximum pixel value and the minimum pixel value to obtain the multiple initial image pixels.
[0118] One or more embodiments of this specification provide another image processing device, which can perform restoration processing on a compressed texture image after image compression processing. The compression method of the compressed texture image is: determining target pixel parameters corresponding to an initial texture image according to initial image pixels in the initial texture image, and using the target pixel parameters to adjust the initial texture image to obtain a target texture image that is convenient for compression; finally, performing image compression processing on the target texture image to obtain a compressed texture image.
[0119] After obtaining the compressed texture image, image decompression processing can be performed on the compressed texture image to obtain a target texture image, and parameter restoration processing can be performed on the target image pixels in the target texture image by using a parameter texture image to obtain the initial texture image, thereby realizing the restoration of the compressed texture image and ensuring that after compressing the initial texture image into a compressed texture image, accurate image restoration can be performed.
[0120] The above is a schematic solution of another image processing device according to this embodiment. It should be noted that the technical solution of this another image processing device and the technical solution of the above another image processing method belong to the same concept. For the details not described in the technical solution of this another image processing device, reference can be made to the description of the technical solution of the above another image processing method.
[0121] Figure 6 FIG. shows a block diagram of a computing device 600 according to an embodiment of the present specification. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.
[0122] The computing device 600 further includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include the Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interfaces (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC).
[0123] In an embodiment of the present specification, the above components of the computing device 600 and Figure 6 other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 6 the block diagram of the computing device shown is only for illustrative purposes and is not a limitation on the scope of the present specification. Those skilled in the art can add or replace other components as needed.
[0124] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 600 can also be a mobile or stationary server.
[0125] Wherein, the processor 620 is configured to execute the following computer-executable instructions, and when the computer-executable instructions are executed by the processor, the steps of any one of the above image processing methods are implemented.
[0126] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. The key point of each embodiment is to illustrate the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to any one of the image processing method embodiments, the description is relatively simple. For the relevant parts, reference can be made to the partial description of any one of the image processing method embodiments.
[0127] An embodiment of this specification also provides a computer-readable storage medium, which stores computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of any one of the above image processing methods are implemented.
[0128] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. The key point of each embodiment is to illustrate the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to any one of the image processing method embodiments, the description is relatively simple. For the relevant parts, reference can be made to the partial description of any one of the image processing method embodiments.
[0129] An embodiment of this specification also provides a computer program product, including computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of any one of the above image processing methods are implemented.
[0130] The above is a schematic solution of a computer program product of this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of any one of the above image processing methods belong to the same concept. For the details not described in detail in the technical solution of the computer program product, reference can be made to the description of the technical solution of any one of the above image processing methods.
[0131] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0132] The computer instructions include computer program code, which may be in source code form, object code form, executable file, or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0133] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of this specification are not limited by the described order of actions, because according to the embodiments of this specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this specification.
[0134] In the above embodiments, the descriptions of the various embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0135] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The alternative embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can understand and utilize this specification well. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. An image processing method, characterized in that: include: Determining initial image pixels in an initial texture image, and determining target pixel parameters corresponding to the initial texture image according to the initial image pixels; Generate a parameter texture image according to the target pixel parameters, and use the parameter texture image to perform parameter adjustment processing on the initial image pixels to obtain target image pixels; A target texture image is generated according to the target image pixels, and image compression processing is performed on the target texture image to obtain a compressed texture image.
2. The image processing method according to claim 1, characterized in that: The number of pixels of the initial image is multiple; The step of determining target pixel parameters corresponding to the initial texture image according to the initial image pixels includes: A pixel value corresponding to each of the multiple initial image pixels is determined, and a maximum pixel value and a minimum pixel value among the multiple pixel values are determined as target pixel parameters corresponding to the initial texture image.
3. The image processing method according to any one of claims 1 to 2, characterized in that: There are multiple initial texture images; The determining of initial image pixels in the initial texture image comprises: Performing image segmentation on the texture image to be compressed to obtain a plurality of texture image blocks; The plurality of texture image blocks are determined as a plurality of initial texture images, and the initial image pixels included in each initial texture image are determined.
4. The image processing method according to claim 3, characterized in that: The generating a parameter texture image according to the target pixel parameter comprises: Determining a blank texture image corresponding to each of the initial texture images, wherein the number of pixels in the blank texture image is consistent with the number of images in the multiple initial texture images; The target pixel parameters corresponding to the initial texture images are determined as pixel values, and a plurality of pixel values are saved to the blank texture image to obtain the parameter texture image.
5. The image processing method according to claim 3, characterized in that: The step of using the parameter texture image to perform parameter adjustment processing on the initial image pixels to obtain target image pixels includes: Determine a texture image to be processed from the multiple initial texture images, and determine the target pixel parameter corresponding to the texture image to be processed from the parameter texture image, wherein the texture image to be processed is any one of the multiple initial texture images; The target pixel parameters are used to normalize the initial image pixels in the texture image to be processed to obtain the target image pixels.
6. The image processing method according to claim 1, characterized in that: The method further comprises: generating a target texture image according to the target image pixels, and performing image compression processing on the target texture image to obtain a compressed texture image; storing the compressed texture image and the parameter texture image in a data storage unit; or When an image acquisition request sent by an image acquisition end is received, the compressed texture image and the parameter texture image are sent to the image acquisition end.
7. An image processing method, characterized in that: include: Performing image decompression processing on the compressed texture image to obtain a target texture image, and obtaining target image pixels in the target texture image, wherein the compressed texture image is generated using the image processing method of claim 1; Using a parameter texture image corresponding to the initial texture image, performing parameter recovery processing on the target image pixels to obtain initial image pixels, wherein the parameter texture image is generated according to target pixel parameters corresponding to the initial image pixels in the initial texture image; The initial texture image is generated based on the initial image pixels.
8. The image processing method according to claim 7, characterized in that: There are multiple initial image pixels, and the target pixel parameter is the maximum pixel value and the minimum pixel value among the pixel values corresponding to the initial image pixels; The method of performing parameter restoration processing on the target image pixels by using the parameter texture image corresponding to the initial texture image to obtain the initial image pixels comprises: Determine a parameter texture image corresponding to the initial texture image, and determine the maximum pixel value and the minimum pixel value corresponding to a plurality of initial image pixels in the initial texture image from the parameter texture image; Determine a plurality of target image pixels among the target image pixels, wherein the plurality of target image pixels are obtained by normalizing the plurality of initial image pixels using the maximum pixel value and the minimum pixel value; The target image pixels are subjected to inverse normalization processing by using the maximum pixel value and the minimum pixel value to obtain the plurality of initial image pixels.
9. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method according to any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which implements the steps of the method described in any one of claims 1 to 8 when executed by a processor.
11. A computer program product, characterized in that The method comprises a computer program / instruction which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.