Picture processing method and device, storage medium and electronic device
By employing a parallel processing method of hierarchical merging and index query on mobile terminals, and utilizing Morton code data to process images, the problem of lag caused by high CPU consumption was solved, achieving fast and efficient image decolorization processing and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2021-09-27
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies, especially on mobile devices, suffer from high CPU consumption, leading to lag and overheating when processing images. Furthermore, traditional methods are time-consuming and cannot meet the needs of rapid color reduction processing.
A parallel processing method combining hierarchical merging and index query processing is adopted. Image texture data is processed using Morton code data to generate color level images and index tables, and then processed in parallel on the GPU to achieve image decolorization.
It improves image processing efficiency, meets the need to generate target images without lag while games or other applications are running, and optimizes user and sensory experience.
Smart Images

Figure CN113850882B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to an image processing method and apparatus, a computer-readable storage medium, and an electronic device. Background Technology
[0002] With the development of computers, the variety of image formats has increased significantly. Among these, many image formats include compressed formats such as GIF (Graphics Interchange Format). Therefore, the need to reduce the color temperature of images to conform to compressed formats has gradually become a pressing problem. Currently, traditional octree methods or clustering methods are used to solve this problem.
[0003] Traditional octree color reduction involves three processes: tree construction, tree merging, and finding the index of the corresponding color. After assigning each pixel value of the image to the last-level node of the octree, the current octree is pruned based on the target color count to complete the color reduction process. This color reduction process involves a tree structure with hierarchical dependencies between branches and leaves. Furthermore, both the color reduction process and the clustering method are performed serially on the CPU (central processing unit), resulting in significant CPU consumption. In addition, when processing color reduction on mobile devices such as smartphones, it can cause phone lag and overheating, and the time required to obtain the color reduction results is substantial.
[0004] Therefore, there is an urgent need in this field to develop a new image processing method and apparatus.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this disclosure is to provide an image processing method, an image processing apparatus, a computer-readable storage medium, and an electronic device, thereby overcoming, to at least a certain extent, the technical problems of poor image processing results and terminal device lag caused by limitations in related technologies.
[0007] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0008] According to a first aspect of the present invention, an image processing method is provided, the method comprising:
[0009] Obtain the image to be processed, and perform layer merging processing on the image to be processed to obtain a color table;
[0010] The color table is converted to obtain a color level image, and the color level image is indexed and queried to obtain an index table of the image to be processed.
[0011] The color level image and the index table are subjected to image decolorization processing to obtain a target image corresponding to the image to be processed.
[0012] In an exemplary embodiment of the present invention, the step of performing layer merging processing on the image to be processed to obtain a color table includes:
[0013] The image to be processed is recombined according to rules to obtain recombined image data, and the recombined image data is parsed to obtain image texture data;
[0014] The image texture data is sorted in reverse to obtain image dictionary data, and the image dictionary data is then merged hierarchically to obtain a color table.
[0015] In an exemplary embodiment of the present invention, the step of performing hierarchical merging processing on the image dictionary data to obtain a color table includes:
[0016] If the image texture data forms a tree structure, the image dictionary data is hierarchically merged according to the tree structure to obtain the merge count;
[0017] A count comparison result is obtained by comparing the count threshold corresponding to the merge count with the merge count, and the color table corresponding to the merge count is determined based on the count comparison result.
[0018] In an exemplary embodiment of the present invention, the step of performing image decolorization processing on the color level image and the index table to obtain a target image corresponding to the image to be processed includes:
[0019] If the color-degraded image corresponding to the image to be processed is in a graphics exchange format, perform color-degraded processing on the color level image and the index table to obtain the target image corresponding to the image to be processed.
[0020] If the color-degraded image corresponding to the image to be processed is in a non-graphics interchange format, the image to be processed, the color level image, and the index table are subjected to image color-degraded processing to obtain the target image corresponding to the image to be processed.
[0021] In one exemplary embodiment of the present invention, the image texture data includes: Morton code data.
[0022] In an exemplary embodiment of the present invention, the step of performing color table conversion on the color table to obtain a color level image includes:
[0023] Obtain the image format corresponding to the color table, and obtain the target number of layers in the reconstructed image data;
[0024] The image format is processed by channel writing using the Morton code data and the target layer number to obtain a color-level image.
[0025] In an exemplary embodiment of the present invention, the step of performing an index query process on the color level image to obtain an index table of the image to be processed includes:
[0026] Obtain the image pixel values of the color level image, and compare the Morton code data with the image pixel values to obtain a pixel comparison result;
[0027] The index table of the image to be processed is obtained based on the pixel comparison results.
[0028] According to a second aspect of the present invention, an image processing apparatus is provided, comprising:
[0029] The layer merging module is configured to acquire the image to be processed and perform layer merging processing on the image to be processed to obtain a color table;
[0030] The index query module is configured to perform color table conversion on the color table to obtain a color level image, and perform index query processing on the color level image to obtain an index table of the image to be processed;
[0031] The image decolorization module is configured to perform image decolorization processing on the color level image and the index table to obtain a target image corresponding to the image to be processed.
[0032] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor and a memory; wherein the memory stores computer-readable instructions, which, when executed by the processor, implement the image processing method in any of the above exemplary embodiments.
[0033] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the image processing method in any of the above exemplary embodiments.
[0034] As can be seen from the above technical solutions, the image processing method, image processing apparatus, computer storage medium, and electronic device in the exemplary embodiments of this disclosure have at least the following advantages and positive effects:
[0035] In the methods and apparatus provided by the exemplary embodiments of this disclosure, during image processing, layer merging processing and index query processing can run in parallel, improving the efficiency of image processing and meeting the requirement of obtaining the target image without lag even when games or other applications are running. Furthermore, image decolorization processing is performed on both color level images and index tables, improving the effect of image decolorization and optimizing the user experience and sensory experience.
[0036] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0037] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0038] Figure 1 The illustration schematically shows a flowchart of an image processing method according to an exemplary embodiment of the present disclosure;
[0039] Figure 2 The schematic diagram illustrates a flowchart of a hierarchical merging process in an exemplary embodiment of this disclosure;
[0040] Figure 3 This schematic diagram illustrates the interface diagram of the rule reorganization process in an exemplary embodiment of the present disclosure;
[0041] Figure 4 This schematic diagram illustrates the interface of the image to be processed and the reconstructed image before and after rule recombination processing in an exemplary embodiment of this disclosure;
[0042] Figure 5 The schematic diagram illustrates a flowchart of a hierarchical merging process in an exemplary embodiment of this disclosure;
[0043] Figure 6 The schematic diagram illustrates a flowchart of a color table conversion method in an exemplary embodiment of the present disclosure;
[0044] Figure 7 This schematic diagram illustrates an interface diagram of an exemplary color-level image of this disclosure;
[0045] Figure 8 The schematic diagram illustrates a flowchart of an index query processing method in an exemplary embodiment of this disclosure;
[0046] Figure 9The schematic diagram illustrates the interface of the index table in an exemplary embodiment of this disclosure;
[0047] Figure 10 This schematic diagram illustrates a flowchart of an image decolorization method in an exemplary embodiment of the present disclosure.
[0048] Figure 11 This schematic diagram illustrates the structure of an image processing apparatus according to an exemplary embodiment of the present disclosure;
[0049] Figure 12 The illustration schematically depicts an electronic device for implementing an image processing method according to an exemplary embodiment of the present disclosure;
[0050] Figure 13 The illustration schematically depicts a computer-readable storage medium for implementing an image processing method according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0051] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0052] The terms “a,” “an,” “the,” and “the” are used in this specification to indicate the presence of one or more elements / components / etc.; the terms “including” and “having” are used to indicate an open-ended inclusion and to mean that there may be other elements / components / etc. in addition to the listed elements / components / etc.; the terms “first” and “second” are used only as markings and are not a limitation on the number of objects.
[0053] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0054] Traditional octree color reduction involves three processes: tree construction, tree merging, and finding the index of the corresponding color. After assigning each pixel value of the image to the last level node of the octree, the current octree is pruned according to the target color count.
[0055] For example, when an image needs only 256 colors, the leaf nodes of the octree need to be constrained to 256. The basic principle of pruning is bottom-up merging. Because leaf nodes under the same branch node have the closest colors, the weighted average color of all leaf nodes under the same branch node can be used to describe all leaf nodes, achieving the pruning effect. After the number of leaf nodes is reduced to a fixed number, a replacement approximate color is found for each pixel of the original image in the pruned octree to complete the color reduction process of the original image.
[0056] The color reduction process involves a tree structure with hierarchical dependencies between branches and leaves. Furthermore, all processes are executed linearly on the CPU, processing pixels one by one to generate an octree, then merging the octrees layer by layer, and finally searching for approximate substitute colors pixel by pixel. This method is too CPU-intensive. Most mobile phones or other terminal devices cannot dedicate a significant portion of their CPU resources to color reduction while running games, leading to phone lag, overheating, and prolonged delays in obtaining color reduction results.
[0057] In view of the problems existing in the related technologies, this disclosure proposes an image processing method. Figure 1 A flowchart of the image processing method is shown, such as... Figure 1 As shown, the image processing method includes at least the following steps:
[0058] Step S110. Obtain the image to be processed and perform layer merging processing on the image to obtain the color table.
[0059] Step S120. Perform color table conversion on the color table to obtain color level images, and perform index lookup processing on the color level images to obtain the index table of the images to be processed.
[0060] Step S130. Perform color reduction processing on the color level image and index table to obtain the target image corresponding to the image to be processed.
[0061] In the exemplary embodiments of this disclosure, during image processing, the layer merging process and the index query process can run in parallel, improving the efficiency of image processing and meeting the requirement of obtaining the target image without lag even when games or other applications are running. Furthermore, image decolorization processing is performed on both the color level image and the index table data, improving the effect of image decolorization and optimizing the user experience and sensory experience.
[0062] The following section provides a detailed explanation of each step in the image processing method.
[0063] In step S110, the image to be processed is obtained, and the image to be processed is subjected to layer merging processing to obtain a color table.
[0064] In the exemplary embodiments disclosed herein, the image to be processed may be an image that needs to be de-colored or compressed, and this application does not impose any special limitations on the format of the image to be processed.
[0065] In an optional embodiment, Figure 2 A flowchart illustrating the hierarchical merging process is shown, such as... Figure 2 As shown, the method includes at least the following steps: in step S210, the image to be processed is subjected to rule recombination processing to obtain recombined image data, and the recombined image data is subjected to data parsing processing to obtain image texture data.
[0066] Specifically, rule recombination processing can be implemented using Morton code. For example, when performing Morton code rule recombination processing on a 24-bit deep image, a shader is needed to process each pixel of the image.
[0067] Merton codes enable one-dimensional to two-dimensional (or multi-dimensional) conversions. They generate a single number, the Merton code, by interleaving the bits of two numbers. Merton codes can be used to generate unique indices for pairs of integers. For example, using Merton codes to generate the Merton code for a coordinate point in a coordinate system can uniquely index the corresponding point. These indices are ordered in a "Z" shape.
[0068] Furthermore, there are two ways to calculate the Morton code: one is cross-delimited calculation, and the other is to query the corresponding Morton table for calculation.
[0069] Shaders are a technique specifically designed for rendering graphics. They allow you to customize the graphics card's rendering algorithms to achieve the desired visual effects. From individual pixels to the entire screen, everything can be rendered using shaders.
[0070] Shaders are divided into two categories: vertex shaders and pixel shaders.
[0071] In this context, 3D graphics are composed of individual triangular facets. The vertex shader calculates the vertices on each triangular facet and prepares them for the final pixel rendering.
[0072] A pixel shader, as the name suggests, is a series of algorithms that calculate lighting and color on a pixel-by-pixel basis. Several different graphics APIs (Application Programming Interfaces) have their own shader languages. In DirectX, vertex shaders are called Vertex Shaders, and pixel shaders are called Pixel Shaders. In OpenGL (Open Graphics Library), vertex shaders are also called Vertex Shaders, but pixel shaders are called Fragment Shaders, also known as fragment shaders.
[0073] Simply put, a shader is a piece of code that tells the GPU how to draw the color of each vertex of the model and the final color of each pixel.
[0074] Figure 3 A schematic diagram of the rule recombination processing interface is shown, such as... Figure 3 As shown, the RGB three dimensions of the image to be processed are recombined to obtain new values that can numerically represent color similarity. Specifically, when the original pixel composition is (R, G, B), R = 209, G = 204, B = 170, and each color is 8 bits in binary, the R channel can be described by a letter plus a table, i.e., (R7R6R5R4R3R2R1R0). The representation of the G channel and the B channel is similar and will not be repeated here.
[0075] Therefore, the mapping relationship between the composition of a single pixel and the original pixel is: (R,G,B)=(R7G7B7R6G6B6R5G5B5R4G4B4R3G3B3R2G2B2R1G1B1R0G0B0).
[0076] This mapping relationship allows shaders to process the image to be processed into a reconstructed image, thus obtaining the reconstructed image data.
[0077] Figure 4 The diagram illustrates the interface of the image to be processed and the reconstructed image before and after rule-based recombination processing, as shown below. Figure 4 As shown, the image on the left is the image to be processed, while the image on the right is the reconstructed image, which was generated from the reconstructed image data.
[0078] The acquired reconstructed image data is read into the program via a file reading method, and then the read reconstructed image data is parsed. This reconstructed image data can be PNG (Portable Network Graphics) image data.
[0079] Data parsing and processing can yield the pixel data of each pixel in the reconstructed image data, which is the image texture data.
[0080] In an optional embodiment, the image texture data includes: Morton code data.
[0081] This Morton code data can uniquely represent the corresponding image texture data. Furthermore, the image texture data can also be structured into a tree structure.
[0082] In step S220, the image texture data is reverse sorted to obtain image dictionary data, and the image dictionary data is hierarchically merged to obtain a color table.
[0083] After obtaining the image texture data, it can be reverse-sorted according to the inherently ordered principle of Morton codes to obtain a dictionary-structured data, i.e., image dictionary data. Here, the key is the Morton code data, and the value is the number of times that Morton code data is matched.
[0084] Specifically, reverse sorting can be done by placing larger Morton code data first and smaller data last.
[0085] In an optional embodiment, Figure 5 A flowchart illustrating the hierarchical merging process is shown, such as... Figure 5 As shown, the method includes at least the following steps: In step S510, if the image texture data forms a tree structure, the image dictionary data is processed hierarchically according to the tree structure to obtain the merge count.
[0086] Since the tree structure is sorted from bottom to top and from right to left, image texture data can be processed by merging layers in this order.
[0087] When the tree structure is an octree, the basic idea is to traverse the octree to obtain all levels and read the Morton code data of the higher level in advance. When the lower three bits are found to be different, it can be determined that it is another parent node, and then the merging of the other parent node is re-entered to obtain the merge count.
[0088] In step S520, the counting threshold corresponding to the merge count is compared with the merge count to obtain the counting comparison result, and the color table corresponding to the merge count is determined based on the counting comparison result.
[0089] After obtaining the merge count, a pre-set counting threshold corresponding to the merge count can be further obtained. When processing an image into a 256-color image, the counting threshold can be set to 256.
[0090] Furthermore, the merge count is compared with a counting threshold to obtain a count comparison result. And, when the count comparison result shows that the merge count is less than the technical threshold, the hierarchical merging process can be terminated to obtain the corresponding color table.
[0091] It is worth noting that the color table is essentially still 256 Morton code data, but the unwanted low bits have been changed to 0.
[0092] In this exemplary embodiment, a color table corresponding to the image to be processed can be obtained through hierarchical merging processing, which provides a data foundation and support for color reduction processing of the image to be processed, and ensures the processing effect of the image to be processed.
[0093] In step S120, the color table is converted to obtain a color level image, and the color level image is indexed and queried to obtain an index table of the image to be processed.
[0094] In an exemplary embodiment of this disclosure, after obtaining the color table, the color table can be converted to obtain the corresponding color level image.
[0095] In an optional embodiment, Figure 6 A flowchart illustrating the color table conversion method is shown, such as... Figure 6 As shown, the method includes at least the following steps: in step S610, the image format corresponding to the color table is obtained, and the target number of layers for reconstructing the image data is obtained.
[0096] For example, the image format could be RGBA. Furthermore, the number of bits that became 0 corresponding to the layer merging process, i.e., the layer number describing the leaf nodes, is obtained as the target layer number.
[0097] In step S620, the image format is processed by channel writing using Morton code data and target layer number to obtain a color layer image.
[0098] Specifically, in an image with an RGBA (RGBA color space) format, the Morton code data can be stored in the RGB channels, and the A channel can be used to store the target layer number to obtain a color layer image.
[0099] Figure 7 A schematic diagram of the interface for a color hierarchy image is shown, such as... Figure 7As shown, for example, if the leaf node is at the 5th level from the bottom up, then the lower 15 bits need to be zeroed out and stored in the A channel to obtain the color level image. Furthermore, this process can be implemented in parallel within the shader.
[0100] In this exemplary embodiment, the corresponding color level image can be obtained through color table conversion processing, so as to provide a data foundation for subsequent index query processing.
[0101] Furthermore, after obtaining the color level images, index query processing can be performed on the color level images.
[0102] In an optional embodiment, Figure 8 A flowchart illustrating the index query processing method is shown, such as... Figure 8 As shown, the method includes at least the following steps: In step S810, the image pixel values of the color level image are obtained, and the Morton code data is compared with the image pixel values to obtain a pixel comparison result.
[0103] The pixel values of the image are obtained by iterating through the pixel values of the color level image using a shader.
[0104] Furthermore, the image pixel values are compared with the Morton code data, and the corresponding index is recorded when the Morton code data matches the image pixel value to obtain the pixel comparison result.
[0105] In step S820, an index table of the image to be processed is obtained based on the pixel comparison results.
[0106] When the pixel comparison result includes the recorded hit index, an index table for the image to be processed can be generated based on that index.
[0107] Figure 9 A schematic diagram of the index table interface is shown, such as... Figure 9 As shown, the index table can be a completely red image. Figure 9 The all-red image has been converted to grayscale. Furthermore, the R channel value of this all-red image is 256, while the G and B channels are both 0.
[0108] In this exemplary embodiment, an index table of the image to be processed is obtained by comparing the image pixel values with the Morton code data, providing index data support for subsequent image decolorization processing.
[0109] In step S130, the color level image and index table are subjected to image decolorization processing to obtain the target image corresponding to the image to be processed.
[0110] In an exemplary embodiment of this disclosure, after obtaining the color level image and index table, different image decolorization processes can be performed according to the format of the target image to be generated.
[0111] In an optional embodiment, Figure 10 A flowchart illustrating the image decolorization process is shown, such as... Figure 10 As shown, the method includes at least the following steps: In step S1010, if the color-degraded image corresponding to the image to be processed is in a graphics exchange format, the color level image and the index table are subjected to image color-degraded processing to obtain the target image corresponding to the image to be processed.
[0112] When you want to compress an image into a target image in a picture-interchange format, you can directly provide the color level image and index table as data.
[0113] In step S1020, if the color-degraded image corresponding to the image to be processed is in a non-graphics exchange format, the image to be processed, the color level image, and the index table are subjected to image color-degraded processing to obtain the target image corresponding to the image to be processed.
[0114] When you want to compress an image into a target image that is not a picture-interchange format, you can input the image to be processed, the color level image, and the index table into the shader. The shader will then perform color reduction processing based on the image to be processed, the color level image, and the index table to restore the color-reduced target image.
[0115] When inputting the image to be processed, the color level image, and the index table into the shader's program, the input can be made through the shader's texture parameters.
[0116] In this exemplary embodiment, image decolorization can be performed more specifically according to the different formats of the target images to be obtained, perfectly matching the target images required by the user and improving the efficiency of different image decolorization processes.
[0117] It's worth noting that because the decomposition algorithm can break down some algorithms into concurrent sub-units, when this image processing method is applied to the high-concurrency architecture of a GPU (graphics processing unit), it can handle the three processes—rule processing, hierarchical merging, and index lookup—in parallel. Therefore, the image processing method can be broken down into pipelined tasks, further improving image processing efficiency and meeting the requirement of generating target images quickly and smoothly even during game execution.
[0118] In the exemplary embodiments of this disclosure, the image processing method allows for parallel execution of layer merging and index query processing, improving processing efficiency and ensuring smooth image acquisition even during gameplay or other applications. Furthermore, image decolorization of both the color level image and the index table enhances the decolorization effect and optimizes the user experience.
[0119] Furthermore, in an exemplary embodiment of this disclosure, an image processing apparatus is also provided. Figure 11 A schematic diagram of the image processing device is shown, such as... Figure 11 As shown, the image processing device 1100 may include: a layer merging module 1110, an index query module 1120, and an image desaturation module 1130. Wherein:
[0120] The layer merging module 1110 is configured to acquire the image to be processed and perform layer merging processing on the image to be processed to obtain a color table; the index query module 1120 is configured to perform color table conversion on the color table to obtain a color layer image and perform index query processing on the color layer image to obtain an index table of the image to be processed; the image decolorization module 1130 is configured to perform image decolorization processing on the color layer image and the index table to obtain a target image corresponding to the image to be processed.
[0121] In an exemplary embodiment of the present invention, the step of performing layer merging processing on the image to be processed to obtain a color table includes:
[0122] The image to be processed is recombined according to rules to obtain recombined image data, and the recombined image data is parsed to obtain image texture data;
[0123] The image texture data is sorted in reverse to obtain image dictionary data, and the image dictionary data is then merged hierarchically to obtain a color table.
[0124] In an exemplary embodiment of the present invention, the step of performing hierarchical merging processing on the image dictionary data to obtain a color table includes:
[0125] If the image texture data forms a tree structure, the image dictionary data is hierarchically merged according to the tree structure to obtain the merge count;
[0126] A count comparison result is obtained by comparing the count threshold corresponding to the merge count with the merge count, and the color table corresponding to the merge count is determined based on the count comparison result.
[0127] In an exemplary embodiment of the present invention, the step of performing image decolorization processing on the color level image and the index table to obtain a target image corresponding to the image to be processed includes:
[0128] If the color-degraded image corresponding to the image to be processed is in a graphics exchange format, perform color-degraded processing on the color level image and the index table to obtain the target image corresponding to the image to be processed.
[0129] If the color-degraded image corresponding to the image to be processed is in a non-graphics interchange format, the image to be processed, the color level image, and the index table are subjected to image color-degraded processing to obtain the target image corresponding to the image to be processed.
[0130] In one exemplary embodiment of the present invention, the image texture data includes: Morton code data.
[0131] In an exemplary embodiment of the present invention, the step of performing color table conversion on the color table to obtain a color level image includes:
[0132] Obtain the image format corresponding to the color table, and obtain the target number of layers in the reconstructed image data;
[0133] The image format is processed by channel writing using the Morton code data and the target layer number to obtain a color-level image.
[0134] In an exemplary embodiment of the present invention, the step of performing an index query process on the color level image to obtain an index table of the image to be processed includes:
[0135] Obtain the image pixel values of the color level image, and compare the Morton code data with the image pixel values to obtain a pixel comparison result;
[0136] The index table of the image to be processed is obtained based on the pixel comparison results.
[0137] The specific details of the image processing apparatus 1100 have been described in detail in the corresponding image processing method, so they will not be repeated here.
[0138] It should be noted that although several modules or units of the image processing apparatus 1100 have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0139] Furthermore, in an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0140] The following reference Figure 12 To describe an electronic device 1400 according to such an embodiment of the present invention. Figure 12 The electronic device 1200 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0141] like Figure 12 As shown, the electronic device 1200 is manifested in the form of a general-purpose computing device. The components of the electronic device 1200 may include, but are not limited to: at least one processing unit 1210, at least one storage unit 1220, a bus 1230 connecting different system components (including storage unit 1220 and processing unit 1210), and a display unit 1240.
[0142] The storage unit stores program code that can be executed by the processing unit 1210, causing the processing unit 1210 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention.
[0143] Storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 1221 and / or cache memory 1222, and may further include a read-only memory (ROM) 1223.
[0144] Storage unit 1220 may also include a program / utility 1224 having a set (at least one) of program modules 1225, such program modules 1225 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0145] Bus 1230 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0146] Electronic device 1200 can also communicate with one or more external devices 1200 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 1200, and / or with any device that enables electronic device 1200 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1250. Furthermore, electronic device 1200 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 1260. As shown, network adapter 1260 communicates with other modules of electronic device 1200 via bus 1230. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0147] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0148] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the invention described in the "Exemplary Methods" section above.
[0149] refer to Figure 13 As shown, a program product 1300 for implementing the above-described method according to an embodiment of the present invention is described. It may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0150] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0151] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0152] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0153] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0154] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
Claims
1. An image processing method, characterized in that, The method includes: The process involves acquiring an image to be processed, performing rule-based recombination on the image to obtain recombined image data, and then parsing the recombined image data to obtain image texture data. The image texture data includes Morton code data. The image texture data is then reverse-sorted to obtain image dictionary data, and the image dictionary data is then hierarchically merged to obtain a color table. In the image dictionary data, the keys are the Morton code data, and the values are the number of times the Morton code data is hit. Obtain the image format corresponding to the color table and the target layer number of the reconstructed image data; use the Morton code data and the target layer number to perform channel writing processing on the image format to obtain a color layer image, and perform index query processing on the color layer image to obtain an index table of the image to be processed; The color level image and the index table are subjected to image decolorization processing to obtain a target image corresponding to the image to be processed.
2. The image processing method according to claim 1, characterized in that, The step of performing hierarchical merging processing on the image dictionary data to obtain the color table includes: If the image texture data forms a tree structure, the image dictionary data is hierarchically merged according to the tree structure to obtain the merge count; A count comparison result is obtained by comparing the count threshold corresponding to the merge count with the merge count, and the color table corresponding to the merge count is determined based on the count comparison result.
3. The image processing method according to claim 1, characterized in that, The step of performing image decolorization processing on the color level image and the index table to obtain the target image corresponding to the image to be processed includes: If the color-degraded image corresponding to the image to be processed is in a graphics exchange format, perform color-degraded processing on the color level image and the index table to obtain the target image corresponding to the image to be processed. If the color-degraded image corresponding to the image to be processed is in a non-graphics interchange format, the image to be processed, the color level image, and the index table are subjected to image color-degraded processing to obtain the target image corresponding to the image to be processed.
4. The image processing method according to claim 1, characterized in that, The step of performing an index query on the color level image to obtain the index table of the image to be processed includes: Obtain the image pixel values of the color level image, and compare the Morton code data with the image pixel values to obtain a pixel comparison result; The index table of the image to be processed is obtained based on the pixel comparison results.
5. An image processing apparatus, characterized in that, include: The layer merging module is configured to acquire the image to be processed, perform rule-based recombination processing on the image to be processed to obtain recombined image data, and perform data parsing processing on the recombined image data to obtain image texture data. The image texture data includes: Morton code data; the image texture data is sorted in reverse to obtain image dictionary data, and the image dictionary data is merged hierarchically to obtain a color table; the key in the image dictionary data is the Morton code data, and the value is the number of times the Morton code data is hit; The index query module is configured to obtain the image format corresponding to the color table and the target layer number of the recombined image data; use the Morton code data and the target layer number to perform channel writing processing on the image format to obtain a color layer image, and perform index query processing on the color layer image to obtain an index table of the image to be processed; The image decolorization module is configured to perform image decolorization processing on the color level image and the index table to obtain a target image corresponding to the image to be processed.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the image processing method according to any one of claims 1-4.
7. An electronic device, characterized in that, include: processor; Memory for storing the executable instructions of the processor; The processor is configured to execute the image processing method according to any one of claims 1-4 by executing the executable instructions.
Citation Information
Patent Citations
Color reducing method and device of true color image
CN102592293A
Fractal quadtree texture organization method for building group
CN110533764A
GPU compressed texture processing method
CN111402380A
Raster Graphics Image Transcoding for File Size Reduction
US20130156309A1